apache-commons-rdf-0.5.0/0000755000175000017500000000000013212356734015061 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/0000755000175000017500000000000013212356730020050 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/0000755000175000017500000000000013175733174020650 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/main/0000755000175000017500000000000013175733174021574 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/0000755000175000017500000000000013175733174022515 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/0000755000175000017500000000000013175733174023304 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/0000755000175000017500000000000013175733174024525 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/0000755000175000017500000000000013175733174026200 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/0000755000175000017500000000000013175733174026753 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/0000755000175000017500000000000013175733174027524 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/Dataset.java0000644000175000017500000003330413175733174031757 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.Optional; import java.util.stream.Stream; /** * An RDF * 1.1 Dataset, a set of RDF quads, as defined by * RDF-1.1 Concepts and Abstract * Syntax, a W3C Recommendation published on 25 February 2014. * * @since 0.3.0-incubating * @see RDF#createDataset() */ public interface Dataset extends AutoCloseable, GraphLike { /** * Add a quad to the dataset, possibly mapping any of the components of the * Quad to those supported by this dataset. * * @param quad * The quad to add */ @Override void add(Quad quad); /** * Add a quad to the dataset, possibly mapping any of the components to * those supported by this dataset. * * @param graphName * The graph the quad belongs to, or null for the * default graph * @param subject * The quad subject * @param predicate * The quad predicate * @param object * The quad object */ void add(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object); /** * Check if dataset contains quad. * * @param quad * The quad to check. * @return True if the dataset contains the given Quad. */ @Override boolean contains(Quad quad); /** * Check if dataset contains a pattern of quads. * * @param graphName * The graph the quad belongs to, wrapped as an {@link Optional} * (null is a wildcard, {@link Optional#empty()} is * the default graph) * @param subject * The quad subject (null is a wildcard) * @param predicate * The quad predicate (null is a wildcard) * @param object * The quad object (null is a wildcard) * @return True if the dataset contains any quads that match the given * pattern. */ boolean contains(Optional graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object); /** * Close the dataset, relinquishing any underlying resources. *

* For example, this would close any open file and network streams and free * database locks held by the dataset implementation. *

* The behaviour of the other dataset methods are undefined after closing * the dataset. *

* Implementations might not need {@link #close()}, hence the default * implementation does nothing. */ @Override default void close() throws Exception { } /** * Get the default graph of this dataset. *

* The {@link Triple}s of the default graph are equivalent to the * {@link Quad}s in this Dataset which has the {@link Quad#getGraphName()} * set to {@link Optional#empty()}. *

* It is unspecified if modifications to the returned Graph are reflected in * this Dataset. *

* The returned graph MAY be empty. * * @see #getGraph(BlankNodeOrIRI) * @return The default graph of this Dataset */ Graph getGraph(); /** * Get a named graph in this dataset. *

* The {@link Triple}s of the named graph are equivalent to the the Quads of * this Dataset which has the {@link Quad#getGraphName()} equal to the * provided graphName, or equal to {@link Optional#empty()} if * the provided graphName is null. *

* It is unspecified if modifications to the returned Graph are reflected in * this Dataset. *

* It is unspecified if requesting an unknown or empty graph will return * {@link Optional#empty()} or create a new empty {@link Graph}. * * @see #getGraph() * @see #getGraphNames() * @param graphName * The name of the graph, or null for the default * graph. * @return The named Graph, or {@link Optional#empty()} if the dataset do * not contain the named graph. */ Optional getGraph(BlankNodeOrIRI graphName); /** * Get the graph names in this Dataset. *

* The set of returned graph names is equivalent to the set of unique * {@link Quad#getGraphName()} of all the {@link #stream()} of this dataset * (excluding the default graph). *

* The returned {@link Stream} SHOULD NOT contain duplicate graph names. *

* The graph names can be used with {@link #getGraph(BlankNodeOrIRI)} to * retrieve the corresponding {@link Graph}, however callers should be aware * of any concurrent modifications to the Dataset may cause such calls to * return {@link Optional#empty()}. *

* Note that a Dataset always contains a default graph * which is not named, and thus is not represented in the returned Stream. * The default graph is accessible via {@link #getGraph()} or by using * {@link Optional#empty()} in the Quad access methods). * * @return A {@link Stream} of the graph names of this Dataset. */ Stream getGraphNames(); /** * Remove a concrete quad from the dataset. * * @param quad * quad to remove */ @Override void remove(Quad quad); /** * Remove a concrete pattern of quads from the default graph of the dataset. * * @param graphName * The graph the quad belongs to, wrapped as an {@link Optional} * (null is a wildcard, {@link Optional#empty()} is * the default graph) * @param subject * The quad subject (null is a wildcard) * @param predicate * The quad predicate (null is a wildcard) * @param object * The quad object (null is a wildcard) */ void remove(Optional graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object); /** * Clear the dataset, removing all quads. */ @Override void clear(); /** * Number of quads contained by the dataset. *

* The count of a set does not include duplicates, consistent with the * {@link Quad#equals(Object)} equals method for each {@link Quad}. * * @return The number of quads in the dataset */ @Override long size(); /** * Get all quads contained by the dataset.
*

* The iteration does not contain any duplicate quads, as determined by the * {@link Quad#equals(Object)} method for each {@link Quad}. *

* The behaviour of the {@link Stream} is not specified if * {@link #add(Quad)}, {@link #remove(Quad)} or {@link #clear()} are called * on the {@link Dataset} before it terminates. *

* Implementations may throw {@link ConcurrentModificationException} from * Stream methods if they detect a conflict while the Stream is active. * * @return A {@link Stream} over all of the quads in the dataset */ @Override Stream stream(); /** * Get all quads contained by the dataset matched with the pattern. *

* The iteration does not contain any duplicate quads, as determined by the * {@link Quad#equals(Object)} method for each {@link Quad}. *

* The behaviour of the {@link Stream} is not specified if * {@link #add(Quad)}, {@link #remove(Quad)} or {@link #clear()} are called * on the {@link Dataset} before it terminates. *

* Implementations may throw {@link ConcurrentModificationException} from * Stream methods if they detect a conflict while the Stream is active. * * @param graphName * The graph the quad belongs to, wrapped as an {@link Optional} * (null is a wildcard, {@link Optional#empty()} is * the default graph) * @param subject * The quad subject (null is a wildcard) * @param predicate * The quad predicate (null is a wildcard) * @param object * The quad object (null is a wildcard) * @return A {@link Stream} over the matched quads. */ Stream stream(Optional graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object); /** * Get an Iterable for iterating over all quads in the dataset. *

* This method is meant to be used with a Java for-each loop, e.g.: * *

     * for (Quad t : dataset.iterate()) {
     *     System.out.println(t);
     * }
     * 
* * The behaviour of the iterator is not specified if {@link #add(Quad)}, * {@link #remove(Quad)} or {@link #clear()}, are called on the * {@link Dataset} before it terminates. It is undefined if the returned * {@link Iterator} supports the {@link Iterator#remove()} method. *

* Implementations may throw {@link ConcurrentModificationException} from * Iterator methods if they detect a concurrency conflict while the Iterator * is active. *

* The {@link Iterable#iterator()} must only be called once, that is the * Iterable must only be iterated over once. A {@link IllegalStateException} * may be thrown on attempt to reuse the Iterable. *

* The default implementation of this method will call {@link #stream()} to * return its {@link Stream#iterator()}. * * @return A {@link Iterable} that returns {@link Iterator} over all of the * quads in the dataset * @throws IllegalStateException * if the {@link Iterable} has been reused * @throws ConcurrentModificationException * if a concurrency conflict occurs while the Iterator is * active. */ @Override @SuppressWarnings("unchecked") default Iterable iterate() throws ConcurrentModificationException, IllegalStateException { return ((Stream) stream())::iterator; } /** * Get an Iterable for iterating over the quads in the dataset that match * the pattern. *

* This method is meant to be used with a Java for-each loop, e.g.: * *

     * IRI alice = factory.createIRI("http://example.com/alice");
     * IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/");
     * for (Quad t : dataset.iterate(null, alice, knows, null)) {
     *     System.out.println(t.getGraphName());
     *     System.out.println(t.getObject());
     * }
     * 
*

* The behaviour of the iterator is not specified if {@link #add(Quad)}, * {@link #remove(Quad)} or {@link #clear()}, are called on the * {@link Dataset} before it terminates. It is undefined if the returned * {@link Iterator} supports the {@link Iterator#remove()} method. *

* Implementations may throw {@link ConcurrentModificationException} from * Iterator methods if they detect a concurrency conflict while the Iterator * is active. *

* The {@link Iterable#iterator()} must only be called once, that is the * Iterable must only be iterated over once. A {@link IllegalStateException} * may be thrown on attempt to reuse the Iterable. *

* The default implementation of this method will call * {@link #stream(Optional, BlankNodeOrIRI, IRI, RDFTerm)} to return its * {@link Stream#iterator()}. * * @param graphName * The graph the quad belongs to, wrapped as an {@link Optional} * (null is a wildcard, {@link Optional#empty()} is * the default graph) * @param subject * The quad subject (null is a wildcard) * @param predicate * The quad predicate (null is a wildcard) * @param object * The quad object (null is a wildcard) * @return A {@link Iterable} that returns {@link Iterator} over the * matching quads in the dataset * @throws IllegalStateException * if the {@link Iterable} has been reused * @throws ConcurrentModificationException * if a concurrency conflict occurs while the Iterator is * active. */ @SuppressWarnings("unchecked") default Iterable iterate(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) throws ConcurrentModificationException, IllegalStateException { return ((Stream) stream(graphName, subject, predicate, object))::iterator; } } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/package-info.java0000644000175000017500000000407213175733174032716 0ustar andriusandrius/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Commons RDF, a common library of RDF 1.1 concepts. *

* The core RDF 1.1 concepts * are represented by corresponding interfaces: *

* A {@link org.apache.commons.rdf.api.Graph} is a collection of * {@link org.apache.commons.rdf.api.Triple}s, which have a subject, * predicate and object of * {@link org.apache.commons.rdf.api.RDFTerm}s. The three types of RDF terms are * {@link org.apache.commons.rdf.api.IRI}, * {@link org.apache.commons.rdf.api.Literal} and * {@link org.apache.commons.rdf.api.BlankNode}. *

* Implementations of this API should provide an * {@link org.apache.commons.rdf.api.RDF} to facilitate creation of these * objects. *

* All the {@link org.apache.commons.rdf.api.RDFTerm} objects are immutable, * while a {@link org.apache.commons.rdf.api.Graph} MAY be mutable (e.g. support * methods like {@link org.apache.commons.rdf.api.Graph#add(Triple)}). *

* {@link org.apache.commons.rdf.api.RDFSyntax} enumerates the W3C standard RDF * 1.1 syntaxes and their media types. *

* For further documentation and contact details, see the * Commons RDF web site. * */ package org.apache.commons.rdf.api; apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/QuadLike.java0000644000175000017500000000446713175733174032101 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.Optional; /** * A generalised "quad-like" interface, extended by {@link Quad}. *

* A QuadLike statement has at least a {@link #getSubject()}, * {@link #getPredicate()}, {@link #getObject()} and {@link #getGraphName()}, * but unlike a {@link Quad} does not have a formalised * {@link Quad#equals(Object)} or {@link Quad#hashCode()} semantics and is not * required to be immutable or thread-safe. This interface can * also be used for generalised quads (e.g. a {@link BlankNode} as * predicate). *

* Implementations should specialise which specific {@link RDFTerm} types they * return by overriding {@link #getSubject()}, {@link #getPredicate()}, * {@link #getObject()} and {@link #getGraphName()}. * * @since 0.3.0-incubating * @see Quad */ public interface QuadLike extends TripleLike { /** * The graph name (graph label) of this statement, if present. *

* If {@link Optional#isPresent()}, then the {@link Optional#get()} indicate * the graph name of this statement. If the graph name is not present,e.g. * the value is {@link Optional#empty()}, it indicates that this Quad is in * the default graph. * * @return If {@link Optional#isPresent()}, the graph name of this quad, * otherwise {@link Optional#empty()}, indicating the default graph. * The graph name is typically an {@link IRI} or {@link BlankNode}. */ Optional getGraphName(); } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/Quad.java0000644000175000017500000002171013175733174031262 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.Objects; import java.util.Optional; /** * A Quad is a statement in a * RDF-1.1 * Dataset, as defined by RDF-1.1 Concepts and Abstract Syntax, a W3C Working Group Note published * on 25 February 2014. *

* A Quad object in Commons RDF is considered * immutable, that is, over its life time it will have * consistent behaviour for its {@link #equals(Object)}, and the instances * returned from {@link #getGraphName()}, {@link #getSubject()}, * {@link #getPredicate()}, {@link #getObject()} and {@link #asTriple()} will * have consistent {@link Object#equals(Object)} behaviour. *

* Note that Quad methods are not required to return object * identical (==) instances as long as they are equivalent * according to {@link Object#equals(Object)}. Specialisations of * Quad may provide additional methods that are documented to be * mutable. *

* Quad methods are thread-safe, however * specialisations may provide additional methods that are documented to not be * thread-safe. *

* Quads can be safely used in hashing collections like * {@link java.util.HashSet} and {@link java.util.HashMap}. *

* Any Quad can be used interchangeably across Commons RDF * implementations. * * @since 0.3.0-incubating * @see Dataset * @see RDF#createQuad(BlankNodeOrIRI,BlankNodeOrIRI,IRI,RDFTerm) * @see RDF * 1.1: On Semantics of RDF Datasets * @see */ public interface Quad extends QuadLike { /** * The graph name (graph label) of this quad, if present. * * If {@link Optional#isPresent()}, then the {@link Optional#get()} is * either a {@link BlankNode} or an {@link IRI}, indicating the * graph * name of this Quad. If the graph name is not present, e.g. the value * is {@link Optional#empty()}, it indicates that this Quad is in the * default * graph. * * @return If {@link Optional#isPresent()}, the graph name * {@link BlankNodeOrIRI} of this quad, otherwise * {@link Optional#empty()}, indicating the default graph. * * @see RDF- * 1.1 Dataset */ @Override Optional getGraphName(); /** * The subject of this quad, which may be either a {@link BlankNode} or an * {@link IRI}, which are represented in Commons RDF by the interface * {@link BlankNodeOrIRI}. * * @return The subject {@link BlankNodeOrIRI} of this quad. * @see RDF-1.1 * Triple subject */ @Override BlankNodeOrIRI getSubject(); /** * The predicate {@link IRI} of this quad. * * @return The predicate {@link IRI} of this quad. * @see RDF-1.1 * Triple predicate */ @Override IRI getPredicate(); /** * The object of this quad, which may be either a {@link BlankNode}, an * {@link IRI}, or a {@link Literal}, which are represented in Commons RDF * by the interface {@link RDFTerm}. * * @return The object {@link RDFTerm} of this quad. * @see RDF-1.1 * Triple object */ @Override RDFTerm getObject(); /** * Adapt this Quad to a Triple. *

* The returned {@link Triple} will have equivalent values returned from the * methods {@link TripleLike#getSubject()}, * {@link TripleLike#getPredicate()} and {@link TripleLike#getObject()}. *

* The returned {@link Triple} MUST NOT be {@link #equals(Object)} to this * {@link Quad}, even if this quad has a default graph * {@link #getGraphName()} value of {@link Optional#empty()}, but MUST * follow the {@link Triple#equals(Object)} semantics. This means that the * following MUST be true: * *

     * Quad q1, q2;
     * if (q1.equals(q2)) {
     *     assert (q1.asTriple().equals(q2.asTriple()));
     * } else if (q1.asTriple().equals(q2.asTriple())) {
     *     assert (q1.getSubject().equals(q2.getSubject()));
     *     assert (q1.getPredicate().equals(q2.getPredicate()));
     *     assert (q1.getObject().equals(q2.getObject()));
     *     assert (!q1.getGraphName().equals(q2.getGraphName()));
     * }
     * 
* * The default implementation of this method return a proxy * {@link Triple} instance that keeps a reference to this {@link Quad} to * call the underlying {@link TripleLike} methods, but supplies a * {@link Triple} compatible implementation of {@link Triple#equals(Object)} * and {@link Triple#hashCode()}. Implementations may override this method, * e.g. for a more efficient solution. * * @return A {@link Triple} that contains the same {@link TripleLike} * properties as this Quad. */ default Triple asTriple() { return new Triple() { @Override public BlankNodeOrIRI getSubject() { return Quad.this.getSubject(); } @Override public IRI getPredicate() { return Quad.this.getPredicate(); } @Override public RDFTerm getObject() { return Quad.this.getObject(); } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof Triple)) { return false; } final Triple other = (Triple) obj; return Objects.equals(getSubject(), other.getSubject()) && Objects.equals(getPredicate(), other.getPredicate()) && Objects.equals(getObject(), other.getObject()); } @Override public int hashCode() { return Objects.hash(getSubject(), getPredicate(), getObject()); } }; } /** * Check it this Quad is equal to another Quad. *

* Two Quads are equal if and only if their {@link #getGraphName()}, * {@link #getSubject()}, {@link #getPredicate()} and {@link #getObject()} * are equal. *

*

* Implementations MUST also override {@link #hashCode()} so that two equal * Quads produce the same hash code. *

*

* Note that a {@link Quad} MUST NOT be equal to a {@link Triple}, even if * this Quad's {@link #getGraphName()} is {@link Optional#empty()}. To test * triple-like equivalence, callers can use: *

* *
     * Quad q1;
     * Triple t2;
     * q1.asTriple().equals(t2));
     * 
* * @param other * Another object * @return true if other is a Quad and is equal to this * @see Object#equals(Object) */ @Override public boolean equals(Object other); /** * Calculate a hash code for this Quad. *

* The returned hash code MUST be equal to the result of * {@link Objects#hash(Object...)} with the arguments {@link #getSubject()}, * {@link #getPredicate()}, {@link #getObject()}, {@link #getGraphName()}. *

* This method MUST be implemented in conjunction with * {@link #equals(Object)} so that two equal {@link Quad}s produce the same * hash code. * * @return a hash code value for this Quad. * @see Object#hashCode() * @see Objects#hash(Object...) */ @Override public int hashCode(); } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.jav0000644000175000017500000000537013175733174033026 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; /** * Factory for creating RDFTerm instances.. *

* This interface is deprecated in favour of the richer * {@link RDF}. * * @see RDF */ @Deprecated public interface RDFTermFactory { default BlankNode createBlankNode() throws UnsupportedOperationException { throw new UnsupportedOperationException("createBlankNode() not supported"); } default BlankNode createBlankNode(final String name) throws UnsupportedOperationException { throw new UnsupportedOperationException("createBlankNode(String) not supported"); } default Graph createGraph() throws UnsupportedOperationException { throw new UnsupportedOperationException("createGraph() not supported"); } default IRI createIRI(final String iri) throws IllegalArgumentException, UnsupportedOperationException { throw new UnsupportedOperationException("createIRI(String) not supported"); } default Literal createLiteral(final String lexicalForm) throws IllegalArgumentException, UnsupportedOperationException { throw new UnsupportedOperationException("createLiteral(String) not supported"); } default Literal createLiteral(final String lexicalForm, final IRI dataType) throws IllegalArgumentException, UnsupportedOperationException { throw new UnsupportedOperationException("createLiteral(String) not supported"); } default Literal createLiteral(final String lexicalForm, final String languageTag) throws IllegalArgumentException, UnsupportedOperationException { throw new UnsupportedOperationException("createLiteral(String,String) not supported"); } default Triple createTriple(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) throws IllegalArgumentException, UnsupportedOperationException { throw new UnsupportedOperationException("createTriple(BlankNodeOrIRI,IRI,RDFTerm) not supported"); } } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java0000644000175000017500000002464213175733174031012 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.io.Serializable; import java.util.Locale; /** * A RDF implementation. *

* A RDF implementation can create instances of the {@link RDFTerm} * types {@link IRI}, {@link BlankNode} and {@link Literal}, as well as creating * instances of the types {@link Triple}, {@link Quad}, {@link Graph} or * {@link Dataset}. *

* A partial RDF implementation should be clearly documented as such, * and may throw {@link UnsupportedOperationException} where applicable, e.g. if * it does not support creating {@link Dataset}s or {@link Quad}s. *

* Instances of RDF work like a factory for creating Commons RDF * instances. spezializations of this interface may also provide methods for * conversions from/to their underlying RDF framework. *

* If a factory method of a particular implementation does not allow or support * a provided parameter, e.g. because an IRI is considered invalid, then it * SHOULD throw {@link IllegalArgumentException}. * * @since 0.3.0-incubating * @see RDFTerm * @see Graph * @see Quad */ public interface RDF { /** * Create a new blank node. *

* The returned blank node MUST NOT be equal to any existing * {@link BlankNode} instances according to * {@link BlankNode#equals(Object)}. * * @return A new, unique {@link BlankNode} */ public BlankNode createBlankNode(); /** * Create a blank node based on the given name. *

* All {@link BlankNode}s created with the given name on a * particular instance of RDF MUST be equivalent according * to {@link BlankNode#equals(Object)}, *

* The returned BlankNode MUST NOT be equal to BlankNode * instances returned for any other name or those returned from * {@link #createBlankNode()}. *

* The returned BlankNode SHOULD NOT be equivalent to any BlankNodes created * on a different RDF instance, e.g. different * instances of RDF should produce different blank nodes for * the same name unless they purposely are intending to create * equivalent {@link BlankNode} instances (e.g. a reinstated * {@link Serializable} factory). * * @param name * A non-empty, non-null, String that is unique to this blank * node in the context of this {@link RDF}. * @return A BlankNode for the given name */ public BlankNode createBlankNode(String name); /** * Create a new graph. * * It is undefined if the graph will be persisted by any underlying storage * mechanism. * * @return A new Graph */ public Graph createGraph(); /** * Create a new dataset. * * It is undefined if the dataset will be persisted by any underlying * storage mechanism. * * @return A new Dataset */ public Dataset createDataset(); /** * Create an IRI from a (possibly escaped) String. * * The provided iri string MUST be valid according to the * W3C RDF-1.1 * IRI definition. * * @param iri * Internationalized Resource Identifier * @return A new IRI * @throws IllegalArgumentException * If the provided string is not acceptable, e.g. does not * conform to the RFC3987 syntax. */ public IRI createIRI(String iri) throws IllegalArgumentException; /** * Create a simple literal. * * The provided lexical form should not be escaped in any sense, e.g. should * not include "quotes" unless those are part of the literal value. * * The returned Literal MUST have a {@link Literal#getLexicalForm()} that is * equal to the provided lexical form, MUST NOT have a * {@link Literal#getLanguageTag()} present, and SHOULD return a * {@link Literal#getDatatype()} that is equal to the IRI * http://www.w3.org/2001/XMLSchema#string. * * @param lexicalForm * The literal value in plain text * @return The created Literal * @throws IllegalArgumentException * If the provided lexicalForm is not acceptable, e.g. because * it is too large for an underlying storage. */ public Literal createLiteral(String lexicalForm) throws IllegalArgumentException; /** * Create a literal with the specified data type. * * The provided lexical form should not be escaped in any sense, e.g. should * not include "quotes" unless those are part of the literal value. * * It is RECOMMENDED that the provided dataType is one of the RDF-compatible XSD * types. * * The provided lexical form SHOULD be in the * lexical * space of the provided dataType. * * The returned Literal SHOULD have a {@link Literal#getLexicalForm()} that * is equal to the provided lexicalForm, MUST NOT have a * {@link Literal#getLanguageTag()} present, and MUST return a * {@link Literal#getDatatype()} that is equivalent to the provided dataType * IRI. * * @param lexicalForm * The literal value * @param dataType * The data type IRI for the literal value, e.g. * http://www.w3.org/2001/XMLSchema#integer * @return The created Literal * @throws IllegalArgumentException * If any of the provided arguments are not acceptable, e.g. * because the provided dataType is not permitted. */ public Literal createLiteral(String lexicalForm, IRI dataType) throws IllegalArgumentException; /** * Create a language-tagged literal. * * The provided lexical form should not be escaped in any sense, e.g. should * not include "quotes" unless those are part of the literal value. * * The provided language tag MUST be valid according to * BCP47, e.g. * en. * * The provided language tag * MAY be converted to lower case. * * The returned Literal SHOULD have a {@link Literal#getLexicalForm()} which * is equal to the provided lexicalForm, MUST return a * {@link Literal#getDatatype()} that is equal to the IRI * http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, and * MUST have a {@link Literal#getLanguageTag()} present which SHOULD be * equal to the provided language tag (compared as * {@link String#toLowerCase(Locale)} using {@link Locale#ENGLISH}). * * @param lexicalForm * The literal value * @param languageTag * The non-empty language tag as defined by * BCP47 * @return The created Literal * @throws IllegalArgumentException * If the provided values are not acceptable, e.g. because the * languageTag was syntactically invalid. */ public Literal createLiteral(String lexicalForm, String languageTag) throws IllegalArgumentException; /** * Create a triple. * * The returned Triple SHOULD have a {@link Triple#getSubject()} that is * equal to the provided subject, a {@link Triple#getPredicate()} that is * equal to the provided predicate, and a {@link Triple#getObject()} that is * equal to the provided object. * * @param subject * The IRI or BlankNode that is the subject of the triple * @param predicate * The IRI that is the predicate of the triple * @param object * The IRI, BlankNode or Literal that is the object of the triple * @return The created Triple * @throws IllegalArgumentException * If any of the provided arguments are not acceptable, e.g. * because a Literal has a lexicalForm that is too large for an * underlying storage. */ public Triple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) throws IllegalArgumentException; /** * Create a quad. *

* The returned Quad SHOULD have a {@link Quad#getGraphName()} that is equal * to the provided graphName, a {@link Quad#getSubject()} that is equal to * the provided subject, a {@link Quad#getPredicate()} that is equal to the * provided predicate, and a {@link Quad#getObject()} that is equal to the * provided object. * * @param graphName * The IRI or BlankNode that this quad belongs to, or * null for the public graph * @param subject * The IRI or BlankNode that is the subject of the quad * @param predicate * The IRI that is the predicate of the quad * @param object * The IRI, BlankNode or Literal that is the object of the quad * @return The created Quad * @throws IllegalArgumentException * If any of the provided arguments are not acceptable, e.g. * because a Literal has a lexicalForm that is too large for an * underlying storage. */ public Quad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) throws IllegalArgumentException; } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/Triple.java0000644000175000017500000001132513175733174031630 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.Objects; /** * An RDF-1.1 * Triple, as defined by * RDF-1.1 Concepts and * Abstract Syntax, a W3C Recommendation published on 25 February 2014. *

* A Triple object in Commons RDF is considered * immutable, that is, over its life time it will have * consistent behaviour for its {@link #equals(Object)}, and the {@link RDFTerm} * instances returned from {@link #getSubject()}, {@link #getPredicate()} and * {@link #getObject()} will have consistent {@link RDFTerm#equals(Object)} * behaviour. *

* Note that Triple methods are not required to return object * identical (==) instances as long as they are equivalent * according to {@link RDFTerm#equals(Object)}. Specialisations of * Triple may provide additional methods that are documented to be * mutable. *

* Triple methods are thread-safe, however * specialisations may provide additional methods that are documented to not be * thread-safe. *

* Triples can be safely used in hashing collections like * {@link java.util.HashSet} and {@link java.util.HashMap}. *

* Any Triple can be used interchangeably across Commons RDF * implementations. * * @see Quad * @see RDF#createTriple(BlankNodeOrIRI,IRI,RDFTerm) * @see RDF-1.1 * Triple */ public interface Triple extends TripleLike { /** * The subject of this triple, which may be either a {@link BlankNode} or an * {@link IRI}, which are represented in Commons RDF by the interface * {@link BlankNodeOrIRI}. * * @return The subject {@link BlankNodeOrIRI} of this triple. * @see RDF-1.1 * Triple subject */ @Override BlankNodeOrIRI getSubject(); /** * The predicate {@link IRI} of this triple. * * @return The predicate {@link IRI} of this triple. * @see RDF-1.1 * Triple predicate */ @Override IRI getPredicate(); /** * The object of this triple, which may be either a {@link BlankNode}, an * {@link IRI}, or a {@link Literal}, which are represented in Commons RDF * by the interface {@link RDFTerm}. * * @return The object {@link RDFTerm} of this triple. * @see RDF-1.1 * Triple object */ @Override RDFTerm getObject(); /** * Check it this Triple is equal to another Triple. *

* Two Triples are equal if and only if their {@link #getSubject()}, * {@link #getPredicate()} and {@link #getObject()} are equal. *

*

* Implementations MUST also override {@link #hashCode()} so that two equal * Triples produce the same hash code. *

* * @param other * Another object * @return true if other is a Triple and is equal to this * @see Object#equals(Object) */ @Override public boolean equals(Object other); /** * Calculate a hash code for this Triple. *

* The returned hash code MUST be equal to the result of * {@link Objects#hash(Object...)} with the arguments {@link #getSubject()}, * {@link #getPredicate()}, {@link #getObject()}. *

* This method MUST be implemented in conjunction with * {@link #equals(Object)} so that two equal {@link Triple}s produce the * same hash code. * * @return a hash code value for this Triple. * @see Object#hashCode() * @see Objects#hash(Object...) */ @Override public int hashCode(); } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/GraphLike.java0000644000175000017500000000640113175733174032236 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.ConcurrentModificationException; import java.util.stream.Stream; /** * A "graph-like" interface that contains {@link TripleLike} statements. *

* Extended by {@link Graph} (for {@link Triple}) and {@link Dataset} (for * {@link Quad}). *

* Unlike {@link Graph} and {@link Dataset}, this interface can support * generalised {@link TripleLike} or {@link QuadLike} statements, but does not * imply semantics like {@link #size()} or the requirement of mapping * {@link RDFTerm} instances from different implementations. *

* As {@link TripleLike} do not have a specific {@link Object#equals(Object)} * semantics, the behaviour of methods like {@link #contains(TripleLike)} and * {@link #remove(TripleLike)} is undefined for arguments that are not object * identical to previously added or returned {@link TripleLike} statements. * * @param * A {@link TripleLike} type used by the graph methods, typically * {@link Triple} or {@link Quad} * * @since 0.3.0-incubating * @see Graph * @see Dataset * @see TripleLike */ public interface GraphLike { /** * Add a statement. * * @param statement * The TripleLike statement to add */ void add(T statement); /** * Check if statement is contained. * * @param statement * The {@link TripleLike} statement to check * @return True if the statement is contained */ boolean contains(T statement); /** * Add a statement. * * @param statement * The TripleLike statement to add */ void remove(T statement); /** * Remove all statements. */ void clear(); /** * Number of statements. * * @return Number of statements */ long size(); /** * Return a Stream of contained statements. * * @return A {@link Stream} of {@link TripleLike} statements. */ Stream stream(); /** * Iterate over contained statements. * * @return An {@link Iterable} of {@link TripleLike} statements. * @throws IllegalStateException * if the {@link Iterable} has been reused * @throws ConcurrentModificationException * if a concurrency conflict occurs while the Iterator is * active. */ Iterable iterate() throws ConcurrentModificationException, IllegalStateException; } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/TripleLike.java0000644000175000017500000000420013175733174032427 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; /** * A generalised "triple-like" interface, extended by {@link Triple} and * {@link Quad}. *

* A TripleLike statement has at least a {@link #getSubject()}, * {@link #getPredicate()} and {@link #getObject()}, but unlike a {@link Triple} * does not have a formalised {@link Triple#equals(Object)} or * {@link Triple#hashCode()} semantics and is not required to be * immutable or thread-safe. This interfaced can also be used * for generalised triples (e.g. a {@link BlankNode} as predicate). *

* Implementations should specialise which specific {@link RDFTerm} types they * return by overriding {@link #getSubject()}, {@link #getPredicate()} and * {@link #getObject()}. * * * @since 0.3.0-incubating * @see Triple * @see Quad * @see QuadLike */ public interface TripleLike { /** * The subject of this statement. * * @return The subject, typically an {@link IRI} or {@link BlankNode}. */ RDFTerm getSubject(); /** * The predicate of this statement. * * @return The predicate, typically an {@link IRI}. */ RDFTerm getPredicate(); /** * The object of this statement. * * @return The object, typically an {@link IRI}, {@link BlankNode} or * {@link Literal}. */ RDFTerm getObject(); } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/Literal.java0000644000175000017500000001333413175733174031767 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.io.Serializable; import java.util.Locale; import java.util.Objects; import java.util.Optional; /** * An RDF-1.1 Literal, as defined by * RDF-1.1 Concepts and Abstract Syntax, a W3C Recommendation published on * 25 February 2014. * * @see RDF#createLiteral(String) * @see RDF#createLiteral(String, IRI) * @see RDF#createLiteral(String, String) */ public interface Literal extends RDFTerm { /** * The lexical form of this literal, represented by a * Unicode string. * * @return The lexical form of this literal. * @see RDF-1.1 * Literal lexical form */ String getLexicalForm(); /** * The IRI identifying the datatype that determines how the lexical form * maps to a literal value. * * If the datatype IRI is * http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, * {@link #getLanguageTag()} must not return {@link Optional#empty()}, and * it must return a valid * BCP47 language tag. * * @return The datatype IRI for this literal. * @see RDF-1.1 * Literal datatype IRI */ IRI getDatatype(); /** * If and only if the datatype IRI is * http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, the language * tag for this Literal is a non-empty language tag as defined by * BCP47.
* If the datatype IRI is not * http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, this method * must return {@link Optional#empty()}. *

* The value space of language tags is always in lower case; although * RDF implementations MAY convert all language tags to lower case, * safe comparisons of language tags should be done using * {@link String#toLowerCase(Locale)} with the locale * {@link Locale#ROOT}. *

* Implementation note: If your application requires {@link Serializable} * objects, it is best not to store an {@link Optional} in a field. It is * recommended to use {@link Optional#ofNullable(Object)} to create the * return value for this method. * * @return The {@link Optional} language tag for this literal. If * {@link Optional#isPresent()} returns true, the value returned by * {@link Optional#get()} must be a non-empty language tag string * conforming to BCP47. * @see RDF-1.1 * Literal language tag */ Optional getLanguageTag(); /** * Check it this Literal is equal to another Literal. *

* Literal * term equality: * Two literals are term-equal (the same RDF literal) if * and only if the two lexical forms, the two datatype IRIs, and the two * language tags (if any) compare equal, character by character. Thus, two * literals can have the same value without being the same RDF term. *
* As the value space for language tags is lower-space, if they are present, * they MUST be compared character by character * using the equivalent of {@link String#toLowerCase(java.util.Locale)} with * the locale {@link Locale#ROOT}. *

* Implementations MUST also override {@link #hashCode()} so that two equal * Literals produce the same hash code. * * @param other * Another object * @return true if other is a Literal and is equal to this * @see Object#equals(Object) */ @Override public boolean equals(Object other); /** * Calculate a hash code for this Literal. *

* The returned hash code MUST be equal to the result of * {@link Objects#hash(Object...)} with the arguments * {@link #getLexicalForm()}, {@link #getDatatype()}, * {@link #getLanguageTag()}.map(s->s.toLowerString(Locale.ROOT)). *

* This method MUST be implemented in conjunction with * {@link #equals(Object)} so that two equal Literals produce the same hash * code. * * @return a hash code value for this Literal. * @see Object#hashCode() * @see Objects#hash(Object...) */ @Override public int hashCode(); } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/IRI.java0000644000175000017500000000534213175733174031016 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; /** * An RDF-1.1 IRI, * as defined by RDF-1.1 * Concepts and Abstract Syntax, a W3C Recommendation published on 25 * February 2014. * * @see RDF#createIRI(String) */ public interface IRI extends BlankNodeOrIRI { /** * Return the IRI encoded as a native Unicode String.
* * The returned string must not include URL-encoding to escape non-ASCII * characters. * * @return The IRI encoded as a native Unicode String. */ String getIRIString(); /** * Check it this IRI is equal to another IRI.

* IRI * equality: Two IRIs are equal if and only if they are equivalent under * Simple String Comparison according to section 5.1 of [RFC3987]. Further * normalization MUST NOT be performed when comparing IRIs for equality. *
* * Two IRI instances are equal if and only if their {@link #getIRIString()} * are equal. * * Implementations MUST also override {@link #hashCode()} so that two equal * IRIs produce the same hash code. * * @param other * Another object * @return true if other is an IRI and is equal to this * @see Object#equals(Object) */ @Override public boolean equals(Object other); /** * Calculate a hash code for this IRI. *

* The returned hash code MUST be equal to the {@link String#hashCode()} of * the {@link #getIRIString()}. *

* This method MUST be implemented in conjunction with * {@link #equals(Object)} so that two equal IRIs produce the same hash * code. * * @return a hash code value for this IRI. * @see Object#hashCode() */ @Override public int hashCode(); } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDFTerm.java0000644000175000017500000001010513175733174031627 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; /** * An RDF-1.1 * Term, as defined by * RDF-1.1 Concepts and * Abstract Syntax, a W3C Recommendation published on 25 February 2014. *

* A {@link RDFTerm} object in Commons RDF is considered * immutable, that is, over its life time it will have * consistent behaviour for its {@link #equals(Object)} and {@link #hashCode()}, * and objects returned from its getter methods (e.g. {@link IRI#getIRIString()} * and {@link Literal#getLanguageTag()}) will have consistent * {@link #equals(Object)} behaviour. *

* Note that methods in RDFTerm and its Commons RDF specialisations * {@link IRI}, {@link BlankNode} and {@link Literal} are not required to return * object identical (==) instances as long as they are equivalent * according to their {@link Object#equals(Object)}. Further specialisations may * provide additional methods that are documented to be mutable. *

* Methods in RDFTerm and its Commons RDF specialisations * {@link IRI}, {@link BlankNode} and {@link Literal} are * thread-safe, however further specialisations may add * additional methods that are documented to not be thread-safe. *

* RDFTerms can be safely used in hashing collections like * {@link java.util.HashSet} and {@link java.util.HashMap}. *

* Any RDFTerm can be used interchangeably across Commons RDF * implementations. * * @see RDF-1.1 * Term */ public interface RDFTerm { /** * Return the term serialised as specified by the RDF-1.1 N-Triples * Canonical form. * * @return The term serialised as RDF-1.1 N-Triples. * @see * RDF-1.1 N-Triples Canonical form */ String ntriplesString(); /** * Check it this RDFTerm is equal to another RDFTerm. *

* If this object is an {@link IRI}, equality is checked using * {@link IRI#equals(Object)}, or if this object is a {@link BlankNode}, * equality is checked using {@link BlankNode#equals(Object)}, or if this * object is a {@link Literal}, equality is checked using * {@link Literal#equals(Object)}. *

* Implementations MUST also override {@link #hashCode()} so that two equal * Literals produce the same hash code. * * @see IRI#equals(Object) * @see BlankNode#equals(Object) * @see Literal#equals(Object) * * @param other * Another object * @return true if other is a RDFTerm and is equal to this */ @Override public boolean equals(Object other); /** * Calculate a hash code for this RDFTerm. *

* As an {@link RDFTerm} is immutable, this method will always * return the same hashCode over the lifetime of this object. *

* This method MUST be implemented in conjunction with * {@link #equals(Object)} so that two equal RDFTerm produce the same hash * code. * * @see IRI#hashCode() * @see Literal#hashCode() * @see BlankNode#hashCode() * * @return a hash code value for this RDFTerm. */ @Override public int hashCode(); } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/BlankNode.java0000644000175000017500000001174613175733174032235 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.UUID; /** * A RDF-1.1 * Blank Node, as defined by * RDF-1.1 * Concepts and Abstract Syntax, a W3C Recommendation published on 25 * February 2014.
* * Note:

* Blank nodes * are disjoint from IRIs and literals. Otherwise, the set of possible blank * nodes is arbitrary. RDF makes no reference to any internal structure of blank * nodes.
* * Also note that:
Blank node * identifiers are local identifiers that are used in some concrete RDF * syntaxes or RDF store implementations. They are always locally * scoped to the file or RDF store, and are not persistent or * portable identifiers for blank nodes. Blank node identifiers are not * part of the RDF abstract syntax, but are entirely dependent on the concrete * syntax or implementation. The syntactic restrictions on blank node * identifiers, if any, therefore also depend on the concrete RDF syntax or * implementation. * * Implementations that handle blank node identifiers in concrete syntaxes need * to be careful not to create the same blank node from multiple occurrences of * the same blank node identifier except in situations where this is supported * by the syntax.
* * A BlankNode SHOULD contain a {@link UUID}-derived string as part of its * universally unique {@link #uniqueReference()}. * * @see RDF#createBlankNode() * @see RDF#createBlankNode(String) * @see RDF-1.1 * Blank Node */ public interface BlankNode extends BlankNodeOrIRI { /** * Return a reference for uniquely identifying the blank node. *

* The reference string MUST universally and uniquely identify this blank * node. That is, different blank nodes created separately in different JVMs * or from different {@link RDF} instances MUST NOT have the same reference * string. *

* The {@link #uniqueReference()} of two BlankNode instances * MUST be equal if and only if the two blank nodes are equal according to * {@link #equals(Object)}. *

* Clients should not assume any particular structure of the reference * string, however it is recommended that the reference string contain a * UUID-derived string, e.g. as returned from {@link UUID#toString()}. *

* IMPORTANT: This is not a * * blank node identifier nor a serialization/syntax label, and there are * no guarantees that it is a valid identifier in any concrete RDF syntax. * For an N-Triples compatible identifier, use {@link #ntriplesString()}. * * @return A universally unique reference to identify this {@link BlankNode} */ String uniqueReference(); /** * Check it this BlankNode is equal to another BlankNode. Two BlankNodes * MUST be equal if, and only if, they have the same * {@link #uniqueReference()}. *

* Implementations MUST also override {@link #hashCode()} so that two equal * Literals produce the same hash code. * * @param other * Another object * @return true if other is a BlankNode instance that represent the same * blank node * @see Object#equals(Object) */ @Override public boolean equals(Object other); /** * Calculate a hash code for this BlankNode. *

* The returned hash code MUST be equal to the {@link String#hashCode()} of * the {@link #uniqueReference()}. *

* This method MUST be implemented in conjunction with * {@link #equals(Object)} so that two equal BlankNodes produce the same * hash code. * * @return a hash code value for this BlankNode. * @see Object#hashCode() */ @Override public int hashCode(); } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/BlankNodeOrIRI.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/BlankNodeOrIRI.jav0000644000175000017500000000222113175733174032725 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; /** * This interface represents the {@link RDFTerm}s that may be used in the * subject position of an RDF-1.1 {@link Triple} as well as the graph name * position of a {@link Quad}. *

* Instances of BlankNodeOrIRI SHOULD be a {@link BlankNode} or an {@link IRI}. */ public interface BlankNodeOrIRI extends RDFTerm { } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDFSyntax.java0000644000175000017500000002506713175733174032223 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.Collections; import java.util.Locale; import java.util.Optional; import java.util.Set; /** * An RDF syntax, e.g. as used for parsing and writing RDF. *

* An RDF syntax is uniquely identified by its {@link #mediaType()}, and has a * suggested {@link #fileExtension()}. *

* Some of the RDF syntaxes may {@link #supportsDataset()}, meaning they can * represent {@link Quad}s. *

* An enumeration of the official RDF 1.1 syntaxes is available in * {@link W3CRDFSyntax} - for convenience they are also accessible * as constants here, e.g. RDFSyntax.JSONLD. * */ public interface RDFSyntax { /** * JSON-LD 1.0 * * @see https://www.w3.org/TR/json-ld/ * */ public static RDFSyntax JSONLD = W3CRDFSyntax.JSONLD; /** * RDF 1.1 Turtle * * @see https://www.w3.org/TR/turtle/ * */ public static RDFSyntax TURTLE = W3CRDFSyntax.TURTLE; /** * RDF 1.1 N-Quads * * @see https://www.w3.org/TR/n-quads/ */ public static RDFSyntax NQUADS = W3CRDFSyntax.NQUADS; /** * RDF 1.1 N-Triples * * @see https://www.w3.org/TR/n-triples/ */ public static RDFSyntax NTRIPLES = W3CRDFSyntax.NTRIPLES; /** * HTML+RDFa 1.1 and XHTML+RDFa 1.1 * * @see https://www.w3.org/TR/html-rdfa/ * @see https://www.w3.org/TR/xhtml-rdfa/ */ public static RDFSyntax RDFA = W3CRDFSyntax.RDFA; /** * RDF 1.1 XML Syntax * * @see https://www.w3.org/TR/rdf-syntax-grammar/ */ public static RDFSyntax RDFXML = W3CRDFSyntax.RDFXML; /** * RDF 1.1 TriG * * @see https://www.w3.org/TR/trig/ */ public static RDFSyntax TRIG = W3CRDFSyntax.TRIG; /** * A short name of the RDF Syntax e.g. JSONLD. *

* The name is specific to Commons RDF and carries no particular meaning. * * @return Short name for RDF syntax */ public String name(); /** * The title of the RDF Syntax. *

* This is generally the title of the corresponding standard, * e.g. RDF 1.1 Turtle. * * @return Title of RDF Syntax */ public String title(); /** * The IANA media type for * the RDF syntax. *

* The media type can be used as part of Content-Type and * Accept for content negotiation in the * HTTP * protocol. * * @return The registered media type of the RDF Syntax */ public String mediaType(); /** * Set of IANA media types that * covers this RDF syntax, including any non-official media types. *

* The media type can be used as part of Content-Type and * Accept for content negotiation in the * HTTP * protocol. *

* The returned Set MUST include the value {@link #mediaType()}; this is the * behaviour of the default implementation. * * @return The media types corresponding to the RDF Syntax */ default public Set mediaTypes() { return Collections.singleton(mediaType()); } /** * The IANA-registered * file extension. *

* The file extension includes the leading period, e.g. .jsonld * * @return The registered file extension of the RDF Syntax */ public String fileExtension(); /** * Set of file extensions for this RDF syntax, including any non-official extensions. *

* The file extension includes the leading period, e.g. .jsonld *

* The returned Set MUST include the value from {@link #fileExtension()}; this is * the behaviour of the default implementation. * * @return The file extensions corresponding to the RDF Syntax */ default public Set fileExtensions() { return Collections.singleton(fileExtension()); } /** * Indicate if this RDF syntax supports * RDF * Datasets. * * @return true if this RDF Syntax supports datasets; false otherwise */ public boolean supportsDataset(); /** * Return the {@link IRI} that identifies the RDF syntax. *

* Note that the identifying IRI is generally distinct from the IRI of the * document that specifies the RDF syntax. * * @return Identifying IRI, e.g. * http://www.w3.org/ns/formats/JSON-LD */ public IRI iri(); /** * Compare this RDFSyntax with another object. *

* Two {@link RDFSyntax}es are considered equal if their * {@link #mediaType()}s are equal when compared as lower case strings * according to {@link String#toLowerCase(Locale)} with the locale * {@link Locale#ROOT}. * * @param obj the object with which to compare * @return true if this object is the same as the obj argument; false otherwise */ @Override boolean equals(Object obj); /** * The hash code of an RDFSyntax is equivalent to the hash code * of the {@link #mediaType()} in lower case according to * {@link String#toLowerCase(Locale)} with the locale * {@link Locale#ROOT}. * * @return Hash code of RDFSyntax */ @Override int hashCode(); /** * Return the RDF 1.1 serialization syntaxes. *

* This lists the W3C standardized RDF 1.1 syntaxes like {@link #TURTLE} and * {@link #JSONLD}. Note the existence of other RDF syntaxes that are not * included here, e.g. N3 and * TriX. *

* The syntaxes returned only support the {@link #mediaType()} * and {@link #fileExtension()} as defined in the corresponding * W3C specification. * * @return * A set of the official RDF 1.1 {@link RDFSyntax}es. * * @see RDF * 1.1 Primer * @see org.apache.commons.rdf.experimental.RDFParser */ public static Set w3cSyntaxes() { return W3CRDFSyntax.syntaxes; } /** * Return the RDFSyntax with the specified media type. *

* The mediaType is compared in lower case to all media types * supported, therefore it might not be equal to the * {@link RDFSyntax#mediaType} of the returned RDFSyntax. *

* If the media type specifies parameters, e.g. * text/turtle; charset=ascii, only the part of the string to * before ; is considered. *

* This method support all syntaxes returned by {@link #w3cSyntaxes()}. * * @param mediaType * The media type to match * @return If {@link Optional#isPresent()}, the {@link RDFSyntax} which has * a matching {@link RDFSyntax#mediaType()}, otherwise * {@link Optional#empty()} indicating that no matching syntax was * found. */ public static Optional byMediaType(final String mediaType) { final String type = mediaType.toLowerCase(Locale.ROOT).split("\\s*;", 2)[0]; return w3cSyntaxes().stream().filter(t -> t.mediaTypes().contains(type)) .findAny(); } /** * Return the RDFSyntax with the specified file extension. *

* The fileExtension is compared in lower case to all * extensions supported, therefore it might not be equal to the * {@link RDFSyntax#fileExtension} of the returned RDFSyntax. *

* This method support all syntaxes returned by {@link #w3cSyntaxes()}. * * @param fileExtension * The fileExtension to match, starting with . * @return If {@link Optional#isPresent()}, the {@link RDFSyntax} which has * a matching {@link RDFSyntax#fileExtension()}, otherwise * {@link Optional#empty()} indicating that no matching file * extension was found. */ public static Optional byFileExtension(final String fileExtension) { final String ext = fileExtension.toLowerCase(Locale.ROOT); return w3cSyntaxes().stream().filter(t -> t.fileExtensions().contains(ext)) .findAny(); } /** * Return the RDFSyntax with the specified {@link #name()}. *

* This method support all syntaxes returned by {@link #w3cSyntaxes()}. * * @param name * The name to match, , e.g. "JSONLD" * @return If {@link Optional#isPresent()}, the {@link RDFSyntax} which has * a matching {@link RDFSyntax#name()}, otherwise * {@link Optional#empty()} indicating that no matching name was found. */ public static Optional byName(final String name) { return w3cSyntaxes().stream().filter(t -> t.name().equals(name)).findAny(); } } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/Graph.java0000644000175000017500000002531413175733174031435 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.stream.Stream; /** * An RDF 1.1 * Graph, a set of RDF triples, as defined by * RDF-1.1 Concepts and Abstract * Syntax, a W3C Recommendation published on 25 February 2014. * * @see RDF#createGraph() */ public interface Graph extends AutoCloseable, GraphLike { /** * Adds a triple to the graph, possibly mapping any of the components of the * Triple to those supported by this Graph. * * @param triple * The triple to add */ @Override void add(Triple triple); /** * Adds a triple to the graph, possibly mapping any of the components to * those supported by this Graph. * * @param subject * The triple subject * @param predicate * The triple predicate * @param object * The triple object */ void add(BlankNodeOrIRI subject, IRI predicate, RDFTerm object); /** * Checks if graph contains triple. * * @param triple * The triple to check. * @return True if the Graph contains the given Triple. */ @Override boolean contains(Triple triple); /** * Checks if graph contains a pattern of triples. * * @param subject * The triple subject (null is a wildcard) * @param predicate * The triple predicate (null is a wildcard) * @param object * The triple object (null is a wildcard) * @return True if the Graph contains any Triples that match the given * pattern. */ boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object); /** * Closes the graph, relinquishing any underlying resources. *

* For example, this would close any open file and network streams and free * database locks held by the Graph implementation. *

* The behaviour of the other Graph methods are undefined after closing the * graph. *

* Implementations might not need {@link #close()}, hence the default * implementation does nothing. */ @Override default void close() throws Exception { } /** * Removes a concrete triple from the graph. * * @param triple * triple to remove */ @Override void remove(Triple triple); /** * Removes a concrete pattern of triples from the graph. * * @param subject * The triple subject (null is a wildcard) * @param predicate * The triple predicate (null is a wildcard) * @param object * The triple object (null is a wildcard) */ void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object); /** * Clears the graph, removing all triples. */ @Override void clear(); /** * Number of triples contained by the graph. *

* The count of a set does not include duplicates, consistent with the * {@link Triple#equals(Object)} equals method for each {@link Triple}. * * @return The number of triples in the graph */ @Override long size(); /** * Gets all triples contained by the graph.
*

* The iteration does not contain any duplicate triples, as determined by * the {@link Triple#equals(Object)} method for each {@link Triple}. *

* The behaviour of the {@link Stream} is not specified if * {@link #add(Triple)}, {@link #remove(Triple)} or {@link #clear()} are * called on the {@link Graph} before it terminates. *

* Implementations may throw {@link ConcurrentModificationException} from * Stream methods if they detect a conflict while the Stream is active. * * @since 0.3.0-incubating * @return A {@link Stream} over all of the triples in the graph */ @Override Stream stream(); /** * Gets all triples contained by the graph matched with the pattern. *

* The iteration does not contain any duplicate triples, as determined by * the {@link Triple#equals(Object)} method for each {@link Triple}. *

* The behaviour of the {@link Stream} is not specified if * {@link #add(Triple)}, {@link #remove(Triple)} or {@link #clear()} are * called on the {@link Graph} before it terminates. *

* Implementations may throw {@link ConcurrentModificationException} from * Stream methods if they detect a conflict while the Stream is active. *

* * @since 0.3.0-incubating * @param subject * The triple subject (null is a wildcard) * @param predicate * The triple predicate (null is a wildcard) * @param object * The triple object (null is a wildcard) * @return A {@link Stream} over the matched triples. */ Stream stream(BlankNodeOrIRI subject, IRI predicate, RDFTerm object); /** * This method is deprecated, use the equivalent method {@link #stream()} * instead. * * @return A {@link Stream} over all triples. */ @Deprecated default Stream getTriples() { return stream(); } /** * This method is deprecated, use the equivalent method * {@link #stream(BlankNodeOrIRI, IRI, RDFTerm)} instead. * * @param subject * The triple subject (null is a wildcard) * @param predicate * The triple predicate (null is a wildcard) * @param object * The triple object (null is a wildcard) * @return A {@link Stream} over the matched triples. */ @Deprecated default Stream getTriples(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return stream(subject, predicate, object); } /** * Gets an Iterable for iterating over all triples in the graph. *

* This method is meant to be used with a Java for-each loop, e.g.: * *

     * for (Triple t : graph.iterate()) {
     *     System.out.println(t);
     * }
     * 
* * The behaviour of the iterator is not specified if {@link #add(Triple)}, * {@link #remove(Triple)} or {@link #clear()}, are called on the * {@link Graph} before it terminates. It is undefined if the returned * {@link Iterator} supports the {@link Iterator#remove()} method. *

* Implementations may throw {@link ConcurrentModificationException} from * Iterator methods if they detect a concurrency conflict while the Iterator * is active. *

* The {@link Iterable#iterator()} must only be called once, that is the * Iterable must only be iterated over once. A {@link IllegalStateException} * may be thrown on attempt to reuse the Iterable. *

* The default implementation of this method will call {@link #stream()} to return * its {@link Stream#iterator()}. * * @return A {@link Iterable} that returns {@link Iterator} over all of the * triples in the graph * @throws IllegalStateException * if the {@link Iterable} has been reused * @throws ConcurrentModificationException * if a concurrency conflict occurs while the Iterator is * active. */ @Override @SuppressWarnings("unchecked") default Iterable iterate() throws ConcurrentModificationException, IllegalStateException { return ((Stream) stream())::iterator; } /** * Gets an Iterable for iterating over the triples in the graph that match * the pattern. *

* This method is meant to be used with a Java for-each loop, e.g.: * *

     * IRI alice = factory.createIRI("http://example.com/alice");
     * IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/");
     * for (Triple t : graph.iterate(alice, knows, null)) {
     *     System.out.println(t.getObject());
     * }
     * 
*

* The behaviour of the iterator is not specified if {@link #add(Triple)}, * {@link #remove(Triple)} or {@link #clear()}, are called on the * {@link Graph} before it terminates. It is undefined if the returned * {@link Iterator} supports the {@link Iterator#remove()} method. *

* Implementations may throw {@link ConcurrentModificationException} from * Iterator methods if they detect a concurrency conflict while the Iterator * is active. *

* The {@link Iterable#iterator()} must only be called once, that is the * Iterable must only be iterated over once. A {@link IllegalStateException} * may be thrown on attempt to reuse the Iterable. *

* The default implementation of this method will call * {@link #stream(BlankNodeOrIRI, IRI, RDFTerm)} to return its * {@link Stream#iterator()}. * * @param subject * The triple subject (null is a wildcard) * @param predicate * The triple predicate (null is a wildcard) * @param object * The triple object (null is a wildcard) * @return A {@link Iterable} that returns {@link Iterator} over the * matching triples in the graph * @throws IllegalStateException * if the {@link Iterable} has been reused * @throws ConcurrentModificationException * if a concurrency conflict occurs while the Iterator is * active. */ @SuppressWarnings("unchecked") default Iterable iterate(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) throws ConcurrentModificationException, IllegalStateException { return ((Stream) stream(subject, predicate, object))::iterator; } } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/W3CRDFSyntax.java0000644000175000017500000001446613175733174032541 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Locale; import java.util.Set; /** * W3C RDF 1.1 serialization syntax. *

* This defines the W3C standardized RDF 1.1 syntaxes like {@link #TURTLE} and * {@link #JSONLD}. Note the existence of other RDF syntaxes that are not * included here, e.g. N3 and * TriX. *

* This class is package-protected, its static constants are exposed through * {@link RDFSyntax}. * * @see RDFSyntax#w3cSyntaxes() * @see RDF * 1.1 Primer * @see org.apache.commons.rdf.experimental.RDFParser */ class W3CRDFSyntax implements RDFSyntax { /** * IRI representing a W3C RDF * format. */ private final static class FormatIRI implements IRI { private static String BASE = "http://www.w3.org/ns/formats/"; private final String format; private FormatIRI(final String format) { this.format = format; } @Override public String getIRIString() { return BASE + format; } @Override public String ntriplesString() { return "<" + getIRIString() + ">"; } @Override public String toString() { return ntriplesString(); } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof IRI)) { return false; } final IRI other = (IRI) obj; return getIRIString().equals(other.getIRIString()); } @Override public int hashCode() { return getIRIString().hashCode(); } } static final RDFSyntax JSONLD, TURTLE, NQUADS, NTRIPLES, RDFA, RDFXML, TRIG; static final Set syntaxes; static { // Initialize within static block to avoid inserting nulls JSONLD = new W3CRDFSyntax("JSON-LD", "JSON-LD 1.0", "application/ld+json", ".jsonld", true); TURTLE = new W3CRDFSyntax("Turtle", "RDF 1.1 Turtle", "text/turtle", ".ttl", false); NQUADS = new W3CRDFSyntax("N-Quads", "RDF 1.1 N-Quads", "application/n-quads", ".nq", true); NTRIPLES = new W3CRDFSyntax("N-Triples", "RDF 1.1 N-Triples", "application/n-triples", ".nt", false); RDFXML = new W3CRDFSyntax("RDF_XML", "RDF 1.1 XML Syntax", "application/rdf+xml", ".rdf", false); TRIG = new W3CRDFSyntax("TriG", "RDF 1.1 TriG", "application/trig", ".trig", true); RDFA = new W3CRDFSyntax("RDFa", "HTML+RDFa 1.1", "text/html", ".html", false) { private final Set types = Collections.unmodifiableSet(new LinkedHashSet<>( Arrays.asList("text/html", "application/xhtml+xml"))); private final Set extensions = Collections.unmodifiableSet(new LinkedHashSet<>( Arrays.asList(".html", ".xhtml"))); @Override public Set mediaTypes() { return types; } @Override public Set fileExtensions() { return extensions; } }; syntaxes = Collections.unmodifiableSet(new LinkedHashSet<>( Arrays.asList(JSONLD, NQUADS, NTRIPLES, RDFA, RDFXML, TRIG, TURTLE))); } private final String title; private final String mediaType; private final String fileExtension; private final boolean supportsDataset; private final String name; private final IRI iri; private W3CRDFSyntax(final String name, final String title, final String mediaType, final String fileExtension, final boolean supportsDataset) { this.name = name; this.title = title; this.mediaType = mediaType.toLowerCase(Locale.ROOT); this.fileExtension = fileExtension.toLowerCase(Locale.ROOT); this.supportsDataset = supportsDataset; this.iri = new FormatIRI(name); } /** * {@inheritDoc} *

* {@link W3CRDFSyntax} always defines media type in lower case, so * {@link String#toLowerCase(Locale)} need not be called. * */ @Override public String mediaType() { return mediaType; } /** * {@inheritDoc} *

* {@link W3CRDFSyntax} always defines file extensions in lower case, so * {@link String#toLowerCase(Locale)} need not be called. * */ @Override public String fileExtension() { return fileExtension; } @Override public boolean supportsDataset() { return supportsDataset; } @Override public String title() { return title; } @Override public String name() { return name; } @Override public IRI iri() { return iri; } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof RDFSyntax)) { return false; } final RDFSyntax other = (RDFSyntax) obj; return mediaType.equals(other.mediaType().toLowerCase(Locale.ROOT)); } @Override public int hashCode() { return mediaType.hashCode(); } @Override public String toString() { return title; } }apache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/experimental/0000755000175000017500000000000013175733174031450 5ustar andriusandrius././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/experimental/package-info.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/experimental/package-i0000644000175000017500000000257413175733174033224 0ustar andriusandrius/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Experimental Commons RDF features. *

* Interfaces/classes in this package should be considered at * risk; they might change or be removed in the next minor update of * Commons RDF. *

* When class/interface has stabilized, it will move to the * {@link org.apache.commons.rdf.api} package. *

*/ package org.apache.commons.rdf.experimental;././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/main/java/org/apache/commons/rdf/experimental/RDFParser0000644000175000017500000005263313175733174033174 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.experimental; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.util.Optional; import java.util.concurrent.Future; import java.util.function.Consumer; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFSyntax; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.api.Triple; /** * Parse an RDF source into a target (e.g. a Graph/Dataset). *

Experimental

This interface (and its implementations) should be * considered at risk; they might change or be removed in the * next minor update of Commons RDF. It may move to the the * {@link org.apache.commons.rdf.api} package when it has stabilized. *

Description

*

* This interface follows the * Builder pattern, * allowing to set parser settings like {@link #contentType(RDFSyntax)} and * {@link #base(IRI)}. A caller MUST call one of the source methods * (e.g. {@link #source(IRI)}, {@link #source(Path)}, * {@link #source(InputStream)}), and MUST call one of the target * methods (e.g. {@link #target(Consumer)}, {@link #target(Dataset)}, * {@link #target(Graph)}) before calling {@link #parse()} on the returned * RDFParser - however methods can be called in any order. *

* The call to {@link #parse()} returns a {@link Future}, allowing asynchronous * parse operations. Callers are recommended to check {@link Future#get()} to * ensure parsing completed successfully, or catch exceptions thrown during * parsing. *

* Setting a method that has already been set will override any existing value * in the returned builder - regardless of the parameter type (e.g. * {@link #source(IRI)} will override a previous {@link #source(Path)}. Settings * can be unset by passing null - note that this may require * casting, e.g. contentType( (RDFSyntax) null ) to undo a previous * call to {@link #contentType(RDFSyntax)}. *

* It is undefined if a RDFParser is mutable or thread-safe, so callers should * always use the returned modified RDFParser from the builder methods. The * builder may return itself after modification, or a cloned builder with the * modified settings applied. Implementations are however encouraged to be * immutable, thread-safe and document this. As an example starting point, see * org.apache.commons.rdf.simple.AbstractRDFParser. *

* Example usage: *

* *
 * Graph g1 = rDFTermFactory.createGraph();
 * new ExampleRDFParserBuilder().source(Paths.get("/tmp/graph.ttl")).contentType(RDFSyntax.TURTLE).target(g1).parse()
 *         .get(30, TimeUnit.Seconds);
 * 
* */ public interface RDFParser { /** * The result of {@link RDFParser#parse()} indicating parsing completed. *

* This is a marker interface that may be subclassed to include parser * details, e.g. warning messages or triple counts. */ public interface ParseResult { } /** * Specify which {@link RDF} to use for generating {@link RDFTerm}s. *

* This option may be used together with {@link #target(Graph)} to override * the implementation's default factory and graph. *

* Warning: Using the same {@link RDF} for multiple * {@link #parse()} calls may accidentally merge {@link BlankNode}s having * the same label, as the parser may use the * {@link RDF#createBlankNode(String)} method from the parsed blank node * labels. * * @see #target(Graph) * @param rdfTermFactory * {@link RDF} to use for generating RDFTerms. * @return An {@link RDFParser} that will use the specified rdfTermFactory */ RDFParser rdfTermFactory(RDF rdfTermFactory); /** * Specify the content type of the RDF syntax to parse. *

* This option can be used to select the RDFSyntax of the source, overriding * any Content-Type headers or equivalent. *

* The character set of the RDFSyntax is assumed to be * {@link StandardCharsets#UTF_8} unless overridden within the document * (e.g. {@code } in * {@link RDFSyntax#RDFXML}). *

* This method will override any contentType set with * {@link #contentType(String)}. * * @see #contentType(String) * @param rdfSyntax * An {@link RDFSyntax} to parse the source according to, e.g. * {@link RDFSyntax#TURTLE}. * @throws IllegalArgumentException * If this RDFParser does not support the specified RDFSyntax. * @return An {@link RDFParser} that will use the specified content type. */ RDFParser contentType(RDFSyntax rdfSyntax) throws IllegalArgumentException; /** * Specify the content type of the RDF syntax to parse. *

* This option can be used to select the RDFSyntax of the source, overriding * any Content-Type headers or equivalent. *

* The content type MAY include a charset parameter if the RDF * media types permit it; the default charset is * {@link StandardCharsets#UTF_8} unless overridden within the document. *

* This method will override any contentType set with * {@link #contentType(RDFSyntax)}. * * @see #contentType(RDFSyntax) * @param contentType * A content-type string, e.g. application/ld+json * or text/turtle;charset="UTF-8" as specified by * * RFC7231. * @return An {@link RDFParser} that will use the specified content type. * @throws IllegalArgumentException * If the contentType has an invalid syntax, or this RDFParser * does not support the specified contentType. */ RDFParser contentType(String contentType) throws IllegalArgumentException; /** * Specify a {@link Graph} to add parsed triples to. *

* If the source supports datasets (e.g. the {@link #contentType(RDFSyntax)} * set has {@link RDFSyntax#supportsDataset} is true)), then only quads in * the default graph will be added to the Graph as {@link Triple}s. *

* It is undefined if any triples are added to the specified {@link Graph} * if {@link #parse()} throws any exceptions. (However implementations are * free to prevent this using transaction mechanisms or similar). If * {@link Future#get()} does not indicate an exception, the parser * implementation SHOULD have inserted all parsed triples to the specified * graph. *

* Calling this method will override any earlier targets set with * {@link #target(Graph)}, {@link #target(Consumer)} or * {@link #target(Dataset)}. *

* The default implementation of this method calls {@link #target(Consumer)} * with a {@link Consumer} that does {@link Graph#add(Triple)} with * {@link Quad#asTriple()} if the quad is in the default graph. * * @param graph * The {@link Graph} to add triples to. * @return An {@link RDFParser} that will insert triples into the specified * graph. */ default RDFParser target(final Graph graph) { return target(q -> { if (!q.getGraphName().isPresent()) { graph.add(q.asTriple()); } }); } /** * Specify a {@link Dataset} to add parsed quads to. *

* It is undefined if any quads are added to the specified {@link Dataset} * if {@link #parse()} throws any exceptions. (However implementations are * free to prevent this using transaction mechanisms or similar). On the * other hand, if {@link #parse()} does not indicate an exception, the * implementation SHOULD have inserted all parsed quads to the specified * dataset. *

* Calling this method will override any earlier targets set with * {@link #target(Graph)}, {@link #target(Consumer)} or * {@link #target(Dataset)}. *

* The default implementation of this method calls {@link #target(Consumer)} * with a {@link Consumer} that does {@link Dataset#add(Quad)}. * * @param dataset * The {@link Dataset} to add quads to. * @return An {@link RDFParser} that will insert triples into the specified * dataset. */ default RDFParser target(final Dataset dataset) { return target(dataset::add); } /** * Specify a consumer for parsed quads. *

* The quads will include triples in all named graphs of the parsed source, * including any triples in the default graph. When parsing a source format * which do not support datasets, all quads delivered to the consumer will * be in the default graph (e.g. their {@link Quad#getGraphName()} will be * as {@link Optional#empty()}), while for a source *

* It is undefined if any quads are consumed if {@link #parse()} throws any * exceptions. On the other hand, if {@link #parse()} does not indicate an * exception, the implementation SHOULD have produced all parsed quads to * the specified consumer. *

* Calling this method will override any earlier targets set with * {@link #target(Graph)}, {@link #target(Consumer)} or * {@link #target(Dataset)}. *

* The consumer is not assumed to be thread safe - only one * {@link Consumer#accept(Object)} is delivered at a time for a given * {@link RDFParser#parse()} call. *

* This method is typically called with a functional consumer, for example: * *

     * {@code
     * List quads = new ArrayList;
     * parserBuilder.target(quads::add).parse();
     * }
     * 
* * @param consumer * A {@link Consumer} of {@link Quad}s * @return An {@link RDFParser} that will call the consumer for into the * specified dataset. */ RDFParser target(Consumer consumer); /** * Specify a base IRI to use for parsing any relative IRI references. *

* Setting this option will override any protocol-specific base IRI (e.g. * Content-Location header) or the {@link #source(IRI)} IRI, * but does not override any base IRIs set within the source document (e.g. * @base in Turtle documents). *

* If the source is in a syntax that does not support relative IRI * references (e.g. {@link RDFSyntax#NTRIPLES}), setting the * base has no effect. *

* This method will override any base IRI set with {@link #base(String)}. * * @see #base(String) * @param base * An absolute IRI to use as a base. * @return An {@link RDFParser} that will use the specified base IRI. */ RDFParser base(IRI base); /** * Specify a base IRI to use for parsing any relative IRI references. *

* Setting this option will override any protocol-specific base IRI (e.g. * Content-Location header) or the {@link #source(IRI)} IRI, * but does not override any base IRIs set within the source document (e.g. * @base in Turtle documents). *

* If the source is in a syntax that does not support relative IRI * references (e.g. {@link RDFSyntax#NTRIPLES}), setting the * base has no effect. *

* This method will override any base IRI set with {@link #base(IRI)}. * * @see #base(IRI) * @param base * An absolute IRI to use as a base. * @return An {@link RDFParser} that will use the specified base IRI. * @throws IllegalArgumentException * If the base is not a valid absolute IRI string */ RDFParser base(String base) throws IllegalArgumentException; /** * Specify a source {@link InputStream} to parse. *

* The source set will not be read before the call to {@link #parse()}. *

* The InputStream will not be closed after parsing. The InputStream does * not need to support {@link InputStream#markSupported()}. *

* The parser might not consume the complete stream (e.g. an RDF/XML parser * may not read beyond the closing tag of * </rdf:Description>). *

* The {@link #contentType(RDFSyntax)} or {@link #contentType(String)} * SHOULD be set before calling {@link #parse()}. *

* The character set is assumed to be {@link StandardCharsets#UTF_8} unless * the {@link #contentType(String)} specifies otherwise or the document * declares its own charset (e.g. RDF/XML with a * <?xml encoding="iso-8859-1"> header). *

* The {@link #base(IRI)} or {@link #base(String)} MUST be set before * calling {@link #parse()}, unless the RDF syntax does not permit relative * IRIs (e.g. {@link RDFSyntax#NTRIPLES}). *

* This method will override any source set with {@link #source(IRI)}, * {@link #source(Path)} or {@link #source(String)}. * * @param inputStream * An InputStream to consume * @return An {@link RDFParser} that will use the specified source. */ RDFParser source(InputStream inputStream); /** * Specify a source file {@link Path} to parse. *

* The source set will not be read before the call to {@link #parse()}. *

* The {@link #contentType(RDFSyntax)} or {@link #contentType(String)} * SHOULD be set before calling {@link #parse()}. *

* The character set is assumed to be {@link StandardCharsets#UTF_8} unless * the {@link #contentType(String)} specifies otherwise or the document * declares its own charset (e.g. RDF/XML with a * <?xml encoding="iso-8859-1"> header). *

* The {@link #base(IRI)} or {@link #base(String)} MAY be set before calling * {@link #parse()}, otherwise {@link Path#toUri()} will be used as the base * IRI. *

* This method will override any source set with {@link #source(IRI)}, * {@link #source(InputStream)} or {@link #source(String)}. * * @param file * A Path for a file to parse * @return An {@link RDFParser} that will use the specified source. */ RDFParser source(Path file); /** * Specify an absolute source {@link IRI} to retrieve and parse. *

* The source set will not be read before the call to {@link #parse()}. *

* If this builder does not support the given IRI protocol (e.g. * urn:uuid:ce667463-c5ab-4c23-9b64-701d055c4890), this method * should succeed, while the {@link #parse()} should throw an * {@link IOException}. *

* The {@link #contentType(RDFSyntax)} or {@link #contentType(String)} MAY * be set before calling {@link #parse()}, in which case that type MAY be * used for content negotiation (e.g. Accept header in HTTP), * and SHOULD be used for selecting the RDFSyntax. *

* The character set is assumed to be {@link StandardCharsets#UTF_8} unless * the protocol's equivalent of Content-Type specifies * otherwise or the document declares its own charset (e.g. RDF/XML with a * <?xml encoding="iso-8859-1"> header). *

* The {@link #base(IRI)} or {@link #base(String)} MAY be set before calling * {@link #parse()}, otherwise the source IRI will be used as the base IRI. *

* This method will override any source set with {@link #source(Path)}, * {@link #source(InputStream)} or {@link #source(String)}. * * @param iri * An IRI to retrieve and parse * @return An {@link RDFParser} that will use the specified source. */ RDFParser source(IRI iri); /** * Specify an absolute source IRI to retrieve and parse. *

* The source set will not be read before the call to {@link #parse()}. *

* If this builder does not support the given IRI (e.g. * urn:uuid:ce667463-c5ab-4c23-9b64-701d055c4890), this method * should succeed, while the {@link #parse()} should throw an * {@link IOException}. *

* The {@link #contentType(RDFSyntax)} or {@link #contentType(String)} MAY * be set before calling {@link #parse()}, in which case that type MAY be * used for content negotiation (e.g. Accept header in HTTP), * and SHOULD be used for selecting the RDFSyntax. *

* The character set is assumed to be {@link StandardCharsets#UTF_8} unless * the protocol's equivalent of Content-Type specifies * otherwise or the document declares its own charset (e.g. RDF/XML with a * <?xml encoding="iso-8859-1"> header). *

* The {@link #base(IRI)} or {@link #base(String)} MAY be set before calling * {@link #parse()}, otherwise the source IRI will be used as the base IRI. *

* This method will override any source set with {@link #source(Path)}, * {@link #source(InputStream)} or {@link #source(IRI)}. * * @param iri * An IRI to retrieve and parse * @return An {@link RDFParser} that will use the specified source. * @throws IllegalArgumentException * If the base is not a valid absolute IRI string * */ RDFParser source(String iri) throws IllegalArgumentException; /** * Parse the specified source. *

* A source method (e.g. {@link #source(InputStream)}, {@link #source(IRI)}, * {@link #source(Path)}, {@link #source(String)} or an equivalent subclass * method) MUST have been called before calling this method, otherwise an * {@link IllegalStateException} will be thrown. *

* A target method (e.g. {@link #target(Consumer)}, * {@link #target(Dataset)}, {@link #target(Graph)} or an equivalent * subclass method) MUST have been called before calling parse(), otherwise * an {@link IllegalStateException} will be thrown. *

* It is undefined if this method is thread-safe, however the * {@link RDFParser} may be reused (e.g. setting a different source) as soon * as the {@link Future} has been returned from this method. *

* The RDFParser SHOULD perform the parsing as an asynchronous operation, * and return the {@link Future} as soon as preliminary checks (such as * validity of the {@link #source(IRI)} and {@link #contentType(RDFSyntax)} * settings) have finished. The future SHOULD not mark * {@link Future#isDone()} before parsing is complete. A synchronous * implementation MAY be blocking on the parse() call and * return a Future that is already {@link Future#isDone()}. *

* The returned {@link Future} contains a {@link ParseResult}. * Implementations may subclass this interface to provide any parser * details, e.g. list of warnings. null is a possible return * value if no details are available, but parsing succeeded. *

* If an exception occurs during parsing, (e.g. {@link IOException} or * org.apache.commons.rdf.simple.experimental.RDFParseException), * it should be indicated as the * {@link java.util.concurrent.ExecutionException#getCause()} in the * {@link java.util.concurrent.ExecutionException} thrown on * {@link Future#get()}. * * @return A Future that will return the populated {@link Graph} when the * parsing has finished. * @throws IOException * If an error occurred while starting to read the source (e.g. * file not found, unsupported IRI protocol). Note that IO * errors during parsing would instead be the * {@link java.util.concurrent.ExecutionException#getCause()} of * the {@link java.util.concurrent.ExecutionException} thrown on * {@link Future#get()}. * @throws IllegalStateException * If the builder is in an invalid state, e.g. a * source has not been set. */ Future parse() throws IOException, IllegalStateException; } apache-commons-rdf-0.5.0/commons-rdf-api/src/main/resources/0000755000175000017500000000000013175733174023606 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/main/resources/META-INF/0000755000175000017500000000000013212356336024737 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/main/resources/META-INF/NOTICE0000644000175000017500000000025413212356336025644 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-api/src/main/resources/META-INF/LICENSE0000644000175000017500000002613613175733174025763 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-api/src/site/0000755000175000017500000000000013175733174021614 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/site/resources/0000755000175000017500000000000013175733174023626 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/site/resources/profile.japicmp0000644000175000017500000000000013175733174026621 0ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/site/resources/profile.jacoco0000644000175000017500000000000013175733174026434 0ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/test/0000755000175000017500000000000014132221255021611 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/0000755000175000017500000000000013175733174022550 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/0000755000175000017500000000000014132221255023321 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/0000755000175000017500000000000013175733174024560 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/0000755000175000017500000000000014132221255026215 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/0000755000175000017500000000000013175733174027006 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/0000755000175000017500000000000013175733174027557 5ustar andriusandrius././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractBlankNodeTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractBlankNodeT0000644000175000017500000002066313175733174033156 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; /** * Abstract test class for the BlankNode interface. */ public abstract class AbstractBlankNodeTest { /** * This method must be overridden by the implementing test to create a * {@link BlankNode} to be tested. *

* Each call to this method must provide a new, unique BlankNode. * * @return {@link RDF} instance to be tested. */ protected abstract BlankNode getBlankNode(); /** * Gets a new blank node object based on the given identifier. *

* Subsequent calls to this method during a single test with the same * identifier must return BlankNode objects that are equals and have the * same hashCode. The objects returned from successive calls during a single * test may be the same object, or they may be different objects. *

* * @param identifier * The identifier to use as the reference for creating the blank * node that is returned. * @return A new blank node based on the */ protected abstract BlankNode getBlankNode(String identifier); /** * Test method for {@link BlankNode#uniqueReference()}. */ @Test public final void testInternalIdentifier() { final BlankNode testNull = new BlankNode() { @Override public String ntriplesString() { return null; } @Override public String uniqueReference() { return null; } }; final BlankNode testAutomatic1 = getBlankNode(); final BlankNode testAutomatic2 = getBlankNode(); final BlankNode testManual3a = getBlankNode("3"); final BlankNode testManual3b = getBlankNode("3"); final BlankNode testManual4 = getBlankNode("4"); // Test against our fake stub assertNotEquals(testNull.uniqueReference(), testAutomatic1.uniqueReference()); assertNotEquals(testAutomatic1.uniqueReference(), testNull.uniqueReference()); assertNotEquals(testNull.uniqueReference(), testManual3a.uniqueReference()); assertNotEquals(testManual3a.uniqueReference(), testNull.uniqueReference()); // Test the two imported instances against each other assertEquals(testAutomatic1.uniqueReference(), testAutomatic1.uniqueReference()); assertEquals(testAutomatic2.uniqueReference(), testAutomatic2.uniqueReference()); assertNotEquals(testAutomatic1.uniqueReference(), testAutomatic2.uniqueReference()); assertNotEquals(testAutomatic2.uniqueReference(), testAutomatic1.uniqueReference()); assertNotEquals(testAutomatic1.uniqueReference(), testManual3a.uniqueReference()); assertEquals(testManual3b.uniqueReference(), testManual3a.uniqueReference()); assertNotEquals(testManual3a.uniqueReference(), testManual4.uniqueReference()); } /** * Test method for {@link BlankNode#equals(java.lang.Object)}. */ @Test public final void testEquals() { final BlankNode testNull = new BlankNode() { @Override public String ntriplesString() { return null; } @Override public String uniqueReference() { return null; } }; final BlankNode testAutomatic1 = getBlankNode(); final BlankNode testAutomatic2 = getBlankNode(); final BlankNode testManual3a = getBlankNode("3"); final BlankNode testManual3b = getBlankNode("3"); final BlankNode testManual4 = getBlankNode("4"); // Test against our fake stub assertNotEquals(testNull, testAutomatic1); assertNotEquals(testAutomatic1, testNull); assertNotEquals(testNull, testManual3a); assertNotEquals(testManual3a, testNull); // Test the two imported instances against each other assertEquals(testAutomatic1, testAutomatic1); assertEquals(testAutomatic2, testAutomatic2); assertNotEquals(testAutomatic1, testAutomatic2); assertNotEquals(testAutomatic2, testAutomatic1); assertNotEquals(testAutomatic1, testManual3a); assertEquals(testManual3b, testManual3a); assertNotEquals(testManual3a, testManual4); } /** * Test method for {@link BlankNode#hashCode()}. */ @Test public final void testHashCode() { final BlankNode testNull = new BlankNode() { @Override public String ntriplesString() { return null; } @Override public String uniqueReference() { return null; } }; final BlankNode testAutomatic1 = getBlankNode(); final BlankNode testAutomatic2 = getBlankNode(); final BlankNode testManual3a = getBlankNode("3"); final BlankNode testManual3b = getBlankNode("3"); final BlankNode testManual4 = getBlankNode("4"); // Test against our fake stub assertNotEquals(testNull.hashCode(), testAutomatic1.hashCode()); assertNotEquals(testAutomatic1.hashCode(), testNull.hashCode()); assertNotEquals(testNull.hashCode(), testManual3a.hashCode()); assertNotEquals(testManual3a.hashCode(), testNull.hashCode()); // Test the two imported instances against each other assertEquals(testAutomatic1.hashCode(), testAutomatic1.hashCode()); assertEquals(testAutomatic2.hashCode(), testAutomatic2.hashCode()); assertNotEquals(testAutomatic1.hashCode(), testAutomatic2.hashCode()); assertNotEquals(testAutomatic2.hashCode(), testAutomatic1.hashCode()); assertNotEquals(testAutomatic1.hashCode(), testManual3a.hashCode()); assertEquals(testManual3b.hashCode(), testManual3a.hashCode()); assertNotEquals(testManual3a.hashCode(), testManual4.hashCode()); } /** * Test method for {@link RDFTerm#ntriplesString()}. */ @Test public final void testNtriplesString() { final BlankNode testNull = new BlankNode() { @Override public String ntriplesString() { return null; } @Override public String uniqueReference() { return null; } }; final BlankNode testAutomatic1 = getBlankNode(); final BlankNode testAutomatic2 = getBlankNode(); final BlankNode testManual3a = getBlankNode("3"); final BlankNode testManual3b = getBlankNode("3"); final BlankNode testManual4 = getBlankNode("4"); // Test against our fake stub assertNotEquals(testNull.ntriplesString(), testAutomatic1.ntriplesString()); assertNotEquals(testAutomatic1.ntriplesString(), testNull.ntriplesString()); assertNotEquals(testNull.ntriplesString(), testManual3a.ntriplesString()); assertNotEquals(testManual3a.ntriplesString(), testNull.ntriplesString()); // Test the two imported instances against each other assertEquals(testAutomatic1.ntriplesString(), testAutomatic1.ntriplesString()); assertEquals(testAutomatic2.ntriplesString(), testAutomatic2.ntriplesString()); assertNotEquals(testAutomatic1.ntriplesString(), testAutomatic2.ntriplesString()); assertNotEquals(testAutomatic2.ntriplesString(), testAutomatic1.ntriplesString()); assertNotEquals(testAutomatic1.ntriplesString(), testManual3a.ntriplesString()); assertEquals(testManual3b.ntriplesString(), testManual3a.ntriplesString()); assertNotEquals(testManual3a.ntriplesString(), testManual4.ntriplesString()); } } ././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DefaultRDFTermFactoryTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DefaultRDFTermFact0000644000175000017500000000464613175733174033062 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import org.junit.Test; /** * Test that all {@link RDFTermFactory} default methods throw * {@link UnsupportedOperationException}. */ @SuppressWarnings("deprecation") public class DefaultRDFTermFactoryTest { // All methods in RDFTermFactory has a default implementation RDFTermFactory factory = new RDFTermFactory() {}; @Test(expected=UnsupportedOperationException.class) public void createBlankNode() throws Exception { factory.createBlankNode(); } @Test(expected=UnsupportedOperationException.class) public void createBlankNodeName() throws Exception { factory.createBlankNode("fred"); } @Test(expected=UnsupportedOperationException.class) public void createGraph() throws Exception { factory.createGraph(); } @Test(expected=UnsupportedOperationException.class) public void createIRI() throws Exception { factory.createIRI("http://example.com/"); } @Test(expected=UnsupportedOperationException.class) public void createLiteral() throws Exception { factory.createLiteral("Alice"); } @Test(expected=UnsupportedOperationException.class) public void createLiteralLang() throws Exception { factory.createLiteral("Alice", "en"); } @Test(expected=UnsupportedOperationException.class) public void createLiteralTyped() throws Exception { factory.createLiteral("Alice", new DummyIRI(0)); } @Test(expected=UnsupportedOperationException.class) public void createTriple() throws Exception { factory.createTriple(new DummyIRI(1), new DummyIRI(2), new DummyIRI(3)); } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractDatasetTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractDatasetTes0000644000175000017500000007721413175733174033242 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.*; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import java.util.stream.Stream; import org.junit.Assume; import org.junit.Before; import org.junit.Test; /** * Test Dataset implementation *

* To add to your implementation's tests, create a subclass with a name ending * in Test and provide {@link #createFactory()} which minimally * must support {@link RDF#createDataset()} and {@link RDF#createIRI(String)}, but * ideally support all operations. *

* This test uses try-with-resources blocks for calls to {@link Dataset#stream()} * and {@link Dataset#iterate()}. * * @see Dataset * @see RDF */ public abstract class AbstractDatasetTest { protected RDF factory; protected Dataset dataset; protected IRI alice; protected IRI bob; protected IRI name; protected IRI knows; protected IRI member; protected BlankNode bnode1; protected BlankNode bnode2; protected Literal aliceName; protected Literal bobName; protected Literal secretClubName; protected Literal companyName; protected Quad bobNameQuad; private IRI isPrimaryTopicOf; private IRI graph1; private BlankNode graph2; /** * * This method must be overridden by the implementing test to provide a * factory for the test to create {@link Dataset}, {@link IRI} etc. * * @return {@link RDF} instance to be tested. */ protected abstract RDF createFactory(); @Before public void createDatasetAndAdd() { factory = createFactory(); dataset = factory.createDataset(); assertEquals(0, dataset.size()); graph1 = factory.createIRI("http://example.com/graph1"); graph2 = factory.createBlankNode(); alice = factory.createIRI("http://example.com/alice"); bob = factory.createIRI("http://example.com/bob"); name = factory.createIRI("http://xmlns.com/foaf/0.1/name"); knows = factory.createIRI("http://xmlns.com/foaf/0.1/knows"); member = factory.createIRI("http://xmlns.com/foaf/0.1/member"); bnode1 = factory.createBlankNode("org1"); bnode2 = factory.createBlankNode("org2"); secretClubName = factory.createLiteral("The Secret Club"); companyName = factory.createLiteral("A company"); aliceName = factory.createLiteral("Alice"); bobName = factory.createLiteral("Bob", "en-US"); dataset.add(graph1, alice, name, aliceName); dataset.add(graph1, alice, knows, bob); dataset.add(graph1, alice, member, bnode1); bobNameQuad = factory.createQuad(graph2, bob, name, bobName); dataset.add(bobNameQuad); dataset.add(factory.createQuad(graph2, bob, member, bnode1)); dataset.add(factory.createQuad(graph2, bob, member, bnode2)); // NOTE: bnode1 used in both graph1 and graph2 dataset.add(graph1, bnode1, name, secretClubName); dataset.add(graph2, bnode2, name, companyName); // default graph describes graph1 and graph2 isPrimaryTopicOf = factory.createIRI("http://xmlns.com/foaf/0.1/isPrimaryTopicOf"); dataset.add(null, alice, isPrimaryTopicOf, graph1); dataset.add(null, bob, isPrimaryTopicOf, graph2); } @Test public void size() throws Exception { assertEquals(10, dataset.size()); } @Test public void iterate() throws Exception { Assume.assumeTrue(dataset.size() > 0); final List quads = new ArrayList<>(); for (final Quad t : dataset.iterate()) { quads.add(t); } assertEquals(dataset.size(), quads.size()); //assertTrue(quads.contains(bobNameQuad)); // java.util.List won't do any BlankNode mapping, so // instead bobNameQuad of let's check for an IRI-centric quad final Quad q = factory.createQuad(graph1, alice, name, aliceName); quads.contains(q); // aborted iteration final Iterable iterate = dataset.iterate(); final Iterator it = iterate.iterator(); assertTrue(it.hasNext()); it.next(); closeIterable(iterate); // second iteration - should start from fresh and // get the same count long count = 0; final Iterable iterable = dataset.iterate(); for (@SuppressWarnings("unused") final Quad t : iterable) { count++; } assertEquals(dataset.size(), count); // Pattern iteration which should cover multiple graphs. final Set aliceQuads = new HashSet<>(); for (final Quad aliceQ : dataset.iterate(null, alice, null, null)) { aliceQuads.add(aliceQ); } assertTrue(aliceQuads.contains(factory.createQuad(graph1, alice, name, aliceName))); assertTrue(aliceQuads.contains(factory.createQuad(graph1, alice, knows, bob))); // We can't test this by Quad equality, as bnode1 might become mapped by the // dataset //assertTrue(aliceQuads.contains(factory.createQuad(graph1, alice, member, bnode1))); assertTrue(aliceQuads.contains(factory.createQuad(null, alice, isPrimaryTopicOf, graph1))); assertEquals(4, aliceQuads.size()); // Check the isPrimaryTopicOf statements in the default graph int topics = 0; for (final Quad topic : dataset.iterate(null, null, isPrimaryTopicOf, null)) { topics++; // COMMONSRDF-55: should not be or similar assertFalse(topic.getGraphName().isPresent()); } assertEquals(2, topics); } @Test public void streamDefaultGraphNameAlice() throws Exception { // null below would match in ANY graph (including default graph) final Optional aliceTopic = dataset.stream(null, alice, isPrimaryTopicOf, null).findAny(); assertTrue(aliceTopic.isPresent()); // COMMONSRDF-55: should not be or similar assertNull(aliceTopic.get().getGraphName().orElse(null)); assertFalse(aliceTopic.get().getGraphName().isPresent()); } @Test public void streamDefaultGraphNameByPattern() throws Exception { // Explicitly select in only the default graph Optional.empty() final Optional aliceTopic = dataset.stream(Optional.empty(), null, null, null).findAny(); assertTrue(aliceTopic.isPresent()); // COMMONSRDF-55: should not be or similar assertNull(aliceTopic.get().getGraphName().orElse(null)); assertFalse(aliceTopic.get().getGraphName().isPresent()); } /** * Special quad closing for RDF4J. */ private void closeIterable(final Iterable iterate) throws Exception { if (iterate instanceof AutoCloseable) { ((AutoCloseable) iterate).close(); } } @Test public void iterateFilter() throws Exception { final List friends = new ArrayList<>(); final IRI alice = factory.createIRI("http://example.com/alice"); final IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/knows"); for (final Quad t : dataset.iterate(null, alice, knows, null)) { friends.add(t.getObject()); } assertEquals(1, friends.size()); assertEquals(bob, friends.get(0)); // .. can we iterate over zero hits? final Iterable iterate = dataset.iterate(Optional.of(graph2), bob, knows, alice); for (final Quad unexpected : iterate) { fail("Unexpected quad " + unexpected); } // closeIterable(iterate); } @Test public void contains() throws Exception { assertFalse(dataset.contains(null, bob, knows, alice)); // or so he claims.. assertTrue(dataset.contains(Optional.of(graph1), alice, knows, bob)); try (Stream stream = dataset.stream()) { final Optional first = stream.skip(4).findFirst(); Assume.assumeTrue(first.isPresent()); final Quad existingQuad = first.get(); assertTrue(dataset.contains(existingQuad)); } final Quad nonExistingQuad = factory.createQuad(graph2, bob, knows, alice); assertFalse(dataset.contains(nonExistingQuad)); // An existing quad final Quad quad = factory.createQuad(graph1, alice, knows, bob); // FIXME: Should not this always be true? assertTrue(dataset.contains(quad)); } @Test public void remove() throws Exception { final long fullSize = dataset.size(); dataset.remove(Optional.of(graph1), alice, knows, bob); final long shrunkSize = dataset.size(); assertEquals(1, fullSize - shrunkSize); dataset.remove(Optional.of(graph1), alice, knows, bob); assertEquals(shrunkSize, dataset.size()); // unchanged dataset.add(graph1, alice, knows, bob); dataset.add(graph2, alice, knows, bob); dataset.add(graph2, alice, knows, bob); // Undetermined size at this point -- but at least it // should be bigger assertTrue(dataset.size() > shrunkSize); // and after a single remove they should all be gone dataset.remove(null, alice, knows, bob); assertEquals(shrunkSize, dataset.size()); Quad otherQuad; try (Stream stream = dataset.stream()) { final Optional anyQuad = stream.findAny(); Assume.assumeTrue(anyQuad.isPresent()); otherQuad = anyQuad.get(); } dataset.remove(otherQuad); assertEquals(shrunkSize - 1, dataset.size()); dataset.remove(otherQuad); assertEquals(shrunkSize - 1, dataset.size()); // no change // for some reason in rdf4j this causes duplicates! dataset.add(otherQuad); // dataset.stream().forEach(System.out::println); // should have increased assertTrue(dataset.size() >= shrunkSize); } @Test public void clear() throws Exception { dataset.clear(); assertFalse(dataset.contains(null, alice, knows, bob)); assertEquals(0, dataset.size()); dataset.clear(); // no-op assertEquals(0, dataset.size()); assertFalse(dataset.contains(null, null, null, null)); // nothing here } @Test public void getQuads() throws Exception { long quadCount; try (Stream stream = dataset.stream()) { quadCount = stream.count(); } assertTrue(quadCount > 0); try (Stream stream = dataset.stream()) { assertTrue(stream.allMatch(t -> dataset.contains(t))); } // Check exact count Assume.assumeNotNull(bnode1, bnode2, aliceName, bobName, secretClubName, companyName, bobNameQuad); assertEquals(10, quadCount); } @Test public void getQuadsQuery() throws Exception { try (Stream stream = dataset.stream(Optional.of(graph1), alice, null, null)) { final long aliceCount = stream.count(); assertTrue(aliceCount > 0); Assume.assumeNotNull(aliceName); assertEquals(3, aliceCount); } Assume.assumeNotNull(bnode1, bnode2, bobName, companyName, secretClubName); try (Stream stream = dataset.stream(null, null, name, null)) { assertEquals(4, stream.count()); } Assume.assumeNotNull(bnode1); try (Stream stream = dataset.stream(null, null, member, null)) { assertEquals(3, stream.count()); } } @Test public void addBlankNodesFromMultipleDatasets() throws Exception { // Create two separate Dataset instances try (final Dataset g1 = createDataset1(); final Dataset g2 = createDataset2(); final Dataset g3 = factory.createDataset()) { addAllQuads(g1, g3); addAllQuads(g2, g3); // Let's make a map to find all those blank nodes after insertion // (The Dataset implementation is not currently required to // keep supporting those BlankNodes with contains() - see // COMMONSRDF-15) final Map whoIsWho = new ConcurrentHashMap<>(); // ConcurrentHashMap as we will try parallel forEach below, // which should not give inconsistent results (it does with a // HashMap!) // look up BlankNodes by name final IRI name = factory.createIRI("http://xmlns.com/foaf/0.1/name"); try (Stream stream = g3.stream(null, null, name, null)) { stream.parallel().forEach(t -> whoIsWho.put(t.getObject().ntriplesString(), t.getSubject())); } assertEquals(4, whoIsWho.size()); // and contains 4 unique values assertEquals(4, new HashSet<>(whoIsWho.values()).size()); final BlankNodeOrIRI b1Alice = whoIsWho.get("\"Alice\""); assertNotNull(b1Alice); final BlankNodeOrIRI b2Bob = whoIsWho.get("\"Bob\""); assertNotNull(b2Bob); final BlankNodeOrIRI b1Charlie = whoIsWho.get("\"Charlie\""); assertNotNull(b1Charlie); final BlankNodeOrIRI b2Dave = whoIsWho.get("\"Dave\""); assertNotNull(b2Dave); // All blank nodes should differ notEquals(b1Alice, b2Bob); notEquals(b1Alice, b1Charlie); notEquals(b1Alice, b2Dave); notEquals(b2Bob, b1Charlie); notEquals(b2Bob, b2Dave); notEquals(b1Charlie, b2Dave); // And we should be able to query with them again // as we got them back from g3 final IRI hasChild = factory.createIRI("http://example.com/hasChild"); // FIXME: Check graph2 BlankNode in these ..? assertTrue(g3.contains(null, b1Alice, hasChild, b2Bob)); assertTrue(g3.contains(null, b2Dave, hasChild, b1Charlie)); // But not assertFalse(g3.contains(null, b1Alice, hasChild, b1Alice)); assertFalse(g3.contains(null, b1Alice, hasChild, b1Charlie)); assertFalse(g3.contains(null, b1Alice, hasChild, b2Dave)); // nor assertFalse(g3.contains(null, b2Dave, hasChild, b1Alice)); assertFalse(g3.contains(null, b2Dave, hasChild, b1Alice)); // and these don't have any children (as far as we know) assertFalse(g3.contains(null, b2Bob, hasChild, null)); assertFalse(g3.contains(null, b1Charlie, hasChild, null)); } } private void notEquals(final BlankNodeOrIRI node1, final BlankNodeOrIRI node2) { assertFalse(node1.equals(node2)); // in which case we should be able to assume // (as they are in the same dataset) assertFalse(node1.ntriplesString().equals(node2.ntriplesString())); } /** * Add all quads from the source to the target. *

* The quads may be copied in any order. No special conversion or * adaptation of {@link BlankNode}s are performed. * * @param source * Source Dataset to copy quads from * @param target * Target Dataset where quads will be added */ private void addAllQuads(final Dataset source, final Dataset target) { // unordered() as we don't need to preserve quad order // sequential() as we don't (currently) require target Dataset to be // thread-safe try (Stream stream = source.stream()) { stream.unordered().sequential().forEach(t -> target.add(t)); } } /** * Make a new dataset with two BlankNodes - each with a different * uniqueReference */ private Dataset createDataset1() { final RDF factory1 = createFactory(); final IRI name = factory1.createIRI("http://xmlns.com/foaf/0.1/name"); final Dataset g1 = factory1.createDataset(); final BlankNode b1 = createOwnBlankNode("b1", "0240eaaa-d33e-4fc0-a4f1-169d6ced3680"); g1.add(b1, b1, name, factory1.createLiteral("Alice")); final BlankNode b2 = createOwnBlankNode("b2", "9de7db45-0ce7-4b0f-a1ce-c9680ffcfd9f"); g1.add(b2, b2, name, factory1.createLiteral("Bob")); final IRI hasChild = factory1.createIRI("http://example.com/hasChild"); g1.add(null, b1, hasChild, b2); return g1; } /** * Create a different implementation of BlankNode to be tested with * dataset.add(a,b,c); (the implementation may or may not then choose to * translate such to its own instances) * * @param name * @return */ private BlankNode createOwnBlankNode(final String name, final String uuid) { return new BlankNode() { @Override public String ntriplesString() { return "_: " + name; } @Override public String uniqueReference() { return uuid; } @Override public int hashCode() { return uuid.hashCode(); } @Override public boolean equals(final Object obj) { if (!(obj instanceof BlankNode)) { return false; } final BlankNode other = (BlankNode) obj; return uuid.equals(other.uniqueReference()); } }; } private Dataset createDataset2() { final RDF factory2 = createFactory(); final IRI name = factory2.createIRI("http://xmlns.com/foaf/0.1/name"); final Dataset g2 = factory2.createDataset(); final BlankNode b1 = createOwnBlankNode("b1", "bc8d3e45-a08f-421d-85b3-c25b373abf87"); g2.add(b1, b1, name, factory2.createLiteral("Charlie")); final BlankNode b2 = createOwnBlankNode("b2", "2209097a-5078-4b03-801a-6a2d2f50d739"); g2.add(b2, b2, name, factory2.createLiteral("Dave")); final IRI hasChild = factory2.createIRI("http://example.com/hasChild"); // NOTE: Opposite direction of loadDataset1 g2.add(b2, b2, hasChild, b1); return g2; } /** * Ensure {@link Dataset#getGraphNames()} contains our two graphs. * * @throws Exception * If test fails */ @Test public void getGraphNames() throws Exception { final Set names = dataset.getGraphNames().collect(Collectors.toSet()); assertTrue("Can't find graph name " + graph1, names.contains(graph1)); assertTrue("Found no quads in graph1", dataset.contains(Optional.of(graph1), null, null, null)); final Optional graphName2 = dataset.getGraphNames().filter(BlankNode.class::isInstance).findAny(); assertTrue("Could not find graph2-like BlankNode", graphName2.isPresent()); assertTrue("Found no quads in graph2", dataset.contains(graphName2, null, null, null)); // Some implementations like Virtuoso might have additional internal graphs, // so we can't assume this: //assertEquals(2, names.size()); } @Test public void getGraph() throws Exception { try (final Graph defaultGraph = dataset.getGraph()) { // TODO: Can we assume the default graph was empty before our new triples? assertEquals(2, defaultGraph.size()); assertTrue(defaultGraph.contains(alice, isPrimaryTopicOf, graph1)); // NOTE: graph2 is a BlankNode assertTrue(defaultGraph.contains(bob, isPrimaryTopicOf, null)); } } @Test public void getGraphNull() throws Exception { // Default graph should be present try (final Graph defaultGraph = dataset.getGraph(null).get()) { // TODO: Can we assume the default graph was empty before our new triples? assertEquals(2, defaultGraph.size()); assertTrue(defaultGraph.contains(alice, isPrimaryTopicOf, graph1)); // NOTE: wildcard as graph2 is a (potentially mapped) BlankNode assertTrue(defaultGraph.contains(bob, isPrimaryTopicOf, null)); } } @Test public void getGraph1() throws Exception { // graph1 should be present try (final Graph g1 = dataset.getGraph(graph1).get()) { assertEquals(4, g1.size()); assertTrue(g1.contains(alice, name, aliceName)); assertTrue(g1.contains(alice, knows, bob)); assertTrue(g1.contains(alice, member, null)); assertTrue(g1.contains(null, name, secretClubName)); } } @Test public void getGraph2() throws Exception { // graph2 should be present, even if is named by a BlankNode // We'll look up the potentially mapped graph2 blanknode final BlankNodeOrIRI graph2Name = (BlankNodeOrIRI) dataset.stream(Optional.empty(), bob, isPrimaryTopicOf, null) .map(Quad::getObject).findAny().get(); try (final Graph g2 = dataset.getGraph(graph2Name).get()) { assertEquals(4, g2.size()); final Triple bobNameTriple = bobNameQuad.asTriple(); assertTrue(g2.contains(bobNameTriple)); assertTrue(g2.contains(bob, member, bnode1)); assertTrue(g2.contains(bob, member, bnode2)); assertFalse(g2.contains(bnode1, name, secretClubName)); assertTrue(g2.contains(bnode2, name, companyName)); } } @Test public void containsLanguageTagsCaseInsensitive() { // COMMONSRDF-51: Ensure we can add/contains/remove with any casing // of literal language tag final Literal lower = factory.createLiteral("Hello there", "en-gb"); final Literal upper = factory.createLiteral("Hello there", "EN-GB"); final Literal mixed = factory.createLiteral("Hello there", "en-GB"); final IRI example1 = factory.createIRI("http://example.com/s1"); final IRI greeting = factory.createIRI("http://example.com/greeting"); dataset.add(null, example1, greeting, upper); // any kind of Triple should match assertTrue(dataset.contains(factory.createQuad(null, example1, greeting, upper))); assertTrue(dataset.contains(factory.createQuad(null, example1, greeting, lower))); assertTrue(dataset.contains(factory.createQuad(null, example1, greeting, mixed))); // or as patterns assertTrue(dataset.contains(null, null, null, upper)); assertTrue(dataset.contains(null, null, null, lower)); assertTrue(dataset.contains(null, null, null, mixed)); } @Test public void containsLanguageTagsCaseInsensitiveTurkish() { // COMMONSRDF-51: Special test for Turkish issue where // "i".toLowerCase() != "i" // See also: // https://garygregory.wordpress.com/2015/11/03/java-lowercase-conversion-turkey/ // This is similar to the test in AbstractRDFTest, but on a graph final Locale defaultLocale = Locale.getDefault(); try { Locale.setDefault(Locale.ROOT); final Literal lowerROOT = factory.createLiteral("moi", "fi"); final Literal upperROOT = factory.createLiteral("moi", "FI"); final Literal mixedROOT = factory.createLiteral("moi", "fI"); final IRI exampleROOT = factory.createIRI("http://example.com/s1"); final IRI greeting = factory.createIRI("http://example.com/greeting"); dataset.add(null, exampleROOT, greeting, mixedROOT); final Locale turkish = Locale.forLanguageTag("TR"); Locale.setDefault(turkish); // If the below assertion fails, then the Turkish // locale no longer have this peculiarity that // we want to test. Assume.assumeFalse("FI".toLowerCase().equals("fi")); // Below is pretty much the same as in // containsLanguageTagsCaseInsensitive() final Literal lower = factory.createLiteral("moi", "fi"); final Literal upper = factory.createLiteral("moi", "FI"); final Literal mixed = factory.createLiteral("moi", "fI"); final IRI exampleTR = factory.createIRI("http://example.com/s2"); dataset.add(null, exampleTR, greeting, upper); assertTrue(dataset.contains(factory.createQuad(null, exampleTR, greeting, upper))); assertTrue(dataset.contains(factory.createQuad(null, exampleTR, greeting, upperROOT))); assertTrue(dataset.contains(factory.createQuad(null, exampleTR, greeting, lower))); assertTrue(dataset.contains(factory.createQuad(null, exampleTR, greeting, lowerROOT))); assertTrue(dataset.contains(factory.createQuad(null, exampleTR, greeting, mixed))); assertTrue(dataset.contains(factory.createQuad(null, exampleTR, greeting, mixedROOT))); assertTrue(dataset.contains(null, exampleTR, null, upper)); assertTrue(dataset.contains(null, exampleTR, null, upperROOT)); assertTrue(dataset.contains(null, exampleTR, null, lower)); assertTrue(dataset.contains(null, exampleTR, null, lowerROOT)); assertTrue(dataset.contains(null, exampleTR, null, mixed)); assertTrue(dataset.contains(null, exampleTR, null, mixedROOT)); // What about the triple we added while in ROOT locale? assertTrue(dataset.contains(factory.createQuad(null, exampleROOT, greeting, upper))); assertTrue(dataset.contains(factory.createQuad(null, exampleROOT, greeting, lower))); assertTrue(dataset.contains(factory.createQuad(null, exampleROOT, greeting, mixed))); assertTrue(dataset.contains(null, exampleROOT, null, upper)); assertTrue(dataset.contains(null, exampleROOT, null, lower)); assertTrue(dataset.contains(null, exampleROOT, null, mixed)); } finally { Locale.setDefault(defaultLocale); } } @Test public void removeLanguageTagsCaseInsensitive() { // COMMONSRDF-51: Ensure we can remove with any casing // of literal language tag final Literal lower = factory.createLiteral("Howdy", "en-us"); final Literal upper = factory.createLiteral("Howdy", "EN-US"); final Literal mixed = factory.createLiteral("Howdy", "en-US"); final IRI example1 = factory.createIRI("http://example.com/s1"); final IRI greeting = factory.createIRI("http://example.com/greeting"); dataset.add(null, example1, greeting, upper); // Remove should also honour any case dataset.remove(null, example1, null, mixed); assertFalse(dataset.contains(null, null, greeting, null)); dataset.add(null, example1, greeting, lower); dataset.remove(null, example1, null, upper); // Check with Triple dataset.add(factory.createQuad(null, example1, greeting, mixed)); dataset.remove(factory.createQuad(null, example1, greeting, upper)); assertFalse(dataset.contains(null, null, greeting, null)); } private static Optional closableFindAny(final Stream stream) { try (Stream s = stream) { return s.findAny(); } } @Test public void streamLanguageTagsCaseInsensitive() { // COMMONSRDF-51: Ensure we can add/contains/remove with any casing // of literal language tag final Literal lower = factory.createLiteral("Good afternoon", "en-gb"); final Literal upper = factory.createLiteral("Good afternoon", "EN-GB"); final Literal mixed = factory.createLiteral("Good afternoon", "en-GB"); final IRI example1 = factory.createIRI("http://example.com/s1"); final IRI greeting = factory.createIRI("http://example.com/greeting"); dataset.add(null, example1, greeting, upper); // or as patterns assertTrue(closableFindAny(dataset.stream(null, null, null, upper)).isPresent()); assertTrue(closableFindAny(dataset.stream(null, null, null, lower)).isPresent()); assertTrue(closableFindAny(dataset.stream(null, null, null, mixed)).isPresent()); // Check the quad returned equal a new quad final Quad q = closableFindAny(dataset.stream(null, null, null, lower)).get(); assertEquals(q, factory.createQuad(null, example1, greeting, mixed)); } /** * An attempt to use the Java 8 streams to look up a more complicated query. *

* FYI, the equivalent SPARQL version (untested): * *

     *     SELECT ?orgName WHERE {
     *             ?org foaf:name ?orgName .
     *             ?alice foaf:member ?org .
     *             ?bob foaf:member ?org .
     *             ?alice foaf:knows ?bob .
     *           FILTER NOT EXIST { ?bob foaf:knows ?alice }
     *    }
     * 
* * @throws Exception If test fails */ @Test public void whyJavaStreamsMightNotTakeOverFromSparql() throws Exception { Assume.assumeNotNull(bnode1, bnode2, secretClubName); // Find a secret organizations try (Stream stream = dataset.stream(null, null, knows, null)) { assertEquals("\"The Secret Club\"", // Find One-way "knows" stream.filter(t -> !dataset.contains(null, (BlankNodeOrIRI) t.getObject(), knows, t.getSubject())) .map(knowsQuad -> { try (Stream memberOf = dataset // and those they know, what are they // member of? .stream(null, (BlankNodeOrIRI) knowsQuad.getObject(), member, null)) { return memberOf // keep those which first-guy is a // member of .filter(memberQuad -> dataset.contains(null, knowsQuad.getSubject(), member, // First hit is good enough memberQuad.getObject())) .findFirst().get().getObject(); } }) // then look up the name of that org .map(org -> { try (Stream orgName = dataset.stream(null, (BlankNodeOrIRI) org, name, null)) { return orgName.findFirst().get().getObject().ntriplesString(); } }).findFirst().get()); } } } apache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyQuadTest.java0000644000175000017500000000342513175733174033174 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.*; import java.util.Objects; import org.junit.Test; public class DummyQuadTest { Quad quad = new DummyQuad(); @Test public void getGraphName() throws Exception { assertFalse(quad.getGraphName().isPresent()); } @Test public void getSubject() throws Exception { assertEquals(1, ((DummyIRI) quad.getSubject()).i); } @Test public void getPredicate() throws Exception { assertEquals(2, ((DummyIRI) quad.getPredicate()).i); } @Test public void getObject() throws Exception { assertEquals(3, ((DummyIRI) quad.getObject()).i); } @Test public void equals() throws Exception { assertEquals(quad, new DummyQuad()); } @Test public void testHashCode() { final int expected = Objects.hash(quad.getSubject(), quad.getPredicate(), quad.getObject(), quad.getGraphName()); assertEquals(expected, quad.hashCode()); } } apache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyIRITest.java0000644000175000017500000000324513175733174032725 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.*; import org.junit.Test; public class DummyIRITest { DummyIRI iri = new DummyIRI(1337); @Test public void i() throws Exception { assertEquals(1337, iri.i); } @Test public void equals() throws Exception { assertEquals(iri, new DummyIRI(1337)); } @Test public void notEquals() throws Exception { assertNotEquals(iri, new DummyIRI(1)); } @Test public void ntriplesString() throws Exception { assertEquals("", iri.ntriplesString()); } @Test public void getIRIString() throws Exception { assertEquals("http://example.com/1337", iri.getIRIString()); } @Test public void testHashCode() throws Exception { assertEquals("http://example.com/1337".hashCode(), iri.hashCode()); } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractGraphTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractGraphTest.0000644000175000017500000006446413175733174033163 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; import org.junit.Assume; import org.junit.Before; import org.junit.Test; /** * Test Graph implementation *

* To add to your implementation's tests, create a subclass with a name ending * in Test and provide {@link #createFactory()} which minimally * must support {@link RDF#createGraph()} and {@link RDF#createIRI(String)}, but * ideally support all operations. *

* This test uses try-with-resources blocks for calls to {@link Graph#stream()} * and {@link Graph#iterate()}. * * @see Graph * @see RDF */ public abstract class AbstractGraphTest { protected RDF factory; protected Graph graph; protected IRI alice; protected IRI bob; protected IRI name; protected IRI knows; protected IRI member; protected BlankNode bnode1; protected BlankNode bnode2; protected Literal aliceName; protected Literal bobName; protected Literal secretClubName; protected Literal companyName; protected Triple bobNameTriple; /** * * This method must be overridden by the implementing test to provide a * factory for the test to create {@link Graph}, {@link IRI} etc. * * @return {@link RDF} instance to be tested. */ protected abstract RDF createFactory(); @Before public void createGraphAndAdd() { factory = createFactory(); graph = factory.createGraph(); assertEquals(0, graph.size()); alice = factory.createIRI("http://example.com/alice"); bob = factory.createIRI("http://example.com/bob"); name = factory.createIRI("http://xmlns.com/foaf/0.1/name"); knows = factory.createIRI("http://xmlns.com/foaf/0.1/knows"); member = factory.createIRI("http://xmlns.com/foaf/0.1/member"); try { bnode1 = factory.createBlankNode("org1"); bnode2 = factory.createBlankNode("org2"); } catch (final UnsupportedOperationException ex) { // leave as null } try { secretClubName = factory.createLiteral("The Secret Club"); companyName = factory.createLiteral("A company"); aliceName = factory.createLiteral("Alice"); bobName = factory.createLiteral("Bob", "en-US"); } catch (final UnsupportedOperationException ex) { // leave as null } if (aliceName != null) { graph.add(alice, name, aliceName); } graph.add(alice, knows, bob); if (bnode1 != null) { graph.add(alice, member, bnode1); } if (bobName != null) { try { bobNameTriple = factory.createTriple(bob, name, bobName); } catch (final UnsupportedOperationException ex) { // leave as null } if (bobNameTriple != null) { graph.add(bobNameTriple); } } if (bnode1 != null) { graph.add(factory.createTriple(bob, member, bnode1)); graph.add(factory.createTriple(bob, member, bnode2)); if (secretClubName != null) { graph.add(bnode1, name, secretClubName); graph.add(bnode2, name, companyName); } } } @Test public void size() throws Exception { assertTrue(graph.size() > 0); Assume.assumeNotNull(bnode1, bnode2, aliceName, bobName, secretClubName, companyName, bobNameTriple); // Can only reliably predict size if we could create all triples assertEquals(8, graph.size()); } @Test public void iterate() throws Exception { Assume.assumeTrue(graph.size() > 0); final List triples = new ArrayList<>(); for (final Triple t : graph.iterate()) { triples.add(t); } assertEquals(graph.size(), triples.size()); if (bobNameTriple != null) { assertTrue(triples.contains(bobNameTriple)); } // aborted iteration final Iterable iterate = graph.iterate(); final Iterator it = iterate.iterator(); assertTrue(it.hasNext()); it.next(); closeIterable(iterate); // second iteration - should start from fresh and // get the same count long count = 0; final Iterable iterable = graph.iterate(); for (@SuppressWarnings("unused") final Triple t : iterable) { count++; } assertEquals(graph.size(), count); } /** * Special triple closing for RDF4J. */ private void closeIterable(final Iterable iterate) throws Exception { if (iterate instanceof AutoCloseable) { ((AutoCloseable) iterate).close(); } } @Test public void iterateFilter() throws Exception { final List friends = new ArrayList<>(); final IRI alice = factory.createIRI("http://example.com/alice"); final IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/knows"); for (final Triple t : graph.iterate(alice, knows, null)) { friends.add(t.getObject()); } assertEquals(1, friends.size()); assertEquals(bob, friends.get(0)); // .. can we iterate over zero hits? final Iterable iterate = graph.iterate(bob, knows, alice); for (final Triple unexpected : iterate) { fail("Unexpected triple " + unexpected); } // closeIterable(iterate); } @Test public void contains() throws Exception { assertFalse(graph.contains(bob, knows, alice)); // or so he claims.. assertTrue(graph.contains(alice, knows, bob)); try (Stream stream = graph.stream()) { final Optional first = stream.skip(4).findFirst(); Assume.assumeTrue(first.isPresent()); final Triple existingTriple = first.get(); assertTrue(graph.contains(existingTriple)); } final Triple nonExistingTriple = factory.createTriple(bob, knows, alice); assertFalse(graph.contains(nonExistingTriple)); Triple triple = null; try { triple = factory.createTriple(alice, knows, bob); } catch (final UnsupportedOperationException ex) { } if (triple != null) { // FIXME: Should not this always be true? // assertTrue(graph.contains(triple)); } } @Test public void remove() throws Exception { final long fullSize = graph.size(); graph.remove(alice, knows, bob); final long shrunkSize = graph.size(); assertEquals(1, fullSize - shrunkSize); graph.remove(alice, knows, bob); assertEquals(shrunkSize, graph.size()); // unchanged graph.add(alice, knows, bob); graph.add(alice, knows, bob); graph.add(alice, knows, bob); // Undetermined size at this point -- but at least it // should be bigger assertTrue(graph.size() > shrunkSize); // and after a single remove they should all be gone graph.remove(alice, knows, bob); assertEquals(shrunkSize, graph.size()); Triple otherTriple; try (Stream stream = graph.stream()) { final Optional anyTriple = stream.findAny(); Assume.assumeTrue(anyTriple.isPresent()); otherTriple = anyTriple.get(); } graph.remove(otherTriple); assertEquals(shrunkSize - 1, graph.size()); graph.remove(otherTriple); assertEquals(shrunkSize - 1, graph.size()); // no change // for some reason in rdf4j this causes duplicates! graph.add(otherTriple); // graph.stream().forEach(System.out::println); // should have increased assertTrue(graph.size() >= shrunkSize); } @Test public void clear() throws Exception { graph.clear(); assertFalse(graph.contains(alice, knows, bob)); assertEquals(0, graph.size()); graph.clear(); // no-op assertEquals(0, graph.size()); } @Test public void getTriples() throws Exception { long tripleCount; try (Stream stream = graph.stream()) { tripleCount = stream.count(); } assertTrue(tripleCount > 0); try (Stream stream = graph.stream()) { assertTrue(stream.allMatch(t -> graph.contains(t))); } // Check exact count Assume.assumeNotNull(bnode1, bnode2, aliceName, bobName, secretClubName, companyName, bobNameTriple); assertEquals(8, tripleCount); } @Test public void getTriplesQuery() throws Exception { try (Stream stream = graph.stream(alice, null, null)) { final long aliceCount = stream.count(); assertTrue(aliceCount > 0); Assume.assumeNotNull(aliceName); assertEquals(3, aliceCount); } Assume.assumeNotNull(bnode1, bnode2, bobName, companyName, secretClubName); try (Stream stream = graph.stream(null, name, null)) { assertEquals(4, stream.count()); } Assume.assumeNotNull(bnode1); try (Stream stream = graph.stream(null, member, null)) { assertEquals(3, stream.count()); } } @Test public void addBlankNodesFromMultipleGraphs() throws Exception { // Create two separate Graph instances // and add them to a new Graph g3 try (final Graph g1 = createGraph1(); final Graph g2 = createGraph2(); final Graph g3 = factory.createGraph()) { addAllTriples(g1, g3); addAllTriples(g2, g3); // Let's make a map to find all those blank nodes after insertion // (The Graph implementation is not currently required to // keep supporting those BlankNodes with contains() - see // COMMONSRDF-15) final Map whoIsWho = new ConcurrentHashMap<>(); // ConcurrentHashMap as we will try parallel forEach below, // which should not give inconsistent results (it does with a // HashMap!) // look up BlankNodes by name final IRI name = factory.createIRI("http://xmlns.com/foaf/0.1/name"); try (Stream stream = g3.stream(null, name, null)) { stream.parallel().forEach(t -> whoIsWho.put(t.getObject().ntriplesString(), t.getSubject())); } assertEquals(4, whoIsWho.size()); // and contains 4 unique values assertEquals(4, new HashSet<>(whoIsWho.values()).size()); final BlankNodeOrIRI b1Alice = whoIsWho.get("\"Alice\""); assertNotNull(b1Alice); final BlankNodeOrIRI b2Bob = whoIsWho.get("\"Bob\""); assertNotNull(b2Bob); final BlankNodeOrIRI b1Charlie = whoIsWho.get("\"Charlie\""); assertNotNull(b1Charlie); final BlankNodeOrIRI b2Dave = whoIsWho.get("\"Dave\""); assertNotNull(b2Dave); // All blank nodes should differ notEquals(b1Alice, b2Bob); notEquals(b1Alice, b1Charlie); notEquals(b1Alice, b2Dave); notEquals(b2Bob, b1Charlie); notEquals(b2Bob, b2Dave); notEquals(b1Charlie, b2Dave); // And we should be able to query with them again // as we got them back from g3 final IRI hasChild = factory.createIRI("http://example.com/hasChild"); assertTrue(g3.contains(b1Alice, hasChild, b2Bob)); assertTrue(g3.contains(b2Dave, hasChild, b1Charlie)); // But not assertFalse(g3.contains(b1Alice, hasChild, b1Alice)); assertFalse(g3.contains(b1Alice, hasChild, b1Charlie)); assertFalse(g3.contains(b1Alice, hasChild, b2Dave)); // nor assertFalse(g3.contains(b2Dave, hasChild, b1Alice)); assertFalse(g3.contains(b2Dave, hasChild, b1Alice)); // and these don't have any children (as far as we know) assertFalse(g3.contains(b2Bob, hasChild, null)); assertFalse(g3.contains(b1Charlie, hasChild, null)); } catch (final UnsupportedOperationException ex) { Assume.assumeNoException(ex); } } @Test public void containsLanguageTagsCaseInsensitive() throws Exception { // COMMONSRDF-51: Ensure we can add/contains/remove with any casing // of literal language tag final Literal lower = factory.createLiteral("Hello", "en-gb"); final Literal upper = factory.createLiteral("Hello", "EN-GB"); final Literal mixed = factory.createLiteral("Hello", "en-GB"); final IRI example1 = factory.createIRI("http://example.com/s1"); final IRI greeting = factory.createIRI("http://example.com/greeting"); try (final Graph graph = factory.createGraph()) { graph.add(example1, greeting, upper); // any kind of Triple should match assertTrue(graph.contains(factory.createTriple(example1, greeting, upper))); assertTrue(graph.contains(factory.createTriple(example1, greeting, lower))); assertTrue(graph.contains(factory.createTriple(example1, greeting, mixed))); // or as patterns assertTrue(graph.contains(null, null, upper)); assertTrue(graph.contains(null, null, lower)); assertTrue(graph.contains(null, null, mixed)); } } @Test public void containsLanguageTagsCaseInsensitiveTurkish() throws Exception { // COMMONSRDF-51: Special test for Turkish issue where // "i".toLowerCase() != "i" // See also: // https://garygregory.wordpress.com/2015/11/03/java-lowercase-conversion-turkey/ // This is similar to the test in AbstractRDFTest, but on a graph final Locale defaultLocale = Locale.getDefault(); try (final Graph g = factory.createGraph()) { Locale.setDefault(Locale.ROOT); final Literal lowerROOT = factory.createLiteral("moi", "fi"); final Literal upperROOT = factory.createLiteral("moi", "FI"); final Literal mixedROOT = factory.createLiteral("moi", "fI"); final IRI exampleROOT = factory.createIRI("http://example.com/s1"); final IRI greeting = factory.createIRI("http://example.com/greeting"); g.add(exampleROOT, greeting, mixedROOT); final Locale turkish = Locale.forLanguageTag("TR"); Locale.setDefault(turkish); // If the below assertion fails, then the Turkish // locale no longer have this peculiarity that // we want to test. Assume.assumeFalse("FI".toLowerCase().equals("fi")); // Below is pretty much the same as in // containsLanguageTagsCaseInsensitive() final Literal lower = factory.createLiteral("moi", "fi"); final Literal upper = factory.createLiteral("moi", "FI"); final Literal mixed = factory.createLiteral("moi", "fI"); final IRI exampleTR = factory.createIRI("http://example.com/s2"); g.add(exampleTR, greeting, upper); assertTrue(g.contains(factory.createTriple(exampleTR, greeting, upper))); assertTrue(g.contains(factory.createTriple(exampleTR, greeting, upperROOT))); assertTrue(g.contains(factory.createTriple(exampleTR, greeting, lower))); assertTrue(g.contains(factory.createTriple(exampleTR, greeting, lowerROOT))); assertTrue(g.contains(factory.createTriple(exampleTR, greeting, mixed))); assertTrue(g.contains(factory.createTriple(exampleTR, greeting, mixedROOT))); assertTrue(g.contains(exampleTR, null, upper)); assertTrue(g.contains(exampleTR, null, upperROOT)); assertTrue(g.contains(exampleTR, null, lower)); assertTrue(g.contains(exampleTR, null, lowerROOT)); assertTrue(g.contains(exampleTR, null, mixed)); assertTrue(g.contains(exampleTR, null, mixedROOT)); // What about the triple we added while in ROOT locale? assertTrue(g.contains(factory.createTriple(exampleROOT, greeting, upper))); assertTrue(g.contains(factory.createTriple(exampleROOT, greeting, lower))); assertTrue(g.contains(factory.createTriple(exampleROOT, greeting, mixed))); assertTrue(g.contains(exampleROOT, null, upper)); assertTrue(g.contains(exampleROOT, null, lower)); assertTrue(g.contains(exampleROOT, null, mixed)); } finally { Locale.setDefault(defaultLocale); } } @Test public void removeLanguageTagsCaseInsensitive() throws Exception { // COMMONSRDF-51: Ensure we can remove with any casing // of literal language tag final Literal lower = factory.createLiteral("Hello", "en-gb"); final Literal upper = factory.createLiteral("Hello", "EN-GB"); final Literal mixed = factory.createLiteral("Hello", "en-GB"); final IRI example1 = factory.createIRI("http://example.com/s1"); final IRI greeting = factory.createIRI("http://example.com/greeting"); try (final Graph graph = factory.createGraph()) { graph.add(example1, greeting, upper); // Remove should also honour any case graph.remove(example1, null, mixed); assertFalse(graph.contains(null, greeting, null)); graph.add(example1, greeting, lower); graph.remove(example1, null, upper); // Check with Triple graph.add(factory.createTriple(example1, greeting, mixed)); graph.remove(factory.createTriple(example1, greeting, upper)); assertFalse(graph.contains(null, greeting, null)); } } private static Optional closableFindAny(final Stream stream) { try (Stream s = stream) { return s.findAny(); } } @Test public void streamLanguageTagsCaseInsensitive() throws Exception { // COMMONSRDF-51: Ensure we can add/contains/remove with any casing // of literal language tag final Literal lower = factory.createLiteral("Hello", "en-gb"); final Literal upper = factory.createLiteral("Hello", "EN-GB"); final Literal mixed = factory.createLiteral("Hello", "en-GB"); final IRI example1 = factory.createIRI("http://example.com/s1"); final IRI greeting = factory.createIRI("http://example.com/greeting"); try (final Graph graph = factory.createGraph()) { graph.add(example1, greeting, upper); // or as patterns assertTrue(closableFindAny(graph.stream(null, null, upper)).isPresent()); assertTrue(closableFindAny(graph.stream(null, null, lower)).isPresent()); assertTrue(closableFindAny(graph.stream(null, null, mixed)).isPresent()); // Check the triples returned equal a new triple final Triple t = closableFindAny(graph.stream(null, null, lower)).get(); assertEquals(t, factory.createTriple(example1, greeting, mixed)); } } private void notEquals(final BlankNodeOrIRI node1, final BlankNodeOrIRI node2) { assertFalse(node1.equals(node2)); // in which case we should be able to assume // (as they are in the same graph) assertFalse(node1.ntriplesString().equals(node2.ntriplesString())); } /** * Add all triples from the source to the target. *

* The triples may be copied in any order. No special conversion or * adaptation of {@link BlankNode}s are performed. * * @param source * Source Graph to copy triples from * @param target * Target Graph where triples will be added */ private void addAllTriples(final Graph source, final Graph target) { // unordered() as we don't need to preserve triple order // sequential() as we don't (currently) require target Graph to be // thread-safe try (Stream stream = source.stream()) { stream.unordered().sequential().forEach(t -> target.add(t)); } } /** * Make a new graph with two BlankNodes - each with a different * uniqueReference */ private Graph createGraph1() { final RDF factory1 = createFactory(); final IRI name = factory1.createIRI("http://xmlns.com/foaf/0.1/name"); final Graph g1 = factory1.createGraph(); final BlankNode b1 = createOwnBlankNode("b1", "0240eaaa-d33e-4fc0-a4f1-169d6ced3680"); g1.add(b1, name, factory1.createLiteral("Alice")); final BlankNode b2 = createOwnBlankNode("b2", "9de7db45-0ce7-4b0f-a1ce-c9680ffcfd9f"); g1.add(b2, name, factory1.createLiteral("Bob")); final IRI hasChild = factory1.createIRI("http://example.com/hasChild"); g1.add(b1, hasChild, b2); return g1; } /** * Create a different implementation of BlankNode to be tested with * graph.add(a,b,c); (the implementation may or may not then choose to * translate such to its own instances) * * @param name * @return */ private BlankNode createOwnBlankNode(final String name, final String uuid) { return new BlankNode() { @Override public String ntriplesString() { return "_: " + name; } @Override public String uniqueReference() { return uuid; } @Override public int hashCode() { return uuid.hashCode(); } @Override public boolean equals(final Object obj) { if (!(obj instanceof BlankNode)) { return false; } final BlankNode other = (BlankNode) obj; return uuid.equals(other.uniqueReference()); } }; } private Graph createGraph2() { final RDF factory2 = createFactory(); final IRI name = factory2.createIRI("http://xmlns.com/foaf/0.1/name"); final Graph g2 = factory2.createGraph(); final BlankNode b1 = createOwnBlankNode("b1", "bc8d3e45-a08f-421d-85b3-c25b373abf87"); g2.add(b1, name, factory2.createLiteral("Charlie")); final BlankNode b2 = createOwnBlankNode("b2", "2209097a-5078-4b03-801a-6a2d2f50d739"); g2.add(b2, name, factory2.createLiteral("Dave")); final IRI hasChild = factory2.createIRI("http://example.com/hasChild"); // NOTE: Opposite direction of loadGraph1 g2.add(b2, hasChild, b1); return g2; } /** * An attempt to use the Java 8 streams to look up a more complicated query. *

* FYI, the equivalent SPARQL version (untested): * *

     *     SELECT ?orgName WHERE {
     *             ?org foaf:name ?orgName .
     *             ?alice foaf:member ?org .
     *             ?bob foaf:member ?org .
     *             ?alice foaf:knows ?bob .
     *           FILTER NOT EXIST { ?bob foaf:knows ?alice }
     *    }
     * 
* * @throws Exception If test fails */ @Test public void whyJavaStreamsMightNotTakeOverFromSparql() throws Exception { Assume.assumeNotNull(bnode1, bnode2, secretClubName); // Find a secret organizations try (Stream stream = graph.stream(null, knows, null)) { assertEquals("\"The Secret Club\"", // Find One-way "knows" stream.filter(t -> !graph.contains((BlankNodeOrIRI) t.getObject(), knows, t.getSubject())) .map(knowsTriple -> { try (Stream memberOf = graph // and those they know, what are they // member of? .stream((BlankNodeOrIRI) knowsTriple.getObject(), member, null)) { return memberOf // keep those which first-guy is a // member of .filter(memberTriple -> graph.contains(knowsTriple.getSubject(), member, // First hit is good enough memberTriple.getObject())) .findFirst().get().getObject(); } }) // then look up the name of that org .map(org -> { try (Stream orgName = graph.stream((BlankNodeOrIRI) org, name, null)) { return orgName.findFirst().get().getObject().ntriplesString(); } }).findFirst().get()); } } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyTripleTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyTripleTest.ja0000644000175000017500000000324113175733174033206 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.*; import java.util.Objects; import org.junit.Test; public class DummyTripleTest { Triple triple = new DummyTriple(); @Test public void getSubject() throws Exception { assertEquals(1, ((DummyIRI) triple.getSubject()).i); } @Test public void getPredicate() throws Exception { assertEquals(2, ((DummyIRI) triple.getPredicate()).i); } @Test public void getObject() throws Exception { assertEquals(3, ((DummyIRI) triple.getObject()).i); } @Test public void equals() throws Exception { assertEquals(triple, new DummyTriple()); } @Test public void testHashCode() { final int expected = Objects.hash(triple.getSubject(), triple.getPredicate(), triple.getObject()); assertEquals(expected, triple.hashCode()); } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyDatasetTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyDatasetTest.j0000644000175000017500000000630313175733174033175 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.*; import org.junit.Test; public class DummyDatasetTest { Dataset dataset = new DummyDataset(); @Test public void add() throws Exception { dataset.add(new DummyQuad()); } @Test public void addSPO() throws Exception { dataset.add(null, new DummyIRI(1), new DummyIRI(2), new DummyIRI(3)); } @Test public void contains() throws Exception { assertTrue(dataset.contains(new DummyQuad())); } @Test public void containsSPO() throws Exception { assertTrue(dataset.contains(null, null, null, null)); assertTrue(dataset.contains(null, new DummyIRI(1), new DummyIRI(2), new DummyIRI(3))); assertFalse(dataset.contains(null, new DummyIRI(0), new DummyIRI(0), new DummyIRI(0))); } @Test(expected = IllegalStateException.class) public void clearNotSupported() throws Exception { dataset.clear(); } @Test(expected = IllegalStateException.class) public void remove() throws Exception { dataset.remove(new DummyQuad()); } @Test public void removeSPO() throws Exception { dataset.remove(null, new DummyIRI(0), new DummyIRI(0), new DummyIRI(0)); } @Test public void size() throws Exception { assertEquals(1, dataset.size()); } @Test public void stream() throws Exception { assertEquals(new DummyQuad(), dataset.stream().findAny().get()); } @Test public void streamFiltered() throws Exception { assertEquals(new DummyQuad(), dataset.stream(null, null, null, null).findAny().get()); assertEquals(new DummyQuad(), dataset.stream(null, new DummyIRI(1), new DummyIRI(2), new DummyIRI(3)).findAny().get()); assertFalse(dataset.stream(null, new DummyIRI(0), new DummyIRI(0), new DummyIRI(0)).findAny().isPresent()); } @Test public void getGraph() throws Exception { assertTrue(dataset.getGraph() instanceof DummyGraph); } @Test public void getGraphNull() throws Exception { assertTrue(dataset.getGraph(null).get() instanceof DummyGraph); } @Test public void getGraphNamed() throws Exception { assertFalse(dataset.getGraph(new DummyIRI(0)).isPresent()); } @Test public void getGraphNames() throws Exception { assertFalse(dataset.getGraphNames().findAny().isPresent()); } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DefaultGraphTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DefaultGraphTest.j0000644000175000017500000000515313175733174033144 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.*; import org.junit.Test; public class DefaultGraphTest { DummyGraph graph = new DummyGraph(); @Test public void close() throws Exception { graph.close(); // no-op } @SuppressWarnings("deprecation") @Test public void defaultGetTriples() throws Exception { assertFalse(graph.streamCalled); assertFalse(graph.filteredStreamCalled); assertEquals(1L, graph.getTriples().count()); assertTrue(graph.streamCalled); assertFalse(graph.filteredStreamCalled); } @SuppressWarnings("deprecation") @Test public void defaultGetTriplesFiltered() throws Exception { assertFalse(graph.streamCalled); assertFalse(graph.filteredStreamCalled); assertEquals(1L, graph.getTriples(null,null,null).count()); assertFalse(graph.streamCalled); assertTrue(graph.filteredStreamCalled); // Ensure arguments are passed on to graph.stream(s,p,o); assertEquals(0L, graph.getTriples(new DummyIRI(0),null,null).count()); } @Test public void defaultIterate() throws Exception { assertFalse(graph.streamCalled); assertFalse(graph.filteredStreamCalled); for (final Triple t : graph.iterate()) { assertEquals(t, new DummyTriple()); } assertTrue(graph.streamCalled); assertFalse(graph.filteredStreamCalled); } @Test public void defaultFilteredIterate() throws Exception { assertFalse(graph.streamCalled); assertFalse(graph.filteredStreamCalled); for (final Triple t : graph.iterate(null, new DummyIRI(2), null)) { assertEquals(t, new DummyTriple()); } assertTrue(graph.filteredStreamCalled); assertFalse(graph.streamCalled); } } apache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyIRI.java0000644000175000017500000000265613175733174032072 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; class DummyIRI implements IRI { static final String EXAMPLE_COM = "http://example.com/"; final int i; public DummyIRI(final int i) { this.i = i; } @Override public String ntriplesString() { return "<" + EXAMPLE_COM + i + ">"; } @Override public String getIRIString() { return EXAMPLE_COM + i; } @Override public boolean equals(final Object obj) { return (obj instanceof IRI) && ((IRI) obj).getIRIString().equals(EXAMPLE_COM + i); } @Override public int hashCode() { return getIRIString().hashCode(); } }apache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyDataset.java0000644000175000017500000000717213175733174033032 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.Arrays; import java.util.Optional; import java.util.stream.Stream; class DummyDataset implements Dataset { boolean streamCalled = false; boolean filteredStreamCalled; @Override public void add(final Quad Quad) { if (! contains(Quad)) { throw new IllegalStateException("DummyDataset can't be modified"); } } @Override public void add(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { if (! contains(Optional.ofNullable(graphName), subject, predicate, object)) { throw new IllegalStateException("DummyDataset can't be modified"); } } @Override public boolean contains(final Quad Quad) { return Quad.equals(new DummyQuad()); } @Override public boolean contains(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return (graphName == null || ! graphName.isPresent()) && (subject == null || subject.equals(new DummyIRI(1))) && (predicate == null || predicate.equals(new DummyIRI(2))) && (object == null || object.equals(new DummyIRI(3))); } @Override public void remove(final Quad Quad) { if (contains(Quad)) { throw new IllegalStateException("DummyDataset can't be modified"); } } @Override public void remove(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { if (contains(graphName, subject, predicate, object)) { throw new IllegalStateException("DummyDataset can't be modified"); } } @Override public void clear() { throw new IllegalStateException("DummyDataset can't be modified"); } @Override public long size() { return 1; } @Override public Stream stream() { streamCalled = true; return Arrays.asList(new DummyQuad()).stream(); } @Override public Stream stream(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { filteredStreamCalled = true; if (contains(graphName, subject, predicate, object)) { return Stream.of(new DummyQuad()); } return Stream.empty(); } @Override public Graph getGraph() { return new DummyGraph(); } @Override public Optional getGraph(final BlankNodeOrIRI graphName) { if (graphName == null) { return Optional.of(getGraph()); } return Optional.empty(); } @Override public Stream getGraphNames() { return Stream.empty(); } }././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DefaultQuadTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DefaultQuadTest.ja0000644000175000017500000000316113175733174033133 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.*; import java.util.Objects; import org.junit.Test; public class DefaultQuadTest { @Test public void asQuad() throws Exception { final Quad q = new DummyQuad(); final Triple t = q.asTriple(); assertEquals(t, t); assertNotEquals(t, q); assertEquals(t, new DummyTriple()); assertEquals(t, new DummyQuad().asTriple()); // FIXME: This would not catch if asTriple() accidentally mixed up s/p/o // as they are here all the same assertEquals(new DummyIRI(1), t.getSubject()); assertEquals(new DummyIRI(2), t.getPredicate()); assertEquals(new DummyIRI(3), t.getObject()); assertEquals(Objects.hash(q.getSubject(), q.getPredicate(), q.getObject()), t.hashCode()); } } apache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyQuad.java0000644000175000017500000000357213175733174032337 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Optional; class DummyQuad implements Quad { @Override public Optional getGraphName() { return Optional.empty(); } @Override public BlankNodeOrIRI getSubject() { return new DummyIRI(1); } @Override public IRI getPredicate() { return new DummyIRI(2); } @Override public RDFTerm getObject() { return new DummyIRI(3); } private static List quadList(final Quad q) { return Arrays.asList( q.getGraphName().orElse(null), q.getSubject(), q.getPredicate(), q.getObject()); } @Override public boolean equals(final Object obj) { if (!(obj instanceof Quad)) { return false; } return quadList(this).equals(quadList((Quad) obj)); } @Override public int hashCode() { return Objects.hash(getSubject(), getPredicate(), getObject(), getGraphName()); } }././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DefaultDatasetTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DefaultDatasetTest0000644000175000017500000000362613175733174033243 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; public class DefaultDatasetTest { DummyDataset dataset = new DummyDataset(); @Test public void close() throws Exception { dataset.close(); // no-op } @Test public void defaultIterate() throws Exception { assertFalse(dataset.streamCalled); assertFalse(dataset.filteredStreamCalled); for (final Quad t : dataset.iterate()) { assertEquals(t, new DummyQuad()); } assertTrue(dataset.streamCalled); assertFalse(dataset.filteredStreamCalled); } @Test public void defaultFilteredIterate() throws Exception { assertFalse(dataset.streamCalled); assertFalse(dataset.filteredStreamCalled); for (final Quad t : dataset.iterate(null, null, new DummyIRI(2), null)) { assertEquals(t, new DummyQuad()); } assertTrue(dataset.filteredStreamCalled); assertFalse(dataset.streamCalled); } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTest.ja0000644000175000017500000004477213175733174033050 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.*; import java.util.Locale; import java.util.Objects; import java.util.Optional; import org.junit.Assume; import org.junit.Before; import org.junit.Test; /** * Test RDF implementation (and thus its RDFTerm implementations) *

* To add to your implementation's tests, create a subclass with a name ending * in Test and provide {@link #createFactory()} which minimally * supports one of the operations, but ideally supports all operations. * * @see RDF */ public abstract class AbstractRDFTest { private RDF factory; /** * * This method must be overridden by the implementing test to provide a * factory for the test to create {@link Literal}, {@link IRI} etc. * * @return {@link RDF} instance to be tested. */ protected abstract RDF createFactory(); @Before public void setUp() { factory = createFactory(); } @Test public void testCreateBlankNode() throws Exception { final BlankNode bnode = factory.createBlankNode(); final BlankNode bnode2 = factory.createBlankNode(); assertNotEquals("Second blank node has not got a unique internal identifier", bnode.uniqueReference(), bnode2.uniqueReference()); } @Test public void testCreateBlankNodeIdentifierEmpty() throws Exception { try { factory.createBlankNode(""); } catch (final IllegalArgumentException e) { // Expected exception } } @Test public void testCreateBlankNodeIdentifier() throws Exception { factory.createBlankNode("example1"); } @Test public void testCreateBlankNodeIdentifierTwice() throws Exception { BlankNode bnode1, bnode2, bnode3; bnode1 = factory.createBlankNode("example1"); bnode2 = factory.createBlankNode("example1"); bnode3 = factory.createBlankNode("differ"); // We don't know what the identifier is, but it MUST be the same assertEquals(bnode1.uniqueReference(), bnode2.uniqueReference()); // We don't know what the ntriplesString is, but it MUST be the same assertEquals(bnode1.ntriplesString(), bnode2.ntriplesString()); // and here it MUST differ assertNotEquals(bnode1.uniqueReference(), bnode3.uniqueReference()); assertNotEquals(bnode1.ntriplesString(), bnode3.ntriplesString()); } @Test public void testCreateBlankNodeIdentifierTwiceDifferentFactories() throws Exception { BlankNode bnode1, differentFactory; bnode1 = factory.createBlankNode(); // it MUST differ from a second factory differentFactory = createFactory().createBlankNode(); // NOTE: We can't make similar assumption if we provide a // name to createBlankNode(String) as its documentation // only says: // // * BlankNodes created using this method with the same parameter, for // * different instances of RDFFactory, SHOULD NOT be equivalent. // // https://github.com/apache/incubator-commonsrdf/pull/7#issuecomment-92312779 assertNotEquals(bnode1, differentFactory); assertNotEquals(bnode1.uniqueReference(), differentFactory.uniqueReference()); // but we can't require: // assertNotEquals(bnode1.ntriplesString(), // differentFactory.ntriplesString()); } @Test public void testCreateGraph() throws Exception { try (final Graph graph = factory.createGraph(); final Graph graph2 = factory.createGraph()) { assertEquals("Graph was not empty", 0, graph.size()); graph.add(factory.createBlankNode(), factory.createIRI("http://example.com/"), factory.createBlankNode()); assertNotSame(graph, graph2); assertEquals("Graph was empty after adding", 1, graph.size()); assertEquals("New graph was not empty", 0, graph2.size()); } } @Test public void testCreateIRI() throws Exception { final IRI example = factory.createIRI("http://example.com/"); assertEquals("http://example.com/", example.getIRIString()); assertEquals("", example.ntriplesString()); final IRI term = factory.createIRI("http://example.com/vocab#term"); assertEquals("http://example.com/vocab#term", term.getIRIString()); assertEquals("", term.ntriplesString()); // and now for the international fun! // make sure this file is edited/compiled as UTF-8 final IRI latin1 = factory.createIRI("http://accént.example.com/première"); assertEquals("http://accént.example.com/première", latin1.getIRIString()); assertEquals("", latin1.ntriplesString()); final IRI cyrillic = factory.createIRI("http://example.иÑпытание/Кириллица"); assertEquals("http://example.иÑпытание/Кириллица", cyrillic.getIRIString()); assertEquals("", cyrillic.ntriplesString()); final IRI deseret = factory.createIRI("http://ð€.example.com/ð€"); assertEquals("http://ð€.example.com/ð€", deseret.getIRIString()); assertEquals("", deseret.ntriplesString()); } @Test public void testCreateLiteral() throws Exception { final Literal example = factory.createLiteral("Example"); assertEquals("Example", example.getLexicalForm()); assertFalse(example.getLanguageTag().isPresent()); assertEquals("http://www.w3.org/2001/XMLSchema#string", example.getDatatype().getIRIString()); // http://lists.w3.org/Archives/Public/public-rdf-comments/2014Dec/0004.html assertEquals("\"Example\"", example.ntriplesString()); } @Test public void testCreateLiteralDateTime() throws Exception { final Literal dateTime = factory.createLiteral("2014-12-27T00:50:00T-0600", factory.createIRI("http://www.w3.org/2001/XMLSchema#dateTime")); assertEquals("2014-12-27T00:50:00T-0600", dateTime.getLexicalForm()); assertFalse(dateTime.getLanguageTag().isPresent()); assertEquals("http://www.w3.org/2001/XMLSchema#dateTime", dateTime.getDatatype().getIRIString()); assertEquals("\"2014-12-27T00:50:00T-0600\"^^", dateTime.ntriplesString()); } @Test public void testCreateLiteralLang() throws Exception { final Literal example = factory.createLiteral("Example", "en"); assertEquals("Example", example.getLexicalForm()); assertEquals("en", example.getLanguageTag().get()); assertEquals("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString", example.getDatatype().getIRIString()); assertEquals("\"Example\"@en", example.ntriplesString()); } @Test public void testCreateLiteralLangISO693_3() throws Exception { // see https://issues.apache.org/jira/browse/JENA-827 final Literal vls = factory.createLiteral("Herbert Van de Sompel", "vls"); // JENA-827 assertEquals("vls", vls.getLanguageTag().get()); assertEquals("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString", vls.getDatatype().getIRIString()); assertEquals("\"Herbert Van de Sompel\"@vls", vls.ntriplesString()); } private void assertEqualsBothWays(final Object a, final Object b) { assertEquals(a, b); assertEquals(b, a); // hashCode must match as well assertEquals(a.hashCode(), b.hashCode()); } @Test public void testCreateLiteralLangCaseInsensitive() throws Exception { /* * COMMONSRDF-51: Literal langtag may not be in lowercase, but must be * COMPARED (aka .equals and .hashCode()) in lowercase as the language * space is lower case. */ final Literal upper = factory.createLiteral("Hello", "EN-GB"); final Literal lower = factory.createLiteral("Hello", "en-gb"); final Literal mixed = factory.createLiteral("Hello", "en-GB"); /* * Disabled as some RDF frameworks (namely RDF4J) can be c configured to * do BCP47 normalization (e.g. "en-GB"), so we can't guarantee * lowercase language tags are preserved. */ // assertEquals("en-gb", lower.getLanguageTag().get()); /* * NOTE: the RDF framework is free to lowercase the language tag or * leave it as-is, so we can't assume: */ // assertEquals("en-gb", upper.getLanguageTag().get()); // assertEquals("en-gb", mixed.getLanguageTag().get()); /* ..unless we do a case-insensitive comparison: */ assertEquals("en-gb", lower.getLanguageTag().get().toLowerCase(Locale.ROOT)); assertEquals("en-gb", upper.getLanguageTag().get().toLowerCase(Locale.ROOT)); assertEquals("en-gb", mixed.getLanguageTag().get().toLowerCase(Locale.ROOT)); // However these should all be true using .equals assertEquals(lower, lower); assertEqualsBothWays(lower, upper); assertEqualsBothWays(lower, mixed); assertEquals(upper, upper); assertEqualsBothWays(upper, mixed); assertEquals(mixed, mixed); // Note that assertEqualsBothWays also checks // that .hashCode() matches } @Test public void testCreateLiteralLangCaseInsensitiveOther() throws Exception { // COMMONSRDF-51: Ensure the Literal is using case insensitive // comparison against any literal implementation // which may not have done .toLowerString() in their constructor final Literal upper = factory.createLiteral("Hello", "EN-GB"); final Literal lower = factory.createLiteral("Hello", "en-gb"); final Literal mixed = factory.createLiteral("Hello", "en-GB"); final Literal otherLiteral = new Literal() { @Override public String ntriplesString() { return "Hello@eN-Gb"; } @Override public String getLexicalForm() { return "Hello"; } @Override public Optional getLanguageTag() { return Optional.of("eN-Gb"); } @Override public IRI getDatatype() { return factory.createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"); } @Override public boolean equals(final Object obj) { throw new RuntimeException("Wrong way comparison of literal"); } }; // NOTE: Our fake Literal can't do .equals() or .hashCode(), // so don't check the wrong way around! assertEquals(mixed, otherLiteral); assertEquals(lower, otherLiteral); assertEquals(upper, otherLiteral); } @Test public void testCreateLiteralLangCaseInsensitiveInTurkish() throws Exception { // COMMONSRDF-51: Special test for Turkish issue where // "i".toLowerCase() != "i" // See also: // https://garygregory.wordpress.com/2015/11/03/java-lowercase-conversion-turkey/ final Locale defaultLocale = Locale.getDefault(); try { Locale.setDefault(Locale.ROOT); final Literal mixedROOT = factory.createLiteral("moi", "fI"); final Literal lowerROOT = factory.createLiteral("moi", "fi"); final Literal upperROOT = factory.createLiteral("moi", "FI"); final Locale turkish = Locale.forLanguageTag("TR"); Locale.setDefault(turkish); // If the below assertion fails, then the Turkish // locale no longer have this peculiarity that // we want to test. Assume.assumeFalse("FI".toLowerCase().equals("fi")); final Literal mixed = factory.createLiteral("moi", "fI"); final Literal lower = factory.createLiteral("moi", "fi"); final Literal upper = factory.createLiteral("moi", "FI"); assertEquals(lower, lower); assertEqualsBothWays(lower, upper); assertEqualsBothWays(lower, mixed); assertEquals(upper, upper); assertEqualsBothWays(upper, mixed); assertEquals(mixed, mixed); // And our instance created previously in ROOT locale // should still be equal to the instance created in TR locale // (e.g. test constructor is not doing a naive .toLowerCase()) assertEqualsBothWays(lower, lowerROOT); assertEqualsBothWays(upper, lowerROOT); assertEqualsBothWays(mixed, lowerROOT); assertEqualsBothWays(lower, upperROOT); assertEqualsBothWays(upper, upperROOT); assertEqualsBothWays(mixed, upperROOT); assertEqualsBothWays(lower, mixedROOT); assertEqualsBothWays(upper, mixedROOT); assertEqualsBothWays(mixed, mixedROOT); } finally { Locale.setDefault(defaultLocale); } } @Test public void testCreateLiteralString() throws Exception { final Literal example = factory.createLiteral("Example", factory.createIRI("http://www.w3.org/2001/XMLSchema#string")); assertEquals("Example", example.getLexicalForm()); assertFalse(example.getLanguageTag().isPresent()); assertEquals("http://www.w3.org/2001/XMLSchema#string", example.getDatatype().getIRIString()); // http://lists.w3.org/Archives/Public/public-rdf-comments/2014Dec/0004.html assertEquals("\"Example\"", example.ntriplesString()); } @Test public void testCreateTripleBnodeBnode() { final BlankNode subject = factory.createBlankNode("b1"); final IRI predicate = factory.createIRI("http://example.com/pred"); final BlankNode object = factory.createBlankNode("b2"); final Triple triple = factory.createTriple(subject, predicate, object); // bnode equivalence should be OK as we used the same // factory and have not yet inserted Triple into a Graph assertEquals(subject, triple.getSubject()); assertEquals(predicate, triple.getPredicate()); assertEquals(object, triple.getObject()); } @Test public void testCreateTripleBnodeIRI() { final BlankNode subject = factory.createBlankNode("b1"); final IRI predicate = factory.createIRI("http://example.com/pred"); final IRI object = factory.createIRI("http://example.com/obj"); final Triple triple = factory.createTriple(subject, predicate, object); // bnode equivalence should be OK as we used the same // factory and have not yet inserted Triple into a Graph assertEquals(subject, triple.getSubject()); assertEquals(predicate, triple.getPredicate()); assertEquals(object, triple.getObject()); } @Test public void testCreateTripleBnodeTriple() { final BlankNode subject = factory.createBlankNode(); final IRI predicate = factory.createIRI("http://example.com/pred"); final Literal object = factory.createLiteral("Example", "en"); final Triple triple = factory.createTriple(subject, predicate, object); // bnode equivalence should be OK as we used the same // factory and have not yet inserted Triple into a Graph assertEquals(subject, triple.getSubject()); assertEquals(predicate, triple.getPredicate()); assertEquals(object, triple.getObject()); } @Test public void testPossiblyInvalidBlankNode() throws Exception { BlankNode withColon; try { withColon = factory.createBlankNode("with:colon"); } catch (final IllegalArgumentException ex) { // Good! return; } // Factory allows :colon, which is OK as long as it's not causing an // invalid ntriplesString assertFalse(withColon.ntriplesString().contains("with:colon")); // and creating it twice gets the same ntriplesString assertEquals(withColon.ntriplesString(), factory.createBlankNode("with:colon").ntriplesString()); } @Test(expected = IllegalArgumentException.class) public void testInvalidIRI() throws Exception { factory.createIRI(""); } @Test(expected = IllegalArgumentException.class) public void testInvalidLiteralLang() throws Exception { factory.createLiteral("Example", "with space"); } @Test(expected = Exception.class) public void testInvalidTriplePredicate() { final BlankNode subject = factory.createBlankNode("b1"); final BlankNode predicate = factory.createBlankNode("b2"); final BlankNode object = factory.createBlankNode("b3"); factory.createTriple(subject, (IRI) predicate, object); } @Test public void hashCodeBlankNode() throws Exception { final BlankNode bnode1 = factory.createBlankNode(); assertEquals(bnode1.uniqueReference().hashCode(), bnode1.hashCode()); } @Test public void hashCodeIRI() throws Exception { final IRI iri = factory.createIRI("http://example.com/"); assertEquals(iri.getIRIString().hashCode(), iri.hashCode()); } @Test public void hashCodeLiteral() throws Exception { final Literal literal = factory.createLiteral("Hello"); assertEquals(Objects.hash(literal.getLexicalForm(), literal.getDatatype(), literal.getLanguageTag()), literal.hashCode()); } @Test public void hashCodeTriple() throws Exception { final IRI iri = factory.createIRI("http://example.com/"); final Triple triple = factory.createTriple(iri, iri, iri); assertEquals(Objects.hash(iri, iri, iri), triple.hashCode()); } } apache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyGraph.java0000644000175000017500000000567113175733174032510 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.Arrays; import java.util.stream.Stream; class DummyGraph implements Graph { boolean streamCalled = false; boolean filteredStreamCalled; @Override public void add(final Triple triple) { if (! contains(triple)) { throw new IllegalStateException("DummyGraph can't be modified"); } } @Override public void add(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { if (! contains(subject, predicate, object)) { throw new IllegalStateException("DummyGraph can't be modified"); } } @Override public boolean contains(final Triple triple) { return triple.equals(new DummyTriple()); } @Override public boolean contains(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return (subject == null || subject.equals(new DummyIRI(1))) && (predicate == null || predicate.equals(new DummyIRI(2))) && (object == null || object.equals(new DummyIRI(3))); } @Override public void remove(final Triple triple) { if (contains(triple)) { throw new IllegalStateException("DummyGraph can't be modified"); } } @Override public void remove(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { if (contains(subject, predicate, object)) { throw new IllegalStateException("DummyGraph can't be modified"); } } @Override public void clear() { throw new IllegalStateException("DummyGraph can't be modified"); } @Override public long size() { return 1; } @Override public Stream stream() { streamCalled = true; return Arrays.asList(new DummyTriple()).stream(); } @Override public Stream stream(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { filteredStreamCalled = true; if (contains(subject, predicate, object)) { return Stream.of(new DummyTriple()); } return Stream.empty(); } }././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyGraphTest.javaapache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyGraphTest.jav0000644000175000017500000000514613175733174033204 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.*; import org.junit.Test; public class DummyGraphTest { Graph graph = new DummyGraph(); @Test public void add() throws Exception { graph.add(new DummyTriple()); } @Test public void addSPO() throws Exception { graph.add(new DummyIRI(1), new DummyIRI(2), new DummyIRI(3)); } @Test public void contains() throws Exception { assertTrue(graph.contains(new DummyTriple())); } @Test public void containsSPO() throws Exception { assertTrue(graph.contains(null, null, null)); assertTrue(graph.contains(new DummyIRI(1), new DummyIRI(2), new DummyIRI(3))); assertFalse(graph.contains(new DummyIRI(0), new DummyIRI(0), new DummyIRI(0))); } @Test(expected = IllegalStateException.class) public void clearNotSupported() throws Exception { graph.clear(); } @Test(expected = IllegalStateException.class) public void remove() throws Exception { graph.remove(new DummyTriple()); } @Test public void removeSPO() throws Exception { graph.remove(new DummyIRI(0), new DummyIRI(0), new DummyIRI(0)); } @Test public void size() throws Exception { assertEquals(1, graph.size()); } @Test public void stream() throws Exception { assertEquals(new DummyTriple(), graph.stream().findAny().get()); } @Test public void streamFiltered() throws Exception { assertEquals(new DummyTriple(), graph.stream(null, null, null).findAny().get()); assertEquals(new DummyTriple(), graph.stream(new DummyIRI(1), new DummyIRI(2), new DummyIRI(3)).findAny().get()); assertFalse(graph.stream(new DummyIRI(0), new DummyIRI(0), new DummyIRI(0)).findAny().isPresent()); } } apache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/RDFSyntaxTest.java0000644000175000017500000001465513175733174033117 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import static org.junit.Assert.*; import java.util.Optional; import org.junit.Test; public class RDFSyntaxTest { @Test public void byFileExtension() throws Exception { assertEquals(RDFSyntax.JSONLD, RDFSyntax.byFileExtension(".jsonld").get()); assertEquals(RDFSyntax.NQUADS, RDFSyntax.byFileExtension(".nq").get()); assertEquals(RDFSyntax.NTRIPLES, RDFSyntax.byFileExtension(".nt").get()); assertEquals(RDFSyntax.RDFA, RDFSyntax.byFileExtension(".html").get()); assertEquals(RDFSyntax.RDFXML, RDFSyntax.byFileExtension(".rdf").get()); assertEquals(RDFSyntax.TRIG, RDFSyntax.byFileExtension(".trig").get()); assertEquals(RDFSyntax.TURTLE, RDFSyntax.byFileExtension(".ttl").get()); } @Test public void byFileExtensionFailsWithoutDot() throws Exception { assertEquals(Optional.empty(), RDFSyntax.byFileExtension("rdf")); } @Test public void byFileExtensionLowerCase() throws Exception { assertEquals(RDFSyntax.TURTLE, RDFSyntax.byFileExtension(".TtL").get()); } @Test public void byFileExtensionUnknown() throws Exception { assertEquals(Optional.empty(), RDFSyntax.byFileExtension(".tar")); } @Test public void byMediaType() throws Exception { assertEquals(RDFSyntax.JSONLD, RDFSyntax.byMediaType("application/ld+json").get()); assertEquals(RDFSyntax.NQUADS, RDFSyntax.byMediaType("application/n-quads").get()); assertEquals(RDFSyntax.NTRIPLES, RDFSyntax.byMediaType("application/n-triples").get()); assertEquals(RDFSyntax.RDFA, RDFSyntax.byMediaType("text/html").get()); assertEquals(RDFSyntax.RDFA, RDFSyntax.byMediaType("application/xhtml+xml").get()); assertEquals(RDFSyntax.RDFXML, RDFSyntax.byMediaType("application/rdf+xml").get()); assertEquals(RDFSyntax.TRIG, RDFSyntax.byMediaType("application/trig").get()); assertEquals(RDFSyntax.TURTLE, RDFSyntax.byMediaType("text/turtle").get()); } @Test public void byMediaTypeContentType() throws Exception { assertEquals(RDFSyntax.TURTLE, RDFSyntax.byMediaType("text/turtle; charset=\"UTF-8\"").get()); assertEquals(RDFSyntax.TURTLE, RDFSyntax.byMediaType("text/turtle ; charset=\"UTF-8\"").get()); // That's a Content-Type, not media type; we won't split by "," assertEquals(Optional.empty(), RDFSyntax.byMediaType("text/turtle, text/plain")); // no trimming will be done assertEquals(Optional.empty(), RDFSyntax.byMediaType(" text/turtle")); } @Test public void byMediaTypeLowerCase() throws Exception { assertEquals(RDFSyntax.JSONLD, RDFSyntax.byMediaType("APPLICATION/ld+JSON").get()); } @Test public void byMediaTypeUnknown() throws Exception { assertEquals(Optional.empty(), RDFSyntax.byMediaType("application/octet-stream")); } @Test public void fileExtension() throws Exception { assertEquals(".jsonld", RDFSyntax.JSONLD.fileExtension()); assertEquals(".nq", RDFSyntax.NQUADS.fileExtension()); assertEquals(".nt", RDFSyntax.NTRIPLES.fileExtension()); assertEquals(".html", RDFSyntax.RDFA.fileExtension()); assertEquals(".rdf", RDFSyntax.RDFXML.fileExtension()); assertEquals(".trig", RDFSyntax.TRIG.fileExtension()); assertEquals(".ttl", RDFSyntax.TURTLE.fileExtension()); } @Test public void fileExtensions() throws Exception { assertTrue(RDFSyntax.JSONLD.fileExtensions().contains(".jsonld")); assertTrue(RDFSyntax.NQUADS.fileExtensions().contains(".nq")); assertTrue(RDFSyntax.NTRIPLES.fileExtensions().contains(".nt")); assertTrue(RDFSyntax.RDFA.fileExtensions().contains(".html")); assertTrue(RDFSyntax.RDFA.fileExtensions().contains(".xhtml")); assertTrue(RDFSyntax.RDFXML.fileExtensions().contains(".rdf")); assertTrue(RDFSyntax.TRIG.fileExtensions().contains(".trig")); assertTrue(RDFSyntax.TURTLE.fileExtensions().contains(".ttl")); } @Test public void mediaType() throws Exception { assertEquals("application/ld+json", RDFSyntax.JSONLD.mediaType()); assertEquals("application/n-quads", RDFSyntax.NQUADS.mediaType()); assertEquals("application/n-triples", RDFSyntax.NTRIPLES.mediaType()); assertEquals("text/html", RDFSyntax.RDFA.mediaType()); assertEquals("application/rdf+xml", RDFSyntax.RDFXML.mediaType()); assertEquals("application/trig", RDFSyntax.TRIG.mediaType()); assertEquals("text/turtle", RDFSyntax.TURTLE.mediaType()); } @Test public void mediaTypes() throws Exception { assertTrue(RDFSyntax.JSONLD.mediaTypes().contains("application/ld+json")); assertTrue(RDFSyntax.NQUADS.mediaTypes().contains("application/n-quads")); assertTrue(RDFSyntax.NTRIPLES.mediaTypes().contains("application/n-triples")); assertTrue(RDFSyntax.RDFA.mediaTypes().contains("text/html")); assertTrue(RDFSyntax.RDFA.mediaTypes().contains("application/xhtml+xml")); assertTrue(RDFSyntax.RDFXML.mediaTypes().contains("application/rdf+xml")); assertTrue(RDFSyntax.TRIG.mediaTypes().contains("application/trig")); assertTrue(RDFSyntax.TURTLE.mediaTypes().contains("text/turtle")); } @Test public void string() throws Exception { assertEquals("JSON-LD 1.0", RDFSyntax.JSONLD.toString()); assertEquals("RDF 1.1 Turtle", RDFSyntax.TURTLE.toString()); } @Test public void byName() throws Exception { for (final RDFSyntax s : RDFSyntax.w3cSyntaxes()) { assertEquals(s, RDFSyntax.byName(s.name()).get()); } } } apache-commons-rdf-0.5.0/commons-rdf-api/src/test/java/org/apache/commons/rdf/api/DummyTriple.java0000644000175000017500000000331113175733174032673 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.api; import java.util.Arrays; import java.util.List; import java.util.Objects; class DummyTriple implements Triple { @Override public BlankNodeOrIRI getSubject() { return new DummyIRI(1); } @Override public IRI getPredicate() { return new DummyIRI(2); } @Override public RDFTerm getObject() { return new DummyIRI(3); } private static List tripleList(final Triple q) { return Arrays.asList( q.getSubject(), q.getPredicate(), q.getObject()); } @Override public boolean equals(final Object obj) { if (!(obj instanceof Triple)) { return false; } return tripleList(this).equals(tripleList((Triple) obj)); } @Override public int hashCode() { return Objects.hash(getSubject(), getPredicate(), getObject()); } }apache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/0000755000175000017500000000000013212356336023632 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/example-rdf/0000755000175000017500000000000013175733174026045 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/example-rdf/example.rdf0000644000175000017500000000203113175733174030171 0ustar andriusandrius Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/example-rdf/example.trig0000644000175000017500000000164313175733174030373 0ustar andriusandrius{ _:b0 ; "Licensed to the Apache Software Foundation (ASF) under one\n or more contributor license agreements. See the NOTICE file\n distributed with this work for additional information\n regarding copyright ownership. The ASF licenses this file\n to you under the Apache License, Version 2.0 (the\n \"License\"); you may not use this file except in compliance\n with the License. You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n"@en . } apache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/example-rdf/example.nt0000644000175000017500000000162513175733174030047 0ustar andriusandrius_:b1 . _:b1 "Licensed to the Apache Software Foundation (ASF) under one\n or more contributor license agreements. See the NOTICE file\n distributed with this work for additional information\n regarding copyright ownership. The ASF licenses this file\n to you under the Apache License, Version 2.0 (the\n \"License\"); you may not use this file except in compliance\n with the License. You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n"@en . apache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/example-rdf/example.jsonld0000644000175000017500000000241013175733174030710 0ustar andriusandrius{ "@graph" : [ { "@id" : "_:b0", "license" : "http://www.apache.org/licenses/LICENSE-2.0", "rights" : { "@language" : "en", "@value" : "Licensed to the Apache Software Foundation (ASF) under one\n or more contributor license agreements. See the NOTICE file\n distributed with this work for additional information\n regarding copyright ownership. The ASF licenses this file\n to you under the Apache License, Version 2.0 (the\n \"License\"); you may not use this file except in compliance\n with the License. You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n" } }, { "@graph" : [ { "@id" : "_:b0", "license" : "http://example.com/LICENSE" } ], "@id" : "http://example.com" } ], "@context" : { "rights" : { "@id" : "http://purl.org/dc/terms/rights" }, "license" : { "@id" : "http://purl.org/dc/terms/license", "@type" : "@id" } } } apache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/example-rdf/example.ttl0000644000175000017500000000163513175733174030232 0ustar andriusandrius_:b0 ; "Licensed to the Apache Software Foundation (ASF) under one\n or more contributor license agreements. See the NOTICE file\n distributed with this work for additional information\n regarding copyright ownership. The ASF licenses this file\n to you under the Apache License, Version 2.0 (the\n \"License\"); you may not use this file except in compliance\n with the License. You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n"@en . apache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/example-rdf/example.nq0000644000175000017500000000176113175733174030045 0ustar andriusandrius_:b1 . _:b1 "Licensed to the Apache Software Foundation (ASF) under one\n or more contributor license agreements. See the NOTICE file\n distributed with this work for additional information\n regarding copyright ownership. The ASF licenses this file\n to you under the Apache License, Version 2.0 (the\n \"License\"); you may not use this file except in compliance\n with the License. You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n"@en . _:b1 . apache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/META-INF/0000755000175000017500000000000013212356336024772 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/META-INF/NOTICE0000644000175000017500000000025413212356336025677 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-api/src/test/resources/META-INF/LICENSE0000644000175000017500000002613613212356336026007 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-api/pom.xml0000644000175000017500000000531213212356730021366 0ustar andriusandrius 4.0.0 org.apache.commons commons-rdf-parent 0.5.0 commons-rdf-api jar Commons RDF API Commons Java API for RDF 1.1 org.apache.commons.rdf.api org.apache.maven.plugins maven-jar-plugin test-jar test-jar org.apache.felix maven-bundle-plugin org.apache.commons.rdf.api org.apache.commons.rdf.api commonsrdf-api-site scm:svn:${commons.scmPubUrl}/api/ apache-commons-rdf-0.5.0/commons-rdf-simple/0000755000175000017500000000000013212356730020570 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/0000755000175000017500000000000013175733174021370 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/0000755000175000017500000000000013175733174022314 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/0000755000175000017500000000000013175733174023235 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/0000755000175000017500000000000013175733174024024 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/0000755000175000017500000000000013175733174025245 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/0000755000175000017500000000000013175733174026720 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/0000755000175000017500000000000013175733174027473 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/0000755000175000017500000000000013175733174030764 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/Types.java0000644000175000017500000002732313175733174032742 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import org.apache.commons.rdf.api.IRI; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Optional; import java.util.Set; /** * Types from the RDF and XML Schema vocabularies. */ public final class Types implements IRI, SimpleRDF.SimpleRDFTerm { /** * http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML */ public static final Types RDF_HTML = new Types("http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML"); /** * http://www.w3.org/1999/02/22-rdf-syntax-ns#langString */ public static final Types RDF_LANGSTRING = new Types("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"); /** * http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral * * @deprecated Not used in RDF-1.1 */ @Deprecated public static final Types RDF_PLAINLITERAL = new Types("http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral"); /** * http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral */ public static final Types RDF_XMLLITERAL = new Types("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"); /** * http://www.w3.org/2001/XMLSchema#anyURI */ public static final Types XSD_ANYURI = new Types("http://www.w3.org/2001/XMLSchema#anyURI"); /** * http://www.w3.org/2001/XMLSchema#base64Binary */ public static final Types XSD_BASE64BINARY = new Types("http://www.w3.org/2001/XMLSchema#base64Binary"); /** * http://www.w3.org/2001/XMLSchema#boolean */ public static final Types XSD_BOOLEAN = new Types("http://www.w3.org/2001/XMLSchema#boolean"); /** * http://www.w3.org/2001/XMLSchema#byte */ public static final Types XSD_BYTE = new Types("http://www.w3.org/2001/XMLSchema#byte"); /** * http://www.w3.org/2001/XMLSchema#date */ public static final Types XSD_DATE = new Types("http://www.w3.org/2001/XMLSchema#date"); /** * http://www.w3.org/2001/XMLSchema#dateTime */ public static final Types XSD_DATETIME = new Types("http://www.w3.org/2001/XMLSchema#dateTime"); /** * http://www.w3.org/2001/XMLSchema#dayTimeDuration */ public static final Types XSD_DAYTIMEDURATION = new Types("http://www.w3.org/2001/XMLSchema#dayTimeDuration"); /** * http://www.w3.org/2001/XMLSchema#decimal */ public static final Types XSD_DECIMAL = new Types("http://www.w3.org/2001/XMLSchema#decimal"); /** * http://www.w3.org/2001/XMLSchema#double */ public static final Types XSD_DOUBLE = new Types("http://www.w3.org/2001/XMLSchema#double"); /** * http://www.w3.org/2001/XMLSchema#duration */ public static final Types XSD_DURATION = new Types("http://www.w3.org/2001/XMLSchema#duration"); /** * http://www.w3.org/2001/XMLSchema#float */ public static final Types XSD_FLOAT = new Types("http://www.w3.org/2001/XMLSchema#float"); /** * http://www.w3.org/2001/XMLSchema#gDay */ public static final Types XSD_GDAY = new Types("http://www.w3.org/2001/XMLSchema#gDay"); /** * http://www.w3.org/2001/XMLSchema#gMonth */ public static final Types XSD_GMONTH = new Types("http://www.w3.org/2001/XMLSchema#gMonth"); /** * http://www.w3.org/2001/XMLSchema#gMonthDay */ public static final Types XSD_GMONTHDAY = new Types("http://www.w3.org/2001/XMLSchema#gMonthDay"); /** * http://www.w3.org/2001/XMLSchema#gYear */ public static final Types XSD_GYEAR = new Types("http://www.w3.org/2001/XMLSchema#gYear"); /** * http://www.w3.org/2001/XMLSchema#gYearMonth */ public static final Types XSD_GYEARMONTH = new Types("http://www.w3.org/2001/XMLSchema#gYearMonth"); /** * http://www.w3.org/2001/XMLSchema#hexBinary */ public static final Types XSD_HEXBINARY = new Types("http://www.w3.org/2001/XMLSchema#hexBinary"); /** * http://www.w3.org/2001/XMLSchema#int */ public static final Types XSD_INT = new Types("http://www.w3.org/2001/XMLSchema#int"); /** * http://www.w3.org/2001/XMLSchema#integer */ public static final Types XSD_INTEGER = new Types("http://www.w3.org/2001/XMLSchema#integer"); /** * http://www.w3.org/2001/XMLSchema#language */ public static final Types XSD_LANGUAGE = new Types("http://www.w3.org/2001/XMLSchema#language"); /** * http://www.w3.org/2001/XMLSchema#long */ public static final Types XSD_LONG = new Types("http://www.w3.org/2001/XMLSchema#long"); /** * http://www.w3.org/2001/XMLSchema#Name */ public static final Types XSD_NAME = new Types("http://www.w3.org/2001/XMLSchema#Name"); /** * http://www.w3.org/2001/XMLSchema#NCName */ public static final Types XSD_NCNAME = new Types("http://www.w3.org/2001/XMLSchema#NCName"); /** * http://www.w3.org/2001/XMLSchema#negativeInteger */ public static final Types XSD_NEGATIVEINTEGER = new Types("http://www.w3.org/2001/XMLSchema#negativeInteger"); /** * http://www.w3.org/2001/XMLSchema#NMTOKEN */ public static final Types XSD_NMTOKEN = new Types("http://www.w3.org/2001/XMLSchema#NMTOKEN"); /** * http://www.w3.org/2001/XMLSchema#nonNegativeInteger */ public static final Types XSD_NONNEGATIVEINTEGER = new Types("http://www.w3.org/2001/XMLSchema#nonNegativeInteger"); /** * http://www.w3.org/2001/XMLSchema#nonPositiveInteger */ public static final Types XSD_NONPOSITIVEINTEGER = new Types("http://www.w3.org/2001/XMLSchema#nonPositiveInteger"); /** * http://www.w3.org/2001/XMLSchema#normalizedString */ public static final Types XSD_NORMALIZEDSTRING = new Types("http://www.w3.org/2001/XMLSchema#normalizedString"); /** * http://www.w3.org/2001/XMLSchema#positiveInteger */ public static final Types XSD_POSITIVEINTEGER = new Types("http://www.w3.org/2001/XMLSchema#positiveInteger"); /** * http://www.w3.org/2001/XMLSchema#short */ public static final Types XSD_SHORT = new Types("http://www.w3.org/2001/XMLSchema#short"); /** * http://www.w3.org/2001/XMLSchema#string */ public static final Types XSD_STRING = new Types("http://www.w3.org/2001/XMLSchema#string"); /** * http://www.w3.org/2001/XMLSchema#time */ public static final Types XSD_TIME = new Types("http://www.w3.org/2001/XMLSchema#time"); /** * http://www.w3.org/2001/XMLSchema#token */ public static final Types XSD_TOKEN = new Types("http://www.w3.org/2001/XMLSchema#token"); /** * http://www.w3.org/2001/XMLSchema#unsignedByte */ public static final Types XSD_UNSIGNEDBYTE = new Types("http://www.w3.org/2001/XMLSchema#unsignedByte"); /** * http://www.w3.org/2001/XMLSchema#unsignedInt */ public static final Types XSD_UNSIGNEDINT = new Types("http://www.w3.org/2001/XMLSchema#unsignedInt"); /** * http://www.w3.org/2001/XMLSchema#unsignedLong */ public static final Types XSD_UNSIGNEDLONG = new Types("http://www.w3.org/2001/XMLSchema#unsignedLong"); /** * http://www.w3.org/2001/XMLSchema#unsignedShort */ public static final Types XSD_UNSIGNEDSHORT = new Types("http://www.w3.org/2001/XMLSchema#unsignedShort"); private static final Set ALL_TYPES; static { final Set tempTypes = new LinkedHashSet<>(); tempTypes.add(RDF_HTML); tempTypes.add(RDF_LANGSTRING); tempTypes.add(RDF_PLAINLITERAL); tempTypes.add(RDF_XMLLITERAL); tempTypes.add(XSD_ANYURI); tempTypes.add(XSD_BASE64BINARY); tempTypes.add(XSD_BOOLEAN); tempTypes.add(XSD_BYTE); tempTypes.add(XSD_DATE); tempTypes.add(XSD_DATETIME); tempTypes.add(XSD_DAYTIMEDURATION); tempTypes.add(XSD_DECIMAL); tempTypes.add(XSD_DOUBLE); tempTypes.add(XSD_DURATION); tempTypes.add(XSD_FLOAT); tempTypes.add(XSD_GDAY); tempTypes.add(XSD_GMONTH); tempTypes.add(XSD_GMONTHDAY); tempTypes.add(XSD_GYEAR); tempTypes.add(XSD_GYEARMONTH); tempTypes.add(XSD_HEXBINARY); tempTypes.add(XSD_INT); tempTypes.add(XSD_INTEGER); tempTypes.add(XSD_LANGUAGE); tempTypes.add(XSD_LONG); tempTypes.add(XSD_NAME); tempTypes.add(XSD_NCNAME); tempTypes.add(XSD_NEGATIVEINTEGER); tempTypes.add(XSD_NMTOKEN); tempTypes.add(XSD_NONNEGATIVEINTEGER); tempTypes.add(XSD_NONPOSITIVEINTEGER); tempTypes.add(XSD_NORMALIZEDSTRING); tempTypes.add(XSD_POSITIVEINTEGER); tempTypes.add(XSD_SHORT); tempTypes.add(XSD_STRING); tempTypes.add(XSD_TIME); tempTypes.add(XSD_TOKEN); tempTypes.add(XSD_UNSIGNEDBYTE); tempTypes.add(XSD_UNSIGNEDINT); tempTypes.add(XSD_UNSIGNEDLONG); tempTypes.add(XSD_UNSIGNEDSHORT); ALL_TYPES = Collections.unmodifiableSet(tempTypes); } private final IRI field; private Types(final String field) { this.field = new IRIImpl(field); } @Override public String getIRIString() { return this.field.getIRIString(); } @Override public String ntriplesString() { return this.field.ntriplesString(); } @Override public boolean equals(final Object other) { return this.field.equals(other); } @Override public int hashCode() { return this.field.hashCode(); } @Override public String toString() { return this.field.toString(); } /** * Get an immutable set of the IRIs used by the RDF-1.1 specification to * define types, from the RDF and XML Schema vocabularies. * * @return A {@link Set} containing all of the IRIs in this collection. */ public static Set values() { return ALL_TYPES; } /** * Get the IRI from this collection if it is present, or return * {@link Optional#empty()} otherwise. * * @param nextIRI * The IRI to look for. * @return An {@link Optional} containing the IRI from this collection or * {@link Optional#empty()} if it is not present here. */ public static Optional get(final IRI nextIRI) { if (ALL_TYPES.contains(nextIRI)) { // If we know about this IRI, then look through our set to find the // object that matches and return it for (final IRI nextType : ALL_TYPES) { if (nextType.equals(nextIRI)) { return Optional.of(nextType); } } } return Optional.empty(); } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/LiteralImpl.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/LiteralImpl.0000644000175000017500000001067213175733174033211 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import java.util.IllformedLocaleException; import java.util.Locale; import java.util.Objects; import java.util.Optional; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; /** * A simple implementation of Literal. */ final class LiteralImpl implements Literal, SimpleRDF.SimpleRDFTerm { private static final String QUOTE = "\""; private final IRI dataType; private final String languageTag; private final String lexicalForm; public LiteralImpl(final String literal) { this(literal, Types.XSD_STRING); } public LiteralImpl(final String lexicalForm, final IRI dataType) { this.lexicalForm = Objects.requireNonNull(lexicalForm); this.dataType = Types.get(Objects.requireNonNull(dataType)).orElse(dataType); if (Types.RDF_LANGSTRING.equals(this.dataType)) { throw new IllegalArgumentException( "Cannot create a non-language literal with type " + Types.RDF_LANGSTRING); } this.languageTag = null; } public LiteralImpl(final String literal, final String languageTag) { this.lexicalForm = Objects.requireNonNull(literal); this.languageTag = Objects.requireNonNull(lowerCase(languageTag)); if (languageTag.isEmpty()) { // TODO: Check against // http://www.w3.org/TR/n-triples/#n-triples-grammar throw new IllegalArgumentException("Language tag can't be null"); } try { new Locale.Builder().setLanguageTag(languageTag); } catch (final IllformedLocaleException ex) { throw new IllegalArgumentException("Invalid languageTag: " + languageTag, ex); } // System.out.println(aLocale); this.dataType = Types.RDF_LANGSTRING; } @Override public IRI getDatatype() { return dataType; } @Override public Optional getLanguageTag() { return Optional.ofNullable(languageTag); } @Override public String getLexicalForm() { return lexicalForm; } @Override public String ntriplesString() { final StringBuilder sb = new StringBuilder(); sb.append(QUOTE); // Escape special characters sb.append(getLexicalForm().replace("\\", "\\\\"). // escaped to \\ replace("\"", "\\\""). // escaped to \" replace("\r", "\\r"). // escaped to \r replace("\n", "\\n")); // escaped to \n sb.append(QUOTE); // getLanguageTag().ifPresent(s -> sb.append("@" + s)); if (getLanguageTag().isPresent()) { sb.append("@"); sb.append(getLanguageTag().get()); } else if (!getDatatype().equals(Types.XSD_STRING)) { sb.append("^^"); sb.append(getDatatype().ntriplesString()); } return sb.toString(); } @Override public String toString() { return ntriplesString(); } @Override public int hashCode() { return Objects.hash(lexicalForm, dataType, languageTag); } private static String lowerCase(final String langTag) { return langTag.toLowerCase(Locale.ROOT); } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof Literal)) { return false; } final Literal literal = (Literal) obj; return getDatatype().equals(literal.getDatatype()) && getLexicalForm().equals(literal.getLexicalForm()) && getLanguageTag().equals(literal.getLanguageTag().map(LiteralImpl::lowerCase)); } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/DatasetImpl.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/DatasetImpl.0000644000175000017500000002005113175733174033172 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import java.util.HashSet; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.simple.SimpleRDF.SimpleRDFTerm; /** * A simple, memory-based implementation of Dataset. *

* {@link Quad}s in the graph are kept in a {@link Set}. *

* All Stream operations are performed using parallel and unordered directives. */ final class DatasetImpl implements Dataset { private static final int TO_STRING_MAX = 10; private final Set quads = new HashSet<>(); private final SimpleRDF factory; DatasetImpl(final SimpleRDF simpleRDF) { this.factory = simpleRDF; } @Override public void add(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final BlankNodeOrIRI newGraphName = (BlankNodeOrIRI) internallyMap(graphName); final BlankNodeOrIRI newSubject = (BlankNodeOrIRI) internallyMap(subject); final IRI newPredicate = (IRI) internallyMap(predicate); final RDFTerm newObject = internallyMap(object); final Quad result = factory.createQuad(newGraphName, newSubject, newPredicate, newObject); quads.add(result); } @Override public void add(final Quad quad) { final BlankNodeOrIRI newGraph = (BlankNodeOrIRI) internallyMap(quad.getGraphName().orElse(null)); final BlankNodeOrIRI newSubject = (BlankNodeOrIRI) internallyMap(quad.getSubject()); final IRI newPredicate = (IRI) internallyMap(quad.getPredicate()); final RDFTerm newObject = internallyMap(quad.getObject()); // Check if any of the object references changed during the mapping, to // avoid creating a new Quad object if possible if (newGraph == quad.getGraphName().orElse(null) && newSubject == quad.getSubject() && newPredicate == quad.getPredicate() && newObject == quad.getObject()) { quads.add(quad); } else { // Make a new Quad with our mapped instances final Quad result = factory.createQuad(newGraph, newSubject, newPredicate, newObject); quads.add(result); } } private RDFTerm internallyMap(final T object) { if (object == null || object instanceof SimpleRDFTerm) { return object; } if (object instanceof BlankNode && !(object instanceof BlankNodeImpl)) { final BlankNode blankNode = (BlankNode) object; // This guarantees that adding the same BlankNode multiple times to // this graph will generate a local object that is mapped to an // equivalent object, based on the code in the package private // BlankNodeImpl class return factory.createBlankNode(blankNode.uniqueReference()); } else if (object instanceof IRI && !(object instanceof IRIImpl)) { final IRI iri = (IRI) object; return factory.createIRI(iri.getIRIString()); } else if (object instanceof Literal && !(object instanceof LiteralImpl)) { final Literal literal = (Literal) object; if (literal.getLanguageTag().isPresent()) { return factory.createLiteral(literal.getLexicalForm(), literal.getLanguageTag().get()); } return factory.createLiteral(literal.getLexicalForm(), (IRI) internallyMap(literal.getDatatype())); } else { throw new IllegalArgumentException("Not a BlankNode, IRI or Literal: " + object); } } @Override public void clear() { quads.clear(); } @Override public boolean contains(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return stream(graphName, subject, predicate, object).findAny().isPresent(); } @Override public boolean contains(final Quad quad) { return quads.contains(Objects.requireNonNull(quad)); } @Override public Stream stream() { return quads.parallelStream().unordered(); } @Override public Stream stream(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Optional newGraphName; if (graphName == null) { // Avoid Optional> ... newGraphName = null; } else { newGraphName = graphName.map(g -> (BlankNodeOrIRI) internallyMap(g)); } final BlankNodeOrIRI newSubject = (BlankNodeOrIRI) internallyMap(subject); final IRI newPredicate = (IRI) internallyMap(predicate); final RDFTerm newObject = internallyMap(object); return getQuads(t -> { if (newGraphName != null && !t.getGraphName().equals(newGraphName)) { // This would check Optional.empty() == Optional.empty() return false; } if (subject != null && !t.getSubject().equals(newSubject)) { return false; } if (predicate != null && !t.getPredicate().equals(newPredicate)) { return false; } if (object != null && !t.getObject().equals(newObject)) { return false; } return true; }); } private Stream getQuads(final Predicate filter) { return stream().filter(filter); } @Override public void remove(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Stream toRemove = stream(graphName, subject, predicate, object); for (final Quad t : toRemove.collect(Collectors.toList())) { // Avoid ConcurrentModificationException in ArrayList remove(t); } } @Override public void remove(final Quad quad) { quads.remove(Objects.requireNonNull(quad)); } @Override public long size() { return quads.size(); } @Override public String toString() { final String s = stream().limit(TO_STRING_MAX).map(Object::toString).collect(Collectors.joining("\n")); if (size() > TO_STRING_MAX) { return s + "\n# ... +" + (size() - TO_STRING_MAX) + " more"; } return s; } @Override public void close() { } @Override public Graph getGraph() { return getGraph(null).get(); } @Override public Optional getGraph(final BlankNodeOrIRI graphName) { return Optional.of(new DatasetGraphView(this, graphName)); } @Override public Stream getGraphNames() { // Not very efficient.. return stream().map(Quad::getGraphName).filter(Optional::isPresent).map(Optional::get).distinct(); } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/TripleImpl.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/TripleImpl.j0000644000175000017500000000540613175733174033225 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import java.util.Objects; /** * A simple implementation of Triple. */ final class TripleImpl implements Triple { private final BlankNodeOrIRI subject; private final IRI predicate; private final RDFTerm object; /** * Construct Triple from its constituent parts. *

* The objects are not changed. All mapping of BNode objects is done in * {@link SimpleRDF#createTriple(BlankNodeOrIRI, IRI, RDFTerm)}. * * @param subject * subject of triple * @param predicate * predicate of triple * @param object * object of triple */ public TripleImpl(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { this.subject = Objects.requireNonNull(subject); this.predicate = Objects.requireNonNull(predicate); this.object = Objects.requireNonNull(object); } @Override public BlankNodeOrIRI getSubject() { return subject; } @Override public IRI getPredicate() { return predicate; } @Override public RDFTerm getObject() { return object; } @Override public String toString() { return getSubject().ntriplesString() + " " + getPredicate().ntriplesString() + " " + getObject().ntriplesString() + " ."; } @Override public int hashCode() { return Objects.hash(subject, predicate, object); } @Override public boolean equals(final Object obj) { if (!(obj instanceof Triple)) { return false; } final Triple other = (Triple) obj; return getSubject().equals(other.getSubject()) && getPredicate().equals(other.getPredicate()) && getObject().equals(other.getObject()); } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/package-info.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/package-info0000644000175000017500000000334413175733174033237 0ustar andriusandrius/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * A simple in-memory implementation of the Commons RDF API. *

* This package contains a simple (if not naive) implementation of * {@link org.apache.commons.rdf.api} using in-memory POJO objects. *

* Note that although this module fully implements the commons-rdf API, it * should not be considered a reference implementation. It is * not thread-safe nor scalable, but may be useful for testing * and simple usage (e.g. prototyping). *

* To use this implementation, create an instance of * {@link org.apache.commons.rdf.simple.SimpleRDF} and use methods like * {@link org.apache.commons.rdf.simple.SimpleRDF#createGraph} and * {@link org.apache.commons.rdf.simple.SimpleRDF#createIRI(String)}. *

* The {@link org.apache.commons.rdf.simple.Types} class provide constant * {@link org.apache.commons.rdf.api.IRI}s of the common RDF XML datatypes. * */ package org.apache.commons.rdf.simple; ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental/apache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental0000755000175000017500000000000013175733174033402 5ustar andriusandrius././@LongLink0000644000000000000000000000016700000000000011607 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental/package-info.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental0000644000175000017500000000255313175733174033411 0ustar andriusandrius/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Experimental Commons RDF Simple implementations. *

* Classes in this package should be considered at risk; they * might change or be removed in the next minor update of Commons RDF. *

* When a class has stabilized, it will move to the * {@link org.apache.commons.rdf.simple} package. *

    *
  • {@link org.apache.commons.rdf.simple.experimental.AbstractRDFParser} - an abstract helper class for implementations * of {@link org.apache.commons.rdf.experimental.RDFParser}.
  • *
*/ package org.apache.commons.rdf.simple.experimental;././@LongLink0000644000000000000000000000017400000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental/AbstractRDFParser.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental0000644000175000017500000004763413175733174033422 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple.experimental; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.nio.file.Files; import java.nio.file.Path; import java.util.Optional; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.function.Consumer; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFSyntax; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.experimental.RDFParser; import org.apache.commons.rdf.simple.SimpleRDF; /** * Abstract RDFParser *

* This abstract class keeps the properties in protected fields like * {@link #sourceFile} using {@link Optional}. Some basic checking like * {@link #checkIsAbsolute(IRI)} is performed. *

* This class and its subclasses are {@link Cloneable}, immutable and * (therefore) thread-safe - each call to option methods like * {@link #contentType(String)} or {@link #source(IRI)} will return a cloned, * mutated copy. *

* By default, parsing is done by the abstract method * {@link #parseSynchronusly()} - which is executed in a cloned snapshot - hence * multiple {@link #parse()} calls are thread-safe. The default {@link #parse()} * uses a thread pool in {@link #threadGroup} - but implementations can override * {@link #parse()} (e.g. because it has its own threading model or use * asynchronous remote execution). */ public abstract class AbstractRDFParser> implements RDFParser, Cloneable { public static final ThreadGroup threadGroup = new ThreadGroup("Commons RDF parsers"); private static final ExecutorService threadpool = Executors.newCachedThreadPool(r -> new Thread(threadGroup, r)); // Basically only used for creating IRIs private static RDF internalRdfTermFactory = new SimpleRDF(); /** * Get the set {@link RDF}, if any. * * @return The {@link RDF} to use, or {@link Optional#empty()} if it has not * been set */ public Optional getRdfTermFactory() { return rdfTermFactory; } /** * Get the set content-type {@link RDFSyntax}, if any. *

* If this is {@link Optional#isPresent()}, then {@link #getContentType()} * contains the value of {@link RDFSyntax#mediaType}. * * @return The {@link RDFSyntax} of the content type, or * {@link Optional#empty()} if it has not been set */ public Optional getContentTypeSyntax() { return contentTypeSyntax; } /** * Get the set content-type String, if any. *

* If this is {@link Optional#isPresent()} and is recognized by * {@link RDFSyntax#byMediaType(String)}, then the corresponding * {@link RDFSyntax} is set on {@link #getContentType()}, otherwise that is * {@link Optional#empty()}. * * @return The Content-Type IANA media type, e.g. text/turtle, * or {@link Optional#empty()} if it has not been set */ public final Optional getContentType() { return contentType; } /** * Get the target to consume parsed Quads. *

* From the call to {@link #parseSynchronusly()}, this will be a * non-null value (as a target is a required setting). * * @return The target consumer of {@link Quad}s, or null if it * has not yet been set. * */ public Consumer getTarget() { return target; } /** * Get the target dataset as set by {@link #target(Dataset)}. *

* The return value is {@link Optional#isPresent()} if and only if * {@link #target(Dataset)} has been set, meaning that the implementation * may choose to append parsed quads to the {@link Dataset} directly instead * of relying on the generated {@link #getTarget()} consumer. *

* If this value is present, then {@link #getTargetGraph()} MUST be * {@link Optional#empty()}. * * @return The target Dataset, or {@link Optional#empty()} if another kind * of target has been set. */ public Optional getTargetDataset() { return targetDataset; } /** * Get the target graph as set by {@link #target(Graph)}. *

* The return value is {@link Optional#isPresent()} if and only if * {@link #target(Graph)} has been set, meaning that the implementation may * choose to append parsed triples to the {@link Graph} directly instead of * relying on the generated {@link #getTarget()} consumer. *

* If this value is present, then {@link #getTargetDataset()} MUST be * {@link Optional#empty()}. * * @return The target Graph, or {@link Optional#empty()} if another kind of * target has been set. */ public Optional getTargetGraph() { return targetGraph; } /** * Get the set base {@link IRI}, if present. * * @return The base {@link IRI}, or {@link Optional#empty()} if it has not * been set */ public Optional getBase() { return base; } /** * Get the set source {@link InputStream}. *

* If this is {@link Optional#isPresent()}, then {@link #getSourceFile()} * and {@link #getSourceIri()} are {@link Optional#empty()}. * * @return The source {@link InputStream}, or {@link Optional#empty()} if it * has not been set */ public Optional getSourceInputStream() { return sourceInputStream; } /** * Get the set source {@link Path}. *

* If this is {@link Optional#isPresent()}, then * {@link #getSourceInputStream()} and {@link #getSourceIri()} are * {@link Optional#empty()}. * * @return The source {@link Path}, or {@link Optional#empty()} if it has * not been set */ public Optional getSourceFile() { return sourceFile; } /** * Get the set source {@link Path}. *

* If this is {@link Optional#isPresent()}, then * {@link #getSourceInputStream()} and {@link #getSourceInputStream()} are * {@link Optional#empty()}. * * @return The source {@link IRI}, or {@link Optional#empty()} if it has not * been set */ public Optional getSourceIri() { return sourceIri; } private Optional rdfTermFactory = Optional.empty(); private Optional contentTypeSyntax = Optional.empty(); private Optional contentType = Optional.empty(); private Optional base = Optional.empty(); private Optional sourceInputStream = Optional.empty(); private Optional sourceFile = Optional.empty(); private Optional sourceIri = Optional.empty(); private Consumer target; private Optional targetDataset; private Optional targetGraph; @SuppressWarnings("unchecked") @Override public T clone() { try { return (T) super.clone(); } catch (final CloneNotSupportedException e) { throw new RuntimeException(e); } } @SuppressWarnings("unchecked") protected T asT() { return (T) this; } @Override public T rdfTermFactory(final RDF rdfTermFactory) { final AbstractRDFParser c = clone(); c.rdfTermFactory = Optional.ofNullable(rdfTermFactory); return c.asT(); } @Override public T contentType(final RDFSyntax rdfSyntax) throws IllegalArgumentException { final AbstractRDFParser c = clone(); c.contentTypeSyntax = Optional.ofNullable(rdfSyntax); c.contentType = c.contentTypeSyntax.map(syntax -> syntax.mediaType()); return c.asT(); } @Override public T contentType(final String contentType) throws IllegalArgumentException { final AbstractRDFParser c = clone(); c.contentType = Optional.ofNullable(contentType); c.contentTypeSyntax = c.contentType.flatMap(RDFSyntax::byMediaType); return c.asT(); } @Override public T base(final IRI base) { final AbstractRDFParser c = clone(); c.base = Optional.ofNullable(base); c.base.ifPresent(i -> checkIsAbsolute(i)); return c.asT(); } @Override public T base(final String base) throws IllegalArgumentException { return base(internalRdfTermFactory.createIRI(base)); } @Override public T source(final InputStream inputStream) { final AbstractRDFParser c = clone(); c.resetSource(); c.sourceInputStream = Optional.ofNullable(inputStream); return c.asT(); } @Override public T source(final Path file) { final AbstractRDFParser c = clone(); c.resetSource(); c.sourceFile = Optional.ofNullable(file); return c.asT(); } @Override public T source(final IRI iri) { final AbstractRDFParser c = clone(); c.resetSource(); c.sourceIri = Optional.ofNullable(iri); c.sourceIri.ifPresent(i -> checkIsAbsolute(i)); return c.asT(); } @Override public T source(final String iri) throws IllegalArgumentException { final AbstractRDFParser c = clone(); c.resetSource(); c.sourceIri = Optional.ofNullable(iri).map(internalRdfTermFactory::createIRI); c.sourceIri.ifPresent(i -> checkIsAbsolute(i)); return source(internalRdfTermFactory.createIRI(iri)); } /** * Check if an iri is absolute. *

* Used by {@link #source(String)} and {@link #base(String)}. * * @param iri * IRI to check * @throws IllegalArgumentException * If the IRI is not absolute */ protected void checkIsAbsolute(final IRI iri) throws IllegalArgumentException { if (!URI.create(iri.getIRIString()).isAbsolute()) { throw new IllegalArgumentException("IRI is not absolute: " + iri); } } /** * Check that one and only one source is present and valid. *

* Used by {@link #parse()}. *

* Subclasses might override this method, e.g. to support other source * combinations, or to check if the sourceIri is resolvable. * * @throws IOException * If a source file can't be read */ protected void checkSource() throws IOException { if (!sourceFile.isPresent() && !sourceInputStream.isPresent() && !sourceIri.isPresent()) { throw new IllegalStateException("No source has been set"); } if (sourceIri.isPresent() && sourceInputStream.isPresent()) { throw new IllegalStateException("Both sourceIri and sourceInputStream have been set"); } if (sourceIri.isPresent() && sourceFile.isPresent()) { throw new IllegalStateException("Both sourceIri and sourceFile have been set"); } if (sourceInputStream.isPresent() && sourceFile.isPresent()) { throw new IllegalStateException("Both sourceInputStream and sourceFile have been set"); } if (sourceFile.isPresent() && !sourceFile.filter(Files::isReadable).isPresent()) { throw new IOException("Can't read file: " + sourceFile); } } /** * Check if base is required. * * @throws IllegalStateException * if base is required, but not set. */ protected void checkBaseRequired() throws IllegalStateException { if (!base.isPresent() && sourceInputStream.isPresent() && !contentTypeSyntax.filter(t -> t == RDFSyntax.NQUADS || t == RDFSyntax.NTRIPLES).isPresent()) { throw new IllegalStateException("base iri required for inputstream source"); } } /** * Reset all source* fields to Optional.empty() *

* Subclasses should override this and call super.resetSource() * if they need to reset any additional source* fields. * */ protected void resetSource() { sourceInputStream = Optional.empty(); sourceIri = Optional.empty(); sourceFile = Optional.empty(); } /** * Reset all optional target* fields to {@link Optional#empty()}. *

* Note that the consumer set for {@link #getTarget()} is * note reset. *

* Subclasses should override this and call super.resetTarget() * if they need to reset any additional target* fields. * */ protected void resetTarget() { targetDataset = Optional.empty(); targetGraph = Optional.empty(); } /** * Parse {@link #sourceInputStream}, {@link #sourceFile} or * {@link #sourceIri}. *

* One of the source fields MUST be present, as checked by * {@link #checkSource()}. *

* {@link #checkBaseRequired()} is called to verify if {@link #getBase()} is * required. * * @throws IOException * If the source could not be read * @throws RDFParseException * If the source could not be parsed (e.g. a .ttl file was not * valid Turtle) */ protected abstract void parseSynchronusly() throws IOException, RDFParseException; /** * Prepare a clone of this RDFParser which have been checked and completed. *

* The returned clone will always have {@link #getTarget()} and * {@link #getRdfTermFactory()} present. *

* If the {@link #getSourceFile()} is present, but the {@link #getBase()} is * not present, the base will be set to the file:/// IRI for * the Path's real path (e.g. resolving any symbolic links). * * @return A completed and checked clone of this RDFParser * @throws IOException * If the source was not accessible (e.g. a file was not found) * @throws IllegalStateException * If the parser was not in a compatible setting (e.g. * contentType was an invalid string) */ protected T prepareForParsing() throws IOException, IllegalStateException { checkSource(); checkBaseRequired(); checkContentType(); checkTarget(); // We'll make a clone of our current state which will be passed to // parseSynchronously() final AbstractRDFParser c = clone(); // Use a fresh SimpleRDF for each parse if (!c.rdfTermFactory.isPresent()) { c.rdfTermFactory = Optional.of(createRDFTermFactory()); } // sourceFile, but no base? Let's follow any symlinks and use // the file:/// URI if (c.sourceFile.isPresent() && !c.base.isPresent()) { final URI baseUri = c.sourceFile.get().toRealPath().toUri(); c.base = Optional.of(internalRdfTermFactory.createIRI(baseUri.toString())); } return c.asT(); } /** * Subclasses can override this method to check the target is valid. *

* The default implementation throws an IllegalStateException if the target * has not been set. */ protected void checkTarget() { if (target == null) { throw new IllegalStateException("target has not been set"); } if (targetGraph.isPresent() && targetDataset.isPresent()) { // This should not happen as each target(..) method resets the // optionals throw new IllegalStateException("targetGraph and targetDataset can't both be set"); } } /** * Subclasses can override this method to check compatibility with the * contentType setting. * * @throws IllegalStateException * if the {@link #getContentType()} or * {@link #getContentTypeSyntax()} is not compatible or invalid */ protected void checkContentType() throws IllegalStateException { } /** * Guess RDFSyntax from a local file's extension. *

* This method can be used by subclasses if {@link #getContentType()} is not * present and {@link #getSourceFile()} is set. * * @param path * Path which extension should be checked * @return The {@link RDFSyntax} which has a matching * {@link RDFSyntax#fileExtension}, otherwise * {@link Optional#empty()}. */ protected static Optional guessRDFSyntax(final Path path) { return fileExtension(path).flatMap(RDFSyntax::byFileExtension); } /** * Return the file extension of a Path - if any. *

* The returned file extension includes the leading . *

* Note that this only returns the last extension, e.g. the file extension * for archive.tar.gz would be .gz * * @param path * Path which filename might contain an extension * @return File extension (including the leading ., or * {@link Optional#empty()} if the path has no extension */ private static Optional fileExtension(final Path path) { final Path fileName = path.getFileName(); if (fileName == null) { return Optional.empty(); } final String filenameStr = fileName.toString(); final int last = filenameStr.lastIndexOf("."); if (last > -1) { return Optional.of(filenameStr.substring(last)); } return Optional.empty(); } /** * Create a new {@link RDF} for a parse session. *

* This is called by {@link #parse()} to set {@link #rdfTermFactory(RDF)} if * it is {@link Optional#empty()}. *

* As parsed blank nodes might be made with * {@link RDF#createBlankNode(String)}, each call to this method SHOULD * return a new RDF instance. * * @return A new {@link RDF} */ protected RDF createRDFTermFactory() { return new SimpleRDF(); } @Override public Future parse() throws IOException, IllegalStateException { final AbstractRDFParser c = prepareForParsing(); return threadpool.submit(() -> { c.parseSynchronusly(); return null; }); } @Override public T target(final Consumer consumer) { final AbstractRDFParser c = clone(); c.resetTarget(); c.target = consumer; return c.asT(); } @Override public T target(final Dataset dataset) { @SuppressWarnings({ "rawtypes", "unchecked" }) final AbstractRDFParser c = (AbstractRDFParser) RDFParser.super.target(dataset); c.resetTarget(); c.targetDataset = Optional.of(dataset); return c.asT(); } @Override public T target(final Graph graph) { @SuppressWarnings({ "rawtypes", "unchecked" }) // super calls our final // .clone() AbstractRDFParser c = (AbstractRDFParser) RDFParser.super.target(graph); c.resetTarget(); c.targetGraph = Optional.of(graph); return c.asT(); } } ././@LongLink0000644000000000000000000000017400000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental/RDFParseException.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental0000644000175000017500000000326213175733174033407 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple.experimental; import org.apache.commons.rdf.experimental.RDFParser; public class RDFParseException extends Exception { private static final long serialVersionUID = 5427752643780702976L; private final RDFParser builder; public RDFParseException(final RDFParser builder) { super(); this.builder = builder; } public RDFParseException(final RDFParser builder, final String message, final Throwable cause) { super(message, cause); this.builder = builder; } public RDFParseException(final RDFParser builder, final String message) { super(message); this.builder = builder; } public RDFParseException(final RDFParser builder, final Throwable cause) { super(cause); this.builder = builder; } public RDFParser getRDFParserBuilder() { return builder; } }././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDF.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDF.ja0000644000175000017500000000725713175733174033100 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import java.util.UUID; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.api.Triple; /** * Simple RDF implementation. *

* The {@link RDFTerm}, {@link Triple}, {@link Quad}, {@link Graph} and * {@link Dataset} instances created by SimpleRDF are simple in-memory * Implementations that are not thread-safe or efficient, but which may be * useful for testing and prototyping purposes. */ public class SimpleRDF implements RDF { /** * Marker interface to say that this RDFTerm is part of the Simple * implementation. Used by {@link GraphImpl} to avoid double remapping. *

* This method is package protected to avoid any third-party subclasses. * */ static interface SimpleRDFTerm extends RDFTerm { } /** * Unique salt per instance, for {@link #createBlankNode(String)} */ private final UUID SALT = UUID.randomUUID(); @Override public BlankNode createBlankNode() { return new BlankNodeImpl(); } @Override public BlankNode createBlankNode(final String name) { return new BlankNodeImpl(SALT, name); } @Override public Graph createGraph() { // Creates a GraphImpl object using this object as the factory for // delegating all object creation to return new GraphImpl(this); } @Override public Dataset createDataset() throws UnsupportedOperationException { return new DatasetImpl(this); } @Override public IRI createIRI(final String iri) { final IRI result = new IRIImpl(iri); // Reuse any IRI objects already created in Types return Types.get(result).orElse(result); } @Override public Literal createLiteral(final String literal) { return new LiteralImpl(literal); } @Override public Literal createLiteral(final String literal, final IRI dataType) { return new LiteralImpl(literal, dataType); } @Override public Literal createLiteral(final String literal, final String language) { return new LiteralImpl(literal, language); } @Override public Triple createTriple(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return new TripleImpl(subject, predicate, object); } @Override public Quad createQuad(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) throws IllegalArgumentException { return new QuadImpl(graphName, subject, predicate, object); } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/DatasetGraphView.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/DatasetGraph0000644000175000017500000001112113175733174033252 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import java.util.Optional; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; /** * A {@link Graph} view on a {@link Dataset}. *

* This view is backed by a {@link Dataset}, and can be constructed in two ways: * *

*
{@link #DatasetGraphView(Dataset)}
*
Expose a union graph view of the Dataset, where all the * {@link Quad}s of the Dataset is represented as a {@link Triple}. Adding * triples will add them to the default graph, while removing triples * will remove from all graphs.
* *
{@link #DatasetGraphView(Dataset, BlankNodeOrIRI)}
*
Expose a particular graph of the Dataset, either named by an {@link IRI}, * a {@link BlankNode}, or null for the default * graph.
*
*

* Changes in the Graph are reflected directly in the Dataset and vice versa. * This class is thread-safe is the underlying Dataset is thread-safe. */ public class DatasetGraphView implements Graph { private final boolean unionGraph; private final BlankNodeOrIRI namedGraph; private final Dataset dataset; public DatasetGraphView(final Dataset dataset) { this.dataset = dataset; this.namedGraph = null; this.unionGraph = true; } public DatasetGraphView(final Dataset dataset, final BlankNodeOrIRI namedGraph) { this.dataset = dataset; this.namedGraph = namedGraph; this.unionGraph = false; } @Override public void close() throws Exception { dataset.close(); } @Override public void add(final Triple triple) { dataset.add(namedGraph, triple.getSubject(), triple.getPredicate(), triple.getObject()); } @Override public void add(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { dataset.add(namedGraph, subject, predicate, object); } @Override public boolean contains(final Triple triple) { return dataset.contains(unionOrNamedGraph(), triple.getSubject(), triple.getPredicate(), triple.getObject()); } private Optional unionOrNamedGraph() { if (unionGraph) { return null; } return Optional.ofNullable(namedGraph); } @Override public boolean contains(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return dataset.contains(unionOrNamedGraph(), subject, predicate, object); } @Override public void remove(final Triple triple) { dataset.remove(unionOrNamedGraph(), triple.getSubject(), triple.getPredicate(), triple.getObject()); } @Override public void remove(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { dataset.remove(unionOrNamedGraph(), subject, predicate, object); } @Override public void clear() { dataset.remove(unionOrNamedGraph(), null, null, null); } @Override public long size() { return stream().count(); } @Override public Stream stream() { return stream(null, null, null); } @Override public Stream stream(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Stream stream = dataset.stream(unionOrNamedGraph(), subject, predicate, object).map(Quad::asTriple); if (unionGraph) { // remove duplicates return stream.distinct(); } return stream; } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/GraphImpl.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/GraphImpl.ja0000644000175000017500000001505213175733174033166 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import org.apache.commons.rdf.api.*; import org.apache.commons.rdf.simple.SimpleRDF.SimpleRDFTerm; import java.util.HashSet; import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; /** * A simple, memory-based implementation of Graph. *

* {@link Triple}s in the graph are kept in a {@link Set}. *

* All Stream operations are performed using parallel and unordered directives. */ final class GraphImpl implements Graph { private static final int TO_STRING_MAX = 10; private final Set triples = new HashSet<>(); private final SimpleRDF factory; GraphImpl(final SimpleRDF simpleRDF) { this.factory = simpleRDF; } @Override public void add(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final BlankNodeOrIRI newSubject = (BlankNodeOrIRI) internallyMap(subject); final IRI newPredicate = (IRI) internallyMap(predicate); final RDFTerm newObject = internallyMap(object); final Triple result = factory.createTriple(newSubject, newPredicate, newObject); triples.add(result); } @Override public void add(final Triple triple) { triples.add(internallyMap(triple)); } private RDFTerm internallyMap(final T object) { if (object == null || object instanceof SimpleRDFTerm) { // No need to re-map our own objects. // We support null as internallyMap() is also used by the filters, // and the // factory constructors later do null checks return object; } if (object instanceof BlankNode) { final BlankNode blankNode = (BlankNode) object; // This guarantees that adding the same BlankNode multiple times to // this graph will generate a local object that is mapped to an // equivalent object, based on the code in the package private // BlankNodeImpl class return factory.createBlankNode(blankNode.uniqueReference()); } else if (object instanceof IRI) { final IRI iri = (IRI) object; return factory.createIRI(iri.getIRIString()); } else if (object instanceof Literal) { final Literal literal = (Literal) object; if (literal.getLanguageTag().isPresent()) { return factory.createLiteral(literal.getLexicalForm(), literal.getLanguageTag().get()); } return factory.createLiteral(literal.getLexicalForm(), (IRI) internallyMap(literal.getDatatype())); } else { throw new IllegalArgumentException("RDFTerm was neither a BlankNode, IRI nor Literal: " + object); } } private Triple internallyMap(final Triple triple) { final BlankNodeOrIRI newSubject = (BlankNodeOrIRI) internallyMap(triple.getSubject()); final IRI newPredicate = (IRI) internallyMap(triple.getPredicate()); final RDFTerm newObject = internallyMap(triple.getObject()); // Check if any of the object references changed during the mapping, to // avoid creating a new Triple object if possible if (newSubject == triple.getSubject() && newPredicate == triple.getPredicate() && newObject == triple.getObject()) { return triple; } return factory.createTriple(newSubject, newPredicate, newObject); } @Override public void clear() { triples.clear(); } @Override public boolean contains(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return stream(subject, predicate, object).findFirst().isPresent(); } @Override public boolean contains(final Triple triple) { return triples.contains(internallyMap(triple)); } @Override public Stream stream() { return triples.parallelStream().unordered(); } @Override public Stream stream(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final BlankNodeOrIRI newSubject = (BlankNodeOrIRI) internallyMap(subject); final IRI newPredicate = (IRI) internallyMap(predicate); final RDFTerm newObject = internallyMap(object); return getTriples(t -> { // Lacking the requirement for .equals() we have to be silly // and test ntriples string equivalance if (subject != null && !t.getSubject().equals(newSubject)) { return false; } if (predicate != null && !t.getPredicate().equals(newPredicate)) { return false; } if (object != null && !t.getObject().equals(newObject)) { return false; } return true; }); } private Stream getTriples(final Predicate filter) { return stream().filter(filter); } @Override public void remove(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Stream toRemove = stream(subject, predicate, object); for (final Triple t : toRemove.collect(Collectors.toList())) { // Avoid ConcurrentModificationException in ArrayList remove(t); } } @Override public void remove(final Triple triple) { triples.remove(internallyMap(triple)); } @Override public long size() { return triples.size(); } @Override public String toString() { final String s = stream().limit(TO_STRING_MAX).map(Object::toString).collect(Collectors.joining("\n")); if (size() > TO_STRING_MAX) { return s + "\n# ... +" + (size() - TO_STRING_MAX) + " more"; } return s; } } apache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/IRIImpl.java0000644000175000017500000000366613175733174033107 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import org.apache.commons.rdf.api.IRI; import java.net.URI; /** * A simple implementation of IRI. */ final class IRIImpl implements IRI, SimpleRDF.SimpleRDFTerm { private final String iri; public IRIImpl(final String iri) { // should throw IllegalArgumentException on most illegal IRIs URI.create(iri); // NOTE: We don't keep the URI as it uses outdated RFC2396 and will get // some IDNs wrong this.iri = iri; } @Override public String getIRIString() { return iri; } @Override public String ntriplesString() { return "<" + getIRIString() + ">"; } @Override public String toString() { return ntriplesString(); } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof IRI)) { return false; } final IRI other = (IRI) obj; return getIRIString().equals(other.getIRIString()); } @Override public int hashCode() { return iri.hashCode(); } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/BlankNodeImpl.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/BlankNodeImp0000644000175000017500000000746613175733174033227 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import java.nio.charset.StandardCharsets; import java.util.Objects; import java.util.UUID; import java.util.concurrent.atomic.AtomicLong; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.simple.SimpleRDF.SimpleRDFTerm; /** * A simple implementation of BlankNode. */ final class BlankNodeImpl implements BlankNode, SimpleRDFTerm { private static final UUID SALT = UUID.randomUUID(); private static final AtomicLong COUNTER = new AtomicLong(); private final String uniqueReference; public BlankNodeImpl() { this(SALT, Long.toString(COUNTER.incrementAndGet())); } public BlankNodeImpl(final UUID uuidSalt, final String name) { if (Objects.requireNonNull(name).isEmpty()) { throw new IllegalArgumentException("Invalid blank node id: " + name); } // Build a semi-URN - to be hashed for a name-based UUID below // Both the scope and the id are used to create the UUID, ensuring that // a caller can reliably create the same bnode if necessary by sending // in the same scope to RDF.createBlankNode(String) final String uuidInput = "urn:uuid:" + uuidSalt + "#" + name; // The above is not a good value for this.id, as the id // needs to be further escaped for // ntriplesString() (there are no restrictions on // RDF.createBlankNode(String) ). // Rather than implement ntriples escaping here, and knowing // our uniqueReference() contain a UUID anyway, we simply // create another name-based UUID, and use it within both // uniqueReference() and within ntriplesString(). // // A side-effect from this is that the blank node identifier // is not preserved or shown in ntriplesString. In a way // this is a feature, not a bug. as the contract for RDF // has no such requirement. this.uniqueReference = UUID.nameUUIDFromBytes(uuidInput.getBytes(StandardCharsets.UTF_8)).toString(); } @Override public String uniqueReference() { return uniqueReference; } @Override public String ntriplesString() { return "_:" + uniqueReference; } @Override public String toString() { return ntriplesString(); } @Override public int hashCode() { return uniqueReference.hashCode(); } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } // We don't support equality with other implementations if (!(obj instanceof BlankNodeImpl)) { return false; } final BlankNodeImpl other = (BlankNodeImpl) obj; if (uniqueReference == null) { if (other.uniqueReference != null) { return false; } } else if (!uniqueReference.equals(other.uniqueReference)) { return false; } return true; } } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/QuadImpl.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/QuadImpl.jav0000644000175000017500000000661313175733174033210 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import java.util.Objects; import java.util.Optional; /** * A simple implementation of Quad. */ final class QuadImpl implements Quad { private final BlankNodeOrIRI graphName; private final BlankNodeOrIRI subject; private final IRI predicate; private final RDFTerm object; /** * Construct Quad from its constituent parts. *

* The objects are not changed. All mapping of BNode objects is done in * {@link SimpleRDF#createQuad(BlankNodeOrIRI, BlankNodeOrIRI, IRI, RDFTerm)}. * * @param graphName * graphName of triple * @param subject * subject of triple * @param predicate * predicate of triple * @param object * object of triple */ public QuadImpl(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { this.graphName = graphName; // possibly null this.subject = Objects.requireNonNull(subject); this.predicate = Objects.requireNonNull(predicate); this.object = Objects.requireNonNull(object); } @Override public Optional getGraphName() { return Optional.ofNullable(graphName); } @Override public BlankNodeOrIRI getSubject() { return subject; } @Override public IRI getPredicate() { return predicate; } @Override public RDFTerm getObject() { return object; } @Override public String toString() { return getSubject().ntriplesString() + " " + getPredicate().ntriplesString() + " " + getObject().ntriplesString() + " " + getGraphName().map(g -> g.ntriplesString() + " ").orElse("") + "."; } @Override public int hashCode() { return Objects.hash(subject, predicate, object, graphName); } @Override public boolean equals(final Object obj) { if (!(obj instanceof Quad)) { return false; } final Quad other = (Quad) obj; return getGraphName().equals(other.getGraphName()) && getSubject().equals(other.getSubject()) && getPredicate().equals(other.getPredicate()) && getObject().equals(other.getObject()); } @Override public Triple asTriple() { return new TripleImpl(getSubject(), getPredicate(), getObject()); } } ././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDFTermFactory.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDFTer0000644000175000017500000000474413175733174033160 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.RDFTermFactory; import org.apache.commons.rdf.api.Triple; /** * A Simple implementation of {@link RDFTermFactory} *

* This class is deprecated, use instead {@link SimpleRDF}. */ @Deprecated public class SimpleRDFTermFactory implements RDFTermFactory { private final SimpleRDF factory = new SimpleRDF(); @Override public BlankNode createBlankNode() { return factory.createBlankNode(); } @Override public BlankNode createBlankNode(final String name) { return factory.createBlankNode(name); } @Override public Graph createGraph() { return factory.createGraph(); } @Override public IRI createIRI(final String iri) { return factory.createIRI(iri); } @Override public Literal createLiteral(final String literal) { return factory.createLiteral(literal); } @Override public Literal createLiteral(final String literal, final IRI dataType) { return factory.createLiteral(literal, dataType); } @Override public Literal createLiteral(final String literal, final String language) { return factory.createLiteral(literal, language); } @Override public Triple createTriple(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return factory.createTriple(subject, predicate, object); } } apache-commons-rdf-0.5.0/commons-rdf-simple/src/main/resources/0000755000175000017500000000000013175733174024326 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/resources/META-INF/0000755000175000017500000000000013212356336025457 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/resources/META-INF/NOTICE0000644000175000017500000000025413212356336026364 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-simple/src/main/resources/META-INF/services/0000755000175000017500000000000013175733174027311 5ustar andriusandrius././@LongLink0000644000000000000000000000017300000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/resources/META-INF/services/org.apache.commons.rdf.api.RDFTermFactoryapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/resources/META-INF/services/org.apache.commons.0000644000175000017500000000006313175733174032772 0ustar andriusandriusorg.apache.commons.rdf.simple.SimpleRDFTermFactory ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/resources/META-INF/services/org.apache.commons.rdf.api.RDFapache-commons-rdf-0.5.0/commons-rdf-simple/src/main/resources/META-INF/services/org.apache.commons.0000644000175000017500000000005013175733174032766 0ustar andriusandriusorg.apache.commons.rdf.simple.SimpleRDF apache-commons-rdf-0.5.0/commons-rdf-simple/src/main/resources/META-INF/LICENSE0000644000175000017500000002613613175733174026503 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-simple/src/site/0000755000175000017500000000000013175733174022334 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/site/resources/0000755000175000017500000000000013175733174024346 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/site/resources/profile.japicmp0000644000175000017500000000000013175733174027341 0ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/site/resources/profile.jacoco0000644000175000017500000000000013175733174027154 0ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/0000755000175000017500000000000013212356336022340 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/0000755000175000017500000000000013175733174023270 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/0000755000175000017500000000000013175733174024057 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/0000755000175000017500000000000013175733174025300 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/0000755000175000017500000000000013175733174026753 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/0000755000175000017500000000000013175733174027526 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/0000755000175000017500000000000013175733174031017 5ustar andriusandrius././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/SimpleRDFTest.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/SimpleRDFTes0000644000175000017500000000212113175733174033177 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import org.apache.commons.rdf.api.AbstractRDFTest; import org.apache.commons.rdf.api.RDF; /** * Simple RDF Test */ public class SimpleRDFTest extends AbstractRDFTest { @Override public RDF createFactory() { return new SimpleRDF(); } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/TestWritingGraph.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/TestWritingG0000644000175000017500000001253013175733174033335 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import static org.junit.Assert.assertEquals; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.stream.Stream; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.api.Triple; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; /** * Test writing graph */ public class TestWritingGraph { /* * 200k triples should do - about 7 MB on disk. Override with * -Dtriples=20000000 to exercise your memory banks. */ private static final long TRIPLES = Long.getLong("triples", 200000L); /** * Run tests with -Dkeepfiles=true to inspect /tmp files * */ private static boolean KEEP_FILES = Boolean.getBoolean("keepfiles"); private static Graph graph; private static RDF factory; @BeforeClass public static void createGraph() throws Exception { factory = new SimpleRDF(); graph = factory.createGraph(); final IRI subject = factory.createIRI("subj"); final IRI predicate = factory.createIRI("pred"); final List types = new ArrayList<>(Types.values()); // Ensure we don't try to create a literal with rdf:langString but // without a language tag types.remove(Types.RDF_LANGSTRING); Collections.shuffle(types); for (int i = 0; i < TRIPLES; i++) { if (i % 11 == 0) { graph.add(subject, predicate, factory.createBlankNode("Example " + i)); } else if (i % 5 == 0) { graph.add(subject, predicate, factory.createLiteral("Example " + i, "en")); } else if (i % 3 == 0) { graph.add(subject, predicate, factory.createLiteral("Example " + i, types.get(i % types.size()))); } else { graph.add(subject, predicate, factory.createLiteral("Example " + i)); } } } @AfterClass public static void tearDownClass() throws Exception { graph.clear(); graph = null; } @Test public void createGraphTiming() throws Exception { createGraph(); } @Test public void countQuery() { final IRI subject = factory.createIRI("subj"); final IRI predicate = factory.createIRI("pred"); final long count = graph.stream(subject, predicate, null).unordered().parallel().count(); // System.out.println("Counted - " + count); assertEquals(count, TRIPLES); } public static String tripleAsString(final Triple t) { return t.getSubject().ntriplesString() + " " + t.getPredicate().ntriplesString() + " " + t.getObject().ntriplesString() + " ."; } @Test public void writeGraphFromStream() throws Exception { final Path graphFile = Files.createTempFile("graph", ".nt"); if (KEEP_FILES) { System.out.println("From stream: " + graphFile); } else { graphFile.toFile().deleteOnExit(); } final Stream stream = graph.stream().map(TestWritingGraph::tripleAsString); Files.write(graphFile, stream::iterator, StandardCharsets.UTF_8); } @Test public void writeGraphFromStreamFiltered() throws Exception { final Path graphFile = Files.createTempFile("graph", ".nt"); if (KEEP_FILES) { System.out.println("Filtered stream: " + graphFile); } else { graphFile.toFile().deleteOnExit(); } final IRI subject = factory.createIRI("subj"); final IRI predicate = factory.createIRI("pred"); final Stream stream = graph.stream(subject, predicate, null).map(TestWritingGraph::tripleAsString); Files.write(graphFile, stream::iterator, StandardCharsets.UTF_8); } @Test public void writeGraphFromStreamFilteredNoMatches() throws Exception { final Path graphFile = Files.createTempFile("graph-empty-", ".nt"); if (KEEP_FILES) { System.out.println("Filtered stream: " + graphFile); } else { graphFile.toFile().deleteOnExit(); } final IRI subject = factory.createIRI("nonexistent"); final IRI predicate = factory.createIRI("pred"); final Stream stream = graph.stream(subject, predicate, null).map(Object::toString); Files.write(graphFile, stream::iterator, StandardCharsets.UTF_8); } } ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/SimpleDatasetTest.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/SimpleDatase0000644000175000017500000000340313175733174033315 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import static org.junit.Assert.*; import org.apache.commons.rdf.api.AbstractDatasetTest; import org.apache.commons.rdf.api.RDF; import org.junit.Assume; import org.junit.Test; /** * Test SimpleRDF with AbstractGraphTest */ public class SimpleDatasetTest extends AbstractDatasetTest { @Override public RDF createFactory() { return new SimpleRDF(); } @Test public void datasetToString() { Assume.assumeNotNull(aliceName, companyName); //System.out.println(dataset); assertTrue( dataset.toString().contains(" \"Alice\" .")); assertTrue(dataset.toString().contains(" \"A company\" _:")); assertTrue(dataset.toString().contains(" .")); } } ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/SimpleGraphTest.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/SimpleGraphT0000644000175000017500000000311013175733174033274 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import static org.junit.Assert.assertTrue; import org.apache.commons.rdf.api.AbstractGraphTest; import org.apache.commons.rdf.api.RDF; import org.junit.Assume; import org.junit.Test; /** * Test SimpleRDF with AbstractGraphTest */ public class SimpleGraphTest extends AbstractGraphTest { @Override public RDF createFactory() { return new SimpleRDF(); } @Test public void graphToString() { Assume.assumeNotNull(aliceName, companyName); // System.out.println(graph); assertTrue( graph.toString().contains(" \"Alice\" .")); assertTrue(graph.toString().contains(" \"A company\" .")); } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/TypesTest.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/TypesTest.ja0000644000175000017500000000430713175733174033303 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; /** * Tests for the {@link org.apache.commons.rdf.simple.Types} enumeration. */ public class TypesTest { /** * Test method for * {@link org.apache.commons.rdf.simple.Types#getIRIString()} . */ @Test public final void testGetIRIString() { assertEquals("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString", Types.RDF_LANGSTRING.getIRIString()); } /** * Test method for * {@link org.apache.commons.rdf.simple.Types#ntriplesString()}. */ @Test public final void testNtriplesString() { assertEquals("", Types.RDF_LANGSTRING.ntriplesString()); } /** * Test method for * {@link org.apache.commons.rdf.simple.Types#get(org.apache.commons.rdf.api.IRI)} * . */ @Test public final void testGet() { assertTrue(Types.get(new IRIImpl("http://www.w3.org/2001/XMLSchema#boolean")).isPresent()); assertEquals("http://www.w3.org/2001/XMLSchema#boolean", Types.get(new IRIImpl("http://www.w3.org/2001/XMLSchema#boolean")).get().getIRIString()); assertFalse(Types.get(new IRIImpl("http://www.w3.org/2001/XMLSchema#nonExistent")).isPresent()); } } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/experimental/apache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/experimental0000755000175000017500000000000013175733174033435 5ustar andriusandrius././@LongLink0000644000000000000000000000020000000000000011573 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/experimental/AbstractRDFParserTest.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/experimental0000644000175000017500000003022713175733174033443 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple.experimental; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeNotNull; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.util.concurrent.TimeUnit; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.RDFSyntax; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.experimental.RDFParser; import org.apache.commons.rdf.simple.DummyRDFParserBuilder; import org.apache.commons.rdf.simple.SimpleRDF; import org.apache.commons.rdf.simple.Types; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; public class AbstractRDFParserTest { private final RDF factory = new SimpleRDF(); private final DummyRDFParserBuilder dummyParser = new DummyRDFParserBuilder(); private Path testNt; private Path testTtl; private Path testXml; private Path symlink; @Before public void createTempFile() throws IOException { testNt = Files.createTempFile("test", ".nt"); testTtl = Files.createTempFile("test", ".ttl"); testXml = Files.createTempFile("test", ".xml"); // No need to populate the files as the dummy parser // doesn't actually read anything // If supported, we'll make a symbolic link final Path symlinks = Files.createTempDirectory("symlinked"); try { symlink = Files.createSymbolicLink( symlinks.resolve("linked.ttl"), testNt); } catch (IOException|UnsupportedOperationException ex) { symlink = null; } } @After public void deleteTempFiles() throws IOException { Files.deleteIfExists(testNt); Files.deleteIfExists(testTtl); Files.deleteIfExists(testXml); } @Test public void guessRDFSyntax() throws Exception { assertEquals(RDFSyntax.NTRIPLES, AbstractRDFParser.guessRDFSyntax(testNt).get()); assertEquals(RDFSyntax.TURTLE, AbstractRDFParser.guessRDFSyntax(testTtl).get()); assertFalse(AbstractRDFParser.guessRDFSyntax(testXml).isPresent()); } private void checkGraph(final Graph g) throws Exception { assertTrue(g.size() > 0); final IRI greeting = factory.createIRI("http://example.com/greeting"); // Should only have parsed once! assertEquals(1, g.stream(null, greeting, null).count()); final Triple triple = g.stream(null, greeting, null).findAny().get(); assertTrue(triple.getSubject() instanceof IRI); final IRI parsing = (IRI) triple.getSubject(); assertTrue(parsing.getIRIString().startsWith("urn:uuid:")); assertEquals("http://example.com/greeting", triple.getPredicate().getIRIString()); assertTrue(triple.getObject() instanceof Literal); final Literal literal = (Literal) triple.getObject(); assertEquals("Hello world", literal.getLexicalForm()); assertFalse(literal.getLanguageTag().isPresent()); assertEquals(Types.XSD_STRING, literal.getDatatype()); // Check uniqueness of properties that are always present assertEquals(1, g.stream(null, factory.createIRI("http://example.com/source"), null).count()); // Check optional properties that are unique assertTrue(2 > g.stream(null, factory.createIRI("http://example.com/base"), null).count()); assertTrue(2 > g.stream(null, factory.createIRI("http://example.com/contentType"), null).count()); assertTrue(2 > g.stream(null, factory.createIRI("http://example.com/contentTypeSyntax"), null).count()); } @Test public void parseFile() throws Exception { try (final Graph g = factory.createGraph()) { final RDFParser parser = dummyParser.source(testNt).target(g); parser.parse().get(5, TimeUnit.SECONDS); checkGraph(g); // FIXME: this could potentially break if the equivalent of /tmp // includes // international characters assertEquals("<" + testNt.toUri().toString() + ">", firstPredicate(g, "source")); // Should be set to the file path - after following symlinks assertEquals("<" + testNt.toRealPath().toUri().toString() + ">", firstPredicate(g, "base")); // Should NOT have guessed the content type assertNull(firstPredicate(g, "contentType")); assertNull(firstPredicate(g, "contentTypeSyntax")); } } @Test public void parseFileSymlink() throws Exception { // This test will typically not work in Windows // which requires system privileges to create symlinks assumeNotNull(symlink); try (final Graph g = factory.createGraph()) { final RDFParser parser = dummyParser.source(symlink).target(g); parser.parse().get(5, TimeUnit.SECONDS); checkGraph(g); assertEquals("<" + symlink.toUri().toString() + ">", firstPredicate(g, "source")); assertEquals("<" + testNt.toRealPath().toUri().toString() + ">", firstPredicate(g, "base")); } } @Test public void parseNoSource() throws Exception { thrown.expect(IllegalStateException.class); dummyParser.parse(); } @Test public void parseBaseAndContentTypeNoSource() throws Exception { // Can set the other options, even without source() final IRI base = dummyParser.createRDFTermFactory().createIRI("http://www.example.org/test.rdf"); final RDFParser parser = dummyParser.base(base).contentType(RDFSyntax.RDFXML); thrown.expect(IllegalStateException.class); thrown.expectMessage("No source has been set"); // but .parse() should fail parser.parse(); } @Test public void parseFileMissing() throws Exception { Files.delete(testNt); // This should not fail yet final RDFParser parser = dummyParser.source(testNt); // but here: thrown.expect(IOException.class); parser.parse(); } @Test public void parseFileContentType() throws Exception { try (final Graph g = factory.createGraph()) { final RDFParser parser = dummyParser.source(testNt).contentType(RDFSyntax.NTRIPLES).target(g); parser.parse().get(5, TimeUnit.SECONDS); checkGraph(g); // FIXME: this could potentially break if the equivalent of /tmp // includes // international characters assertEquals("<" + testNt.toUri().toString() + ">", firstPredicate(g, "source")); // Should be set to the file path - after following symlinks assertEquals("<" + testNt.toRealPath().toUri().toString() + ">", firstPredicate(g, "base")); assertEquals("\"" + RDFSyntax.NTRIPLES.name() + "\"", firstPredicate(g, "contentTypeSyntax")); assertEquals("\"application/n-triples\"", firstPredicate(g, "contentType")); } } private String firstPredicate(final Graph g, final String pred) { return g.stream(null, factory.createIRI("http://example.com/" + pred), null).map(Triple::getObject) .map(RDFTerm::ntriplesString).findAny().orElse(null); } @Rule public ExpectedException thrown = ExpectedException.none(); @Test public void parseInputStreamFailsIfBaseMissing() throws Exception { final InputStream inputStream = new ByteArrayInputStream(new byte[0]); // Should not fail at this point final RDFParser parser = dummyParser.source(inputStream); // but here: thrown.expect(IllegalStateException.class); thrown.expectMessage("base iri required for inputstream source"); parser.parse(); } @Test public void parseInputStreamWithBase() throws Exception { final InputStream inputStream = new ByteArrayInputStream(new byte[0]); final IRI base = dummyParser.createRDFTermFactory().createIRI("http://www.example.org/test.rdf"); try (final Graph g = factory.createGraph()) { final RDFParser parser = dummyParser.source(inputStream).base(base).target(g); parser.parse().get(5, TimeUnit.SECONDS); checkGraph(g); assertEquals("", firstPredicate(g, "base")); // in our particular debug output, // bnode source indicates InputStream assertTrue(firstPredicate(g, "source").startsWith("_:")); assertNull(firstPredicate(g, "contentType")); assertNull(firstPredicate(g, "contentTypeSyntax")); } } @Test public void parseInputStreamWithNQuads() throws Exception { final InputStream inputStream = new ByteArrayInputStream(new byte[0]); try (final Graph g = factory.createGraph()) { final RDFParser parser = dummyParser.source(inputStream).contentType(RDFSyntax.NQUADS).target(g); parser.parse().get(5, TimeUnit.SECONDS); checkGraph(g); assertNull(firstPredicate(g, "base")); // in our particular debug output, // bnode source indicates InputStream assertTrue(firstPredicate(g, "source").startsWith("_:")); assertEquals("\"application/n-quads\"", firstPredicate(g, "contentType")); assertEquals("\"" + RDFSyntax.NQUADS.name() + "\"", firstPredicate(g, "contentTypeSyntax")); } } @Test public void parseIRI() throws Exception { final IRI iri = dummyParser.createRDFTermFactory().createIRI("http://www.example.net/test.ttl"); try (final Graph g = factory.createGraph()) { final RDFParser parser = dummyParser.source(iri).target(g); parser.parse().get(5, TimeUnit.SECONDS); checkGraph(g); assertEquals("", firstPredicate(g, "source")); // No base - assuming the above IRI is always // the base would break server-supplied base from // any HTTP Location redirects and Content-Location header assertNull(firstPredicate(g, "base")); // ".ttl" in IRI string does not imply any content type assertNull(firstPredicate(g, "contentType")); assertNull(firstPredicate(g, "contentTypeSyntax")); } } @Test public void parseIRIBaseContentType() throws Exception { final IRI iri = dummyParser.createRDFTermFactory().createIRI("http://www.example.net/test.ttl"); try (final Graph g = factory.createGraph()) { final RDFParser parser = dummyParser.source(iri).base(iri).contentType(RDFSyntax.TURTLE).target(g); parser.parse().get(5, TimeUnit.SECONDS); checkGraph(g); assertEquals("", firstPredicate(g, "source")); assertEquals("", firstPredicate(g, "base")); assertEquals("\"" + RDFSyntax.TURTLE.name() + "\"", firstPredicate(g, "contentTypeSyntax")); assertEquals("\"text/turtle\"", firstPredicate(g, "contentType")); } } } ././@LongLink0000644000000000000000000000016500000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/SimpleServiceLoaderTest.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/SimpleServic0000644000175000017500000000250513175733174033351 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import static org.junit.Assert.fail; import java.util.ServiceLoader; import org.apache.commons.rdf.api.RDF; import org.junit.Test; public class SimpleServiceLoaderTest { @Test public void testServiceLoaderLookup() { final ServiceLoader loader = ServiceLoader.load(RDF.class); for (final RDF impl : loader) { if (impl instanceof SimpleRDF) { return; // yay } } fail("SimpleRDF not found in ServiceLoader"); } } ././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/DummyRDFParserBuilder.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/DummyRDFPars0000644000175000017500000001001413175733174033213 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import java.io.IOException; import java.util.UUID; import java.util.function.Consumer; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.experimental.RDFParser; import org.apache.commons.rdf.simple.experimental.AbstractRDFParser; import org.apache.commons.rdf.simple.experimental.RDFParseException; /** * For test purposes - a {@link RDFParser} that inserts information about what * it has been asked to parse instead of actually parsing anything. *

* This always insert at least the triple equivalent to: * *

 *    <urn:uuid:b7ac3fcc-4d86-4d28-8358-a1cd094974a6> <http://example.com/greeting> "Hello world" .
 * 
* * Additional triples match the corresponding getter in AbstractRDFParser, e.g.: * *
 *   <urn:uuid:b7ac3fcc-4d86-4d28-8358-a1cd094974a6> <http://example.com/base> <http://www.example.org/> .
 *   <urn:uuid:b7ac3fcc-4d86-4d28-8358-a1cd094974a6> <http://example.com/sourceFile> "/tmp/file.ttl" .
 * 
* * */ public class DummyRDFParserBuilder extends AbstractRDFParser { @Override protected void parseSynchronusly() throws IOException, IllegalStateException, RDFParseException { // From parseSynchronusly both of these are always present final RDF factory = getRdfTermFactory().get(); final Consumer t = getTarget(); // well - each parsing is unique. This should hopefully // catch any accidental double parsing final IRI parsing = factory.createIRI("urn:uuid:" + UUID.randomUUID()); t.accept(factory.createQuad(null, parsing, factory.createIRI("http://example.com/greeting"), factory.createLiteral("Hello world"))); // Now we'll expose the finalized AbstractRDFParser settings // so they can be inspected by the junit test if (getSourceIri().isPresent()) { t.accept(factory.createQuad(null, parsing, factory.createIRI("http://example.com/source"), getSourceIri().get())); } if (getSourceFile().isPresent()) { t.accept(factory.createQuad(null, parsing, factory.createIRI("http://example.com/source"), factory.createIRI(getSourceFile().get().toUri().toString()))); } if (getSourceInputStream().isPresent()) { t.accept(factory.createQuad(null, parsing, factory.createIRI("http://example.com/source"), factory.createBlankNode())); } if (getBase().isPresent()) { t.accept(factory.createQuad(null, parsing, factory.createIRI("http://example.com/base"), getBase().get())); } if (getContentType().isPresent()) { t.accept(factory.createQuad(null, parsing, factory.createIRI("http://example.com/contentType"), factory.createLiteral(getContentType().get()))); } if (getContentTypeSyntax().isPresent()) { t.accept(factory.createQuad(null, parsing, factory.createIRI("http://example.com/contentTypeSyntax"), factory.createLiteral(getContentTypeSyntax().get().name()))); } } } ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/BlankNodeImplTest.javaapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/BlankNodeImp0000644000175000017500000000266113175733174033252 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.simple; import java.util.UUID; import org.apache.commons.rdf.api.AbstractBlankNodeTest; import org.apache.commons.rdf.api.BlankNode; /** * Concrete implementation of BlankNodeImpl test. */ public class BlankNodeImplTest extends AbstractBlankNodeTest { // Fixed salt just for this test private static UUID SALT = UUID.fromString("35019b59-18b3-4e74-8707-ec55f62a37d6"); @Override protected BlankNode getBlankNode() { return new BlankNodeImpl(); } @Override protected BlankNode getBlankNode(final String identifier) { return new BlankNodeImpl(SALT, identifier); } } apache-commons-rdf-0.5.0/commons-rdf-simple/src/test/resources/0000755000175000017500000000000013212356336024352 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-simple/src/test/resources/NOTICE0000644000175000017500000000025413212356336025257 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-simple/src/test/resources/LICENSE0000644000175000017500000002613613212356336025367 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-simple/pom.xml0000644000175000017500000000552513212356730022114 0ustar andriusandrius 4.0.0 org.apache.commons commons-rdf-parent 0.5.0 commons-rdf-simple jar Commons RDF impl: Simple Simple (if not naive) implementation of Commons RDF API commonsrdf-api-site scm:svn:${commons.scmPubUrl}/simple/ ${project.parent.groupId} commons-rdf-api ${project.version} ${project.parent.groupId} commons-rdf-api ${project.version} tests test org.apache.felix maven-bundle-plugin org.apache.commons.rdf.simple org.apache.commons.rdf.simple osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional osgi.serviceloader; osgi.serviceloader=org.apache.commons.rdf.api.RDF apache-commons-rdf-0.5.0/src/0000755000175000017500000000000014132221255015637 5ustar andriusandriusapache-commons-rdf-0.5.0/src/assembly/0000755000175000017500000000000014132221255017456 5ustar andriusandriusapache-commons-rdf-0.5.0/src/assembly/src.xml0000644000175000017500000000332313175455642021007 0ustar andriusandrius src zip tar.gz ${project.basedir} **/*~ pom.xml.* prelease.properties **/target/** **/.*/** **/*.iml **/*.ipr **/*.iws .project .classpath .metadata atlassian-ide-plugin.xml apache-commons-rdf-0.5.0/src/changes/0000755000175000017500000000000014132221255017247 5ustar andriusandriusapache-commons-rdf-0.5.0/src/changes/changes.xml0000644000175000017500000000641413212355376021420 0ustar andriusandrius Apache Commons RDF Release Notes RDFSyntax should be interface, not enum RDF-1.1 specifies that language tags need to be compared using lower-case Duplicate Bundle-SymbolicName values across all components Stream of Jena quads use wrong IRI for default graph Use newer dependency Jena/RDF4J/JSONLD Java japicmp-maven-plugin breaking build because there is at least one incompatibility AbstractRDFParserTest.parseFile and parseFileContentType broken under Mac OS X JenaDatasetImpl.toString() throws RIOT exception Add ServiceLoader support in OSGi overloaded versions of RDF4J#asRDFTerm(org.eclipse.rdf4j.model.Value) Fix javadocs warnings Add Automatic-Module-Name to bundle manifest Upgrade to Jena 3.4.0, RDF4J 2.2.2 Upgrade Jena version to 3.5.0 Initial Release. apache-commons-rdf-0.5.0/src/site/0000755000175000017500000000000014132221255016603 5ustar andriusandriusapache-commons-rdf-0.5.0/src/site/markdown/0000755000175000017500000000000014132221255020425 5ustar andriusandriusapache-commons-rdf-0.5.0/src/site/markdown/contributing.md0000644000175000017500000000575013175455642023504 0ustar andriusandrius # Contribute Contributions to this project will be gratefully received. Feel free to subscribe to the [dev@commons](mail-lists.html) mailing list to follow the ongoing development of Commons RDF, ask questions about its usage, or help shape Commons RDF by contributing your ideas, code and use cases. Please use the Subject tag `[RDF]` in your posts. You can contribute to Apache Commons RDF in many ways: * Participate in the design discussions on [dev@commons](mail-lists.html) * Implement the Commons RDF API in your own [implementation](implementations.html) * Raise an [issue](https://issues.apache.org/jira/browse/COMMONSRDF) * Raise a [pull request](https://github.com/apache/commons-rdf/pulls) to: + Contribute new [tests](https://github.com/apache/commons-rdf/tree/master/api/src/test/java/org/apache/commons/rdf/api) + Suggest changes to the [API](https://github.com/apache/commons-rdf/tree/master/api/) + Improve the [Javadocs](apidocs/) + Fix bugs in the [simple](https://github.com/apache/commons-rdf/tree/master/simple/src/main/java/org/apache/commons/rdf/simple) implementation + .. and more * Improve the [website](https://commons.apache.org/proper/commons-rdf/) by: + Raising a pull request for changes to [src/site](https://github.com/apache/commons-rdf/tree/master/src/site) + Contribute example use cases All ASF committers have write access to Apache Commons repositories and are welcome to contribute directly. (No need to ask!) Please make sure you have subscribed to the [dev@commons](mail-lists.html) list first for any feedback. We do ask that you raise a corresponding [issue](https://issues.apache.org/jira/browse/COMMONSRDF) referenced in your commits (e.g. `COMMONSRDF-999: Avoid NullPointerException in GraphImpl.iterate()`). Larger changes or any changes to the [api](api/) should be raised as a [pull request](https://github.com/apache/commons-rdf/pulls) for code review and discussion. All contributions are assumed to be under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0), however we may ask you to also sign a [software grant](https://www.apache.org/licenses/software-grant.txt) for any larger contributions. apache-commons-rdf-0.5.0/src/site/markdown/download.md0000644000175000017500000001012013212355376022562 0ustar andriusandrius # Download Commons RDF ## Maven Apache Commons RDF is available from [Maven Central](https://repo.maven.apache.org/maven2/org/apache/commons/commons-rdf-api/), mirrored from [ASF's Maven repository](https://repository.apache.org/content/repositories/releases/org/apache/commons/commons-rdf-api/). For convenience of IDE users, the Maven artifacts include `-javadoc.jar` and `-sources.jar`, however you might prefer the online [API javadoc](apidocs/) and the [source code releases](#Source_code) (see below). To use Commons RDF with [Maven](https://maven.apache.org/), add to your `pom.xml`: ```xml org.apache.commons commons-rdf-api 0.5.0 org.apache.commons commons-rdf-simple 0.5.0 org.apache.commons commons-rdf-jsonld-java 0.5.0 org.apache.commons commons-rdf-jena 0.5.0 org.apache.commons commons-rdf-rdf4j 0.5.0 ``` The `` above might not be up to date, see the [source code releases](#Source_code) below to find the latest version. See the [user guide](userguide.html) for documentation of the Apache Commons RDF API, and the [implementations](implementations.html) for details on each of the bindings. ## Source code Here you can find all source releases published of Apache Commons RDF. For the latest developments you may also be interested in the [source code repository](source-repository.html), which is also [mirrored to GitHub](http://github.com/apache/commons-rdf). ### 0.5.0 **Apache Commons RDF 0.5.0** was published on 2017-11-XX, and is available for download from official mirrors of the ASF Distribution Directory [incubator/commonsrdf](https://www.apache.org/dyn/closer.lua/incubator/commonsrdf/0.5.0/): * [apache-commons-rdf-0.5.0-src.zip](https://www.apache.org/dyn/closer.lua/incubator/commonsrdf/0.5.0/apache-commons-rdf-0.5.0-src.zip) ([asc](https://www.apache.org/dist/incubator/commonsrdf/0.5.0/apache-commons-rdf-0.5.0-src.zip.asc), [md5](https://www.apache.org/dist/incubator/commonsrdf/0.5.0/apache-commons-rdf-0.5.0-src.zip.md5), [sha1](https://www.apache.org/dist/incubator/commonsrdf/0.5.0/apache-commons-rdf-0.5.0-src.zip.sha1)) After downloading the files, [check the signatures](https://www.apache.org/info/verification.html) using the following [KEYS](https://www.apache.org/dist/incubator/commonsrdf/KEYS) file. The [changelog](https://s.apache.org/rdf-0.3.0) is available from the [Apache Commons RDF Jira](https://issues.apache.org/jira/browse/COMMONSRDF). ### Previous Releases Previous release are available from [archive.apache.org](https://archive.apache.org/dist/commons/rdf/). Note that earlier [incubator releases](https://archive.apache.org/dist/incubator/commonsrdf/) (0.3.0-incubating and earlier) are archived separately. apache-commons-rdf-0.5.0/src/site/markdown/implementations.md0000644000175000017500000002534613212355376024203 0ustar andriusandrius # Implementations The Commons RDF API must be used with one or more implementations. The Apache Commons RDF distribution includes bindings for the implementations: * [Commons RDF Simple](#Commons_RDF_Simple) * [Apache Jena](#Apache_Jena) * [Eclipse RDF4J](#Eclipse_RDF4J) (formerly Sesame) * [JSONLD-Java](#JSONLD-Java) In addition there can be [External implementations](#External-implementations) which are released separately by their respective projects. One goal of the Commons RDF API is to enable runtime cross-compatibility of its implementations, therefore it is perfectly valid to combine them and for instance do: * Copy triples from a Jena `Model` to an RDF4J `Repository` (e.g. copying between two Common RDF `Graph`s) * Create an RDF4J-backed `Quad` that use a Jena-backed `BlankNode` * Read an RDF file with Jena's parsers into an RDF4J-backed `Dataset` ### Commons RDF Simple [org.apache.commons.rdf.simple](apidocs/org/apache/commons/rdf/simple/package-summary.html) is part of Commons RDF, and its main purpose is to verify and clarify the [test harness](testapidocs/org/apache/commons/rdf/api/package-summary.html). It is backed by simple (if not naive) in-memory POJO objects and have no external dependencies. Note that although this module fully implements the commons-rdf API, it should **not** be considered as a reference implementation. It is **not thread-safe** and probably **not scalable**, however it may be useful for testing and simple usage (e.g. prototyping and creating graph fragments). **Usage:** ```xml org.apache.commons commons-rdf-simple 0.5.0 ``` ```java import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.simple.SimpleRDF; RDF rdf = new SimpleRDF(); Graph graph = rdf.createGraph(); ``` ### Apache Jena [org.apache.commons.rdf.jena](apidocs/org/apache/commons/rdf/jena/package-summary.html) is an implementation of the Commons RDF API backed by [Apache Jena](http://jena.apache.org/), including converters from/to Jena and Commons RDF. **Usage:** ```xml org.apache.commons commons-rdf-jena 0.5.0 ``` ```java import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.RDFTermFactory; import org.apache.commons.rdf.jena.JenaRDF; RDF rdf = new JenaRDF(); Graph graph = rdf.createGraph(); ``` Objects created with [JenaRDF](apidocs/org/apache/commons/rdf/jena/JenaRDF.html) implement interfaces like [JenaQuad](apidocs/org/apache/commons/rdf/jena/JenaQuad.html) and [JenaLiteral](apidocs/org/apache/commons/rdf/jena/JenaLiteral.html) which give access to the underlying Jena objects through methods like [asJenaNode()](apidocs/org/apache/commons/rdf/jena/JenaRDFTerm.html#asJenaNode--) and [asJenaGraph()](apidocs/org/apache/commons/rdf/jena/JenaGraph.html#asJenaGraph--). `JenaRDF` includes additional methods for converting from/to Apache Jena and Commons RDF, like [asRDFTerm(Node)](apidocs/org/apache/commons/rdf/jena/JenaRDF.html#asRDFTerm-org.apache.jena.graph.Node-) and [asJenaNode(RDFTerm)](apidocs/org/apache/commons/rdf/jena/JenaRDF.html#asJenaNode-org.apache.commons.rdf.api.RDFTerm-). #### Generalized RDF Apache Jena can support [generalized RDF](https://www.w3.org/TR/rdf11-concepts/#section-generalized-rdf), e.g.: > A generalized RDF triple is a triple having a subject, a predicate, and object, where each can be an IRI, a blank node or a literal. Within Commons RDF it is possible to create [generalized triples](apidocs/org/apache/commons/rdf/jena/JenaRDF.html#createGeneralizedTriple-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-) and [quads](apidocs/org/apache/commons/rdf/jena/JenaRDF.html#createGeneralizedQuad-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-) using `JenaRDF` - however note that the returned [JenaGeneralizedTripleLike](apidocs/org/apache/commons/rdf/jena/JenaGeneralizedTripleLike.html) and [JenaGeneralizedQuadLike](apidocs/org/apache/commons/rdf/jena/JenaGeneralizedQuadLike.html) do not have the [equality semantics of Triple](apidocs/org/apache/commons/rdf/api/Triple.html#equals-java.lang.Object-) or [Quad](apidocs/org/apache/commons/rdf/api/Quad.html#equals-java.lang.Object-) and thus can't be used with the regular [Graph](apidocs/org/apache/commons/rdf/api/Graph.html) or [Dataset](apidocs/org/apache/commons/rdf/api/Dataset.html) methods. The generalized triples/quads can be accessed as [org.apache.jena.graph.Triple](https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/graph/Triple.html) and [org.apache.jena.sparql.core.Quad](https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/sparql/core/Quad.html) - but can't currently be used with an equivalent _generalized graph_ or _generalized dataset_ within Commons RDF (see [COMMONSRDF-42](https://issues.apache.org/jira/browse/COMMONSRDF-42)). ### Eclipse RDF4J [org.apache.commons.rdf.rdf4j](apidocs/org/apache/commons/rdf/rdf4j/package-summary.html) is an implementation of the Commons RDF API backed by Eclispe [RDF4J 2.0](http://rdf4j.org/) (formerly Sesame), including converters from/to RDF4J and Commons RDF. **Usage:** ```xml org.apache.commons commons-rdf-rdf4j 0.5.0 ``` ```java import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.rdf4j.RDF4J; RDF rdf = new RDF4J(); Graph graph = rdf.createGraph(); ``` Objects created with [RDF4J](apidocs/org/apache/commons/rdf/rdf4j/RDF4J.html) implement interfaces like [RDF4JTerm](apidocs/org/apache/commons/rdf/rdf4j/RDF4JTerm.html) and [RDF4JGraph](apidocs/org/apache/commons/rdf/rdf4j/RDF4JGraph.html) which give access to the underlying Jena objects through methods like [asValue()](apidocs/org/apache/commons/rdf/rdf4j/RDF4JTerm.html#asValue--) and [asRepository()](apidocs/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.html#asRepository--). `RDF4J` includes additional methods for converting from/to RDF4J and Commons RDF, like [asTriple(Statement)](apidocs/org/apache/commons/rdf/rdf4j/RDF4J.html#asTriple-org.eclipse.rdf4j.model.Statement-) and [asRDFTerm(Value)](apidocs/org/apache/commons/rdf/rdf4j/RDF4J.html#asRDFTerm-org.eclipse.rdf4j.model.Value-). #### Closing RDF4J resources When using `RDF4J` with an RDF4J `Repository`, e.g. from [asRDFTermGraph(Repository)](apidocs/org/apache/commons/rdf/rdf4j/RDF4J.html#asGraph-org.eclipse.rdf4j.repository.Repository-org.apache.commons.rdf.rdf4j.RDF4J.Option...-), care must be taken to close underlying resources when using the methods [stream()](apidocs/org/apache/commons/rdf/rdf4j/RDF4JGraph.html#stream--) and [iterate()](apidocs/org/apache/commons/rdf/rdf4j/RDF4JGraph.html#iterate--) for both `Graph`s and `Dataset`s. This can generally achieved using a [try-with-resources](https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) block, e.g.: ```java int subjects; try (Stream s : graph.stream(s,p,o)) { subjects = s.map(RDF4JTriple::getSubject).distinct().count() } ``` This will ensure that the underlying RDF4J [RepositoryConnection](http://rdf4j.org/javadoc/latest/org/eclipse/rdf4j/repository/RepositoryConnection.html) and [RepositoryResult](http://rdf4j.org/javadoc/latest/org/eclipse/rdf4j/repository/RepositoryResult.html) are closed after use. Methods that return directly, like [Graph.add()](apidocs/org/apache/commons/rdf/api/Graph.html#add-org.apache.commons.rdf.api.Triple-) and [Dataset.size()](apidocs/org/apache/commons/rdf/api/Dataset.html#size--) will use and close separate transactions per method calls and therefore do not need any special handling; however this will come with a performance hit when doing multiple graph/dataset modifications. (See [COMMONSRDF-45](https://issues.apache.org/jira/browse/COMMONSRDF-45)) Java's [java.util.Iteratable](http://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html) and [java.util.Iterator](http://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html) does not extend [`AutoClosable`](http://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html), and as there are many ways that a for-each loop may not run to exhaustion, Commons RDF introduces [ClosableIterable](apidocs/org/apache/commons/rdf/rdf4j/ClosableIterable.html), which can be used with RDF4J as: ```java RDF4JGraph graph; // ... try (ClosableIterable s : graph.iterate()) { for (Triple t : triples) { return t; // OK to terminate for-loop early } } ``` ### JSONLD-Java [org.apache.commons.rdf.jsonld](apidocs/org/apache/commons/rdf/jsonld/package-summary.html) is an implementation of the Commons RDF API backed by [JSON-LD-Java](https://github.com/jsonld-java/jsonld-java). This is primarily intended to support [JSON-LD](http://json-ld.org/) parsing and writing. **Usage:** ```xml org.apache.commons commons-rdf-jsonld 0.5.0 ``` ```java import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.RDFTermFactory; import org.apache.commons.rdf.jsonld.JsonLdFactory; RDF rdf = new JsonLdRDF(); Graph graph = rdfTermFactory.createGraph(); ``` ## External implementations ### OWL API [OWL API](http://owlapi.sourceforge.net/) 5 extends Commons RDF directly for its family of [RDFNode](https://github.com/owlcs/owlapi/blob/version5/api/src/main/java/org/semanticweb/owlapi/io/RDFNode.java#L25) implementations. It is a partial compatibility implementation without its own `RDFTermFactory`, `Graph` or `Dataset`. ## Related implementations ### Apache Clerezza [Apache Clerezza](https://clerezza.apache.org/) is aligning its [RDF core](https://github.com/apache/clerezza-rdf-core) module with Commons RDF. apache-commons-rdf-0.5.0/src/site/markdown/userguide.md0000644000175000017500000013155113212355376022763 0ustar andriusandrius # User Guide This page shows some examples of a client using the Commons RDF API. It was last updated for version `0.5.0` of the Commons RDF [API](apidocs/). * [Introduction](#Introduction) * [RDF concepts](#RDF_concepts) * [Using Commons RDF from Maven](#Using_Commons_RDF_from_Maven) * [Creating Commons RDF instances](#Creating_Commons_RDF_instances) * [Finding an RDF implementation](#Finding_an_RDF_implementation) * [Using an RDF implementation](#Using_an_RDF_implementation) * [RDF terms](#RDF_terms) * [N-Triples string](#N-Triples_string) * [IRI](#IRI) * [Blank node](#Blank_node) * [Blank node reference](#Blank_node_reference) * [Literal](#Literal) * [Datatype](#Datatype) * [Types](#Types) * [Language](#Language) * [Triple](#Triple) * [Quad](#Quad) * [Graph](#Graph) * [Adding triples](#Adding_triples) * [Finding triples](#Finding_triples) * [Size](#Size) * [Iterating over triples](#Iterating_over_triples) * [Stream of triples](#Stream_of_triples) * [Removing triples](#Removing_triples) * [Dataset](#Dataset) * [Dataset operations](#Dataset_operations) * [Mutability and thread safety](#Mutability_and_thread_safety) * [Implementations](#Implementations) * [Cross-compatibility](#Cross-compatibility) * [Complete example](#Complete_example) ## Introduction [Commons RDF](index.html) is an API that intends to directly describe [RDF 1.1 concepts](http://www.w3.org/TR/rdf11-concepts/) as a set of corresponding interfaces and methods. ### RDF concepts RDF is a [graph-based data model](http://www.w3.org/TR/rdf11-concepts/#data-model), where a _graph_ contains a series of _triples_, each containing the node-arc-node link _subject_ -> _predicate_ -> _object_. Nodes in the graph are represented either as _IRIs_, _literals_ and _blank nodes_. : This user guide does not intend to give a detailed description of RDF as a data model. To fully understand this user guide, you should have a brief understanding of the core RDF concepts mentioned above. For more information on RDF, see the [RDF primer](http://www.w3.org/TR/rdf11-primer/) and the [RDF concepts](http://www.w3.org/TR/rdf11-concepts/#data-model) specification from W3C. ## Using Commons RDF from Maven To use Commons RDF API from an [Apache Maven](http://maven.apache.org/) project, add the following dependency to your `pom.xml`: ```xml org.apache.commons commons-rdf-api 0.5.0 ``` _The `` above might not be up to date, see the [download page](download.html) for the latest version._ If you are testing a `SNAPSHOT` version, then you will have to either build Commons RDF from [source](https://github.com/apache/commons-rdf), or add this [snapshot repository](https://github.com/apache/commons-rdf#snapshot-repository): ```xml apache.snapshots Apache Snapshot Repository http://repository.apache.org/snapshots false ``` As Commons RDF requires Java 8 or later, you will also need: ```xml 1.8 1.8 ``` In the examples below we will use the [_simple_ implementation](apidocs/org/apache/commons/rdf/simple/package-summary.html), but the examples should be equally applicable to other [implementations](implementations.html). To add a dependency for the _simple_ implementation, add to your ``: ```xml org.apache.commons commons-rdf-simple 0.5.0 ``` _The `` above might not be up to date, see the [download page](download.html) for the latest version._ ## Creating Commons RDF instances To create instances of Commons RDF interfaces like [`Graph`](apidocs/org/apache/commons/rdf/api/Graph.html) and [`IRI`](apidocs/org/apache/commons/rdf/api/IRI.html) you will need a [RDF](apidocs/org/apache/commons/rdf/api/RDF.html) implementation. ### Finding an RDF implementation The [implementations](implementations.html) of `RDF` can usually be created using a normal Java constructor, for instance the _simple_ implementation from [SimpleRDF](apidocs/org/apache/commons/rdf/simple/SimpleRDF.html): ```java import org.apache.commons.rdf.api.*; import org.apache.commons.rdf.simple.SimpleRDF; // ... RDF rdf = new SimpleRDF(); ``` If you don't want to depend on instantiating a concrete `RDF` implementation, you can alternatively use the [ServiceLoader](http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html) to lookup any `RDF` implementations found on the classpath: ```java import java.util.Iterator; import java.util.ServiceLoader; import org.apache.commons.rdf.api.*; // ... ServiceLoader loader = ServiceLoader.load(RDF.class); Iterator iterator = loader.iterator(); RDF rdf = iterator.next(); ``` Note that the `ServiceLoader` approach above might not work well within split classloader systems like OSGi. When using the factory method [createBlankNode(String)](apidocs/org/apache/commons/rdf/api/RDF.html#createBlankNode-java.lang.String-) from different sources, care should be taken to create correspondingly different `RDF` instances. ### Using an RDF implementation Using the `RDF` implementation you can construct any [RDFTerm](apidocs/org/apache/commons/rdf/api/RDFTerm.html), e.g. to create a [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html), [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) and [Literal](apidocs/org/apache/commons/rdf/api/Literal.html): ```java BlankNode aliceBlankNode = rdf.createBlankNode(); IRI nameIri = rdf.createIRI("http://example.com/name"); Literal aliceLiteral = rdf.createLiteral("Alice"); ``` You can also create a stand-alone [Triple](apidocs/org/apache/commons/rdf/api/Triple.html): ```java Triple triple = rdf.createTriple(aliceBlankNode, nameIri, aliceLiteral); ``` The [RDF](apidocs/org/apache/commons/rdf/api/RDF.html) interface also contains more specific variants of some of the methods above, e.g. to create a typed literal. In addition, the [implementations](implementations.html) of `RDF` may add specific converter methods and implementation-specific subtypes for interoperability with their underlying RDF framework's API. ## RDF terms [RDFTerm](apidocs/org/apache/commons/rdf/api/RDFTerm.html) is the super-interface for instances that can be used as subject, predicate and object of a [Triple](apidocs/org/apache/commons/rdf/api/Triple.html). The RDF term interfaces are arranged in this type hierarchy: * [RDFTerm](apidocs/org/apache/commons/rdf/api/RDFTerm.html) * [BlankNodeOrIRI](apidocs/org/apache/commons/rdf/api/BlankNodeOrIRI.html) * [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html) * [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) * [Literal](apidocs/org/apache/commons/rdf/api/Literal.html) ### N-Triples string All of the [RDFTerm](apidocs/org/apache/commons/rdf/api/RDFTerm.html) types support the `ntriplesString()` method: ```java System.out.println(aliceBlankNode.ntriplesString()); System.out.println(nameIri.ntriplesString()); System.out.println(aliceLiteral.ntriplesString()); ``` > `_:ef136d20-f1ee-3830-a54b-cd5e489d50fb` > > ```` > > ``"Alice"`` This returns the [N-Triples](http://www.w3.org/TR/n-triples) canonical form of the term, which can be useful for debugging or simple serialization. _Note: The `.toString()` of the `simple` implementation used in some of these examples use `ntriplesString()` internally, but Commons RDF places no such formal requirement on the `.toString()` method. Clients that rely on a canonical N-Triples-compatible string should instead use `ntriplesString()`._ ### IRI An [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) is a representation of an [Internationalized Resource Identifier](http://www.w3.org/TR/rdf11-concepts/#dfn-iri), e.g. `http://example.com/alice` or `http://ns.example.org/vocab#term`. > IRIs in the RDF abstract syntax MUST be absolute, and MAY contain a fragment identifier. An IRI identifies a resource that can be used as a _subject_, _predicate_ or _object_ of a [Triple](apidocs/org/apache/commons/rdf/api/Triple.html) or [Quad](apidocs/org/apache/commons/rdf/api/Quad.html), where it can also be used a _graph name_. To create an `IRI` instance from an `RDF` implementation, use [createIRI](apidocs/org/apache/commons/rdf/api/RDF.html#createIRI-java.lang.String-): ```java IRI iri = rdf.createIRI("http://example.com/alice"); ``` You can retrieve the IRI string using [getIRIString](apidocs/org/apache/commons/rdf/api/IRI.html#getIRIString--): ```java System.out.println(iri.getIRIString()); ``` > `http://example.com/alice` _Note: The **IRI** string might contain non-ASCII characters which must be %-encoded for applications that expect an **URI**. It is currently out of scope for Commons RDF to perform such a conversion, however implementations might provide separate methods for that purpose._ Two IRI instances can be compared using the [equals](apidocs/org/apache/commons/rdf/api/IRI.html#equals-java.lang.Object-) method, which uses [simple string comparison](http://tools.ietf.org/html/rfc3987#section-5.3.1): ```java IRI iri2 = rdf.createIRI("http://example.com/alice"); System.out.println(iri.equals(iri2)); ``` > `true` ```java IRI iri3 = rdf.createIRI("http://example.com/alice/./"); System.out.println(iri.equals(iri3)); ``` > `false` Note that IRIs are never equal to objects which are not themselves instances of [IRI](apidocs/org/apache/commons/rdf/api/IRI.html): ```java System.out.println(iri.equals("http://example.com/alice")); System.out.println(iri.equals(rdf.createLiteral("http://example.com/alice"))); ``` > `false` > > `false` ### Blank node A [blank node](http://www.w3.org/TR/rdf11-concepts/#section-blank-nodes) is a resource which, unlike an IRI, is not directly identified. Blank nodes can be used as _subject_ or _object_ of a [Triple](apidocs/org/apache/commons/rdf/api/Triple.html) or [Quad](apidocs/org/apache/commons/rdf/api/Quad.html), where it can also be used a _graph name_. To create a new [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html) instance from a `RDF` implementation, use [createBlankNode](apidocs/org/apache/commons/rdf/api/RDF.html#createBlankNode--): ```java BlankNode bnode = rdf.createBlankNode(); ``` Every call to `createBlankNode()` returns a brand new blank node which can be used in multiple triples in multiple graphs. Thus every such blank node can only be [equal](apidocs/org/apache/commons/rdf/api/BlankNode.html#equals-java.lang.Object-) to itself: ```java System.out.println(bnode.equals(bnode)); System.out.println(bnode.equals(rdf.createBlankNode())); ``` > `true` > > `false` Sometimes it can be beneficial to create a blank node based on a localized _name_, without needing to keep object references to earlier `BlankNode` instances. For that purpose, the `RDF` interface provides the [expanded createBlankNode](apidocs/org/apache/commons/rdf/api/RDF.html#createBlankNode-java.lang.String-) method: ```java BlankNode b1 = rdf.createBlankNode("b1"); ``` Note that there is no requirement for the [ntriplesString()](apidocs/org/apache/commons/rdf/api/RDFTerm.html#ntriplesString--) of the BlankNode to reflect the provided `name`: ```java System.out.println(b1.ntriplesString()); ``` > `_:6c0f628f-02cb-3634-99db-0e1e99d2e66d` Any later `createBlankNode("b1")` **on the same `RDF` instance** returns a `BlankNode` which are [equal](apidocs/org/apache/commons/rdf/api/BlankNode.html#equals-java.lang.Object-) to the previous b1: ```java System.out.println(b1.equals(rdf.createBlankNode("b1"))); ``` > `true` That means that care should be taken to create a new `RDF` instance if making "different" blank nodes (e.g. parsed from a different RDF file) which accidfentally might have the same name: ```java System.out.println(b1.equals(new SimpleRDF().createBlankNode("b1"))); ``` > `false` #### Blank node reference While blank nodes are distinct from IRIs, and don't have inherent universal identifiers, it can nevertheless be useful for debugging and testing to have a unique reference string for a particular blank node. For that purpose, BlankNode exposes the [uniqueReference](apidocs/org/apache/commons/rdf/api/BlankNode.html#uniqueReference--) method: ```java System.out.println(bnode.uniqueReference()); ``` > `735d5e63-96a4-488b-8613-7037b82c74a5` While this reference string might for the _simple_ implementation also be seen within the `BlankNode.ntriplesString()` result, there is no such guarantee from the Commons RDF API. Clients who need a globally unique reference for a blank node should therefore use the `uniqueReference()` method. _Note: While it is recommended for this string to be (or contain) a [UUID string](http://docs.oracle.com/javase/8/docs/api/java/util/UUID.html), implementations are free to use any scheme to ensure their blank node references are globally unique. Therefore no assumptions should be made about this string except that it is unique per blank node._ ### Literal A [literal](http://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal) in RDF is a value such as a string, number or a date. A `Literal` can only be used as an _object_ of a [Triple](apidocs/org/apache/commons/rdf/api/Triple.html#getObject--) or [Quad](apidocs/org/apache/commons/rdf/api/Quad.html#getObject--) To create a [Literal](apidocs/org/apache/commons/rdf/api/Literal.html) instance from an `RDF` implementation, use [createLiteral](apidocs/org/apache/commons/rdf/api/RDF.html#createLiteral-java.lang.String-): ```java Literal literal = rdf.createLiteral("Hello world!"); System.out.println(literal.ntriplesString()); ``` > `"Hello world!"` The _lexical value_ (what is inside the quotes) can be retrieved using [getLexicalForm()](apidocs/org/apache/commons/rdf/api/Literal.html#getLexicalForm--): ```java String lexical = literal.getLexicalForm(); System.out.println(lexical); ``` > `Hello world!` #### Datatype All literals in RDF 1.1 have a [datatype](http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri) `IRI`, which can be retrieved using [Literal.getDatatype()](apidocs/org/apache/commons/rdf/api/Literal.html#getDatatype--): ```java IRI datatype = literal.getDatatype(); System.out.println(datatype.ntriplesString()); ``` > `` In RDF 1.1, a [simple literal](http://www.w3.org/TR/rdf11-concepts/#dfn-simple-literal) (as created above) always have the type `http://www.w3.org/2001/XMLSchema#string` (or [xsd:string](apidocs/org/apache/commons/rdf/simple/Types.html#XSD_STRING) for short). To create a literal with any other [datatype](http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri) (e.g. `xsd:double`), then create the datatype `IRI` and pass it to the expanded [createLiteral](apidocs/org/apache/commons/rdf/api/RDF.html#createLiteral-java.lang.String-org.apache.commons.rdf.api.IRI-): ```java IRI xsdDouble = rdf.createIRI("http://www.w3.org/2001/XMLSchema#double"); Literal literalDouble = rdf.createLiteral("13.37", xsdDouble); System.out.println(literalDouble.ntriplesString()); ``` > `"13.37"^^` ##### Types The class [Types](apidocs/org/apache/commons/rdf/simple/Types.html), which is part of the _simple_ implementation, provides `IRI` constants for the standard XML Schema datatypes like `xsd:dateTime` and `xsd:float`. Using `Types`, the above example can be simplified to: ```java Literal literalDouble2 = rdf.createLiteral("13.37", Types.XSD_DOUBLE); ``` As the constants in `Types` are all instances of `IRI`, so they can also be used for comparisons: ```java System.out.println(Types.XSD_STRING.equals(literal.getDatatype())); ``` > `true` #### Language Literals may be created with an associated [language tag](http://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string) using the expanded [createLiteral](apidocs/org/apache/commons/rdf/api/RDF.html#createLiteral-java.lang.String-java.lang.String-): ```java Literal inSpanish = rdf.createLiteral("¡Hola, Mundo!", "es"); System.out.println(inSpanish.ntriplesString()); System.out.println(inSpanish.getLexicalForm()); ``` > `"¡Hola, Mundo!"@es` > > `¡Hola, Mundo!` A literal with a language tag always have the implied type `http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`: ```java System.out.println(inSpanish.getDatatype().ntriplesString()); ``` > `` The language tag can be retrieved using [getLanguageTag()](apidocs/org/apache/commons/rdf/api/Literal.html#getLanguageTag--): ```java Optional tag = inSpanish.getLanguageTag(); if (tag.isPresent()) { System.out.println(tag.get()); } ``` > `es` The language tag is behind an [Optional](http://docs.oracle.com/javase/8/docs/api/java/util/Optional.html) as it won't be present for any other datatypes than `http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`: ```java System.out.println(literal.getLanguageTag().isPresent()); System.out.println(literalDouble.getLanguageTag().isPresent()); ``` > `false` > > `false` ## Triple A [triple](http://www.w3.org/TR/rdf11-concepts/#section-triples) in RDF 1.1 consists of: * The [subject](apidocs/org/apache/commons/rdf/api/Triple.html#getSubject--), which is an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) or a [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html) * The [predicate](apidocs/org/apache/commons/rdf/api/Triple.html#getPredicate--), which is an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) * The [object](apidocs/org/apache/commons/rdf/api/Triple.html#getObject--), which is an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html), a [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html) or a [Literal](apidocs/org/apache/commons/rdf/api/Literal.html) To construct a [Triple](apidocs/org/apache/commons/rdf/api/Triple.html) from an `RDF` implementation, use [createTriple](apidocs/org/apache/commons/rdf/api/RDF.html#createTriple-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-): ```java BlankNodeOrIRI subject = rdf.createBlankNode(); IRI predicate = rdf.createIRI("http://example.com/says"); RDFTerm object = rdf.createLiteral("Hello"); Triple triple = rdf.createTriple(subject, predicate, object); ``` The subject of the triple can be retrieved using [getSubject](apidocs/org/apache/commons/rdf/api/Triple.html#getSubject--): ```java BlankNodeOrIRI subj = triple.getSubject(); System.out.println(subj.ntriplesString()); ``` > `_:7b914fbe-aa2a-4551-b71c-8ac0e2b52b26` Likewise the predicate using [getPredicate](apidocs/org/apache/commons/rdf/api/Triple.html#getPredicate--): ```java IRI pred = triple.getPredicate(); System.out.println(pred.getIRIString()); ``` > `http://example.com/says` Finally, the object of the triple is returned with [getObject](apidocs/org/apache/commons/rdf/api/Triple.html#getObject--): ```java RDFTerm obj = triple.getObject(); System.out.println(obj.ntriplesString()); ``` > `"Hello"` For the subject and object you might find it useful to do Java type checking and casting from the types [BlankNodeOrIRI](apidocs/org/apache/commons/rdf/api/BlankNodeOrIRI.html) and [RDFTerm](apidocs/org/apache/commons/rdf/api/RDFTerm.html): ```java if (subj instanceof IRI) { String s = ((IRI) subj).getIRIString(); System.out.println(s); } // .. if (obj instanceof Literal) { IRI type = ((Literal) obj).getDatatype(); System.out.println(type); } ``` In Commons RDF, `BlankNodeOrIRI` instances are always one of `BlankNode` or `IRI`, and `RDFTerm` instances one of `BlankNode`, `IRI` or `Literal`. A `Triple` is considered [equal](apidocs/org/apache/commons/rdf/api/Triple.html#equals-java.lang.Object-) to another `Triple` if each of their subject, predicate and object are equal: ```java System.out.println(triple.equals(rdf.createTriple(subj, pred, obj))); ``` > `true` This equality is true even across implementations, as Commons RDF has specified _equality semantics_ for [Triples](apidocs/org/apache/commons/rdf/api/Triple.html#equals-java.lang.Object-), [Quads](apidocs/org/apache/commons/rdf/api/Quad.html#equals-java.lang.Object-), [IRIs](apidocs/org/apache/commons/rdf/api/IRI.html#equals-java.lang.Object-), [Literals](apidocs/org/apache/commons/rdf/api/Literal.html#equals-java.lang.Object-) and even [BlankNodes](apidocs/org/apache/commons/rdf/api/BlankNode.html#equals-java.lang.Object-). ## Quad A _quad_ is a triple with an associated _graph name_, and can be a statement in a [dataset](http://www.w3.org/TR/rdf11-concepts/#section-dataset). Commons RDF represents such statements using the class [Quad](apidocs/org/apache/commons/rdf/api/Quad.html), which consists of: * The [subject](apidocs/org/apache/commons/rdf/api/Quad.html#getSubject--), which is an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) or a [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html) * The [predicate](apidocs/org/apache/commons/rdf/api/Quad.html#getPredicate--), which is an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) * The [object](apidocs/org/apache/commons/rdf/api/Quad.html#getObject--), which is an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html), a [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html) or a [Literal](apidocs/org/apache/commons/rdf/api/Literal.html) * The [graph name](apidocs/org/apache/commons/rdf/api/Quad.html#getGraphName--), which is an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) or a [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html); wrapped as an `java.util.Optional` To create a `Quad`, use [createQuad](apidocs/org/apache/commons/rdf/api/RDF.html#createQuad-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-): ``` BlankNodeOrIRI graph = rdf.createIRI("http://example.com/graph"); BlankNodeOrIRI subject = rdf.createBlankNode(); IRI predicate = rdf.createIRI("http://example.com/says"); RDFTerm object = rdf.createLiteral("Hello"); Quad quad = rdf.createQuad(graph, subject, predicate, object); ``` The subject, predicate and object are accessible just like in a `Triple`: ``` IRI pred = quad.getPredicate(); System.out.println(pred.ntriplesString()); ``` > `` ### Graph name The quad's _graph name_ is accessible using [getGraphName()](apidocs/org/apache/commons/rdf/api/Quad.html#getGraphName--): ``` Optional g = quad.getGraphName(); ``` The graph name is represented as an [Optional](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html), where `Optional.empty()` indicates that the quad is in the [default graph](https://www.w3.org/TR/rdf11-concepts/#dfn-default-graph), while if the [Optional.isPresent()](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html#isPresent--) then the graph name `BlankNodeOrIRI` is accessible with `g.get()`: ``` if (g.isPresent()) { BlankNodeOrIRI graphName = g.get(); System.out.println(graphName.ntriplesString()); } ``` > `` To create a quad in the _default graph_, supply `null` as the graph name to the factory method: ``` Quad otherQuad = rdf.createQuad(null, subject, predicate, object); System.out.println(otherQuad.getGraphName().isPresent()); ``` > `false` Note that a `Quad` will never return `null` on any of its getters, which is why the graph name is wrapped as an `Optional`. This also allows the use of Java 8 functional programming patterns like: ``` String str = quad.map(BlankNodeOrIRI::ntriplesString).orElse(""); ``` As the `createQuad` method does not expect an `Optional`, you might use this `orElse` pattern to represent the default graph as `null`: ``` BlankNodeOrIRI g = quad.getGraphName().orElse(null); if (g == null) { System.out.println("In default graph"); } rdf.createQuad(g,s,p,o); ``` Care should be taken with regards when accessing graph named with `BlankNode`s, as the graph name will be compared using [BlankNode's equality semantics](apidocs/org/apache/commons/rdf/api/BlankNode.html#equals-java.lang.Object-). ### Quad equality A `Quad` is considered [equal](apidocs/org/apache/commons/rdf/api/Quad.html#equals-java.lang.Object-) to another `Quad` if each of the graph name, subject, predicate and object are equal: ``` System.out.println(quad.equals(otherQuad)); ``` > `false` ### Converting quads to triples All quads can be viewed as triples - in a way "stripping" the graph name: ``` Triple quadAsTriple = quad.asTriple(); ``` This can be utilized to compare quads at triple-level (considering just s/p/o): ``` System.out.println(quadAsTriple.equals(otherQuad.asTriple()); ``` > `true` To create a triple from a quad, you will need to use [RDF.createQuad](apidocs/org/apache/commons/rdf/api/RDF.html#createQuad-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-) providing the desired graph name: ``` Triple t; // .. BlankNodeOrIRI g; // .. Quad q = rdf.createQuad(g, t.getSubject(), t.getPredicate(), t.getObject()); ``` ### TripleLike Note that the class [Quad](apidocs/org/apache/commons/rdf/api/Quad.html) does **not** extend the class [Triple](apidocs/org/apache/commons/rdf/api/Triple.html), as they have different equality semantics. Both `Triple` and `Quad` do however share a common "duck-typing" interface [TripleLike](apidocs/org/apache/commons/rdf/api/TripleLike.html): ``` TripleLike a = quad; TripleLike b = quad.asTriple(); ``` Unlike `Triple` and `Quad`, `TripleLike` does not mandate any specific `.equals()`, it just provides common access to [getSubject()](apidocs/org/apache/commons/rdf/api/TripleLike.html#getSubject--) [getPredicate()](apidocs/org/apache/commons/rdf/api/TripleLike.html#getPredicate--) and [getObject()](apidocs/org/apache/commons/rdf/api/TripleLike.html#getObject--). ``` RDFTerm s = a.getSubject(); RDFTerm p = a.getPredicate(); RDFTerm o = a.getObject(); ``` TripleLike can also be used for [generalized RDF](https://www.w3.org/TR/rdf11-concepts/#section-generalized-rdf) therefore all of its parts are returned as [RDFTerm](apidocs/org/apache/commons/rdf/api/RDFTerm.html). For generalized quads the [QuadLike](apidocs/org/apache/commons/rdf/api/QuadLike.html) interface extends `TripleLike` to add [getGraphName()](apidocs/org/apache/commons/rdf/api/QuadLike.html#getGraphName--) as an `Optional`. ## Graph A [graph](http://www.w3.org/TR/rdf11-concepts/#section-rdf-graph) is a collection of triples. To create a [Graph](apidocs/org/apache/commons/rdf/api/Graph.html) instance from a `RDF` implementation, use [createGraph()](apidocs/org/apache/commons/rdf/api/RDF.html#createGraph--): ```java Graph graph = rdf.createGraph(); ``` Implementations will typically also have other ways of retrieving a `Graph`, e.g. by parsing a Turtle file or connecting to a storage backend. ### Adding triples Any [Triple](apidocs/org/apache/commons/rdf/api/Triple.html) can be added to the graph using the [add](apidocs/org/apache/commons/rdf/api/Graph.html#add-org.apache.commons.rdf.api.Triple-) method: ```java graph.add(triple); ``` As an alternative to creating the `Triple` first, you can use the expanded _subject/predicate/object_ form of [Graph.add](apidocs/org/apache/commons/rdf/api/Graph.html#add-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-): ```java IRI bob = rdf.createIRI("http://example.com/bob"); IRI nameIri = rdf.createIRI("http://example.com/name"); Literal bobName = rdf.createLiteral("Bob"); graph.add(bob, nameIRI, bobName); ``` It is not necessary to check if a triple already exist in the graph, as the underlying implementation will ignore duplicate triples. ### Finding triples You can check if the graph [contains](apidocs/org/apache/commons/rdf/api/Graph.html#contains-org.apache.commons.rdf.api.Triple-) a triple: ```java System.out.println(graph.contains(triple)); ``` > `true` The expanded _subject/predicate/object_ call for [Graph.contains()](apidocs/org/apache/commons/rdf/api/Graph.html#contains-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-) can be used without needing to create a `Triple` first, and also allow `null` as a wildcard parameter: ```java System.out.println(graph.contains(null, nameIri, bobName)); ``` > `true` ### Size The [size](apidocs/org/apache/commons/rdf/api/Graph.html#size--) of a graph is the count of unique triples: ```java System.out.println(graph.size()); ``` > `2` ### Iterating over triples The [iterate](apidocs/org/apache/commons/rdf/api/Graph.html#iterate--) method can be used to sequentially iterate over all the triples of the graph: ```java for (Triple t : graph.iterate()) { System.out.println(t.getObject()); } ``` > `"Alice"` > > `"Bob"` The expanded [iterate](apidocs/org/apache/commons/rdf/api/Graph.html#iterate-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-) method takes a _subject/predicate/object_ filter which permits the `null` wildcard: ```java for (Triple t : graph.iterate(null, null, bobName)) { System.out.println(t.getPredicate()); } ``` > `` ### Stream of triples For processing of larger graphs, and to access more detailed filtering and processing, the [stream](apidocs/org/apache/commons/rdf/api/Graph.html#stream--) method return a Java 8 [Stream](http://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html). Some of the implementations (e.g. [RDF4J](implementations.html#Closing_RDF4J_resources)) might require resources to be closed after the stream has been processed, so `.stream()` should be used within a [try-with-resources](https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) block. ```java try (Stream triples = graph.stream()) { Stream subjects = triples.map(t -> t.getObject()); String s = subjects.map(RDFTerm::ntriplesString).collect(Collectors.joining(" ")); System.out.println(s); } ``` > ``"Alice" "Bob"`` For details about what can be done with a stream, see the [java.util.stream documentation](http://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html). Note that by default the stream will be parallel, use [.sequential()](http://docs.oracle.com/javase/8/docs/api/java/util/stream/BaseStream.html#sequential--) if your stream operations need to interact with objects that are not thread-safe. Streams allow advanced [filter predicates](http://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#filter-java.util.function.Predicate-), but you may find that simple _subject/predicate/object_ patterns are handled more efficiently by the implementation when using the expanded [stream](http://commonsrdf.incubator.apache.org/apidocs/org/apache/commons/rdf/api/Graph.html#stream-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-) method. These can of course be combined: ```java try (Stream named = graph.stream(null, nameIri, null)) { Stream namedB = named.filter( t -> t.getObject().ntriplesString().contains("B")); System.out.println(namedB.map(t -> t.getSubject()).findAny().get()); } ``` > `` ### Removing triples Triples can be [removed](apidocs/org/apache/commons/rdf/api/Graph.html#remove-org.apache.commons.rdf.api.Triple-) from a graph: ```java graph.remove(triple); System.out.println(graph.contains(triple)); ``` > `false` The expanded _subject/predicate/object_ form of [remove()](apidocs/org/apache/commons/rdf/api/Graph.html#remove-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-) can be used without needing to construct a `Triple` first. It also allow `null` as a wildcard pattern: ```java graph.remove(null, nameIri, null); ``` To remove all triples, use [clear](apidocs/org/apache/commons/rdf/api/Graph.html#clear--): ```java graph.clear(); System.out.println(graph.contains(null, null, null)); ``` > `false` ## Dataset A [dataset](https://www.w3.org/TR/rdf11-concepts/#section-dataset) is a collection of quads, or if you like, a collection of `Graph`s. To create a [Dataset](apidocs/org/apache/commons/rdf/api/Dataset.html) instance from a `RDF` implementation, use [createDataset()](apidocs/org/apache/commons/rdf/api/RDF.html#createDataset--): ```java Dataset dataset = rdf.createDataset(); ``` Implementations will typically also have other ways of retrieving a `Dataset`, e.g. by parsing a JSON-LD file or connecting to a storage backend. ### Dataset operations `Dataset` operations match their equivalent operations on `Graph`, except that methods like [add(q)](apidocs/org/apache/commons/rdf/api/Dataset.html#add-org.apache.commons.rdf.api.Quad-) and [remove(q)](apidocs/org/apache/commons/rdf/api/Dataset.html#remove-org.apache.commons.rdf.api.Quad-) use [Quad](apidocs/org/apache/commons/rdf/api/Quad.html) instead of `Triple`. ``` dataset.add(quad); System.out.println(dataset.contains(quad)); dataset.remove(quad); ``` > `true` The convenience method [add(g,s,p,o)](apidocs/org/apache/commons/rdf/api/Dataset.html#add-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-) take an additional `BlankNodeOrIRI` parameter for the graph name - matching `RDF.createQuad(g,s,p,o)`. Note that the expanded pattern methods like [contains(g,s,p,o)](apidocs/org/apache/commons/rdf/api/Dataset.html#contains-java.util.Optional-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-) and [stream(g,s,p,o)](apidocs/org/apache/commons/rdf/api/Dataset.html#stream-java.util.Optional-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-) uses `null` as a wildcard pattern, and therefore an explicit _graph name_ parameter must be supplied as [Optional.empty()](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html#empty--) (default graph) or wrapped using [Optional.of(g)](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html#of-T-): ``` Literal foo = rdf.createLiteral("Foo"); // Match Foo in any graph, any subject, any predicate if (dataset.contains(null, null, null, foo)) { System.out.println("Foo literal found"); } // Match Foo in default graph, any subject, any predicate if (dataset.contains(Optional.empty(), null, null, foo)) { System.out.println("Foo literal found in default graph"); } BlankNodeOrIRI g1 = rdf.createIRI("http://example.com/graph1"); // Match Foo in named graph, any subject, any predicate if (dataset.contains(Optional.of(g1), null, null, foo)) { System.out.println("Foo literal found in default graph"); } ``` ### Graphs in the dataset An [RDF Dataset](https://www.w3.org/TR/rdf11-concepts/#section-dataset) is defined as: > An RDF dataset is a collection of RDF graphs, and comprises: > * Exactly one default graph, being an RDF graph. The default graph does not have a name and may be empty. > * Zero or more named graphs. Each named graph is a pair consisting of an IRI or a blank node (the graph name), and an RDF graph. Graph names are unique within an RDF dataset. It is possible to retrieve these graphs from a `Dataset` using: * [getGraph()](apidocs/org/apache/commons/rdf/api/Dataset.html#getGraph--) for the _default graph_ * [getGraph(blankNodeOrIRI)](apidocs/org/apache/commons/rdf/api/Dataset.html#getGraph-org.apache.commons.rdf.api.BlankNodeOrIRI-) for a named graph ``` Graph defaultGraph = dataset.getGraph(); BlankNodeOrIRI graphName = rdf.createIRI("http://example.com/graph"); Optional otherGraph = dataset.getGraph(graphName); ``` These provide a `Graph` **view** of the corresponding `Triple`s in the `Dataset`: ``` System.out.println(defaultGraph.contains(otherQuad.asTriple())); System.out.println(defaultGraph.size()); ``` > `true` > `1` It is unspecified if modifications to the returned Graph are reflected in the Dataset. Note that it is unspecified if requesting an unknown graph name will return `Optional.empty()` or create a new (empty) `Graph`. Some implementations may also support a _union graph_, a `Graph` that contains all triples regardless of their graph names. _simple_ provides [DatasetGraphView](apidocs/org/apache/commons/rdf/simple/DatasetGraphView.html) which can be used with any `Dataset` for this purpose. ## Mutability and thread safety _Note: This section is subject to change - see discussion on [COMMONSRDF-7](https://issues.apache.org/jira/browse/COMMONSRDF-7)_ In Commons RDF, all instances of `Triple` and `RDFTerm` (e.g. `IRI`, `BlankNode`, `Literal`) are considered _immutable_. That is, their content does not change, and so calling a method like [IRI.getIRIString](apidocs/org/apache/commons/rdf/api/IRI.html#getIRIString--) or [Literal.getDatatype](apidocs/org/apache/commons/rdf/api/Literal.html#getDatatype--) will have a return value which `.equals()` any earlier return values. Being immutable, the `Triple` and `RDFTerm` types should be considered thread-safe. Similarly their `hashCode()` should be considered stable, so any `RDFTerm` or `Triple` can be used in hashing collections like [HashMap](https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html). A `Graph` may be _mutable_, particular if it supports methods like [Graph.add](apidocs/org/apache/commons/rdf/api/Graph.html#add-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-) and [Graph.remove](apidocs/org/apache/commons/rdf/api/Graph.html#remove-org.apache.commons.rdf.api.Triple-). That means that responses to methods like [size](apidocs/org/apache/commons/rdf/api/Graph.html#size--) and [contains](apidocs/org/apache/commons/rdf/api/Graph.html#contains-org.apache.commons.rdf.api.Triple-) might change during its lifetime. A mutable `Graph` might also be modified by operations outside Commons RDF, e.g. because it is backed by a shared datastore with multiple clients. Implementations of Commons RDF may specify the (im)mutability of `Graph` in further details in their documentation. If a graph is immutable, the methods `add` and `remove` may throw a `UnsupportedOperationException`. Commons RDF does not specify if methods on a `Graph` are thread-safe. Iterator methods like [iterate](apidocs/org/apache/commons/rdf/api/Graph.html#iterate--) and [stream](apidocs/org/apache/commons/rdf/api/Graph.html#stream-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-) might throw a [ConcurrentModificationException](http://docs.oracle.com/javase/8/docs/api/java/util/ConcurrentModificationException.html) if it detects a thread concurrency modification, although this behaviour is not guaranteed. Implementations of Commons RDF may specify more specific thread-safety considerations. If an implementation does not specify any thread-safety support, then all potentially concurrent access to a `Graph` must be `synchronized`, e.g.: ```java Graph graph; // ... synchronized(graph) { graph.add(triple); } // ... synchronized(graph) { for (Triple t : graph) { // ... } } ``` ## Implementations The [Commons RDF API](apidocs/org/apache/commons/rdf/api/package-summary.html) is a set of Java interfaces, which can be implemented by several Java RDF frameworks. See the [implementations](implementations.html) page for an updated list of providers. Commons RDF defines a `RDF` interface as a factory for using a particular implementations' `RDFTerm`, `Triple`, `Quad`, `Graph` and `Dataset`. The `RDF` implementations also add adapter/converter methods to facilitate interoperability with their underlying framework's API. Note that some RDF frameworks have several possibilities for creating a backend for a `Graph` or `Dataset`, which configuration is implementation-specific. ### Cross-compatibility While different frameworks have their own classes implementing the Commons RDF interfaces, Commons RDF objects are cross-compatible. Thus a client is able to mix and match objects from multiple implementations: ```java import org.apache.commons.rdf.rdf4j.RDF4J; import org.apache.commons.rdf.jena.JenaRDF; RDF rdf4j = new RDF4J(); JenaRDF jena = new JenaRDF(); JenaGraph jenaGraph = jena.createGraph(); // Jena-specific load method jenaGraph.asJenaModel().read("dataset.ttl"); // Another Graph, from a different implementation Graph rdf4jGraph = rdf4j.createGraph(); // Any RDF implementation can make RDFTerms IRI rdfIRI = rdf4j.createIRI("http://example.com/property1"); // and used added to a different implementation's jenaGraph.add(rdfIRI,rdfIRI,rdfIRI); // Both Triple and RDFTerm instances can be used // with interoperability for (Triple t1: g1.stream(null, iri1, null)) { if (g2.contains(t1.getSubject(), null, t1.getObject())) { g2.remove(t1); } } ``` It is however generally recommended to use the matching `RDF` implementation for operations on a `Graph` or `Dataset` as it avoids unnecessary conversion round-trips. _Note: The `Graph` implementation is not required to keep the JVM object reference, e.g. after `g2.add(subj1, pred, obj)` it is not required to later return the same `subj1` implementation in `g2.stream()`. Special care should be taken if returned values needs to be casted to implementation specific types, e.g. using the appropriate adapter method from the desired `RDF` implementation._ The `.equals()` methods of `RDFTerm`, `Triple` and `Quad` are explicitly defined, so their instances can be compared across implementations, and thus can safely be used for instance as keys in a `java.util.Map` or `java.util.Set`. _Note: Special care might need to be taken for cross-interoperability of `BlankNode` instances. While multiple triples/quads with the same "foreign" `BlankNode` can be added without breaking their connections, the `Graph`/`Quad` is not required to **return** blank node instances that `.equals()` those previously inserted - specifically implementations are **not** expected to persist the blank node [uniqueReference](apidocs/org/apache/commons/rdf/api/BlankNode.html#uniqueReference--)._ ## Complete example The complete source code for the examples used in this user guide can be browsed in [UserGuideTest.java](https://github.com/apache/commons-rdf/blob/master/examples/src/example/UserGuideTest.java) within the [examples](https://github.com/apache/commons-rdf/tree/master/examples) folder of the Commons RDF [source code repository](source-repository.html). apache-commons-rdf-0.5.0/src/site/markdown/introduction.md0000644000175000017500000005657113212355376023520 0ustar andriusandrius # Introduction to RDF using Commons RDF This page is a tutorial to introduce programming with the [Resource Description Framework (RDF)](https://www.w3.org/TR/rdf11-concepts/) using Java and [Apache Commons RDF](index.md). If you already know RDF, you may instead jump ahead to the [Commons RDF user guide](userguide.html). This is not meant as an extensive RDF tutorial, for that please consult the [W3C RDF 1.1 Primer](https://www.w3.org/TR/rdf11-primer/). You may also like the [Apache Jena introduction to RDF](https://jena.apache.org/tutorials/rdf_api.html) which uses the [Apache Jena](https://jena.apache.org/) implementation directly. This tutorial attempts to show the basic concepts of RDF and how you can work with RDF programmatically using the [Apache Commons RDF API](index.md) in a simple Java program. ## Getting started with Commons RDF This tutorial will assume you already know a bit of [Java programming](http://docs.oracle.com/javase/tutorial/) and that you use an _IDE_ like [Eclipse](http://www.eclipse.org/) or [Netbeans](https://netbeans.org/). Note that Commons RDF requires Open JDK 8, [Java 8](https://www.java.com/) or equivalent. The Commons RDF JARs are [available from Maven Central](download.html#Maven). While there are multiple [Commons RDF implementations](implementations.html), this tutorial will use the built-in _simple_ implementation as it requires no additional dependencies. First, create a new Java project for this tutorial, say `rdftutorial`. **Tip**: Check that your IDE project is using the **Java 8** syntax and compiler. We'll create the package name `org.example`, but you can use whatever you prefer. Then create `RdfTutorial.java` with a static `main()` method we can run: ```java package org.example; import org.apache.commons.rdf.api.*; import org.apache.commons.rdf.simple.SimpleRDF; public class RdfTutorial { public static void main(String[] args) { // ... } } ``` ### Adding Commons RDF to the class path Above we added the `import` for the Commons RDF API, but the library is not yet on your class path. **Note**: If you are already familiar with _Maven_, then see instead [how to use Commons RDF from Maven](userguide.html#Using_Commons_RDF_from_Maven) and add the `commons-rdf-simple` dependency to your project. This will make it easier later to share your project or to use newer versions of Commons RDF. This tutorial assumes a classic Java project with local `.jar` files (say in your project's `lib/` folder), so download and add to your project's class path: * [commons-rdf-api-0.5.0.jar](https://repo.maven.apache.org/maven2/org/apache/commons/commons-rdf-api/0.5.0/commons-rdf-api-0.5.0.jar) ([signature](https://repo.maven.apache.org/maven2/org/apache/commons/commons-rdf-api/0.5.0/commons-rdf-api-0.5.0.jar.asc)) * [commons-rdf-simple-0.5.0.jar](https://repo.maven.apache.org/maven2/org/apache/commons/commons-rdf-simple/0.5.0/commons-rdf-simple-0.5.0.jar) ([signature](https://repo.maven.apache.org/maven2/org/apache/commons/commons-rdf-simple/0.5.0/commons-rdf-simple-0.5.0.jar.asc)) _Tip: If you prefer you can [verify the signatures](https://www.apache.org/info/verification.html) using the Apache Commons [KEYS](https://www.apache.org/dist/commons/KEYS)._ As there are [multiple Commons RDF implementations](implementations.html), we have to say which one we want to use. Add to your `RdfTutorial` class: ```java RDF rdf = new SimpleRDF(); ``` If you have the classpath set up correctly, you should now be able to compile `RdfTutorial` without warnings. ## RDF resources "The clue is in the name"; the _Resource Description Framework_ (RDF) is for describing **resources**. But what is a resource? Anything can be a resource, it is just a concept we want to describe, like computer _files_ (text document, image, database), _physical things_ (person, place, cat), _locations_ (city, point on a map), or more _abstract concepts_ (organization, disease, theatre play). To know which concept we mean, in RDF the resource needs to either: * have a global _identifier_; we call this an **IRI** * be used _indirectly_ in a statement; we call this a **blank node** * be a _value_, we call this a **literal** In this tutorial we'll use the _IRI_ syntax `` to indicate an identified resource, the _blank node_ syntax `_:it` to indicate an indirectly referenced resource, and the _literal_ syntax `"Hello"` to indicate a value. Don't worry about this syntax, RDF is a **model** with several ways to represent it when saved to a file; the [Commons RDF API](apidocs/index.html?org/apache/commons/rdf/api/package-summary.html) directly reflects the RDF model in a syntax-neutral way. Let's create our first identified resource, an `IRI` instance: ```java IRI alice = rdf.createIRI("Alice"); System.out.println(alice.ntriplesString()); ``` This should print out: > `` **Note**: For simplicity this tutorial use _relative IRI references_ which are not really global identifiers. While this is supported by `SimpleRDF`, some implementations will require _absolute IRIs_ like ``. ### Triples To describe a resource in RDF we provide one or more statements, which are called _triples_ of 3 resources (_subject_, _predicate_, _object_): ```turtle . ``` ![Alice knows Bob](images/rdf-01.svg) This RDF statement is a relationship between the **subject** `` and the **object** ``, not dissimilar from the subject and direct object of the similar English sentence _"Alice knows Bob"_. What kind of relationship? Well, that is identified with the **predicate** ``. The relationship is _directional_, from the subject to the object; although _Alice knows Bob_, we don't know if Bob really knows Alice! In RDF the predicate is also called a _property_ as it is describing the subject. You may have noticed that properties are also resources - to understand the kind of relationship we also need a description of it's concept. More about this later! Let's try to create the above statement in Commons RDF; first we'll create the remaining resources `` and ``: ```java IRI knows = rdf.createIRI("knows"); IRI bob = rdf.createIRI("Bob"); ``` Note that the Java variable names `alice`, `knows` and `bob` are not important to Commons RDF, we could as well have called these `a`, `k`, `b`, but to not confuse yourself it's good to keep the variable names somewhat related to the captured identifiers. Next we'll create a `Triple`: ```java Triple aliceKnowsBob = rdf.createTriple(alice, knows, bob); ``` We can access `.getSubject()`, `.getPredicate()` and `.getObject()` from a `Triple`: ```java System.out.println(aliceKnowsBob.getSubject().ntriplesString()); System.out.println(aliceKnowsBob.getPredicate().ntriplesString()); System.out.println(aliceKnowsBob.getObject().ntriplesString()); ``` > ``
> ``
> `` _**Tip**: Instances from `SimpleRDF` can be printed directly, as `System.out` would use their `.toString()`, but for consistent behaviour across implementations we use `.ntriplesString()` above._ With `SimpleRDF` we can also print the `Triple` for debugging: ```java System.out.println(aliceKnowsBob); ``` > ` .` ### Graph By using the same identified resources in multiple triples, you can create a _graph_. For instance, this graph shows multiple relations of `` and ``: ```turtle . . . . . . ``` The power of a graph as a data structure is that you don't have to decide a hierarchy. The statements of an RDF graph can be listed in any order, and so we should not consider the `` resource as anything more special than `` or ``. ![Graph of Alice knows Bob and Charlie, Alice and Charlie play Tennis, Bob plays Football](images/rdf-02.svg) It is therefore possible to _query_ the graph, such as _"Who plays Tennis?_ or _"Who does Alice know?"_, but also more complex, like _"Does Alice know anyone that plays Football?"_. Let's try that now using Commons RDF. To keep the triples we'll need a `Graph`: ```java Graph graph = rdf.createGraph(); ``` We already have the first triple, so we'll `.add()` it to the `graph`: ```java graph.add(aliceKnowsBob); ``` Before adding the remaining statements we need a few more resources: ```java IRI charlie = rdf.createIRI("Charlie"); IRI plays = rdf.createIRI("plays"); IRI football = rdf.createIRI("Football"); IRI tennis = rdf.createIRI("Tennis"); ``` Now we use the `graph.add(subj,pred,obj)` shorthand which creates the `Triple` instances and add them to the graph. ```java graph.add(alice, knows, charlie); graph.add(alice, plays, tennis); graph.add(bob, knows, charlie); graph.add(bob, plays, football); graph.add(charlie, plays, tennis); ``` Next we'll ask the graph those questions using `.iterate(s,p,o)` and `null` as the wildcard. ```java System.out.println("Who plays Tennis?"); for (Triple triple : graph.iterate(null, plays, tennis)) { System.out.println(triple.getSubject()); } ``` > `Who plays Tennis?`
> ``
> `` Notice how we only print out the `.getSubject()` (our wildcard), if you check `.getPredicate()` or `.getObject()` you will find they are equal to `plays` and `tennis`: ```java System.out.println("Who plays Tennis?"); for (Triple triple : graph.iterate(null, plays, tennis)) { System.out.println(triple.getSubject()); System.out.println(plays.equals(triple.getPredicate())); System.out.println(tennis.equals(triple.getObject())); } ``` We can query with wildcards in any positions, for instance for the _object_: ```java System.out.println("Who does Alice know?"); for (Triple triple : graph.iterate(alice, knows, null)) { System.out.println(triple.getObject()); } ``` > `Who does Alice know?`
> ``
> `` Let's try to look up which of those friends play football: ```java System.out.println("Does Alice know anyone that plays Football?"); for (Triple triple : graph.iterate(alice, knows, null)) { RDFTerm aliceFriend = triple.getObject(); if (graph.contains(aliceFriend, plays, football)) { System.out.println("Yes, " + aliceFriend); } } ``` You will get a compiler error: > `RDFTerm` cannot be converted to `BlankNodeOrIRI` This is because in an RDF triple, not all kind of resources can be used in all positions, and the kind of resource in Commons RDF is indicated by the interfaces: * [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) (identified) * [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html) (indirect) * [Literal](apidocs/org/apache/commons/rdf/api/Literal.html) (value) Look at the method signature of [graph.contains(s,p,o)](apidocs/org/apache/commons/rdf/api/Graph.html#contains-org.apache.commons.rdf.api.BlankNodeOrIRI-org.apache.commons.rdf.api.IRI-org.apache.commons.rdf.api.RDFTerm-): ```java boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) ``` In short, for any RDF triple: * The **subject** must be a [BlankNodeOrIRI](apidocs/org/apache/commons/rdf/api/BlankNodeOrIRI.html), that is either a `BlankNode` or `IRI` * The **predicate** must be a [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) (so we can look up what it means) * The **object** must be a [RDFTerm](apidocs/org/apache/commons/rdf/api/RDFTerm.html), that is either a `BlankNode`, `IRI` or `Literal` As we are retrieving triples from the graph, the `triple.getObject()` is only known to be an RDFTerm if we use it as a Java variable - there could in theory be triples in the graph with `Literal` and `BlankNode` objects: ```turtle "Santa Claus". _:someone. ``` In this case we could have done a naive casting like `(IRI)aliceFriend`; we inserted her `IRI`-represented friends right before, but this is a toy example - there's no need to use RDF if you already know the answer! So unless you know for sure in your graph that `` is never used with a literal value as object, this would not be safe. So we'll do an `instanceof` check (skipping any literals) and cast to `BlankNodeOrIRI`: ```java System.out.println("Does Alice know anyone that plays Football?"); for (Triple triple : graph.iterate(alice, knows, null)) { RDFTerm aliceFriend = triple.getObject(); if (! (aliceFriend instanceof BlankNodeOrIRI)) { continue; } if (graph.contains( (BlankNodeOrIRI)aliceFriend, plays, football)) { System.out.println("Yes, " + aliceFriend); } } ``` > `Does Alice know anyone that plays Football?`
> `Yes, ` ## Literal values We talked briefly about literals above as a way to represent _values_ in RDF. What is a literal value? In a way you could think of a value as when you no longer want to stay in graph-land of related resources, and just want to use primitive types like `float`, `int` or `String` to represent values like a player rating, the number of matches played, or the full name of a person (including spaces and punctuation which don't work well in an identifier). Such values are in Commons RDF represented as instances of `Literal`, which we can create using `rdf.createLiteral(..)`. Strings are easy: ```java Literal aliceName = rdf.createLiteral("Alice W. Land"); ``` We can then add a triple that relates the resource `` to this value, let's use a new predicate ``: ```java IRI name = rdf.createIRI("name"); graph.add(alice, name, aliceName); ``` When you look up literal properties in a graph, take care that in RDF a property is not necessarily _functional_, that is, it would be perfectly valid RDF-wise for a person to have multiple names; Alice might also be called _"Alice Land"_. Instead of using `graph.iterate()` and `break` in a for-loop, it might be easier to use the Java 8 `Stream` returned from `.stream()` together with `.findAny()` - which return an `Optional` in case there is no ``: ```java System.out.println(graph.stream(alice, name, null).findAny()); ``` > `Optional[ "Alice W. Land" .]` **Note:** Using `.findFirst()` will not returned the "first" recorded triple, as triples in a graph are not necessarily kept in order. You can use `optional.isPresent()` and `optional.get()` to check if a `Triple` matched the graph stream pattern: ```java import java.util.Optional; // ... Optional nameTriple = graph.stream(alice, name, null).findAny(); if (nameTriple.isPresent()) { System.out.println(nameTriple.get()); } ``` If you feel adventerous, you can try the [Java 8 functional programming](http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/Lambda-QuickStart/index.html) style to work with of `Stream` and `Optional` and get the literal value unquoted: ```java graph.stream(alice, name, null) .findAny().map(Triple::getObject) .filter(obj -> obj instanceof Literal) .map(literalName -> ((Literal)literalName).getLexicalForm()) .ifPresent(System.out::println); ``` > `Alice W. Land` Notice how we here used a `.filter` to skip any non-`Literal` names (which would not have the `.getLexicalForm()` method). ### Typed literals Non-String value types are represented in RDF as _typed literals_; which is similar to (but not the same as) Java native types. A typed literal is a combination of a _string representation_ (e.g. "13.37") and a data type IRI, e.g. ``. RDF reuse the XSD datatypes. A collection of the standardized datatype `IRI`s are provided in Simple's [Types](apidocs/org/apache/commons/rdf/simple/Types.html) class, which we can use with `createLiteral` by adding the corresponding `import`: ```java import org.apache.commons.rdf.simple.Types; // ... IRI playerRating = rdf.createIRI("playerRating"); Literal aliceRating = rdf.createLiteral("13.37", Types.XSD_FLOAT); graph.add(alice, playerRating, aliceRating); ``` Note that Commons RDF does not currently provide converters from/to native Java data types and the RDF string representations. ### Language-specific literals We live in a globalized world, with many spoken and written languages. While we can often agree about a concept like ``, different languages might call it differently. The distinction in RDF between identified resources and literal values, mean we can represent names or labels for the same thing. Rather than introducing language-specific predicates like `` and `` it is usually better in RDF to use _language-typed literals_: ```java Literal footballInEnglish = rdf.createLiteral("football", "en"); Literal footballInNorwegian = rdf.createLiteral("fotball", "no"); graph.add(football, name, footballInEnglish); graph.add(football, name, footballInNorwegian); ``` The language tags like `"en"` and `"no"` are identified by [BCP47](https://tools.ietf.org/html/bcp47) - you can't just make up your own but must use one that matches the language. It is possible to use localized languages as well, e.g. ```java Literal footballInAmericanEnglish = rdf.createLiteral("soccer", "en-US"); graph.add(football, name, footballInAmericanEnglish); ``` Note that Commons RDF does not currently provide constants for the standardized languages or methods to look up localized languages. ## Blank nodes - when you don't know the identity Sometimes you don't know the identity of a resource. This can be the case where you know the _existence_ of a resource, similar to "someone" or "some" in English. For instance, ```turtle _:someone . _:someone . ``` We don't know who this `_:someone` is, it could be `` (which we know plays football), it could be someone else, even `` (we don't know that she doesn't play football). In RDF we represent `_:someone` as a _blank node_ - it's a resource without a global identity. Different RDF files can all talk about `_:blanknode`, but they would all be different resources. Crucially, a blank node can be used in multiple triples within the same graph, so that we can relate a subject to a blank node resource, and then describe the blank node further. Let's add some blank node statements to our graph: ```turtle BlankNode someone = rdf.createBlankNode(); graph.add(charlie, knows, someone); graph.add(someone, plays, football); BlankNode someoneElse = rdf.createBlankNode(); graph.add(charlie, knows, someoneElse); ``` Every call to `rdf.createBlankNode()` creates a new, unrelated blank node with an internal identifier. Let's have a look: ```java for (Triple heKnows : graph.iterate(charlie, knows, null)) { if (! (heKnows.getObject() instanceof BlankNodeOrIRI)) { continue; } BlankNodeOrIRI who = (BlankNodeOrIRI)heKnows.getObject(); System.out.println("Charlie knows "+ who); for (Triple whoPlays : graph.iterate(who, plays, null)) { System.out.println(" who plays " + whoPlays.getObject()); } } ``` > `Charlie knows _:ae4115fb-86bf-3330-bc3b-713810e5a1ea`
> ` who plays `
> `Charlie knows _:884d5c05-93a9-3709-b655-4152c2e51258` As we see above, given a `BlankNode` instance it is perfectly valid to ask the same `Graph` about further triples relating to the `BlankNode`. (Asking any other graph will probably not give any results). ### Blank node labels In Commons RDF it is also possible to create a blank node from a _name_ or _label_ - which can be useful if you don't want to keep or retrieve the `BlankNode` instance to later add statements about the same node. Let's first delete the old `BlankNode` statements: ```java graph.remove(null,null,someone); graph.remove(someone,null,null); ``` And now we'll try an alternate approach: ```java // no Java variable for the new BlankNode instance graph.add(charlie, knows, rdf.createBlankNode("someone")); // at any point later (with the same RDF instance) graph.add(rdf.createBlankNode("someone"), plays, football); ``` Running the `"Charlie knows"` query again (try making it into a function) should still work, but now return a different label for the football player: > `Charlie knows _:5e2a75b2-33b4-3bb8-b2dc-019d42c2215a`
> ` who plays `
> `Charlie knows _:884d5c05-93a9-3709-b655-4152c2e51258` You may notice that with `SimpleRDF` the string `"someone"` does **not** survive into the string representation of the `BlankNode` label as `_:someone`, that is because unlike `IRI`s the label of a blank node carries no meaning and does not need to be preserved. Note that it needs to be the same `RDF` instance to recreate the same _"someone"_ `BlankNode`. This is a Commons RDF-specific behaviour to improve cross-graph compatibility, other RDF frameworks may save the blank node using the provided label as-is with a `_:` prefix, which in some cases could cause collisions (but perhaps more readable output). ### Open world assumption How to interpret a blank node depends on the assumptions you build into your RDF application - it could be thought of as a logical "there exists a resource that.." or a more pragmatic "I don't know/care about the resource's IRI". Blank nodes can be useful if your RDF model describes intermediate resources like "a person's membership of an organization" or "a participant's result in a race" which it often is not worth maintaining identifiers for. It is common on the semantic web to use the [open world assumption](http://wiki.opensemanticframework.org/index.php/Overview_of_the_Open_World_Assumption) - if it is not stated as a _triple_ in your graph, then you don't know if something is is true or false, for instance if ` .` Note that the open world assumption applies both to `IRI`s and `BlankNode`s, that is, you can't necessarily assume that the resources `` and `` describe two different people just because they have two different identifiers - in fact it is very common that different systems use different identifiers to describe the same (or pretty much the same) thing in the real world. It is however common for applications to "close the world"; saying "given this information I have gathered as RDF, I'll assume these resources are all separate things in the world, then do I then know if ` ` is false?". Using logical _inference rules_ and _ontologies_ is one method to get stronger assumptions and conclusions. Note that building good rules or ontologies requires a fair bit more knowledge than what can be conveyed in this short tutorial. It is out of scope for Commons RDF to support the many ways to deal with logical assumptions and conclusions, however you may find interest in using [Jena implementation](implementations.html#Apache_Jena) combined with Jena's [ontology API](https://jena.apache.org/documentation/ontology/). apache-commons-rdf-0.5.0/src/site/markdown/index.md0000644000175000017500000001551113175455642022100 0ustar andriusandrius # Apache Commons RDF Commons RDF aims to provide a common library for [RDF 1.1](http://www.w3.org/TR/rdf11-concepts/) that could be implemented by systems on the Java Virtual Machine. The main motivation behind this simple library is revise an historical incompatibility issue. This library does not pretend to be a generic api wrapping those libraries, but a set of interfaces for the RDF 1.1 concepts that can be used to expose common RDF-1.1 concepts using common Java interfaces. In the initial phase commons-rdf is focused on a subset of the core concepts defined by RDF-1.1 (URI/IRI, Blank Node, Literal, Triple, and Graph). In particular, commons RDF aims to provide a type-safe, non-general API that covers RDF 1.1. In a future phase we may define interfaces for Datasets and Quads. ## API The class diagram on the right depicts the main [interfaces](apidocs/index.html?org/apache/commons/rdf/api/package-summary.html) which may be included in Commons RDF, specifically: * [Graph](apidocs/index.html?org/apache/commons/rdf/api/Graph.html): a graph, a set of RDF triples. * [Triple](apidocs/index.html?org/apache/commons/rdf/api/Triple.html): a RDF triple with `getSubject()`, `getPredicate()`, `getObject()`. * [Dataset](apidocs/index.html?org/apache/commons/rdf/api/Dataset.html): a dataset, of RDF quads (or if you like, a set of named graphs). * [Quad](apidocs/index.html?org/apache/commons/rdf/api/Quad.html): a RDF quad with with `getGraphName()`, `getSubject()`, `getPredicate()`, `getObject()`. * [RDFTerm](apidocs/index.html?org/apache/commons/rdf/api/RDFTerm.html): any RDF 1.1 Term which can be part of a Triple or Quad. IRIs, literals and blank nodes are collectively known as RDF terms. * [IRI](apidocs/index.html?org/apache/commons/rdf/api/IRI.html): an Internationalized Resource Identifier (e.g. representing ``) * [BlankNode](apidocs/index.html?org/apache/commons/rdf/api/BlankNode.html): a RDF-1.1 Blank Node, e.g. representing `_:b1`. Disjoint from IRIs and literals. * [BlankNodeOrIRI](apidocs/index.html?org/apache/commons/rdf/api/BlankNodeOrIRI.html): this interface represents the RDF Terms that may be used in the subject position of an RDF 1.1 `Triple`, including `BlankNode` and `IRI`. * [Literal](apidocs/index.html?org/apache/commons/rdf/api/Literal.html): a RDF-1.1 literal, e.g. representing `"Hello there"@en`. The design of the [API](apidocs/index.html?org/apache/commons/rdf/api/package-summary.html) follows the terminology as defined by [RDF 1.1 Concepts and Abstract Syntax](http://www.w3.org/TR/rdf11-concepts/), a W3C Recommendation published on 25 February 2014. The idea is that Commons RDF provide a common library for RDF 1.1 with multiple implementions for the Java Virtual Machine, allowing the portability across different Commons RDF implementations. Commons RDF is designed for compatibility between different [implementations](implementations.html), e.g. by defining strong equality and hash code semantics (e.g. for [triple](apidocs/org/apache/commons/rdf/api/Triple.html#equals-java.lang.Object-) and [literals](fapidocs/org/apache/commons/rdf/api/Literal.html#equals-java.lang.Object-) ); this allows users of Commons RDF to "mix and match", for instance querying a `FooGraphImpl` and directly adding its `FooTripleImpl`s to a `BarGraphImpl` without any explicit convertion. To create such instances without hard-coding an implementation, one can use: * [RDF](apidocs/index.html?org/apache/commons/rdf/api/RDF.html): interface for creating instances of the above types (e.g. `LiteralImpl` and `GraphImpl`) as well as converting from/to the underlying framework's API. The API also includes a couple of "upper" interfaces which do not have the above equality semantics and bridge the graph/quad duality: * [TripleLike](apidocs/index.html?org/apache/commons/rdf/api/TripleLike.html): common super-interface of `Triple` and `Quad` (also a generalised triple). * [QuadLike](apidocs/index.html?org/apache/commons/rdf/api/QuadLike.html): a `TripleLike` that also has `getGraphName()` (a generalized quad) * [GraphLike](apidocs/index.html?org/apache/commons/rdf/api/GraphLike.html): common super-interface of `Graph` and `Dataset`. See the the [user guide](userguide.html) for examples of how to interact with these interfaces. ## Modules The project is composed by two modules: * [API](apidocs/index.html?org/apache/commons/rdf/api/package-summary.html) defines a common library of RDF 1.1 concepts. * [Simple](apidocs/index.html?org/apache/commons/rdf/simple/package-summary.html) provides a simple implementation, mainly for internal validation and very simple scenarios. * [jena](apidocs/index.html?org/apache/commons/rdf/jena/package-summary.html) provides an Apache Jena-backed implementation * [rdf4j](apidocs/index.html?org/apache/commons/rdf/rdf4j/package-summary.html) provides an Eclipse RDF4J-backed implementation * [jsonld-java](apidocs/index.html?org/apache/commons/rdf/jsonldjava/package-summary.html) provides an JSONLD-Java-backed implementation These modules follow the [semantic versioning](http://semver.org/) principles, where version `x.y.z` of `Simple` implements version `x.y` of the `API`; i.e., the version `z` are backwards-compatible patches of the implementation. For more details, read about the [implementations of the Commons RDF API](implementations.html). ## Contributing Everybody is welcomed to [join the project](mail-lists.html) and [contribute](contributing.html)! apache-commons-rdf-0.5.0/src/site/site.xml0000644000175000017500000000576713175455642020327 0ustar andriusandrius Apache Commons RDF /images/commonsrdf-logo.png Apache Commons RDF logo https://commons.apache.org/proper/commons-rdf/ org.apache.commons commons-skin 4.1 Apache Commons RDF Apache, Commons, RDF
Apache Commons, Apache, the Apache feather logo, and the Apache Commons project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
apache-commons-rdf-0.5.0/src/site/resources/0000755000175000017500000000000014132221255020615 5ustar andriusandriusapache-commons-rdf-0.5.0/src/site/resources/images/0000755000175000017500000000000014132221255022062 5ustar andriusandriusapache-commons-rdf-0.5.0/src/site/resources/images/rdf-01.svg0000644000175000017500000001323413175455642023616 0ustar andriusandrius
<Bob>
&lt;Bob&gt;
<knows>
&lt;knows&gt;
<Alice>
&lt;Alice&gt;
apache-commons-rdf-0.5.0/src/site/resources/images/class-diagram.png0000644000175000017500000021366513175455642025333 0ustar andriusandrius‰PNG  IHDRî'øo± IDATx^ìX”KÇÿ ˜€bww€„…Š‚uÕkëµ[¯­Ø‰b'*v×gw_; »»®(Êî÷œá¾ë.îÂî²Ä.gžç{îçöÿž™3gdàĘ`L€ ˜ ™É´”ʘ`L€ €…›'`L€ 0"ÀÂmBƒÅMeL€ 0&ÀÂÍs€ 0&À˜€ `á6¡Áâ¦2&À˜`áæ9À˜`LÀ„°p›Ð`qS™`L€ °pó`L€ 0&`BX¸Mh°¸©L€ 0&ÀX¸y0&À˜0!,Ü&4XÜT&À˜`,Ü<˜`L€ ˜n,n*`L€ 0nžL€ 0&ÀLˆ · 7• 0ãpv´ï™Ì[&C^ã–Ì¥1è (x™be``H}Y±pëKŒó3&`6œî³h›ÍpšdG"äáù‚ƒo<Чñ,ÜúÐâ¼L€ ˜g…Yuˆ;cr"ärààP}έ-΢€YPîT)S#g6^17«N„yóî5Þ¾­l w"$n`‰—€ªpÊWƒºOL¼å–™]ÿlÀÞÃY¸Íb4¹L€ Ä;îxGžä+dáNòS€0&,ܱ¡ÇÏB€…Ûjü `Là?,Ü<â› w|çú˜0+,Üf5œ&Ñn“&n$`‰• wbóm ·ùŽ-÷Œ 0x À¹ 5,Ü Gâöýk¨V©.¬,“A9>|ü€[÷BðîÃ!ô=ÚCîœÔʽyç f.ñ s¡ü%´Ž@îìùà¥Mf2\fÑ n³Fî` EÀPá~ôä.&Îû èÚf°Ææï:´{l†«‹;:4óy úy·†¥¥fz¯V{N.—Ãÿì>lÚ½Ö©m1fÀlØÚØ)óüsb'¶ì]‰fu;£š[Ý„BÆõÆ’ w,òãL€ $m† ÷© ÿ`ÍÖùhT»-j¹7ÖñÍ»W1¥rç(€‘}}Dž×ožÃkZO-è€þÕøÜökqàØVÔ¬ÜMþl¯Ì³|ƒ/ÎÇ€®ãP¤€}Ò8î= · 7 0„'`¨pÿoÇbøŸÝÏÎÞ(^ØQcGî=º…©~CQ¬P)ôë2Fä ¸r‹×MGÍ* ФNÏ}øôC&tD–ŒÙ1n°Ÿ2ÏØ™}ñìåcÌô^ëÔ6 [`nƒ°ñCL€ 0H† ÷´ùÃp÷áM̽6Ö¶¿á ÿ¿•“pãnZ4øêˆ<;¬Ãþc[йŔurÓ: C&tƧ/0ÒfóÚ÷ðïè7ºÒ¦I‡)#–òð™0nWoaìÀ¹Èš9§VÃ'wÅÛ÷¯…pÓ~¸d½Û+ÞF&<8nÁX¸ FÇ2&À ³¸_¼~oŸ^Zñ¥JiEœP¦T%!ܪiÈ„Nû†ÙãÖÁÂÂBc$þžÞ­`eiß±ëDžçbݶ…1YßΣP¢°sŒù8CÂ`áN8ö\3`f@À‹ûâå“Xº~&ê×l‰?«5SR Á%KY.À”K`e•L´w] O é9E+½»o`Úüájl$Ú$ÞÅÊüv.\µ º5ZÀÖ:ŒŒùv…Û|Ç–{Ƙ@<0D¸·í[ƒÇ·£gû(U¼ŒZ+¥=ìÍûÂÕÙCí»Ð›˜»|<Ü]k£eîZ{·d½.]>¶Mz¢RÙ"ß”yCqÿñ-LºÓg‰2\E\`áŽ+²\.`I‚€!Â={éX\»ŒIÃ!CºÌjœþ}û#§vGÞœ1¼ÏtµïöÝ‚ש rTÈg/ÅÊÍs‘=K.xyÎûÛÒÒyr«ä˜9fM’sî$ ·9.÷ 08'`ˆp×^ˆ©ïصÛ' û°žS‘/OaežÅk§# ä Föñù-*Úç/ŸpÀþ9±ilÒŠhk’eýìå#Œé©v¬,ÎÁpqF€…;ÎÐrÁL€ $ú 7yŒ›Ô…òÇ î5"’Îj—uªŒÎ-ú+óxMë×o^(CÒõå¿Ïp÷ÁuüøùCViÛ¤2eøµ~>ð8–oô^(à 'Ó&ÀÂmÚãÇ­gL è+ÜW®_ç³Ý]ë eÿ5¶>"â'†N삯߾`òð%Hkk‡°o_Ų¨‰.Ik›ùó^èš‚¹lÙ³ÿœÜ‰®­Á¥TÅ&ÆÕÇ– wl òóL€ $iú w’†Å7 n£`äB˜HªX¸“êÈ'\¿Y¸Ž=×̘€`á6ƒA4±.°p›Ø€qs™H\X¸×x$…Ö°p'…Qæ>2&gX¸ã -¬… 7O &À˜@,°pÇ?jnƒ°ñCL€ 0H,Ü<â› w|çú˜0+,Üf5œ&Ñn“&n$`‰• wbóm ·ùŽ-÷Œ 0x )Ü ( CÎlyТ¾æhhñЮ"‰8}éÎÍ;dˆË=‚ƒCýõé¾LŸÌœ— 0&`Nœü#hN#jb}Q n5n.` IÀÙÉA!cåNÈ!HòuGÈ#þ¾ºT[ö®Äë7Ï1¼ÒÚÚé\†!Y¸ ¡ÆÏ0&Àþ#`nÂýþã;œ<µ«6…•¥U¬ÆùýÇ78vz®Ý¾Œ×o^àû÷0¤H‘ Y3ç@©bePŵ6R§²ŽUÆxØá¾tË6ÌDÛ&=Q©l P_Çû@ެyÐÿï±ÉdÆhšÆ2X¸ã -̘@R `nÂ- ÒÜ ‘½ÃÍ»Wð5ì ²fÊ>F!cú,×cŒõîoßÃ0bJ7dΘ ÃzMU6áBÐ ,Û0K)æÆh›¦2X¸ãŠ,—˘@’ `n½i÷r9µ±î›wCá»Ä[X×[ôƒ}±Òjs!üG8¶ï_ƒ£§÷ o΂Úk*,,,l¾è+Üü·‰ö÷îàûb.Êv+ Œé‰°o_1iØBXÆrÅBî›*\1`æ@ÀPá¦%é]‡Ö#ôF >ýˆôvááú'ªT¨¥\¢^²Þ—.ŸÆt¯•bYöîƒëèÒz‹—讜â÷øÙ}ÈåȘ>+Ê8¹¡¦[$‹b-Ÿ¹x'Îij— WÈ‘Á.œJº¢–Gc¤L‘J”×Ç«%Â|S‹…Ì ¦lÿŽˆø‰NìÄù ãxõïsXY%ËÂî®uPÖÉMm('΄GOï¢wG/Øý%lQÇ{뾕°±N ·²5•Kæ1õY—~P=ý¼Û‹¾Ý_½°y÷ Ü{tòäÊ– kµA‘%•ÍQ ÷ 9ƒ“çáÝÇ7HcÙ¶:ÕþR.}Ëår Ø ©SÙ`ì y¿MabDûÝ][ ‚K©Šq2ÅY¸ã+ʘ@R!`ˆpúüfÂ÷ð0T.÷lmípónB®_BÅ2ÕÑ®i/où†Ù8䲎nøö…ò‡}±²È™-7ߎmûV£p¾(íèK \¿s—.ŸB‰ÂÎèÓÉK)6þgöã;#OŽ(ãTY,?x|[8V)`]ljú®\¿ˆ]‡6àñ³{Bx,“%/ dIú­š„Ð(ï\EòÛ#,< Oàþã[hT« jy4eЋY¹sÀȾ>zOƒèú¬k?¨ÒÁã;À )S¤DÕJõ7gÐËÒ¦]ËðáÓ[ ëí#8R’„»BéªxüìJ;T€ÌÂÇNïÅ»oйÅåËɃ'w0yî`T­ø'š×ïò[ÿž<„ñ¾žpq¨ˆ®­éÝ]`áÖ…çaL€ h!`ˆp¯ß¾ÇÏÀ€¿Ç¢HAeÉóVL@ÈŒîï+¬YÚ#>séŠr{ÁÒròÛ÷ÿÂkZØuF÷¶ÃÔ¡6îZ&¬ðÞF*—¨×l‡Oîb`·ñH•2µ²¾…k¦!(ô,Fõ›­±ÙËÆáÚ­ µ¥rzX²~þª× Õ+ÕS>ÿ3â'¦ù Ó1märØXÛâô¥#X½yjTnˆ¦¶×{Þhë3¤O?H¸?~þ€Ö»‹—#)]½ˆ9ËÆÃÕÅšõUî‚y‹‰—i‰ûÑ“»˜8wŠ•A¯#DÞǶbûµèÑnK”ÓØ?ª[&³Ä4¯ez÷_—X¸u¡Äy˜`Fn²^Žk/tâÐ…j¥¾zóïÞ½BŽlyIJd vnÑe*+ó’0“@“%XXeÉ—2Å;{éÔpk€¦u;hl59Œ)ô߆=‡7 Q"q¢¤I¸®žŠ «çD{­¬ÔÖN?„݇7(Ë„­YÝΨæVWïy£­Ïš Š®’pûŽ]‹T)y®Ó’¿§wk¤µM§ä/ÕÙ£íP8–,¯¬ŠÆªçð¦È•=Fü·z ½XH/WšÚ5}ÁÜypó'mŽ“}nn½§?À˜øE@_‹›Ž ØÅ •B¿.c¢E) ʈ>Ó‘'gAeÞuÛŠýêè’‹}tm3XdùþýöÛŠ Ðsxóþ•ðôVMª‚¥I¸½}zãÅë§ÑÖײAW¸W¨­\ÂoZ·#j¸ÕW{†Ž…ÑKEÔTµb]4¯ßY|¬­Ïúöƒ„›ÒôQ+«oøä®xÿárÿ^ªS“÷ónti3À{ÀQŽßÊIbKaš× ­çµ¥©#—Ã.M:£ÿ¹°p)Ș@R" ¯p¿|ý £}z‰elZÎŽ.ióv¦#Gtô¨iöÈ–5rŸ6j²±N#<¶É™jÆ"/a’˜—v¬[k;XZZà\ ?ŽŸ=€˜„›^4>~z‡^µ·——dÎçcùF_xT¨ƒ þVkÖ‹WOpøänågaß¿ç;MÂ5оý áNž,%&S_Õ ÊÇÌè‹ç¯cþ¤-°´´T¾,h ÀU¸g,…[÷B£õº—¬ò1ç![æFÿs`á6:R. 0¤D@_áþðé=†LèÚOÜc’AÂ-YÜÑí³JߺwU7íÇR~ÕDGšèhSLÂ-YÜQ—55þÍ»WâŒs¦ Y1~ðüh‘{Ï裓pëÛn…ðý»ÅM/"ßÿúC)ºã`lq'¥¿fî+`I‚€¾ÂMPŒi Èd˜îµ\môù«§¸~'Eò—ÎiÚå虽ظs)þ¨Òë´SãLËàä4&9¡Ññ©U[æ¢y½Î¨ZI}Ïyªß0qL*&á–œØÈA®dgµú¾|ýŒ)RªEY›µÄ7î\A›Æ=àV®¦Öy pëÛiÛgô*ØZ§Q¶¿A–ŒÙ1f`äò·>Â-YÓÞf#{ͫӎÄû×x;Iüp'™09†÷š-óqêâ?hÛ¸'*•«¡ì3yn“÷È>>ȳ€VA¡#JdÕZ§²÷À9j´÷ð&ì?¶ž]Æ¢P¾bÂK¼Õ«Uª‡fõ:)ë:yþ¶î[°o_йåqäŒÒÜåãz33½×À:µøLò*/ZÐAìËKá<#""0wÅx<{ñãû)σ?}ñ“ç Ëô-tg¡£†}úü!6ìZ*–ë×h‰?«7‹VDõí‡$ÜôbC/8R:p +7ÍmjÓ¤‡Þ­ô*o?\yž>ê¤<¡#d°`¯r“ûkæ3&$"Ütœkò¼Áøü媔ÿéí2áÖý«âwygtl®~LIÓÞ«½‹–¤Ý+ÔAÊd)qó^.ŸDÑöèÛÙ[ìßRxÎQÓ{ŠÿÖñhŠ é²àÚí a7®ÝN„褳ÜäHFûîtq†ÿÙ}(]ª’8÷íêâ.<ÜI ¯Þ yË–rCxD8.{Ý-P¯zsµñ¦sé‹×ùàó .“ …ò•€ujk|ùúEœ'ï÷dVÉð‡{cüY­™ò¨›6ëWß~p'K–VVV Ž|9 áÝǷ“^.W`¤ç dÍy¡ˆ>÷¯sÜ¿êT;N/-ãfõãsÜI⯟;ɘ€I0D¸©£´¼óàz\»Œ¯ß¾Ïew×Úb¿—7&A¡ï.ŸÆ‘Ó{ðäù±<ž1]f!¸µÜ!yò”JžŸÞÅæÝËE„µdVÉQ¬p)4%­mz,X37n_FÞ\…0¨ûDüûö%¯.ÎfÛ¤Nƒ¡½&#CºÌøù󇈜v!ø„ˆœFJh9¿J¹Z¨P¦ªÆ±#kž‚¦\¹~ /ÿ}&^lRÛŠØä%Š:ÃÕÙCDŒSMщ¨>ý á¦c`};Ææ=+@aX#ä?E`˜¦µÛ#_žÂÊjõî_‘Ól1vÐÜßúýÏÉ]زgþn5PŒE\$vN‹ ª\&`I†€¡Âd%PGI¸)Vú„! ŒÞi¹¤\ `I‰ wâí¸név0rpÚkŠß–8ç·Š 0& F€…;qNˆ¸nê1ßÇ8Ç[Řˆ‘ wŒˆ$C\ 7uŠù袖AÝ'ˆÁ^¿yŽa½§ÇI´4Uˆ¼Tž SŠ+eLÀ\°p›ËHšN?X¸Mg¬¸¥L€ $B,܉pP̼I,Üf>ÀÜ=&Àâ– wÜòåÒ'ÀÂͳ‚ 0& ,ܱ€ÇD€…Û lü`L ’ 7Ï„ø&ÀÂßĹ>&ÀÌŠ€n>]&T,]ͬúÇI|nÜ Åí{¡ˆœw DÈÁÁ¡þú´T¦Of΢0'.Nö ºé‹Htu©\!gáNø\'`¦I@u©Ü4{À­6uòˆ¿ƒƒ¯.Õ§üª©-΢€YpvvPð Y ©Iu†â£Ë¼TnRƒÆeL a DZÜ´Í-Cάyм~—„m×nöÎÝ+NóN"ä¼TnöƒÎdLÀxØ«Üx,¹$ݰW¹nœ8`L@#nžñM€…;¾‰s}L€ ˜n³N“è ·I 7’ 0ÄJ€…;±ŽŒù¶‹…Û|Ç–{Ƙ@<`áŽÈ\…nžL€ 0X`áŽ<~Ô ,Üa㇘`‘X¸y&Ä7îø&Îõ1&`VX¸Íj8M¢3,Ü&1LÜH&À+îÄ:2æÛ.nó[î`ñ@€…; ›Q/_?ÃT¿¡(YÔÓgÆÿíðìì"JêÜKnQqÆ„"àèhßÀÂBæ˜Põs½qK@.W‡ìŒÛZâ®tsî÷ßáäùƒ¨]µ)¬,­ ç5­^¿y¡ölÊ©.mFÈS®¥=P0o1ƒÊV}èÀ±­p¶wEæŒÙc]–± ˆŽßᘯ۶'ÎÄèþ¾È‘5OŒ+Ê8¹¡¦[$‹b-Ÿ¹xTˆÃ³— WÈ‘Á.“ÎZAËØ”úxµDøoÊ·Y`Á”­âß?ñω8t¯þ}+«dBdÜ]ë ¬“›Úd‘,nMÂMiÉxÚ‚xôô®šõIßÝypûŽnƃÇw„•žÖ6 å+Žú5["cú,¢žy+& äF€Zƒ»ODÁ|Åþ#ûnF`ÈYÐKqÈ”!+Ü+ÔA—ªÉ~]Âúþã8¶ ¡7ñþã[$O–Ù³äBõJõàX²¼ZùžÜÅÞ£›qûþ5Ñ®46iQ²ˆ êÖh»4bäçf?þ·s1º´€2¥ÔyQÙçB×ZhÕ°[Œx,Ü1"â I ªp/\¤×]ñ Ùt®;Ý»ýºþ2© ÷§Ïï1aö |CårÀÖÖ7ï† äú%T,Síšöô–o˜óAþ(ëè†/aŸQ(oqØ+‹œÙrãàñíØ¶o5 ç+ÒŽn°´°Àõ;Wpéò)± Û§“—R¤$ÑÈ“£Ê8UËÓ߯™KGQ¤€=t'ê»rý"vÚ€ÇÏî¡k«A°L–L¼$ÐҶߪI½€òÎUP$¿=ÂÂÃp!ðî?¾…FµÚ –GåˆÇ$Ü”ñòµ‹˜¿j’è[ç–ijŸÜÁô#:•-ª”ÿilí„øúŸÝdVÉá=pl­Óˆåvÿ3›?«5CîìùP0_ ØXÛbñÚé9#ö¾‹p@„ü'‚BÏãÖ½PÔ¯ÑVo&êúñãfzâí‡ÅËGÖLÙö= ‚ŽãÑÓÈþ»”ª(ò’Xû.ñF:»Œp+Wilìðäùñ"dÊ#ûúˆýimüT_6fŒ^-Ú©šˆï ñ`!“aú¨•1þv°pLjˆ3$$¨Â})àrB6‡ë6"Ò.¥”¥%5á^¿}ŽŸ;€E‘‚J’%)-™®Ú<g.AñBŽbIØÂÂBä}ûþ_8ÚuF÷¶ÃԬȻ– +¼w‡‘°/VZä_³u>>¹‹ÝÆ#UÊÔÊú®™† Ð³Õo¶x 4{Ù8\»¤¶TN/KÖÏÀ_õ: kTJ$~Óü†áÉ‹‡˜6r¹Rtîïáßá9º%2¤ËŒ‰CŠ"Ÿ=€S£éŸíÅ …”ŽžÙ‹;—¢yƒ.¨ZáOñ±´_¬ºÇöí+毜[›´èÚfð¯vþüSº Ÿ1z•øüÞ£[»›^8èÅCÙ§Ÿ?à·j2 ä.‚º5š‹—–±3=Å*-q«Šnpè9,X35*7mÖÆ8 Ó™3dƒW¿™ÿФՕqƒü%SôÎv,ÜFü!⢌O€…ÛøLK‰IU¸IŽk/T,iL^½ywï^!G¶<°±N‹Õ[üpúâatnÑ_8s)…ìô@wn1…£#¢¥ðÙKÇ †[4­ÛAãp“)ô߆=‡7¢W‡p(VF«ð,\=AWωöZY©;¬:›éŸÏ IDAT»oP+Cá¦ÊˆµeÎøÿil'-ÏGÈå¸÷ð&f-­Ö'Mµbýãçññ¼ãqón(f[/¶Ȫž8g XèÙa¸Vú§Ïbœo?a•“§½j’AÑ>½‘9c6Œì;C+¿7ï^cÄ”®b [Í{ú;®Ã¾£[àÙe ŠúõR« wbùãvh$ÀÂm¾#© 7í«ØÅ •B¿.c¢`I¸Gô™Ž<9 *óJÎLÑ=ìb_Aiu’cÔþc[zoÞ¿b©šz´ªÜÓÕdq{ûôÆ‹×O£mkË]á^¡¶È£«p÷ón @ß±k•eŸ:ÿ°º©¾°o_Ôê¬Z±.š×ï,>Ó&Ü䥽÷È!ÒäG@{ÿªiÖ˜µHÊZ|´`õ_=ôv™àX¢, ç/‰¢ÔV%.^>‰¥ë5[ÉR¹6Öi”–¼&~ŸÞŤ9ƒÄ¶HëÆÝ5r¤Uñ2Ör€Ø>ˆ.±p›ïï¢YôŒ…Û,†Qc'’ªpSŽÑ>½Ä26-gG—$á?ØOí¬ò² ³p!èšÖilY#—¸£&“¼9 B.—cÆ"/áôEb^Ú±l­í`iisþby:&ᦟޡWGíí¥³Ô™3dÕY¸?ù€ã: [æ\3pŽxŽŽJ‘ Ó^ʯš¶ï_ƒþÛbnÉâ&Ë8UÊHk5º¤‹Å}úÒ¬Þ<UÊ×B«FÝ„7ø€±ma“ÚcÎUzºS=Wobβñ1 ÷ž6Šeûfu;£š[]µ&Nñú›p«føòõ3®Þ ÂÉsqëþU”srG§ž,îj•ê¢Y½Hk?ºÄwL„ø{³'ÀÂm¾CœT…›F”•@Ä^Ëa©ìù«§¸~'Eò—G­´YÜ’³–& Ž–ÁÉ’”œÐèت-sѼ^gT­¤.fSý† í˜,nɉMS°¼)RªíÇ$ÜdÓþ2EWÑ×GXØä=>rjwÍ/ÿYâ1YÜ+7ÍÆÙŒê7 9³åUþñ|þò Ã'wGÝT-nM]´B1Þ·þ}÷ sÆýO_<Æx_OäËUÃzOýí:! ñL“pK{ܪÛQ ¢£{læ=nóýÉK:=cá6ß±NʽfË|œºøÚ6î‰Jåj(™<·Éƒ{däÎY@«p¿ûð#¦tG‘¤#RR!{oÂþcää4…òçÉ[½Z¥zhV¯“²®“çaë¾ÕbYu_uîòñâ\óLï5°Nm#òK^å´ÿKûòÒY興Ì]1^,eì§´’£nÚƒ^±qî>¼©¶çþ }FµD®ìùáåéèE‰œÈüVN-ƒ»•­‰6MzˆÏ¥ãpÝÛ…Óg®·î]…C'v GûáʳîÔFzº|í‚èëÔ‘Ëa—&ð¼'¡Ök 2eȦ¬ÚH¸Ésßwì:ñ¹·O¼xýƒºOgÊ¥D«´Þ¸v;Ô¬ÒP|¬‰ŸÒ«Ü  Rk"Y­C‡ Þ¬Y :<.º S™ß¿Ge7W”,ieË#c)G—Ö®] ßY30tèüÕì—SPLÏÑ÷´òЫg7tïÞ]þŽù&"]Ê4$ ·!ÔøS'@x¦ø }ÑÒȘ>3øo‡gçÑj±Ùcê#/•ÇDˆ¿OP† ÷ÆÿÃôiSP®\yÌò«u)üß_cÞÜÙ¨T©2ª×¨)úJÖy¥ŠåP¹²;5nŒ©S&áÓ§O8ôÏ1á4tûö-¬Z¹.œÇ‡!C”.]={õFÖ¬¿Ž•œ8qú÷…·÷8XZY‚ö°>| ,û¿þjŽŽºÀÊÊJÔyíÚU´kÛ -Z´BÅJ•°xÑBQ-þø£úzöW:,QþQ£F`ÿ¾½X¾b5´Ç5¦Uz!(X°V®Š +)í¥Ïœ5•+G^uNù&Ož€íÛ¶Š½pOÏþÂêõê–,YˆS'OâÝ»·°³K'˜vëÞÙ³G¿œÓÄaᎉÏ4`áæ™‘¨ "Ü_¿~EýzµñíÛ7ìØ¹3fÔ«÷ïßÃ_M !¿ïZ¶ltéÓ£Jwܼy]:w/Mšü…¬Ù²áé“'ذa=²eˆuë7!EŠ¢¾Õ«WbÎìYBè^¾|‰êÕkÀÆÖ»wíÄÝ»w„·ky íÁO˜0ÕpõjˆØwOmm-„ôÁƒû6l$šþy!%ZV§vž8y©REÞ¥¬)ѳM›4DãÆM1bä(‘EZ‰Ø»ï²dÉ"^TF‰C‡¨µéúõkèÙ£«ëzõ kÖ¬xpÿ>6mÚ úÿ¿ [ÄK‹¡‰…ÛPrü\R'ÀÂÔg@"ï¿!Â}ðà~Œ1 õë7Ähï±z÷ðèÑÃ2x ¥+רY–$°Û¶mÁÐa#P¢DIeÙ æÏòeK0Ïo!Ê—wŸ“îÛ·NNÎð›¿Hiõ¿xñõêÖBÞ¼ù°yËv‘wêÔIؼi£ølé²B,)I–x­Zµ1aâñ½+W.lݶ+Úþ‘>ÆDÓ¦‘ÂO¢ÿöí>r\”EÛgÏžÁ¨Qc„@S¢—Ÿf5BÎ\¹áë;)Sþz9øöìÕ:ýºS[_Ð,ÜúãüL ’ 7Ï„DMÀáž4q¼×I“§¢fÍZz÷oá?,]º½zõËÙÚYª?~ü÷õ.]²HXØóæ-Pzn7oÖDXÖ$ÎùòåW+¦ÖÕñùó'œ:}^|Þ¹S{\¾Œ%KW¡—Ò“'ѰA]Ôª]&LKÇ»jÔü“'O‹¶´ °rårå’º´—îâR>3|ű0*oò”ébEAJÒúÒ¥+„x«¦ÏŸ£C‡6hذ1¼Féç§Z ·ÞS“`,Ü<?C„[:£¼jõ:5«˜zKÇÁÔ¯ó[ÇÝܪ`–oä EýûõÅɓDZgïA±<¬šèìó–Í…ؽÿþ·r¤£\áááp«TE‹µ#jªYÃCˆ>£&á¯R¹Ò¦µÃî=ûÕ²ž={}z÷Ts$/%Ç£wOtèð+„¥¦Ñ¤gÏ;£\R—,xòF¿{çŽèÇ¢ÅËàìì¢ö8û¦ï¢Kªç ™I,܆Pãg˜[Ü<9C„»{·.¸té"6lØò›'9YÀ7ü:÷üêÕKˆ¤[·ø»kä=¹Ö© ™Ì{öP£C–+Y° D‹­‘;OXPŒB hÒ¯¸WØÿø)ñoI [µjƒ«•CGÐ*U,/ާ­[¿?B£†õP·n=Œ;A-/e›;ǪŽd“'MÀÖ­›Õ¬{mÃXëjHÚÛ¶G.©K{éäG1œé¥aÚô¨ZµºZå˹ P¡Âèѳ·Ö’?~5g<}§ ·¾Ä8?ˆ$ÀKå<5C„Ûkä08°_,»»{DÛ?r*ó™>¾³ç¡R%7aEW¯VE,Ϙ9[ù,y“¦K—Nì+«:„½~ýJ4¡åg²^U’D›Ä[5\B·®Ñ¨qŒ9‡ÿƒaCaàÀ!hÙ*26²”hšö©U­É&/÷ôéÓkíßÛ·oA–=9ÅM™ê#òI{éä‰>|„—p´Ëœ9 6nÚ ‘çË—/b€å¦ûÌŒ³ùa.Âíìl¯ H2ÈÄ\¹²ç‹3f\0 .—n€B†…Ü#88Ô_:‘&'& î;·cü¸1â¨YªÑ%ÉLA:âEžÔd}“.¥à @téÒuëÕǘ1ãÕŠ\»f|}g –¬ë)S&bËæMÅxÆŒiøßúuâÅ€^æûÍÅòåK±xÉòß–¬›6i€wïÞáÈÑ¢N²’É1ÍÖ6 <mß(bZïÞ= êDF{éäOA^Èê^¸p¾ØŸ'KŸ,~J´Ì_Áµ ìí„s^ÔDÞìQ÷ì zsn'øWÐ)ÀωÀÏy½Ë—C÷èSOY}hq^½"Üä€EG ž?&œËºví.Â{ª&²¬×­[ƒ5«WŠåÞ;#ç¼$ÂQã…ÓѨ¶mZ¢Zµê˜:íוƒ>DçNí„¥Nçµ%¯ìNÛáÊ•ËÂÜ<Í¥Dç¢ÿjÚPìgÓò5‰§´'Obª½–ÔÝ*¹¢té2"²¥{÷î ¯ðŠ+aö¿hYJÇѤÕi/=þÊ3Ýä W¯nmñ" µ‡ mݪ¹8G¾ióväÍûë^c:ž6qâ8Q7µ!6É\„ÛÙÉAñߎIlpð³LÀ`rEDË  «ô)€…[ZœW/†7UpçÎôóì:zEç¸IüìÒ¥ÇçOAbK{Ðd½V¨P£FA¦L™E»¤3ÎÃ[5ÀåmÕ²™8SíÙoŠ+Žá½^­z ¬\±L·jÙª8¦EKÍ$öŠÝÜ* q§3д´>gî|”-[NÔIËì)R$gÎUSHÈtìÐmÚ´C¿þÅWt…‚¯P™.¥ËhdI/ä™.mìÛÿ2gάÜK—–襇ÉÚ'«_5 9ç‘“-Å7oÑ Òg@@à%K‚ÕøÌ˜¥F¯Aý/³¹7YÜ´VÎâmÈ,àgbK€æž\ÎKå±åÈÏ‘€¡ÂMMøüù³ÖãþÇD°Ú»¥›°hO×¥tiüQ³6JÚ«_-HÖ,YÅ’“™jWÈ‚Ÿ0~,Ä%%eË•Æ""äèÛ§žÆÂm’ÃÆNX¸Á p´0EáŽô„ÇW3nžLÀ0,܆qã§â‰€) 7yrŸ?w6Æ8âñ„0ÑVÃÂh‡†–È °p'òJêÍ3EᦳӴ—Sñ¤>¶,ÜI}pÿ %ÀÂm(9~.^˜¢pÇ 3¨„…Û ‘» X¸;Wª+n]I™^>nÓ3nqâ ÀÂ8Æ[¡… ·ùN nó[îYÜ`áŽ[¾\z, °pÇ`"~œ…;7-Q`áNÔÃÃcá6ß9ÀÂm¾cË=‹[,ÜqË—K%îXLijp'âÁIM{ñê ¼gô[ÙšhÓä×…?º6íø¹X¿}:6÷Dygw]û-ß÷ðï˜¹È ß¾ðÞSÅ pº¤÷ßa‚oäÎQ½:Œˆuˆ`Õ:Y¸uΓ`¢ 7]ÉÉ<Ðõ¦RR(ǃB ÿuM@$.fò”çäùƒ¨]µ)¬,­ô"ûí{Î^:†}}#k}š€«·1gÙxÔ­Ñõª7×ëÙè2³p %¢ w\ÔÁe&<î„©‚NbÙ†™˜;a#’'K®WÃ(¦ýÖ}ê±ô_¿yŽÈ“£ ä-¦V^×ÚÈš)»^uèšÙÂ}÷á L›?µÜ£Qí¶ºV­–^>Î\:ŠÑýg#[æ•õ!n£`äB⊀‹“ýJÈdíãª|.7‘P(V…tH$­Ñ«æfqoÚ½GNí6H¸5 ¸r‹×MÇU¡qvz±Mfc7YË·\Ť¡ akcgPsÞ}xƒSºÁ©dytm=È 2X¸‚ ‰/ŽŽ%-d+e2™æõ´øj×g Åe¹BÞ!8øjäj&– nZ’Þuh=Boâó×Ho—®¢J…ZÊ%ê%ë}péòiL÷Z)¬à»®£KëAp,^VP"QC„ûÓç÷˜0{¾‡‡ a°µµÃÍ»!¹~ ËTG»¦½Òåfã|?Ê:ºáKØgÊ[öÅÊ"g¶Ü8x|;¶í[ÂùJ ´£,-,pýÎ\º| % ;£O'/Èþ»$ÜÿÌ~üoçb±\]Æ©²Xðø¶XÂ-RÀºŽõ‘î:´ŸÝC×Vƒ`™,™xIP(ð[5 ¡7PÞ¹ Šä·GXx.žÀýǷШVÔòh¢qÄ$ÜÚúheiñ›pK"Ÿ7W!É_ÅË öÙ„ë·/£m㞨T®†h‡&áÖ‡Ù¡ã;°uß*to;TX˱IGÏìÅÆKѪa7µ— CËdá6”?—$ Ä¥hPgË´šà*䊎Á!+õïèX4¯¥EòûÒ3)SY£n³N¸|×._ˆ¶(+årŪààP}êLjy nòv&að÷X)è D6oű<º¿¯°fWmž‡3—Ž x!Gôé4 "/9nyMë!·º·¦húnã®e ïÝa$ì‹E:sÒ>ëÃ'w1°Ûx5¯è…k¦!(ô,Fõ›-^(Í^6×n©-•ÓËÀ’õ3ðW½N¨^©ž²½?#~bšß0Þ¿}­¬Ž¬áÀ +ùôÕO Z½æ¨Q¯ÞþûgáôáÝøöUk±T¯L¡è²Cߺ“B~}…›¬×ãÚ 84Rd¤ôêÍ ¼{÷ 9²åuZ¬Þâ‡Ó£s‹þ(ëTY™„™ºs‹(\ ¤Z´Ä;{éÔpk€¦u5» üø€ƒþÛ°çðFq\É¡X­Â½põT]='Úke¥î°vêü!ì>¼A­ ÕÅ$ÜÚúp÷h?\¹] Õ5k‰7nܹ‚IÃ#CºL¿YÜú29µ;ÈK~ÆèU±žÆô‚ÓkÄ_(§(†ôœëòX¸c H ´ˆö΀ †Æê¿³³ƒ¯ ð”ÊkÚ¾ïÞ .ÞYÝ%--,ƒ¤rÓeÈŒ¡“©5ûÒé£8{÷o]Õ.à@ÿÀÀ+¾Æê¯¹”£¯p¿ÿøC'vA±B¥Ð¯Ë˜h1H¢6¢ÏtäÉYP™wݶ…b¿:ºäb_]Û Y¾ÿ†ýǶ"(ôÞ¼nÕÔ£íP8þ·¬Éâöö鯟F[_Ë]á^¡öoytî¨}ŒN¸Çœ‹¬™sªÕµrÓlœ ðÇàîQ0_ñß„[_ft¬Í.MzŒ4Ï(SuÀ˜¶°±Iƒqƒüb] w¬ræN@“hG:TYºsØÙÉ>XÕ ÏÛw-®Ç–Us•ˆ µº£«£—‚Ò«þ6td…Ù½Wƒ/üf…+€±W¢WsŸ ú§¯p¿|ý £}z‰elZÎŽ.IÂ=~°2güuljÙ†Y¸tMë´G¶¬‘KÜQ“uäÍYr¹3yá΃ë 1/íX ¶Öv°´´À¹@?{1 7½h|üô½:jo/µ/s†¬ wÔ>F'Ü“‡/Fz»Lju­ß±Hô¥ßßcQ¬ Ão­3*¸ÛÐFÈ—«°ºbŒD|øï˜î¥¾hgHÙ,܆Pãg’ øí¨{ÑÙræ…çèY‚óìqýñüɃ_âm€Õíâhß²íR!Ùråƒç¨™Ç1ìë,ž1 Ï+·ÆE¾¹Üƒ÷»G¦¯pøôC&tDÁ¼Å0¸Ç$ƒ„[²{´Çå¢-ãÖ½«B¸)åWMÛ÷¯Áÿm1 ·dqûŽ]‹T)­õúû×ÕâÖG¸Ç œƒl™s©µCf/ϙȕ=ŸV‹[fT0[Üz 3gf‰ƒ@Ô=gjU\XÚT®³³C?©Ô¤}húÿwo†`Ɍѿ„[r……“¾Ö¾³“Ù ÊÐO‡EìÕ`kmCãÇ(Æ}+ônj-›B&Ãt¯å°T‰NöüÕS\¿,<¦É9M›Å-y)k:MËà´§*…æ¤c`«¶ÌEózQµ’z²©~ÃpïÑÍ…[rb#¹’EœÕ ~ùú)R¤Ôe-.„»[Û!p.éªÖŽÉó†OyŸQ+Ä™ë¨^åú0£‚y;îÿv¸&`T‘çÇ-ÉdPF]ˆ+Ѧ†G=ÖÇkräίìÓ"/µýgC–­£®ä/\]WÖÁ¢mØ2D¸×l™SÿQ;¾Dµ“ç6ypìãƒÜ9 hn)¨‡u*xœ[ë4ÊÆï=¼ ûmg—±(”¯˜ðR'oõj•ê¡Y½NÊ|'ÏQÎÈ#›<Éã™ÒÜåãz3ªÞÔ’WyÑ‚b_^:f¹+ÆãÙ‹G7ØOy\•d\·}Qôî襬æß·/…ÐfÉ”]¹‡U¸õaFÓ^ÿõÛÁ‚CêTê« Tß×°/È’1»xi¡þ#´¼Ÿ*e*dÊMm2Ñ Ù˜½cö*7ìbÑÐ$Ú>DÈÃoüZ³6"GÕò&6e±Zé¬î÷r…E>}­î¨Ç͆LZˆô³€EÛðÁ4D¸éhÒäyƒñùË'T)Ù<+õ IDATÿ‡Ø¯½uÿª8Ç]ÞÙ›÷ ÒfqÓw´ÄMKÝ™2d…{…:H™,%nÞ Á…à“(ZÀ};{‹‹-È3zÔôžâ¿u<š"Cº,¸v;Hx`7®Ý´ÄLg¹k¸ÕûîÿÛ±þg÷¡t©JâÜ·«‹»ðp'¾z3Hä-[Ê áá¸tRXìÑÅ⎠ᦠ0c_´´8ÇM‘Þ^þûLÍû^Ó9n]™_é·êþ¿4K¤ÉŽ>òüÆûz öýÿ;/å?vf6ì\Âç¸ ÿ3ã'™€vÚE;Â=®"{EÝvquÇ_•Î寵º£d¡ºê6ï¢qO[!Wб^úžOjóËá&FoÞ½Â΃ëqíV0¾~û‚ti3Àݵ¶¸Pƒ7&á¦ï.ŸÆ‘Ó{ðäù±<ž1]f!¸µÜ!yòHKÒçw±y÷ra-™Ur+\JMIk› ÖLÁÛ—AAMuŸ²&¯.ÎfÛ¤Nƒ¡½&#CºÌ 8ä9íBð 9Mfa!–ó«”«… e~wt”êŽ á¦ýpÿ³ûqéòu.s†lø£JC¸–þÕ­‘ÓtdöôÅCŒ›ÕUÊ×B«FÝÔ¦µ¾Âí·22xÍä‹ÅYóØ&vN‹-A~Þl$„h¼¨ÇÀÚöŠN¿Gj2†Õíèèhgi!§:hä¨ÕÎKË¡¼¿ý7T¸Íæ';"`™<|‰׉–ËïÜ¿ŽÉÊUC’2Vy‰rÊãy†”£ú wl òófA€ÍB&’ÉW¥C"äqgiKõDu£c`©RköÜýÍÃÜ€#Z1^Ü¢P„A&‹ ^ý_bñÖ>ÍY¸ãï' ¾…Û˜·ƒy÷÷ýí칡äX¸ %ÇÏ™ a…ÊäÇ ƒc|‹vÔc`Å¥Bärß½›¡â¿ïÞ¼ÿÓ” è½×µÎ¨-‡<ØÒ’œª™,Þš§< wüýÄ·pSϤû¸GzÎ@ö,šÏÌk#À÷qÇßÜàš’-¢ø©¨ÇÀ AoÈùjM÷œ+T"£i»•-¾¸Â!¡žaáŽ?ò !Üßÿcæ"/Їöš¢ë=ºžÓío|û#wŽ"¬ä·` Zlqƒ"—a’Z´ šÖÛÀt$jèµßΨkˆ¹¹}áõJUoõÁaáÖq²r6£`á6J.È”$Ñ&^º]»© /C&£;«é±÷r¹<° Ö÷H˜4NdíC¡h™l‡¶ä,Þ1Ïjî˜qã`á6.O.ÍDhºž3!,I!ŒrºÂ‰œâT°€l®ÌB¦¼ú) ðŠ,!ð²xGO…;!feÒ®“…;i’ì½FÑN„7_E݇N(á¦I¢U¼¡XÒ1IN¤ÿ:Í”G?aúÎÂ0ܹÖ" I´aÄ;µÙ­¨ûßòð|q¹M—v³xk¦Ä­Ëìá<Æ$ÀÂmLš\V¢&`J¢­iÿÛïqc‹÷ïDY¸=˸¼˜°pÇDˆ¿7 Q£“‰N%RK[Õq-17/›kn'…â²/NL ^ DN<är…ÞWîòtסâÊô% éNíÄ.ÚÔǨ1Ì ¹L_VºæôÊð…LÖ^õEÜóvvrP°hë:s8_\+"Z]Ý OÙ,ÜúÐâ¼ñJ@“hÓÙçÀ Õ(iñÚ&]+‹zÖ:1 ·ÔMáS“šx;;Ù+¤¸îºŽ-çcÆ$ð3B^ïòåÐ=ú”É­-Îo´‰¶\aénèÙçxk¼ðä.áhia¤¬3‘.í'uñvv¶WˆA*¥5rfW wŸ3†ëJ*Þ¼{·ï¤0È2D(ä¼TžTßœûiꢭ´hhK$…Bq<0(Ä=1Ž›6ñ–Ë-û›ÂKRl˜²sZlèñ³†`ç4C¨ñ3‰šÀo–j¤è]6K[®ª($fá¦6k¼uLà……‡9‹7 w¢þ90ËÆ±p›å°&ÝNiºSÛTE›FÑÙÉ>X5VxBaÑeV%EñfáÖefpc`á6&M.+A hmñr§v\u<1EOÓµIM¼Y¸uœÏXX¸E’ËIPæ(Úÿ-?ï€LÖ@‚›ÐÑÓtä¤$Þ,ܺΠÎg,,ÜÆ"Éå$sm±Tîì0Fxÿný½Gj`4ŸŸ7¿=oaI·^î¤;öfÑs-×sšôò¸êÀ˜²p‹Gû2 Ù µÉffk,ÜfñSbR`á6©áâÆªÐv§v„<Â)8ø*Ý[mò)1GOÓ®¹‹7 ·®3ó‹ ·±Hr9ñJ@›h'ÄÚqÙqSˆž¦Kÿµ‹wx£„¼ñL—¶Ç”‡…;&Bü½± °p›(—ç’ŠhHS‰ž¦Ë kŠƒ÷rE„‡)¯°pë2úœÇ˜X¸I“ËŠ.NAA-Ö¸¹YÚª M)KLÀÅ›…;¦QOüßÏZ<7î†`î„Hž,¹Zƒ_¾~†©~CQ²¨ :µè§sg®Ý¾Œ9ËÆ¢~ÍV¨Sµ©ÎÏé’‘…[Jœ'ÑÐt§¶9‹67'á¦þ˜›x››p¿ÿø'ÏDíªMaei«¿ý·ïÿűÓ{qýöeüûî%„Ã&uäÍUeÝàâP‰á‚mÂýãG8&ÏŒŸ?b¤çL¤HžB/;¬Ãþc[0 ë8)`¯×³Ñefá6J.(® hm`l`à•1q]wB–ojÑÓtaeNâmnÂ}!è$–m˜©ÑúÔel¥<‚N`õ–yøñó²gÉ…¼¹ á#1¿y7ß¾‡¡`¾âèÑvl¬ÓêS´ÑójîǶbûµèÛyJvÖ»ÞŸ?1~VDÈbÌ€9°²J¦wš`á6 F.$® hmS¸SÛ\L1zš.ýþoÿÞ€òW[¡0½=osîM»—ãȩݱîwBà»Ô©R¦F§æýa_ÌEmJ| û‚ ;—à|ÐqÌ[ ý»Ž‹µu¯ËœÓ–G“pÿþ #¦vCÆt™1¼Ïtƒ‹¿xù$–®Ÿ‰V »¡Šk-ƒËQ}…Û(¹¸$”E›¸º8Ù›dô4]æ„9ˆ·¡ÂMKÒ»­Gè@|þúéí2ÂÃõOT©PK)bKÖûàÒåÓ˜îµRXÁw\G—ÖƒàX¼¬Àpå ŽžÞƒÇÏîC.@ÆôYQÆÉ 5Ý Y”½Ú3âÄùƒxöòä 92Øe‚SIWÔòhŒ”)R‰òúxµDøoÊ¡³Y`Á”­âß?ñωBl_ýû\X9²æ»k”urS>£P(0nV?QOÿ¿Ç¡hAÍKÄ”Ïw‰·Ø[îØÜå#/¾›·bBn`Ö˜µHÊZY.Y¯½Fü…¢ì…ÐK‰®¸ÜýÏÿpãÎ|üüÖ©¬‘=kÔ­Þ…òW›†Ï_=Å–=Ëqûþ5±DŸ?w4­Û›v-ûmÛÿÌ~üoçbti5eJýêŸ.óZ5q<¾#ÒØ¦Ã˜sô}\c~n£`äBâŠ@Ô$¢žDz/u|1ˆ›Nô4]˜˜ºx"ÜŸ>¿Ç„Ùƒð=< •Ëý[[;±|rý*–©ŽvM{ tË7ÌÆù ±ü%ì3 å-ûbe‘3[n<¾Ûö­Fá|%PÚÑ –¸~ç .]>%–uûtòRîK"”'G”qª,°<¾3—ŽŠ½WÚƒ¥tåúEì:´ŸÝC×Vƒ`™,™xI ‘õ[5 ¡7PÞ¹ Šä·GXx.žÀýǷШVÔòh"Êxøä&Í,Ú5°û„h§Àû×0}áH51ÖG¸Ã¾}Å„Ùðîø»ÖFÖÌ9@ÖüÉó‡ðæÝ+ôÿ{¬roùË×Ï3³¾~ý ÷ u#K<{õWN!u*û«XÒ!®êLŒåšzô4]˜jo™BÑ1 8d‡.e$TC„{ýöE8~î°tP6]‹Ñý}…5»jó<œ¹tÅ 9¢O§Q°°°yiŸØkZØuF÷¶ÃÔ¼6îZ&¬ðÞF¾Xi‘ÍÖùxøä.v/–¯¥$ ʨ~³ÅË¥ÙËÆáÚ­ 5£—%ëgà¯zP½R=åódOó†'/bÚÈåBàŽÙ'–Áë×l‰?«5‹vXär9úiƒyæMØ(òê#Üw\Ç–½+áX¢p-]5Æ¡;³/ž½|¬\×G¸£!^ˆq?ïÖÈ™-FöÙ¯¥cqív0&_"¶%¤D/ƒÆµ+’pÓòûˆ)]álïŠnm"…?6‰VBh[ ¶GS4¬Õ:6E‰gY¸c 06mu¢æ=M—ybŠâ­¯p¿ÿøC'vA±B¥Ð¯Kô"$áÑg:òä,¨D¸nÛB±_]r±¯€®m‹,ähµÿØV…žÃ›÷¯@­šz´ Ç’åµ ··Oo¼xý4ÚúZ6è ÷ µ! wû¦}P¡LÌÂ=fF_<e¸pß¼ŠƒþÛñèé]|úòA­9³åŨ~³Äg´BA+ó'mþ­Sæ Kþ’p?|z“æ Û­w×eêF›çéó‡çÛnek¢M“±.…;Ö¹c`Ñþ¦£cѼ–Éï+¿1ó=~So}…›zŒöé%–±i9;º$ ÷øÁ~Èœ1»2ë² ³@Ç­šÖilY#—¸£&ë4È›³ È¢œ±È ´¬Lb^Ú±l­í`iisþ8~öbnzÑøøézuÔÞ^j_æ Y•Kåuk´@½êÍ£íŸdËå Ì¿^,ùëcq‡Þ ùÓØØ¡FåÈ‘-/R¦H)êôYè…l™s*…{ȄΧ`ö¸õ¿µiÆ¢Q¸u/T)Üô20sñ(±¤NKë±M’_ºT%üÝj`l‹c‹;Ö¹£Ðt=§B‘4—Ç£B5· ,1MšÿæÂ™ yTó&Æes}…ûç÷2¡£85¸Ç$ƒ„[²¸{´Çå¢-ãÖ½«B¸)åWM´çK{¿1 ·dqûŽ]‹T)yzkªøÁ“;˜zf/6î\ªÑ"¤epr®’œÐèت-sѼ^gT­TWíOiªß0Ü{t3Fá–œØÈA®dõ@$ä­"EJµsØ´¢@+ 1.Y°z2‚¯^@§æýPιŠh›ô™Ï¨°µ±S¶÷鋇☙êq°á“»âÛ÷¯b\5]»„ÙËÇAu©\ù)#–"]Ú Êì?þÀ€±íð=üÛo{ÜªÛ ±ù ¢sí³–Œæ=îØ@ägM¢ ÀlîÔ6ms ÂSoC„{Í–ù8uñ´mÜ•ÊÕPb ÏmòàÙǹsÐ*ÜtüiÄ”n°Neïs`kFYÆÞÛD˜MÏ.cQ(_1q&š¬Øj•ê¡Y½NÊ|tdjë¾Õûö[GÎ(Í]>´=Ó{ ¬SÛˆÏ$¯r²Œi_^ SJÎ`sWŒÇ³0n°Ÿò<8+ó[9I´¯k›!¿å&±Ü¶ôR OQ ê>Qé1/yÜì6…ó—P¶wëÞU8tb‡špOž7D?£#[R[?ù$b„ÓQ/rB7ÈO”±ûðFìùgÃo^åÄaí¶‘}ÿ/V¹Ò«Ç­Û¯çJÔÈéÊB–e;¯!ÂMm !;®Çµ[Áøúí‹X¾¥ "U+Ö‚“pÓ÷tùÈé="xY‰ž“—Î4'OþËê#/éÍ»—‹kɬ’£XáR"hJZÛôX°f nܾŒ¼¹ Ë—,ÇÅk§‹³Ùt!ÈÐ^“…°‘•L‘Ó.Ÿ‘Ódb9¿J¹ZZ½Ç=¹‹Ã§v Ç/ÚÛ§èn$ÞòC9§Ê(ëXYii«ŽËÙKG±÷èfáN‘ÐJ•(‹&uÚÃÛ§/2eÌ GJÔç}G6ál€¿ð('kף⟨T¦ºXiX½y®¸Ø¤sËþâ¸q Ë¢ÂQä´¿êuÄcÛE ÕhmÒytr&#¦RÒW¸©C&t‚­uZŒ4×(ӽʂ‘ Ñ—€–;µyy\ Ȥ„%¦9x¯ éÓóqõ½¡ÂWíI¬åÒùò±3=Q O é9%±6SÙ.Z¡ í Â2¬wôNvÑuFÚfŽË£ã,ÜÆ ÈeèE@‹hÃÜByê%†Ì,Ü‘€£x³pë>ÓÉÛœ¼Î=;Fñ"Nº?˜@9÷Ý‚×Åèd§­y|;X Wk\ÚD;1ó1nÏcWZR ©Ä&Þ,Ü1دïi?|Úüáâ‚·²5>mF±gNŽx‰1í>î(¡mcÛW¶¸cKŸ×™‹¶Î¨~ËÈ­Ž$r.EоÕoPÄû²9 ·~óšÂnÞ½ /^?÷s·oÖWyÛ™~%ÅOn:Ö6Åoì‹–F§ýt®”úINvõk¶BªMu~N—Œ,ܺPâòš·rð^®ˆðˆw> ÷ÿÙ»îø¨Š.zfCG?QABHØl,H‘ ˆ M:ÒE:‚i¡I“^,ˆô*%R$4At MD MPQ@@i»óýæmÞ²»Ù$Û÷íÛ;ÿ(Ù)wνï7wîÜñ^'ÔÒ;ˆ¸½ÃZIW,VÐjXÔ.ÆPкS;€ÖAÙÓ|7äMÄí›N¨µçq{޵ Ò™ Pß¡÷7yqû®êÁ3ˆ¸=ËjK¤­-¨a–Ó´Ò¾9qûs’7·tB½¸·ûXQÍtÒŽb–]`Ð’{<ø&AÙÓü‡¹Øê‰ÒD‰¤ä^9÷|Ï›ˆÛ:¡žÜC€ˆÛ=œ¨Væ¤ J<ó ìiþÅÚäMÄí_PoÙ#@Ä=FT# Ò¦;µƒk”=ÍÿxûJÞDÜþ× õ˜5DÜd!Ù" ö´]¸ÇA¤-t~¯@IXü©ÔafäÍ8ï”]ZY"îÀè„zÍ"n²Žlˆ×Ŭ˜Ã!DÚÙ DÜ5Sò?dgëDÜÓ õì"n²Œ,pu§6ú )Ó ºà#@ÙÓ‹¹«•wväMÄXPï â&«ÈW¤Mwj‡Þ`({Z`uà)yqVÔ;7Ù€›i» TªQö´Àƒî yq^4‚#´â&‹È€€N;}~à|‘Þ˜Ú‘à =”„%8:°&2'3Æ*Ùè¼çMÄ}Ð(÷ â&kp@Àõ-JDÚJ2"îàiÃò&âž>h$+DÜd 6\§ä» ÆÔ‚I9Pö´àê";ò&â®>h4"n²t2!íÕ@×s*ËL({Zðõ‘)y‰ H”%zªdy è6.øÒˆ…­¸#JÝ®'K¤^F@ÙÓB£¯ÌÈÛ^"îÐè&ÒF%âŽ4;Í×9¡‡ø™sN+mÛ%a r²#o"îÐé&’F&âŽ$mg í Z ‹Úe='‘¶ò ‚ˆ;´:ÊŠ¼‰¸C«›Hˆ;R4íi¸f¶ÜÑšL'Ò"–°˜6eO ½šÒÉ;‰1Vƒ\å¡×G¤I@ÄiO¿PÁy¥m%ms‚ÉtÔ„Ý”){š2TæáO+neèEíRq«]Ãn¯´‰´ÃÉ({šr´åÍq°;wïàÒç‘7O^["nß1‘¶@ŒÀ.œ³§qÎwŒ©±‹ª§L+oU«7h“#âöê û”¢?Îé©}ìššG”=-”ì4E"ïÈÓ¹¿gLÄí¢®îÔ&ÒöÐljŸ=s¤Œ)%#†ˆœr|\ÌB0ÖÁ~òœÜæi žNšˆÛSÄÒë»"mºSÛK0#¸%a‰`å òŽlý{;{"n/#Òö4jâ"n2 "o²O âö±xmLchØz÷ç‡-<*Ád2]õ°;ªádÌžf©Iw8GžQ¸"opž¬7¦ÖŒ<4hÆÙ!@ÄBv¿»ºS›ÜãHU3 @ÙÓÈ(dhåM¶à.DÜn"•ùõœšhZi» "UsEÜ}0Mþ²ìE¶‘¸&oŒ2R#š½=DÜnÚƒ‹ŠîÔv;ª–9”„…¬ÃWäMW“q{h⊾(M®ÓÍ,¼‰Þ”šäaWTp@€ˆ› Âñq1I`¬‘í7“Þ˜GhZq»aÎ_Àäºr6ªâ”=Í "°Š5I‹ÅÄJÐ6J@6S&âÎ «íkf íkÓ£ä?({šÿ°TSOŽÒª[Mêõi.DÜÙÀçüðp7oûŠ)ŽÑ«É9`gøÒ[w,Ž=zÇ­éâb¶ƒ#Õ`J}Ï—~¨­2 âV†”(…..ÆÄ«$Ëf¶Ü)i2HS¢¬$Sð âÎkç½&³Åg25eÕL«}æ) Ëñ=Àr1`1g¸ŽjŒ¡À“ô†Ô&^¨8 €Y´“dRõÆÔáéÛÜ‹þ¨‰B âVˆ"(†ó]èg0¤LW ¨$R âÎnÅ{š1D§W»¦7¤ÌN?º¸˜ €±ªCÊA¹~|\ì\0¼Ëaih0Ù”]?ö¿ÇÇUìÍÁÞäàŸhkÀ-8Í~×0tµp¼i4¦ð¤?ª«ˆ¸•£ ¥I"rGDi¢Œ²\tƒœÒ4yˆ¸³[qëbm«YwšråÊΟ/×ïß©7¤Öµï>66¶XÎ8Î×è©Í=Q¹V[á¹(¦iÅj3°X÷äÀŽ{÷°8%%Å1êݓΩnH â)üŠœìCñ* º€DÜ~&n­¶b(f›…óáFcêXçîuÒ žGé ©Oz£m]¥Š-X”fÀsÝ3kž;|øðIoú¡6ÊA€^ÌÊÑ…%ÑÅŦÉÑåtƒœ5|™ˆ¸Ó1Ç/€[?²z©Š6Œ™+©»eÕé´1]™†} :êM)‹2wL2c¬†Þ’3}Õì¶Öãã+–gÞ`ÕØs·n›+ûìæ¶T1 qVÕtJѨF•~›·öÒÆ4æŒ-` SNföRM?gi”ö¿í.ˆ‹‹yOÃØ Gs£1e³¦âu1›öÚ»üáÔÔÔ+žhR§‹Ž× ÆÔ±±±ÿË™ƒ6[xkº”•W—ˆ[y:Q’DDÜJÒ†2d!âàü`À.+Zf/ÕŒÇ4¬·:eKÜq1›ÁX}oˆ[˜L… rÉ+ìèèèº …¤DÜ¡@]ÙcqÛéÇUÐYvêË,éLLL©œ9Ù‡ ¼6çxÀ/Œ³/ô¦”irÎqÑ7wv«ÿw"nõëØ—qû‚ž:ÛqÛéÕeZVz· JS§yЬ‚w0Pß1ˆ¸ÃWw’œˆÛ Y×Aj™Ào”(Q¿êG€ˆ[ý:öe†Dܾ §Î¶DÜÎÄIš³ú]¥©ÓDhVF€ˆ;ЇwÿDÜá­¿@HOÄí„j–Ajvu]¥BAÔ§ú âV¿Ž}™!·/詳-· ½:©ñô³`öQ噥©ÓLhVD€ˆ;è†ßDÜá¯CÏ€ˆÛ¢Ù©QPš¿í0¢û#âŽhõg;y"îl!Џ DÜ™¨<Ë 5 J‹¸%&â$ºáß7wøëÐß3 âÎŒ¸3ˤæ"Sš¿•BýEDÜ‘¥oOgKÄí)bê¯ïqK\°4â8¤üTlŒ±<œó~ Èm?ì°K stžƒÅbÞ nD ×¹‰4±QÈ%ì±`8͉²¼8Àñ…O†Yf†fƒÉdºªpQ³Ol‘i4Q8‡N (ag#6{Q’¬j±%aš™,>w|\LS¢¡‡öŠ”Ñl1Ç…+yëâb¯0^¤­H#ðF¨0ûÈ6®ÅL"±M˜ÛA¸¨Ì7âÖÅZ¯Þ ¢Âõ˜›V[1!J£Q¥'$\ŒKoHñé}Êyêt±‰ JÔ2v8ÛA¸èÀ§Í~o.\&Lrf7Yˆ·„ó ›ˆÛ[­glÎvà?ۓ߈û©§Ê¢ÿ€•–z÷;'Oþ„©S&ÛúU që^L@|•Z~Ç‹:¼ÀÆ•óq邸PÏZÂù…íLÜ ZvÆcÅJ’ºÝ@@MvàÆtQÅoÄ­ÓÅã³y_(bR$„ûüøãèöNÕw­-QçõVîA5=FàÓÉCqúçcª$î®ýÇ ôÓ=Æ$¨ÉÂEDÜᢩÉIÄ `# [5½°WÜDÜî°šìÀýY‡¶&whñùèDÜ!WAØ  ¦6·÷f¨&;ð…à¶$â.ÞŠˆ[q* ÔôÂ&âöÞìÔdޣܖDÜÁÅ[q£q+N%a#š^ØDÜÞ›šìÀ{‚Û’ˆ;¸x+n4"nÅ©$lRÓ ›ˆÛ{³S“xBp[qoÅFÄ­8•„@jzaq{ovj²ïQnK"îà⭸ш¸§’°HM/l"nïÍNMvà= ÁmIÄ\¼7·âT6©é…MÄí½Ù©É¼G!¸-Ú¸{÷êŽï¾ÛÝ{¾Cþüù=BîØ±£hÿf´k×}ûõ÷¨­§•-Z€Y3§cúôY¨Vý%pÎQã¥*(V¬8–¯Xíiw~­OÄíW8#ª35½°#‘¸÷|“„¯×.›ïB…¸Ê^Û®šìÀk‚Ü0èÄ}÷î]T¯V÷îÝskªM™Ž„„š.ëŽ>Túûè1ãÜê˾RÒúu;v”Ô¶~ý·OÞõ- è‡vov@ß¾ïeÙ~ÉâEøþÐA$&ŽA‘"EpîÜY4iÜ _o„‘#G{<¶?qßGó¨ñ –|<ÑÞÜyòâáGŠâ©g*áÅš¯¢Páÿù ÿ©ã)¸ñÏUh_xÉç¾üÙÁ¡}Ûñ¿¢Å]æ·ºUÓ ÛŸÄ}úçã8|h~ùé®_ûwïÜA¾ü XôSx®Zm”×>ï¾®´rþ4˜¾ßƒ÷Ç}‚Â<êõpj²¯Arà÷•+cþüϦ™šrGAÕªÕPüIÛµ³RNÞBáÂ…ýËĉâËÕ«°rÕZ”)SÆãþ?ùd.>Ÿ÷)ÆŽz¯Ö÷¨ýŽÛ1xÐ 0­Z·õ¨­¿+qßGtÛW+ðí¦ÕÒê£Èÿ“~øïß›8—ö3.ž;œ9s¡q»nˆÑõ‡¤»º™–ØeÊÅ a«û©fÝm¨zÿ\½‚ ƒ»¢Í;PÑÍÕ—š^Øþ na+kÎÄQÓ!DEå@‰§žAáGŠ‚1àò¥‹8ýóQÉÛö\õ:höf÷@©Òí~§%öÆÕ¿/#qÆ20!¤—EMvà%Aoæ½¶ØßæK®ò¡ Æ7ßlÁÒe+Q®œ{_û¾"õVç8~üöì=€9rxÜ]¿¾½±wïn¬þrJ•*íQû¹sfá‹/>ǼÏ .NçQ[W&â¾èÂÙâDÊè3b+ö¤Ô§N¤bÅgáß›×ñV¿QñzSÒ~>†O&EÓöÝñ|µ:Þt6;7¯Æö +ðþ¸¹(üˆõ£%»¢¦¶¯Ä}ë¿›˜;aþ¸xÏU­ºMÛâ :@øûogñŌѸvå/´}g bâ_Ìâ€ý.¼#{·Añ’OáÝAã}GMvàAl¬â~£Y#œ?{÷DΜ9mÓ×ëÄ;o¿…÷Æ­[·°háÑM™: ÌÇìÙ31sÖ\T©R7oÞ”ö4hˆæ-Zaö¬8r$Uú’¬‘PýûDÁ‚ÖIÞc~²D ,]ºÒ6Þüyó>Á¾½{!<  /TÆ;ÝÞÅã?á –ú¯ÖÁµk×$⊊ÊTe©©)èÔñMtèÐ ½z÷•êõíÓûöíEòîýxि‰¾Äž½¸­kì¸ ¨U«¶ôwÑ~ÁŸÃd2âßÿ•ä¨U»:wyóúl*DÜ÷!?¨ nÞø£f,G”‹¹“GÒ‹·xôSèñÁ$[Có½{8¼ú»pùÒ€ið¿¢O ÊËõ_åe[½9ãáÜé“:{oÔlüï±'pãúUìþfŽàŸ+A¸è/^µ_o•Áu}ìð8˜¼ÏŸÆ¿7®#ß¡lùXÔiÔ~Ä¡ãÁÝ’lÏŸÇÿ/Žç_zÅöÑpûö-$ön#=ryð¡‚úÑ‚lmKM/l_‰{éÇ“pÄx/7hW^o)v†N1@û\5ùôsŸ\\b "n«únÞ¸†1ïuD±è2èùÁýkN•;udoiUõÁ¤ÏñPAë޼WX¶‚åbt¾ÑÇöâÌ/'ðF‡^x¶ª•¼:bÀÆUóñ÷Ÿ¿K.iñð=Séyܽ{³ÇöÇå?/á¹jµðxñÒ+¸ƒÉ[póú?è9t2}Üêøqÿ·X³hJ•‹öÙjÈ“7~¿t{¾Ù€*€cfKnZAÄ_.šÓÁ=ˆ}¾J—­‹ÅŒÃ?îǯ'RQ«aKÔiØ ·oý‡ŸRõX>o +Ú ["oþQªl…l_QjzaûBÜgý s' Æã%J¡çÉÐh4Ùbg_A|„%-ÿº*5qí¯?ñ\µ:Ù–(]Îþ sŽ9ñÂKuQ°pÉ~¾ûv3 ~½‡MEÎ\¹¤îÌ#Ù˜ˆÇ¥ô3±•ûv|%mùt<O–*+ývhïv¬[2WÚ:Ÿö³4¦øXÿóÒy4nó*'Ôskj²·&¬€J!'îÇMnkAÎ"x˾Lž4«V­VÙsæ~*¨\Ä*ýŸþÁ¶í»¤?mذcF'¢P¡‡±xÉ2<öØãÒßÅ ¬YÓF8{ö ¶ïØ%ý.ï1‹•|Ë–­¥•l‹æMP¬ø“˜>}&ò乿’.|áÊïÞ£—´ÊåàÁèÙ£š6} ž¥Ç8k×~‰5k“]2é¿ürmLš<.\@îoãÆ›˜=ûc”{ƺUpâøqtèÐo¾Ù={õqãÃqc°nÝÌÿb*UÒúdFDÜVøN3á‹é£ðüKuд]æû+?Ÿ Ó¡½xçýq(ùTyé…¸jþ4ä{ð!´èØÛ¦‹;·ocTßv(]ïš`û{bŸ¶(øpô9Ãö7ñâß²n bâ« JÍûñ"ˆíói#‘Pÿ Ôkl…˜1ºŸ´Š+b{‚Hч#†ïP·Q;þ_Qìß¹ ›¾\€ö=>À31ñ¶±Ìf3fŽé‡¿/ÿ‰‘ÓK„páÌ/˜5n€4öë­»ºmOjzaûBÜë–|ŒC{·¡E§ÞÐyÿðÕŠyøn××’=uî;RŠ¥‹ RÑw£ÖoKnm¹lKZ†o¿^#Õ/[Þú#ᆯQ· ^mÖÞVW ‰KAÄ‚EIZñîÚ‚GŠC·c‘ÿÒß啸öùêhÕ%ë [y5ÙÛÆâŠ!'n±¢4q¼Ë@­.]:Ád4à‹‹¥U¶\„Û\¬ÒŸþÌžó‰ôgчèkð¡xã°:[·n‘VÇb•,ï1þùi…¾tébLŸ6âß‚¼í‹XéwìØNZí>RúI>Þåj,g}ж?Ÿ ?3¡×°)xâÉRÒ sïö 8žò.ÿ~fñbµ+ö$}ÄxK?žˆ×šwBõ:¯Ûj]ºp{¶oÀ¯'ŽàêßfÖžP>v g•êˆèïJÏW—ö(…{\.Â]*ܦٕQ3—KîÑ+?Çþo7£×ÐðD ÷-ÕôÂö…¸‡÷l-ÅŒž}?^FÆ^þ(rÖEýæñRF’GPxfòå?´.BìËñT=¾OÞ‚s§–â/œ‹|”KöμôJcÔ£ƒCµ?.ÇÔ½P>î´w°4¦ðüˆ1ÿÔ¡îÉ£|1c ê¼Þµ8.€2³'5ÙAvÏŒR~9q·kÛ 'NwÔàˆ`µÆ^“‚ÍGY_Trnbá.A\õê½j 6+^üI,[¾*¶bï[ì'ïÞ‡x0Ãsåâ%B«àÌJ©R¥P´¨5ÚV¸éÏž=+­¢óäÉ“i›3gΠYÓ×Ѥi3 :Bª7lØlÝòµÉ.ˆY¬¶7|µÙ¸åíƒ×_oŒÚu^É´­6ùòåóÉ–ˆ¸­ðMÑ—ÿ¸(¦åÊÛ%¦÷îÝŘ÷:€[,1}‰´={Üû¸võo¼X£ÊVÔÙ¶YŽbßÎhТ3ªÕn(õ·}ãJìܸ ]ûFé§­|¿ü”Š…3Ç"g®Üx©nc+QÆvÊaÛ†Òª[þH…+¨=[×#E¿_Ú£~°@!4lùbŸ­*U.TáJmÐâ-äð'ÚÞ¼qìŒ,€÷FÏFîÜ÷ÿ\ý ì‚Re+âíVÏŠ éÊŽvl\…W¢e—÷÷|uˆxˆåŸN–>ìªÕv´ÛŸMÁá÷aÐøÏ$›p§¨ÉÜ™¯ê„”¸úéÚ¶i‰Úµë`ÂÄðøxîlÌŸ?OŠœ~öYÇ/?q¼J›’bíØ¾ ƒ¿/eX™ÖìKrò. èßW"ñ ï1w{·ºty[:~QåÅç+¹¬ËéÓ¿¢dÉR¶?§¤FçNí¥•¾XñgUÄq5qlM"»}û¶´7/"Âç~ü™Ô´k—N’‹_|ˆ¨¢<ðzö|;½%¹ÔíË×¥£qEЏ÷PegdDÜöúÄžŸLÈ®0ûÊO‹…£÷°)ÒJvÞÔøåDªän´Ï¨&ö¹'~ðn^¿&­ˆòäµ’ôÄ!ÖÀ Ù=)¶R†÷h‰‡ >œÁeyþÌ)i5ÿxñRÒ~vVE(z1¡>µéŠ­ë—"yËZÛþ§}Û¿/ÿ./–½ WþúC’KD4Û×eg7âw5½°}!îUógÀø}r†-Wв\¹ó¢ÿèYÒÏr™½Fü]>ïïJ/boûë5‹l+hQ_>íÐ{øTé¡}™9¦?Äò&ÍGþÂ7ë—a×–5¶U¿}]áyÛ?#¦-vǤ:j²·'âŠ!%JÂèQ#Ñ£G/tJØ–ñèÛ·—tŒkWò><øàƒ6˜ÄþŒ ?A¦‹—,—þ>gÎ,鬳8§-ŽXÉg£ÅŠ^N´²úËõˆŽŽ†¼Ç~þù$ä:ò`ë׭Ÿq£¥cdâ8™("ۚȺ&öÖÅ{V¥OïØ¿Ÿô!\Úr~tû3ÝF£A"o‘}MdaEDž×«[>ú(Ö¬Ý`;Û.æ>bÄPìNÞ%¹×E„¼¯…ˆ8°k 6¬ø ò¾£=¦bÏZÿÝ.lþrîܹöÝã™X뇤pWžHù}GNGÑ'¬+[¡#Ñס=Û%B<ÁúvçÎ-ŒèÙ¥ËÅ ë{÷ÓÜŠ$â8ωómçf…û[쥋hsÙ…*þöå‚YR”ºV³/â\÷â9â•FmðòkÍqÌt‹çŽÏ`$"à?™4D"ŽC¬©]e7jF­Që5÷ö4å±ÕôÂö…¸ÅGðœˆ(ÿæû 6¾J†ÇRì3o[¿\:ë-Ž^5ko=¹ Ûój]þp‹Ñ½ˆ¶ÝÚúûóÒo’Å~·|ÔP|(ŽìÓFÚ©۸-jÖÃV_¶ ûRá6zwSØèÈ^mPêéŠ6šÝ;FMvÝ\•ò{H‰[>î%'Q±Eœu‰M6mÞꀕ8ÖÕ´ÉëQÞ"qÉßá•Wê!-í4š6{ÜÂ¥ll‚»uëúǶ IDATŽ.]­«yyó×Û$bEd@.ë‡~-[µAᇠCoøQÚ‹®Ví%|4eší¥:vÌ(éuµjÕ3D Ë‚vìØIZ ò{àò6€œ]Þ›—ë‹(óC‡¾—ΊËéWE›øÈÇü֚¨(lÛöeïÎGƒ»æ qkµ´QˆªÄ5\Ë8´`,A"/`†ÁbÍ6¤¢ÕVLˆÒh¬gÔjÐu^oåÖèkÏÅû¶;¤:½w÷®\¹Œ´“ǤliyTzÙ–.këS³‰ 6 \»a+)üÀ®¯ñDtü¸o;îݽ‡vï“¥¬Çxq ÷hÍW›á‰eðTùJX¿ô|¿ç) ¦®r®\þ]Šp¶Z-|ýåB”(ý4^kÞY:+ŸÓ™¹¢Ë–—Üç¿_8‹ƒ»·H{Ó½†MÅC I±ŸLþç~=‰Šq/â© •¤ckßïþFòtè5Ìæ¾—Ù}¼8â*×D…¸ðÈ£®÷ÅÁTÓ Ûâ¸[X³p¶dË'K>-y5n\ÿ¿;-úª\³ê5yÓväK¸¼áËx2ÆÖc{ïáÏK¤`³b%Jãì¯'ñýÞmÒ±AáQ§ªÖjˆÿþ½¹!æÙª8‘¢Gå—^AÑâÑRÛý;7KÛ2=‡NÂC¬úbL[#¢Ïí‹|½zFx­yÖ‹ûvj²·^ ¨Râ‘à"¡ˆœDEÆC>ëìjÏZ>ƒ=pдha}1׫[ yóæÃŠ•«ñÑäIصk§t6[¬Ê[·n+%T‘‹Øcþûï¿°cçnø…{Z¸æ?„$Žf5{£9š5kîµ]»VÒëÌŠÈÔ¶wßÉ-’´ˆ#_'Y]r~ôU«×¢téûùÑED»ˆl·Ÿ¯X¹‰3ìëÖ®‘Π‹sùòåѾC'é£Á_Å]âÎŒ¤3“CoHñɶ<Ÿ/Ä=s\üvæW‡!ÅYÚ BÑÇŸD̳U$t´¶ÿÛMHÞ²NzyмÔU_n e&.Ð};6‚i4RQážÛ»c“” Q뮈}®š´ß¼z!L‡öHã 7§È€V¢ÔÓÒjìןŽH‰=z ž±²úvËÑ'eWsâøOɧ+"¡nSé|¸\ný÷/¶o\#ú¸~íª”¨¥LùX¼\¿¹Í; ê [_THZi‰sàî5½°}%n—8îwàÛÍøùøaˆ-q|KdµxФ(ñUj:d¶““þ”¯ô¼-Kš=î¢u‹çâן"wî¼’þê7ë³Ù‚…3GKã‰ÀGÑ¿øÇ·DÜ7Iˤ$AyòäƒH T·‰5w€(ò˜ÂžÛ½{%/~“c8Ztî#}Dº[ÔdîÎ9Ôõ|z¹ú+W¹/ üý÷ßx¥NM—ûä¾ô)m]·ÅbNrµ’ö“p"nOæEuï# ¦¶?ˆ;T¶!{mú%ÎÈôl eS“'ööÄ}àÀ~ôêÙÝå>¹?Rk_.ˆ[JÅéKáœ6S}Kéæ¡¾¬¸=Šª§# ¦v8÷œ ƒpé\g.w;¿¸?XMvàO\Ù—Oïh%¬¸/ $XjìÛ[ây­/ÇŠ[#î7­þâ><œ/ÒSÝß$ó°DÜ~ÑÃ.ÔôÂWâ'Ä%1>QÂpè¡}®®&;ðŒ uöÄí|ÙHpSÍ0î·=I?V<Ú–ˆºÝ€3`U8ǃ1%:`¸ãt›^àaTß}¸ÛA¸(È7âÖÆtc‰DÞá¢îlää|ƒ™Gutçx–Ø¿Žbæ…`ÌvõZV«u"d½©LÍ5L+\ír Q·?Qv¿/ñ²ç‰Ù}ð¹ßcðkº²çàKÞ#ªÁÂE>w¸LÒ9%rÐD3´å|ƒÞ˜ÚØ›>ÕØ&=xMDŸ§™yT_wH?8Ø W{t áü-¿}Îÿ@x-ü-/õ\tq1Éöž&rE%ŽFĉVâãbÄj²ƒ«ŸÝ ÀR¢²#Q&»@8±:®v?‰Œp,™YæŒpDÜ‘h™îÏ™ˆÛ}¬"¥&· MKg˜™å4c(èÊ‚åŽ# ö<3Â1­ÏÛ=éáDzWqæÜ“ŒpDÜÁ¶€ðˆ;¼ô i‰¸] ì¨R²lç\ÜicJÉ`(ˆÆî¹'“”N8˜ÉšîîaWG券ÝÃ3RkqGªæ3Ÿ7·+⎋1ÙEê5l vn\…c‡]'!³R/™Âù4ãûáÄêMŠˆÛ >ç 4‘ˆ¡Ïˆi8j<ˆ%O¼_›‚Ô|2¼pn @8€qp°3œóž¸ÚÃK’={ˆ¸³Ç(Òjq;iÜ9(í½ðlÕ—¥Z¿«ÿikAAj‘ö¸d=ßp„#…DÜá§³@KLÄm‡°sPZž¼ù0hüg¶Ô‡Û7®”\æ6·f&éA­4ê?|L œtùJš7páƒI*#@ÄM¶àŒ·"ÎAiñ/& y§û—ce¼Â¤FÏ”WÈp"½+€Èês7Fp7ή¨ŠÂ âV˜B ·=q»J{âÉRjZ¨Md"hâv½:w¼Õ—¯À”~L-Vçþ±g"nÿਦ^ˆ¸qëb§3àþ¹//4l¶˜ãL¦£&/šR“G ÄíšÌµ{ZFã׫Q9yÚYîœá<5w"nOS}"ny[céÎ]ݳmïV¼ÀœpÕÌ-‰DÚêX5C¥w–®vÇ@8_]íW¬W£Z/_±œ¡ç'së"âÔ“¾ýqg£;¥¿TÃ×ôHrp´1 „ žýqëp‰ˆ›ˆ;\lUµr†#qgãjOj§@8m|\¬ "ÞTô†zoûØ0îƒ €ˆ;ŒÍW¢«…¸3wµWÐj ÑBâý‘Žs¤»Ú­pfÜÙíêžsuXàh8c0¦D«en4ï â&âöÎr¨•ßP;qg³:pÚôcj•¼•ÃÄ’,ó5í—;gt¤ûÚ½¶U5$â&âV•A‡ãd"‘¸3_gÈçy ‡ÉÌÍÔ@àñÚ˜ÆÐ°õ2^˜a0¤ô G;'™ý‡7·ÿ¬‰zò "î¬aó6ŽƒO·X¢F…svçT̰ð&zSj’W†FTƒ7·jŒ9\'BÄí¹æì._¹Ú;2Æ\ºÙE–7 ¿S3÷À¥M®Óöè˜-šBáü!⹦©…+ˆ¸‰¸éÉ1Dܾ+@ºoæÆLæ(àУä:×Ô ‹‹‹y•ƒE^(ÆX^Q¶¹p¾HoLíè-ZñºØ»ŽfFcÊWÞöAí”7·2,1‚¥ âöŸòG1ót0ÖÁ™¼õÆ”8ÿäÿžt•*¶€†­d ç,û5Œµv\m{•Q¿Yô¯‹½šNÜ;hXü? ê1qqÃÎhŒ, âö¿y¸º8HÉ]eÊ”ÉýЃùÎ2ð;wÍ쥜QXgv[¯…ÿû˜ÑxêOOЊ‹ù’¹8ð‰†á çCÓÄ‚£Ñ?×ÿ-wêÔ©ÛžôGu•7·2,1‚¥ âŒò]‘·Ùr§¤÷»µÚ˜FQ–‹åhØó³O¿ü/€|¼§Á:Ç´tºŠMÖ€qÔcÅ~s–ÌaÙ~ç_pôèÑžôGu•7·2,1‚¥ âœò3Deû¸O(IuºØq øœÏc½ìÇáóÛLõçXb0¦´÷F†ø¸Ø¹hÆ/ýý÷õÒÒÒnyÓµQDÜDÜʰÄ–‚ˆ;pÊ—ö¼5–4û€µP­ºïDð$³%ª“}°\|\Ì2ÎXç2F )£uq1wؽ1¥š§hÅkcšs†%÷̬RŽ(¾Œ' GzxÚÕWDÜDÜʱÆ•„ˆ;°Š×éb0Ò6JVÝ2 Yx'ƒ)u¡,“..v €zÌîlŸ%M{Œÿb0¤zœ].^³ F½1u¸NW¡.ƒfØm^òr`‘§Þ…7w l‹úu"n7ò²šóª[ä:7S yÙWÍtºØé è#7N_I'ÊÿŽ‹½ vÿç8cá­¼*×ÅÞäà§¼!n,>>>‡^¯¿+Æ‹ŽŽÎC®r¯Ô¨˜FDÜDÜŠ1ÆH„ˆ;ðšwÞëæN+Þ@K ‹‹1Ù'‰±'n.fs8Ÿm¶8ýÊ¡‹‹¹ÃÛ¯7¤T´¬Ô¿ò â&âV¾•ª\B"îÀ+Ø9ç78ß 7¦ÚGnLWÐdâvylÍ飢R¥JesDñŸ8øƒ!µsÀ¥ŽÃ"n"î°1Vµ JÄÍŠ$ŽAjÁIšÉ™òQ‹9Iâv1†‚68LΉbââ*vÓ0ÍÇnyËh<òEpТQ”Œ7·’í3"d#⎚Cå.‹Icìgiá|"kÉlwksÎï0àÊí»¼Ò‘#G~õŸ~úéóçË­ðÈ?×ÿ-qêÔ©ÄßããË1›s»w]”ëŠ¿ÇÆÆVŒŠ2GGU%qq‡ÂîhL;ˆ¸ƒcΑÝÁr—ÛëWž)?ÁÀÊÙÍüšÙbšÇ9~à ÎqWÃxKÎQ’ƒu4SËõuº˜ž l–…óáFcêXùïñº˜Ë+¨7¤äª4J( â&â…ÝјDÜ!±]\lc(!èÛ¶2ì­§ÌE¨·f‹¥¦Ét$Y«­ÐWMÆPRTà‡†}`0¤l´Œˆ;$棘A‰¸‰¸cŒ‘*­¸ƒ§ù Dz]î<Þý·•¸9çà@²¸ñŒ%8#!®%5SJ!) â&â;UµŒDÜÁS¯ wy²Þ˜Z3P8¯ðmÄÍOg?ª8Ïm0¦ØöÁ³oA5"7L'`È|ŽôRlýcödcÁ@ùþÝå¹xÄÕ10gzÍl±4.tÛQu•#@ÄM+n•›¸ò§GÄ\¹ÈbÖÏ`H™îo)tºØ¾ ˜æU¿œ/2ó¨¾öù̽ꇩ"n"nUv8MŠˆ;¸ÚÊè.ÏxvÚéâb’c5î÷å’–q‘ŸÜÂ-}M¦£&È@}¨"n"nuZvÍŠˆ;øÊrNAêïÃÒó£_‘g&‚ÐDa™ll‹½lpžhñHðQ¡Ã"n"îp±UÕÊIÄ|Õ:»±9àWwyfÇÀ\ÍT¤?µX4ÓÉ-|;׉¸‰¸ÃÕvU#7wðU™!pÌEªQ_¤rÎÒæ²/Î7˜ùݾ&Ó q_8BÀm|&náÒhÌ#‡ÖíQé¢ýÙJŽ«WßÞÃUX°HoJM 'Õ¨EV"n@ì;k4š>ŒßOhýràYÆØvîìpÃ/ã2&nñŠrÝ¿ÎN\äN÷®p–¤7¥Ìð®1µ w|&îÌ „;0‘( ³HE"¦îÌ™ˆˆ‹5‚©ôãß#𦎅7¡mo€ ÿ6¾w†ÈÉð%Rg §]ŒÔù‡jÞDÜ€«|Þ¡ÒG¸Œk§w¸ÈLrú"nÿਊ^ˆ¸C£F"n"no,ˆÛÔÔÑÆïÄý£žn“ ÓøôÓ1ï³Olâq‡FsDÜŽÄ]ò©òxçýq¡Q†‚Gýå§#˜7e¸MB"n++À¢q`%wOÄ­ íqq»c‰DÜî uˆ¸#CÏ.gIÄ­ åqq»c‰DÜî uˆ¸#CÏDÜ Ö37·;æIÄíJ‘Q‡ˆ;2ôLÄ­`=qq»cžDÜî uˆ¸#CÏDÜ Ö37·;æIÄíJ‘Q‡ˆ;2ôLÄ­`=qq»cžDÜî uˆ¸#CÏDÜ Ö37·;æIÄíJ‘Q‡ˆ;2ôLÄ­`=qq»cžDÜî uˆ¸#CÏDÜ Ö37·;æIÄíJ‘Q‡ˆÛ=;víßlƒV­ÛbÀ€´´VíÝ«;¾ûn?vïùùóçÇ’Å‹0cÆT|4e:jzÜŸ¯ è·¯ú§=·rˆÛb± ±O[Túyôk:ÇaÆ`ë–¯±ióV-úXÐçHÄtÈ]HÄí;qo߸;7®rK¡/‰>纬ûÏÕ+ørÑ,c¶C»_mÀ¨Q#ÜÙbÕ¾zõJlÚøΜIcDGG£U«6hÐðu‡öœs¬Z¹k×®Á¹sgQ @¼Z¿zöìÚµj ècaåÊ5RÙuÞ£G/têÜ%K#X¸`>fÏž‰™³æ¢J•ª÷ËÛ¶}ýÞ`k+d=z¤´= p{á·nÝÂÒ¥‹±uËf\¸p¹sçALL,:vêŒøøg½6>"n¯¡ókC"nÿ÷áöbż©¨Õ°%ê4lå ¯WaÇÆ•è1dö» njߣN£6¨^çuÌŸ1§Ž™0jÖräÊ•›W/ÀÞ_¡ÿè90Ú ãdüsõo*ò?ÔmÜ1ñ/Úú>Ÿv ³?|Õë4ÂkÍ;Úþ~öן°ëëµHûå8îܺ%µ­_5_m&=Ëî"nw‘R½·p17lð*®_ÿ¾ÚŒ"EÉé¦M^ÇÙ³glûÈ?þpݺuEçÎ]нG/‡¶}4 +W,³¹³Åò^ò‹/VEµêÕÁÃ7[·àða“Á‹º&ŒÃš/W£Zõ—P㥉4W¬XN‡M›6âµ×bÔè±Ò˜'~ˆ/W¯ÂŒ™s$¯AVeÈØ¾ílýf'Š)‚¤õë0vì(i¿»~ýRS!·_xÆŽ/m\»v Ýß}ÂûШQøýâyT«ÕÐae|ýÚUŒ{¿bŸ«Š6]­^°ñƒºàÚ•¿P£n¼Ú¬½­€&Ñ*'ÔCã6ïHOZñîÚ‚>#fà±bOâ™_0gü ¼ôJ#Ôkj}gÈeÝ’qhï6tø!¢Ë<ã–Mq»SDT qË«âÇOÄ+¯ÔËè·:wVÇßlû… †ˆÎþúëMX»î+”(Q¡}Bj(úXQ›;Û¹sAØ"(îÎ;x¥NMT¨P .‘ªÉ«bá’®yû"ö²ÅžöÇŸÌÃsÏ=/õQã¥*È›7¯Œ3›ˆSìg ’+dQÄœŽ?†={`ö¬’+\¸Û…Û].òz¯Þ}¥çÒ®m+äÉ“I6e‹¡« DÜ^Áæ÷FDÜþ'î1ïu€ÅbÆÈéKôu÷î$ön+­|©‹ÿÊåäQ¾˜1u·EÍúoàæõ0¦(Tïû9rä´Õýó÷ß0ex<]Q‡N½‡Kÿxâ\8û FÍXލ9°pö‡¸ö3z ñ/Öq¹Wþæ/ e羈«l[÷di[DÜ~ô¶Ã·|žyõ—ëPªTé,Á{ÎboY¬vÅùgáVjÕ²Ο¿€={¿³­LE'ÂüzÃú’ëY>ruõêU,]²b•/Üíb¿Û¾È®oAÄbß²*{E¹X÷âTˆ¸óü…c¯!!îwÞ~ zýظi‹t”*«rôèthßÕ«×À´é3¥•²8‚õLùòX¸Ðñk:y×·’k¹o¿þh×®=®\ùo¶k áVnÞ¼%ªT­†üùòIÃ}ûíN,_¾ïõmÚ´CZZ„;»F)(̹Ô}åeäÈ‘›¿Þ&ý´mÛV|0d:vzK \ˆ Ú« IDAT˪¬[·Žƒ±ã& ^½W¥ 7ázý™Ífé¡oÙ²5Þ8Ø¡›Ýß‘pš:mf¦Ý „8šæM!âö5ÿ·!âö/q;üÏù0C˜ÐÜûv`íâ9x£C/<[ÕñH˜f+á&ÏÇC†œL¥}÷!(¯}ÞAñ'RõX8k¬änoв3.ÿñ>ÖÏU­fz íÔq|2éé!æÙ*™p“Û¯ú³²."nÿ?{áÚcHˆ{ð رc»D¼cb²Ä.qä0)(lòGSQ³f-Û¬¦MßÀC­.*¹ˆ,d"ÙÜ?“ÜÒÓ§O•VÛ"Ë™Èvf_D`˜ûô³ùRdöÁƒгG7´nÓýû;fE;þ<7zÍöñ ú‘WÃãÇOBWêf9‡ ãÇaÍšÕ= bî”7aâd©/ñ"\Þö‰X„+\xuΛˆ[-·‰[Žwå†Þ°|$^æà‰'K9À”½ðïÍë>e¡ôw9™Š«º¶1º¼‡¸ç«#Eÿ–:¯·ê‚*/¿ùã¡a«·Põek𩯅ˆÛWÕÓ>$Ľbù2L™2ÉeT¸=´2™ w² [[·nÁ°¡ƒm+e¹¾pu7mÒ‚dwìL–2¯½Û­+~øáP†•½ØsQíbEž¼{xàAìÞŒþïõ‘VêbÅn_d‚®láÒE¼oÝú¯ð䓎ûìÎæÑ©ã›8yò'i?[{›;g¾øâs|>!´Ú8)ðNà‰ll"+›\D»ÔÔìÿîrçÎíÐmZÚiDG—ôɉ¸}‚Ïo‰¸ýKÜ‹çŒÇ±Ã‡Ð/q}üI=‰Uð¹Ó?Kǽì÷¬ïܾ‘}Ú ÌÓ1x«_¢ÔfêÈÞøãâ9ô>w|ÖfŽéß;‹&ÍGþÂ7ë—a×–5èöþ8D?U'ñÅŒÑHxµê5iç íÿnâÎÛÒªÞ“BÄí Zê®âGœÄ V$!ç°3 ×ñæÍ›0qÂ8éœãÂEKlÕ"E¨8ÞÕ·ï{h÷æý}§… ¿‚¼yä¶=ê¾}{aßÞ=Xµz­”‘MÑ·8Ƶ~ÝZ©®H7*Š|^\¬¾Å*\.§NB§Žíðßÿaâ¤)¨UËš¦v­ܾ}K"㬎sˆñD`ZÉ’¥°xÉr©mß>=±ÿ>ìÝwyÒƒcqô?bõ—ë¥3æÒ‹cÊdÉ?lØH4nÒÔ&“øí½.×¼-DÜÞ"çßvDÜþ%n±¿-Ëg.wÈ!ïC?\äQô1ÍA‰‚Ì猈—ê6Býf!9·XlÁjry5­­\­:[Ÿ?á6îóÄË'o>ܼq ¾ßE l{oô,ÛG‚”'bÁ 7Âûãæâ ºmLDÜnC¥úŠ!!nªHg: ?‰¼_x¡²Ý-²‘ýñç8ôýA)ÑHÙ²OK®dû­Ø~£Yc-Z}€Àæ¯7âôéÓ0ô¨\ùEé\µ(ò>t¥JZ¼ýλÒX«W­À3å+`CÒ:ܹsWrÁÇÄÄ W®ÜÒ~øO?"¸Å*_$kINþV:J&"¼7|õ5žxâ iϼþ«ulÉY\YIÙ²eñú륀8q½qã¦6|¤TõÕzu¤ht±Z—‹ˆš‘æöYØ.]º„¶mZàæÍ›hÞ¢%Ê”y b¥-Îp?üpa|>A¶gà³²`"ne<ßDÜþ#î›7®cÌ{í¥sÙ=†LtP°¼ÿbšwêãðÛ¡=Û°néǶ(ﳿžÄÜ ƒólUœHÑ£òK¯ hñhüyéöïÜŒ¼ùò£çÐI¶Uó‡»Hï/}.—¯×.Äžo6àñ¥_¹&˜Fƒ”÷#íçcÒÑ2qÄÌ“BÄí Zê®2â°ŠÈì/æÏÃ÷ßÀ_ý%­†…ÛZd«_ÿ5¼R·žËŒj[¾ÞŒyó>ÅÅ‹¿¡pá"xµþkÙŠà2gW÷Ê•Ë!²–‰3ÔâtëÖm¥³ÒÏ-®k±·\¨ÐÃçµE>rqž[D±‹ìeâܶ¸XäĉãÒÙp±ºÞ»w7úõÍ: ­C‡NÒjXÞÏ8hZ´h…«W¯H«u±r+xû"GÛ/]¶åÊYÏv â®uáò¿q㆔¼¥Î+õбc'i;À—BÄí zþkKÄí?â–#ÁŸ¯þ š¾ù®ƒ’ä}è-:£ZmÇã•òì¾#§£è%ðýžo°~é'hõV?äÉ—ß$-“ÜæyòäCÙ :ÔmÒÖv‰ˆX]y¯#*ƽˆvïÞï³ïvm†ø(¸üûEh¢r Xti¼T· ž‰ñüâ$"nÿ=sáÞSH‰Û抑ˆ[ª â&âvlj¸ÝA)2êqG†ž]Î’ˆ[Ê'â&âvlj¸ÝA)2êqG†ž‰¸¬g"n"nwÌ“ˆÛ”"£wd虈[Áz&â&âvÇ<‰¸ÝA)2êqG†ž‰¸¬g"n"nwÌ“ˆÛ”"£Žß‰;2`Sç,ÍKM“éH²:g§ÜYq;·r5¥,É80Ê`H±^eF%¢ âŽ(ug=Y"îÐ7·7–GÄí jêhã;qëb§3Àñªu`q³0[4…L&ÓÕˆ›xˆ'LÄ èâbLŒ±J!VEx oáMô¦Ô¤ðš¤õ>·V«-¨ÑXÁ¹Ö)©Æð8ò8ÈÄñg¸¤$9}•…WÁ±^¾"é]{"n@«­ bš¾°^Fò¢x Y †xN”RK2R¦+E’#¸øLÜÁ7x£ÅkcCÃÖg‘ä7¦ÄOIíq+OÃ:]l"FÊ’Ñ6’òtÉqg¢ýø¸˜$0æ2QºÙbŽ3™Žš"ÙphîþC€ˆÛXú«'"n!Iý"n¨jµå¢£4¹Ng 8ç‹ôÆÔŽPõyq+OçDÜÊÓ It"nÖàüÐV©Õ†ï¾Å­ÿþ•jsŽ«®)I\ô(ù"n èß>ˆ¸ý‹'õæ_ˆ¸]w\lc°¦ üðìܸú÷8s ïd0¥.ô¯:¨·HD€ˆ[yZ'âVžNH"ZqgjÎAiå+=ö=†àÂÙ_1klÿûí(Hž#?!@Äí' ýØ ·Á¤®üŽ­¸ uJ{óÝA¨WYª5ct?\<ŸfkAAj~·Çˆìˆ[yj'âVžNH"Zq»´ç ´‚?‚Á>³Õýqÿ·X³h–ݪ›‚Ôèaò"nß1ôwDÜþF”úó'´â¶CÓùa­Õ°%ê4le«ñß¿71qÈÛ¤æO ¤¾@Ä­<# âVžNH"Zq»´‹ ´‡‹<êP÷Ë3(Hž ¿"@ÄíW8ýÒ·_`¤N„­¸ÓÍ,(Íw R %Fp·DÜÊS>·òtBÑŠ;ƒ d”æ\™‚Ôèò'DÜþDÓ?}qûGê%0Њâ‚ÇLiyòæÇ›ÝgŠø±ÃßcÿŽM÷§Lj±ÎèU\Ò¥±\‘§Ê9ßm0¦&DÀÔ=E"nE«'â…#âàüzj”IÍSĨ¾Œ€V[1!J£ÙeC„>aDÜŠP ‘ DÜ‚¸ãb’c5|±º=Èô"·­NÛ—Ól+n`”Á’¹ˆ(cæDÜÊÐIá"nëŠÛáå驱pŽ3~'Ád:q?;‹§PýˆD ƒ·Ç›нè¡7"îÐë€$È"îtl´Ú Z&ª± ¨lwò‚ã œó“_µX4 éÂz̼A@{š1DËmÍM!²%oôo"nÿâI½ù"îlð¤ˆ_ÿõv6¦#Ó°679ç‡ ÆT-azˆ¸C¯’€VÜ^Û·×ÐQÃlp^mÓsÊ1"nåè‚$Ɉ­¸iÅMÏEpq’ášÞR0¢Ð. â&³P2DÜDÜJ¶OUÊæì"—&IAiŠÒ5·¢ÔAÂ8!@ÄMÄMEpEÚ”t%ˆ ps("n7¢j!A€ˆ›ˆ;$†‰ƒÆkcû@ƒéös·%Ôh)’\YAÄ­,}4Žqgcº¸c¬’\MoH!Ìè)òxmlÎhì+½ƒkf‹9Ád:jò¨Cªpˆ¸1 àDBÙ·.v:úتÑ^¤æ9M¥ü÷ÈÕˆ3ôuAØ"m›·‚•C¢ˆ;;W¹6¦14l½­å’¦Ç&DŸ(DÕCG0dz[ìi[xTcr+×”ˆ¸•«’ DÜÙAÆÛ›pÕ`L)”];ú=2°fÜÓtg3YYÛq[x_ƒ)Õ9û^d€F³$â#eE ¨´âvCéÎwuÓÑ7@SqÉœóÃà˜nAT­²ÃÃ0ˆ¸ÃCO‘*%·šÏš˜a0¤ôu£)UQ ZmL#ÓWÖÙ&J‘Èš±…‹9™‚ÏÂψ¸ÃOg‘$1·Úvá.O3SJºÑ”ª„1Þ“õ$º).Œo½10‘¶ †èÚÞðÖ§Ú¤'âvS£Îîr³ÅG+)7Á “jÒ, áæê¦¸Œ3á|çH²àn2‘u˜(Ú 1‰¸Ý‰ª„ "n7¡'w¹›@…Y5ßÈšö¬ÃLÝn‹KÄí6TT1q» z¤ºËż5K"8DÔô㿠ξ†æîp½þøE7ásYM§‹Ê€fzCŠÎ—~_Ã4oƒóÍzcêOú˪®|l‹q–UB¹‘7 IÌ“‰¬ý¥…ð쇈;<õ)Rq{ éHs—ÇÇÅÁxékÿü÷È©S§nÛC¥‹‹ù`Œ)Epwa¬X±bñœ9YÔfŒUG9ËŲÚd:ò»}¹ªçùk+Y[,æ…lè òêjKÄ­.}ªm6DÜj4RÜåÑÑÑy ?üÐ Îy²Á˜ZÛ&.fëxç./ššú«‡0B§+_<Çî2ÎûêM©Ë=íC®owl+ÁìeÖ„(Œ ²N"²öuu·#âV·~Ã}vDÜj0RÜåZí3OEiržäà †ÔN‰ÛzÎÕÂy£1u‡'0–)S&w‡ò‡ÁìÔ0þ)Óëüân?tÆÚ]¤¨ž7q{ƒµ DÜ")îòøØXr@ÏÁç ©=aŠ×Æ€“9,M †#÷/aqϸ¸˜`)4·ãôú“—uq1û9ð•ј:1³æöǶ8gbemö2ˆ3ÖŒ%[,”Å µP;ˆ¸É”Œ·Ú‰wyvÄ­ÓžπIÞ·€\D¬=zôŽøá–OKK»å¬ :cí…qR¿ @Äí©“!@Äí°‘à.{Ð 9~F&טÆÇÅŒcÃ,µÆ”^Àè²‰íØ–†'¸™½Lœ±N¶f/£„(þÒC¤÷CÄé ìùq{¡ŸHp—§Ÿá¾ Î÷é©53¸Êãb—ƒ¡5˜¹„^ô¬0ÚšÐk_У¶@€ˆ;¨RŸþB€ˆÛK$#Â]®‹=Èf±Œ4wõ¦”épitq±çãf½!õIo ´ÛŠjÄ8»{Æš'‹ìetÆÚÄ©'q{‚Õ 6DÜ^" îò¸J3fz›sž°ƒoÉŽ€ýUY¯ÿí_Iëb.¬ Þ’Cþ›Nó€®àìª;‘àég¬“‰¬½4Lj戸ý#u ˆ¸}V­îrgo‚ "3.ñ¤Û·-#Ž=ú·=|ñéÄm¶ðf §¯¬³=¶•NÖ éØ–ÆHMýŠ·_á¤ÎüŒ€ªˆ[ì›F±¨îì™úǰéŽs\“’ªôs%t|\ÌB0ÖÁù7Îùnƒ15ÁUá}Ì5ˆ¬ÃÆ HÐl â&Q2ª"îÌHGÉ •lfË’&Ó‰4y|ÉõÏÌëÁ˜+r¾f¶ÜÑf¨K#hxc7mAJˆBǶB¥r׈¸=‹ªU·..&™1V#è(†á€f‹¥¦Ét$Yˆž§‚ý †”ééǶjY‡¡ÂId âö.ªdTMÜ%Ÿ*d8•;Ü•¿þÄÕ¿ÿ´ (w¼6¦1glAfcÜ¿g`+ÀÐÑÍ-‘%‰Žm)×H²ì âÎ#ª:TMÜ>ó(…vè´„‘·µ;7­r nF£eÀ´,†7sΣäã`YÔ#²‚iˆà!@Ä<¬i$Ï âö³°láLÜœ[¾aLS7«Épp0¸6‘ûg¬-I²Ë=,!¡ q“Y("n%kDze n J¶ʹø=ºÓ­„¢øQ!ÔÕÿÙ;訊.Žÿ߆Þ?±Ò¤%$Pz/JG¥·Ð{ï½÷z' ( "UB•–Íš"E`÷}çNxËîf“l¯wÎñ¨›™;3¿;»ÿ73wæy5n¯vOÀ7Ž…;@†@rÂ-“J“¿¼!͉,Înëct:yy\ÜÙ‚‹»àX¸|xy÷Y¸½ÜAÎjž½Âm&â×$sux¶Ýøh˜³ÚÈv˜€·`áöOp;,`áqaëRyÊXäm:}P;­Vû 弜ƒ ønßòW µ–…;@<î|ááÛcbãBîf`á gû`WY¸}Ðiö4Ù\¸õzùO•JÊi-¥Lr× :b—Ë2O`áö´¸þä°pÈø°tŽÛø½ LA¡‚”*éÕk7eÙèT)¯$!½D/ë#´Ú³ÚAÈÝ ,Üälì* ·:Íž&§$ÜöØä2LÀ_ °pû«gý£_,Ü>ìÇ×.aÁäA([­.ê7ílOX¸}ØÑÜt·`áv;r®Ð,Ü`ýu÷6NÞ‹ ?kñ×Ûxþì?dÈ”y F™*µ‘¿P1».ë©£û°uí"|Ö¶J–«ÊÂí:Ôl9À°p˜Ã}¬»,ÜFÓëõøþÛ¯Ä?”ò¼÷>r½•©R¥ÆÝ?ÿÀų±Ðé^ jÝ&¨Y¿¹Ç]ýÍËqüà.ô9 oçÎÏÂíqpü… ·¿xÒ?ûÁÂmä×-kâô±ýx¿¸ZuE¶ì¦A×4š? w~ÿ ­ºFquŽŠ%3Fà·+0nþñp‘\â¥rºŠ+÷1,Ü>æ°k. ÷K‡Ÿ9v›×,@áàp´î> AAA‡Âï7®!r|?¼ç=ô1SäùçÉcŒï×Z”è5Ҥܙcßcóšù‰–³ÏiOáØ÷;qóúe<ö ÙräD‰’åP¹ö§H“&Á]Gzüûoqòð^Ü»ó;2dÌ„ÐÒ•ñQ£–˜Ð¿­(×wô܇- wŠˆ80`áæÁàÍX¸¼xñÓ†uÅÓcÐäÅÈ’5{²>›9ªîÞ¾…±‘ë‘.}\>‡å³Ç ÊÇŸ¡V£–&e¿Ù´Çì4YÎ>ud¶~¾¹Þza¥«×/GìÉh„—©ŒÆíúllÛ°'¢w£pHI )…gÏž ÁÏ_°b~ˆ†ºt4iß;Å1ÆÂ""ÎÀX¸y ønç~<µ '[-‚ËfÆ•óñ4q1r¼þŽìûß~µ-:DHÉr&Ž_:s$~½ü‹Éröö Ëqë·Ëhßg Ò¦KoÈ¿dúp\¿ò ÆÏû©Ó¤ÁÕ‹ç°tÆ!Ú=Gò=øëOÌÙº/P§q;T¨Q?ÅÁÆÂ""ÎÀX¸y ønʬ¸y§þ(QªBŠŽ[3V#sÖlØ´2RÌ–Œ_ˆœo¼eR~lŸVÈ–ãµ$—³i¶OLiåÜqøõÊ/˜°pR§Nƒ Ëg"îô1ô1ïä)`bwÞ¤¸uý :ö…ƒSl3 wŠˆ8`áæ1àX¸¬Ž_ÎÆ¢ßØHEž\¢=gÚ[¦èrZ*§WaÎ×÷þ¼ƒqóÖC¥RŠS0Ûôá]öae4í°ü­ÓépòðhOÆï7®ãù³§&ÕeËþ†N]Šp§}ó4iÓcøôÄoÓT„{ÔìµÈ˜)sŠƒ…;EDœ °póð ,Ü–Í…+~Â)Kñ¿¯'ë¸ß®^ÄÂ)ƒQ8¤"zÇóçÏ0¦W ¼÷=ô:ͤìÙØø|ñ4ÔnŠ5€D?jÞñ@ËßêÒ•‘%ëÿDù/WÏCÑ Ma¸óûMÌÓÓðÿæš4°TAA6ͺWd³pûÄ÷‘é%88ÍKÁͰH€…Àú¥3s݇NCîü…’*_­ŽAa­º Añ°Ò"*|þ¤ø BM|Òº›IÙ][¢pxÏvtì7Š„à|ÜD-˜„¢a¢M·¡&yi¾qåT¯× Õë5Å…sZ¬š;åª×E½&¦·¢Ý»ófŒìfxx°fl³p[C‰ó0,Ü<¼™ 7€£ûwbç—+-F…;OÓwóB·!SIJxì©#Ø´b6ê6iòÕë²ÓR÷¬Q=pïÏ?0jv2fÊŠß~‰}Û¿@ãˆ^/kzÓ : {›îÃP4ôÐq±µ‹¦ B¨Ó8Âd íÛ±vlBÕÚŸ¡fCÓ(ö¤ ·7 ¹mÞF€…ÛÛ<Âí1&À àÉãG˜9²›XöŽè9RÌŽ-qkNDcû†e"h¬û°©È‘óM‘E™)×þ¬-*Ö|õjêèÝ[±{ëçÈ’-‡aúðÞmصy ê7UjªÐž:‚¯VÏûæƒ'/Aö×rA9/ž¿Pqt8Á÷÷¿bñ´!xößS´ì2ÁáÖ]ÃÂÍ_|&`=nëYqN÷`á~ÉüÂY >_4MˆwÁ"%ðNÞ‚J• ?¼‡KçâÄô›ïæG¾ræz9~÷Î-ÌÝTF‚œ!cfhNFãÎï7píÂ9,ZízµÙcz!}†L¨×¬#2fÌ„øØ¸só7¤Ï˜ ´'þIëî(\™²dÅ‚Iƒpë·+â˜Ú»ù âîí›8«=‰ ™³ˆˆòA“– GÎ\Vn«0q&& °pó@ðf,ÜFÞùó[8¸k3.þ¬Å㿈`²té3"wþ÷öaE„”*oñFµØ‡Ä2øý{w9ËÿZºÔVÁeæKÝ—‰ã¦[ÐHœéøYúÍqñœ[Ö.ÄÓ§ÿˆ™tÑ¥@絿ùb®^:'ŽŒå+Xuš´/¹õ댛ÿ…ˆj·&±p[C‰ó0,Ü<¼™€u¿úÞÜ£¶©Ã‚£%Iª¤|4uÙ×v·œ®ýfã |Ú¦J•¯n·o)ÈÂí-žàvøn_ðRà¶‘…; ßÓ+tÑŠrìËׇ ·¯{ÛïN,Üî¤ÍuÙJ€…;bô2  )UNìyçzó]ñæ0_L,ܾè5n³§°p{Š<×k îd(Ñó¦U‘â®q T«ß¬J–3=Æe doÈÃÂí ^à6ø n_ñT`¶“…;@üÎÂ Žæn:… ·S0²`ávXo3ËÂímáöx3noö·…;@Æ w€8š»é,ÜNÁÈF\D€…ÛE`½Í, ··y„ÛãÍX¸½Ù;Ü6î,Üâhî¦S°p;#q¿îÎ'º›ï™=sü4Ç®Óë«hµ?Eû^O¸ÅLÀõX¸]Ϙk°Ÿ€_ ·ýXü¿$ ·ÿû˜{h?nûÙqI×`áv=c¯¬…Û+ÝÂò,Ü^ân†Eþ%Üê¾0‡}"‡1š¸l)æâ L @ °p¨ã}¤Û~%ÜÄ<<4¸¡¬’B=Í_–åÊÆ/<‘ey$I×<Ý.ôúgÛ´ÚóÞÐ/ÀÁM`‰ °pó¨ðf~'ÜÞ›¿øÞâ n°mgÆ%ÜG€…ÛE¬ù‹ï"°l– ¸ÝH…ìG IDAT™«°› ·Ýè’/È_|e³LÀ øûëÈ\…ÝX¸íFÇÂí"tl– xœ ·Ç]À H† ·‹†ñ]–Í27àï¯ sv`á¶ϸ]„ŽÍ2`áö¸ ¸<ãvÿà/¾û™sLÀYøûë,’lÇxÆí ªø‹ï"°l– ¸Ý™«°› ·Ýèx©ÜEèØ,ð8n»€ÀKåîüÅw?s®‘ 8‹E’í¸‚Ï¸]A•—Ê]D•Í2÷`ávg®Å>,ÜöqK±ñSDĘ€×àï¯×º†€…ÛEÀ¿ø.Ëf™€¨Ã‚£_įÁut®Âj,ÜV£²-# ·m¼87ð&ê°«’„¼J›tzÕÿ´Zíoj#·%p °p»È÷,Ü.Ëf™€„«Cd¥YÆuMlœAÄÝP=WÁ’%ÀÂí¢¢ ŽTÒj×_/·Óhã£\T›eLÀIÌ¿»å51±ñN2Ïf˜€ÃX¸FhÙ@hhñÊA*ÕAƒpã4š¸±.ªŽÍ2&à$æËä2?t;‰,›qng‘4³Z,4HËÂí"Àl– ¸€@¢•2^&we6é(nG &SÞxŸ 2´1±qa.¬ŽM3&àÐÐÐl*IOAiÙøÛ\ÔåX¸]ˆX¬•$©„R…Nÿ,ŸV{þš «dÓL€ ØA€D;HÒ} Iªlm×õ²*”£ÉíÊE\J€…Û…xÕê¾0Çèé=R£‰ëëÂ*Ù4`6HmýAH5.Êg·mÉÙÝF€…Û…¨CC ç R¥¹jôÿ@/? ãY· ¡³i&`¤D[ø!ÛŽœÕ½X¸]ÌÛü&ÈrtLl|WËæ™H†=T«T©Ç@–ïi‹"|ü‹ÇŽ—`áv±ƒ^F—GÈj´dÞO£‰›ëâªÙ<`Fhv è*Ièk¼—m‰E›ÇŒ`ávƒ“Ì÷ºÅC=ä(&¾ªwZjuH= ø/Çhâ 8Í0b.  µJ…Ê’,U6ßÃ6¯’Ïk»À lÒ%X¸]‚5±ÑDKæ/Å[¯êç Q«ï¿ÿ~æLÒœƒ$½ÃÂí¦AÃÕØD€–¿Ô%¬jƒqYÞ®“Ÿ÷娛psf`ávü„3¢ºmÆo3o×ô²®‘V{V릦ØUZ¼@‚ÔJ–q_’dϸíÂÈ…œH@"M%Y%W†,U6~)ˆÕ<„,oÓÉr”Vûmeqb>C€…ÛÍ®  Ž‚$µMT­}c´q‘nnŽUÕ……—‘€£0 2ZH2±p[…Ž39‘€ƒB Y–A’¢õz}4‹µæÜN€…Ûíȵ:d®ôITµ,Gëä FÞ´tžúç±d}Œ&^­ >ÃÂíA€U²P Ó¹ËV`á¶ “ó3½| É6ãhó—Kç$Yn£§¿y<…‡’±’N*w2á68žqÛ☰°àŠ’$ ’ ‡Òk²Œ[ä=²ül\lì/·l±åÏyY¨ýÙ»Ü7g`áv&Mm%µï-ò\½>h\J³o%rxþ£³ƒkBBBÞO$ÿ`¹&6¾µ‹…Û6'‡…ï AZHwy“<Ò’$Uäßž=G‰øøøû¶YõÜ,ÔþáGî…û °p»Ÿy¢-™dhu²®]rkê°k’„<²ŒzYWʼnAn’Zr2òÿý蟢—.]ú›…Û¶ÁþVȯݒen.-Ü*‰fh†kRÅʹŒDk–.vÑéuaŽ,™«ÕÅëJPí°¢“'c4q¥­ÈÇY^(V¬Xöt©UÉ’´P’äÛŸ<+õË/¿<òE@,Ô¾è5n³?`áöR/Z¸fqÜÁ™„„„¼ž*•þKh$Y5’œN†ÜY¯—ïkµgy)B¯jÖË;ëc%?Õ˘þÏ?Ïfú’h³P{ÕâÆ0n/w~JkÔü UÐKAxÕpÉ‹LxÛ¾S¢D‰·ƒ‚äA’,g¤2_†üù‹R¯¸¸¸'öYum)j×òeëLÀ^,Üö’sc¹¤×–Î1V–Ð"Ë›”eîüw³p;ÇñjuÈ ˜îMÁi,ÔÎñ-[a®&ÀÂíjÂN²Ÿ|àšþWHªÜ‰«’·Åhâ9© lÆÉÔa!7¤ÖÄÆår²i«Ì±P[…‰31¯#ÀÂíu.I¾A–×dY†$%áJ½ÜÈ[naó1Ô77á5¨òtè¥ù1Ú¸EæÃÕÁweYJ§‰ËäpeV`¡¶ga>@€…ÛœdÞDúVI©éÌw%ú›,IévÂ’¹*_J7°ù ¯orhh‘‚*)Õ/’„«OÿÓ—:{öì_J£ÃÂBš«$ley¿&6¾†+:ÃBí ªl“ xž ·ç}l ^þø6UÈ&A…ŒlJÈ+IRÞ”º ‘M\ß”òñßO <,d¦ y€ç² Y‚´—^Ø ž$IOuz]%­öìigÔÌBí Šlƒ x?n/÷‘¥sÚö4Y§×WáWÚCα2êÐàHÒIBÆ„ÕÚÖÀ²,E¿ÐaR\\ÜOöÖÀBm/9.Ç|› ·—û/\"ÛÓDó}oYÆ5Ml\>{lqÛ $Üj§[ H ÍJ?ŒÑÄVMl±,΂#¨’¬¢•©²$!ÅÕcûü>j[hs^&à½X¸½×7¢eju]:ÆÖfÊ!f<ìŒëPmmG æ§;äU’jµ%aµå|½"ÔPɕ塶EðB–£eIŠÖëõZ^m Ä‘È}öW,Üô,ý0K’ÊäZSKÍ‘$ù @*/Ër˜)’$–]íI²¬ïH—ì)Ëeh©[ÿ0Ù·µ%÷ %ËÛcbãÍgà¬Îj]´#WÞ²Ÿ™ðn,ÜòOxXH,$„z¨z®Ö2´1±qaÆ&Ä~³”z5$©²%Ó²,ÿ¨—ƒ*G÷³P;â.Ë— ·|ozoµÀU:LÀøE.t¶^–$ZOj)û¡N¯‚N{ÔŽ/}óŒÚa²&àÃX¸=à¼DïÑö@¸JÇP”>J«RéæH"’³&˲òÛ¿GÍB혷¸4ð/,Üð§¹p«Õá/YÊ-á*­%sæ44šCv^×)H ê‘âvGr·ã˜VnLÆBm­_8D,Üðº¹pwêÜ]ºtó@K¸Jk ,]ºË—-1d§3z)}yH³)%q« µµð9`&Rúía\. ÀÂí¨.6™¢p'1³¦óô¤Üä¿!ã`Âñ,žQ»Ø]lž ø5n¸—…ÛЬ29áÚ :9oznÞ¸Jº3æêõÏÖhµç¯9Ø.Θ@`áö€óY¸=ÝÁ*SœqÛ`_†¥×?Çn4Îʘ€ · · ;X¥3…[iŠ y®FßÏÁ¦qq&ÀŒ ·ÎÂíèVi.Üz[$ȯR^IB{ÍóË_ì%Çå˜@à`áö€ïY¸=ÝÁ*Í…Û\péR@ʦR©è6¼leºp%›$I%’«Úø"›ÈÅ™,Üp4 · ;XeJœyzSð"T)/TR^I–Ceusc´ñÛlgL À°p{Àá,Ü€î`•Ž·ƒUsq&À˜€ n n@w°Jnrq&ÀœF€…Ûi(­7ÄÂm=+oÉÉÂí-žàv0&ÀÂí1àˆpÿý÷ߨZ¥‚ÅV§I“ï¾›5k}„–-[#]ºt&ùš7kŒ‹/>K•*²eˆbÅŠããë jµêP©T‰lGü¦|j©y‹–¨T© ºvéh5ÕƒÑG‘9sf«ó{*# ·§Ès½L€ ˜`áöÀ˜pD¸Ïœ>…®];¡H‘¢øàƒMZÿþ}œ>} ¿ÿ~ Ńƒ±bEHœ)=þÊ—FæÌYP¿~ñÙ‹/póÖMœ>uOžòC¢=l¥¾5kVcþ¼¹èÞ£—@JÓ¦MÆW_nÂÜÈ(_Þò9-i:H,i1Z”{ðà>ªW«Œ bãÆÍ6Ó:vì(úôîÚÿ0`°Iyz˜˜4q¼uÚ_Ϙ!£púœfþK–®0ÌЩ]öïCíÚuE¿Õáá(^<o¿ý6jÖ¨‚ 2 S¦Ìhݦ-òä΋×cçÎèÙ«öïß‹O?iŒ"E‹Š‡žõë?Gß~ЪU«ûÃÂm5*ÎȘ€‹ °p»°%óö 7-7W¬PùóçÇÆM[,¶üÖ­›hß® îÞ½+„–—}÷#vïÙ×^Ëi±ì¯¿^Ç'ê£d©°dÉr‘çĉгGW!˜ã'L²™ÖªU+°há|Œ;uëÕ7”§¥û¶m[¢uë¶B\ÓäI°uëf¬\µ%JÐEd@³¦ŸâÊ•+hÑ¢•]%Ý¿ÿjT¯"öò×oØ„÷Þ+ þtãÆ 4lPG?-ýÓÃ¥§OÿEùr¥Q¹JUÌœ9Çêþ°p[Š32&àb,Ü.ìLáþé§xD´m…¼yó¡FÍZ&¦ÿý÷_ܸñŽ9,‚Îúôé/fŸ”h¼RŲbéyテIö˜D¿~½Ú )U«×Š|Êì½oßþhÕ:Áž-iÈà8p`?¾Øø ,d(JûæçÎý„uë7B’L#Ù÷ìùsfÏÄ„ “ñqí:xöì™x`ɘ1#vìÜ-f×JR,h/Ÿöô•DKçE_¦L9Ì_°Èð9-›W¯VÉâ^rýbá¶Å뜗 0W`áv%Ý$lÛ;ã¦Y(ÍF“J´?\¶l94lø )bÈvýúu|úIýD"fn‡fä43¯T©2fÍŽ1|(HH“K4«=r”–î_íI+ùiÖ{ûöm±?®D¸Ó^v•Êå¡Óé’µ;wî|É®Öկߣnj3)³vmæEÎwx§$j3µ}Ðà¡hÚ´¹ásm¬;¶C»öÑ£G/«½ÏÂm5*ÎȘ€‹ °p»°%óö ÷”ɱeËWX±bµ8º¥¤+W.ƒö¾׸޽{wcø°!)Љ-\8ß$€í³OàÚµkøì³&T–‡KÖ,Yѵ[D]}üø1*W*'"Ö­Ûhø;Àuhß$ÄÕkÔLÒ¡¡abv½}ûט0~¬I”¼Rh䈡ؽû;ìún^ýuƒ-Úã§Õ f£sêJÚ´é ̘>S§Í_³6±p[KŠó1&àj,Ü®&lÁ¾½ÂMËä´\}è2eÊdb™„fÌÛ¿ùVDf'EÄ’+:çݨa]1;Þ²u;rçÎZ~§%ê\¹ÞÀÎowÛL*&æ ºtî VFŽc(øð!ôï×[Dv7kÖ"E»tTíË/7Š=ì÷ß/l’¿ñg@ç×÷ˆ6ù¼WÏî8yò1Ó§s%Ñ=lÛ¾3Ù3éæbáNÑMœ 07`ávhãjìnZV&Íž=vìL¼t­£}mÚß6N\F{ÁI‰•,ËbFûÍ7ÛаÑ'92Ad•¥ó*UªaÆÌÙ6“Ú°a8†e~æüÄÇÅYóˆvгgo»?g¾è:vˆ,æÇÑþûï?q©LÉ’¥°hñ2;tvœ¢Ì7o1}ùeÿí×_ÅÃ-gÊY¸mv?`LÀEX¸]69³öwJËá$vÕ¢+K%±ll|Ý)çzþü™E±¢eð9³g€ŽmÑòû¢EKAW§R¢ãctŒÌøX™-¸ÆŒ).u¡@7 xS1£¶æÊ• ›·l7œ§¦ˆÑ£GàPôA±rð¿ÿe}FËí´Š@nÆéìٟжMK4GÁsJ¢3çtD¬V­1iòTÃç´G?´t¾|Åj[ºn›pqf&À\H€…Û…p“2mpÓùcº|¥c§.èÚµ»EÓÊYmš1ÓÌ™Ò;w@¨*Wêe=ýýçù¿œ?/Ä‘naëÕ«¯IÄ6]ØBgª)*›¢³mMt„ëòåËâ̹ñe*d'2r6>_»Fì×­Sª  qU*õîÓmÚDˆê~ûíW4jXuëÖÃØqMšðõÖ-˜4i¼!ú\ù£iNÇÌ""ÚÊ\ºtI+kÖ¼%4=SžRßX¸S"ÄgLÀ]X¸ÝEÚ¨{„›®9¥ëN§MŸ…jÕ^EO7ÿÂ…_Тy“ËRèªR:zež²eûŸ˜ñ–)S}\ $œ6N´¬LÝûöÂoK¢#\´ŒýÎ;ï`ËÖo¥‡ Ûºe3èüxªT©Q´hQ´iÛÎ䂘ýû÷aèè?`8Ãmœ”•M_n1œß¦¿Ó=˜?pìÚµ£G°ä–RßX¸S"ÄgLÀ]X¸ÝEÚAáö@3¹J#,Ü<˜ð,Üð„=3n4“«dáæ1À˜€`áö€SX¸=ÝÁ*yÆí @.Θ€Ó°p; ¥õ†X¸­gå-9Y¸½ÅÜ&ÀX¸=0X¸=ÝÁ*Y¸ÈÅ™pn§¡´Þ ·õ¬¼%' ··x‚ÛÁ˜ ·Æ · ;X% ·ƒ¹8`N#ÀÂí4”Öbá¶ž•·ädáöOp;˜`áöÀ`áöt«dáv gLÀiX¸†ÒzCæÂ^á%KYo€sº@̙Ӡ·)I†H×^5DÎ+ÉÈ›dÃ$<€^Ú£[ãöÆs…L€ øn¸Ó\¸=ЮÒA2{¾<:ý³|Zíy#Áw°!\œ 0€#`ÏoOÀArv‡CC‹…©‚bm—í¹€ ’Ò­Óë«hµ?™¾<Ü}Íæš˜ð,Ür¢:,X+IÒ«w]z¨\­íè)¶¼ËÛ¨†‡1š¸l¶×È%˜`¯°p{p4Ð̬ø!— ¨$U Hr¨,K¡’$e²·Ùz½® ]²·| •“eäRIÒ|I%å|Õoo½›u›´3Añ¿¯#ûk¹L>;ºv~¹Êð™ Dj4q}‰!÷• 0ç`áv>S§ZT«CÆJÀ[Œæ+T o¾›šãñôß'ÆÂ1N£‰k‹­@ÏšM%é¢ÍWGÔe« IDâ×¥óš:´3üõ§á#^¦ÕžÕ:Sî?`Ž`ávŒŸËK‡«C(*É”.}!Òùß/Žü…Šá½÷ƒEÞo6­Äñ;_‰¶Œë𨏤£ž]Þß­Àñ¾ùëÌŸ8Àˆ¿ü£&6>Ôw)pË™ð,ÜÞâ‰$Ú¼ ’ÔÀøÏEK| „šfÖoçΟ¨¤¹hPŠrÜÑáaÁQ¤¶Æ–è¡©ó€ HŸ!£I_­ŽD̯bÐdYÖèeŒ×jã·;Þ¶À˜@ `áörᅩ@'Ȫ4µZ½¦¨Q¯Y’-ß¿ßxuâˆ÷VçdkÄûßž`Ú°.¦Û2 I€,ã$9J¯ÉÇœç¶Ä‰ ·x[­é+sŒ›Úkä,‹³í};6âÀŽMÆYêôª¼Z­ötÕ'š˜’xŸ9ö=6¯™ÿª/òKÕ6ï,GC–¢tPmgÿø„빑LÀ+°p{…Rn„ù’9E1÷5Ûd‰ö¯»·1}xWScz¹QŒ6~[Ê5p[Xz˜"Ÿ´ê6DD’_½pÖ`N–å'’$™®¥Uör¾M¯×Grðš-^à¼L 0 °pûˆß‹)’'}ºT$IJ£4Ù<²yéÌ‘&‚YÞßÐGºèsÍT‡GH*iµqÃÓ¥Ïh¾D.‚ÃCƒBB„y¼BâI8®I2æê ZópŸÜ`&à,ÜnÁìX%bŸ[ Z-C¦3Ü&ÆZw‚ba¥a~fÀCþY(ï£:Æ>¥Ò–ÄÛ¸Œ ˜Á -œW¥JÓ2úJò$o_Þ¦Ó#ŠÚRòÿ n/÷wxhH¨0Wi¦ùv)Íð: å³F›ŸÙî§ÑÄÊyy7}ºy/Å›X•%w7¹¸³^’hn©niIÞÆm>=L¸ñLÀiX¸†Ò¹†èìp¤û’T9ñ¹þ®$©^KªFY–ibã•sn Ùš1KÑÿÖnUˆsâÐÑRz߯Áå€6xL à °p{á ýPY’VK̯C}½¡ƒþZ*È䈘q7ø†.Ï8Õ\¼í9;O6Tª  ˆ°4ƒ7Zy¡ceÐæWs­LÀ£X¸=Šß´r1óRéÆHÝgM³h½ÔP X²ÕLÖÌ÷T½¨{Ñ”—{Øz½>ÚÑ·€‰%x S hƒ -dб2h ˆQÆ t,Ü^2”4HHt-¦ Xܯ6?"&Ë|­¦—¸Ó©ÍP ƒ„<Ù€6t¹ ¶q@›S]ÀƘ€W`áöw˜ ½Z•ÔËúˆ¤Îö&Ü¡­×*?æ¼DîÎtql hC”^ÿl Ÿ,p±SØ<p3n77®.Ù4 R¯WMé,oÂòº>B¯×Eóåt¦›«VüYް6 -F·ÆÍÍäê˜pn@µÆdJh|Û™59HØfQõ…$Ñe;‰Ž¤½ZÁ÷¤s@&àãX¸=à@µ:xŽ5hhWéã( nh“$©R²]Ih£Úøžt÷97?ð°p»Ùçjuðj õ1II ¹¹y\Ÿ°6 -ážtÌÕhâÆùI×¹LÀï °p»ÉÅ ûÙúƒæQ㲌ëzY×÷§Ý䈬æå=ét¬,ÉÚd™îH—ûñMî²Ï`áv“ËÂÂ&ºM–×èä ¾) ¹©‰\Ÿ°* M–£urP#“~>¸{>M€…Û î³xYŠ,¯‰‰O´dî†æpLÀ8 -ñ,\†V'«ª°xó@aÞI€…ÛÅ~WXJA¯/åýlCgóV sá*I›8˜MÞ£‰odµ!ÎȘ€Û°p»µù9¿ÄÅÀÙ¼]ÄÅ.*Õ6ããdt ›FßÎ.ƒ\ˆ 0—`ávZ:_[8o*ÍU£*øÙ.äͦ#`é g²^n§ÑÆG9f™K3&àL,ÜΤifË|o["5š¸D/qaØ4°‰ÀË™÷A¥E›kbãòÙd„33&àR,Ü.Ä« ¹*IÈ«T¡Ó?ËÇ÷F»8›v µ:d¬Œ1ˆ7Ϻ•0g`ávI vÂÕ!ò«™ ¿¹Ë…¨Ù´ ˆ;TúkÊ~7Ϻ—M1'`ávDK&-9ò2¹‹H³YWP«CæJ@žu»‚.ÛdŽ`ávŒ_’¥-÷8&n¬‹ªc³LÀ©Ì+e€Ç¯S ³1&`?nûÙ%[’^ö ©¤Õk\Š ¸Ÿ€:,X«¼ë›÷¹ÝÏŸkdI`ávÑØ`ávX6ë6ê°àhãÕb4qü{á6ú\Hš]4:X¸]–ͺ€y€šN¯ ã·Ø¹ ?WÄ’$ÀÂí¢ÁÁÂí"°lÖmx » 5WÄl"ÀÂm.ë3óžõ¬8§wà1ì~áV1nþÑsX6ë6<†Ý†š+b6`á¶ —õ™ù2÷-> IDATGÏzVœÓ; ðöN¿p«˜ ·‹Æÿè¹,›uÃnCÍ1›°pÛ„ËúÌü£g=+Îéx {§_¸UL€…ÛEc€ô\–ͺa·¡æŠ˜€MX¸mÂe}fþѳžçôN<†½Ó/Ü*&ÀÂí¢1À?z.ËfÝF€Ç°ÛPsELÀ&,Ü6á²>3ÿèYÏŠsz'ÃÞén`ávÑà=e³n#ÀcØm¨¹"&`n›pYŸ™ô¬gÅ9½“aïô ·Š ø´p‡†7P©¤P/uc ¨¤´M†È×¼­­’×tPm×jµ¼­mÖ¶ÇËǵÝðÆ|>1†½œµmÒëe­V¿ÝÚüœ Ÿnµ:¤¯Ìa7:€,o‰oèKn7ÁãÀíȹB'~MÜ\'›es~LÀw…Ûì]Á~ì#·tÍWßµlþÎh·ÀâJ˜€ Ȳ|H_Ù‰&Ù”Ÿ`áös[Û=nkIq>&à\,ÜÎåÖüF¸; ˜þrZwl\‰?n¾Úr÷á^²t…Ó±!&à*]»t4˜fáveÿµë7Â=uÙ×þë%ôl錸zñœÁ²¿÷™˜]@‹M2ç(^‚…Û¹HÊ w@¹ûUgY¸ÔñÜm¯ ÀÂínðÙF°pû¬ëk8 ·cü¸4p„ ·#ô¸, w€Žîuë:ÇÎÂí?.Í!ÀÂí=.Ë c€…;@ÏÝö ,Ü^áŸm ·ÏºÎ±†³p;ÆK3G°p;B˲pè`áPÇs·½‚ ·W¸ÁgÁÂí³®s¬á,ÜŽñãÒLÀ,ÜŽÐã²,ÜV޽^±}Z"ço£×ˆ™V–rO6Y–EÛräz½G̲ªRn«0%ÊôùÚ5ˆŒœ9sç¡BÃËßì3–B©¾}zâèÑ#8}™3gvIÎ0ª0™9s*W©ê “~oƒ…Ûï]ìÒ¼pGŽï‡ßo\ÃØÈõH—>C’°ÿ~p_­™‚…CP±V‹´t/^ààw[ðA…êÈ’-‡K•œñ»wnaæÈ(U®:>mÛêv°p3gNÇÆ/Ö›ðR©Txýõב/ß{hּʕ+oò÷‘#‡a÷w»ðí®½È•+—U¬íÍôñG5:uj|³cW²&”~(P7m±˜÷ï¿ÿFÕ*аá'9jŒ½M²XnÔ¨áøn×·¢o½õ¶Ý¶þù¶}½11gpçÎm<þ¯½–¥J}€-[ƒúgKÚñÍvŒ7ݺ÷D‡DQ…ƒ%;iÒ¤Á»ïæFÍZ¡eËÖH—.I6Köliq^n{Éq9"ÐÂýâÅsŒéÕÙräÄ ‰‹lq1DZaé Œžó92dÌdsygPÚQ¿YG”­ZÇ*³,Ü@§Ží«Aó-‘&uÁíÅ‹¸qã7;vTü÷ĉSðÑǵ L›4þýuû²Š³½™<¸êÕ*‹,Íd“KJ?(Ï’%ËQ²Ô‰²Ÿ>} ݺvÂ!ÃѸIS{›e±\³¦Ÿâ?n#úÐQ»ìþû￘6m2vîøFˆeXX8Þ}÷]¨‚‚pùÒEœ9sAAA>bê×·þí³3gLÃÆ07rÊ—¯ Úvæô)tíÚ EŠÅ|hÒÞû÷ïƒ8ýþû-ÆŠQH•*•!%{vu ·½ä¸\À ÷Íë—1Ò@‡—EË.ƒlËgÆÝÛ·0lšg_l±çëõ8øÝft4 y µª.Ü´½P¹R9¤NûD'b}ð{ Øï¿_ë7lÿï¿ÿP±B¨ÕáX¼d¹UœíÍtòä ôèÞ]»vGÇN]’4£ô£X±âÐhb„@Íœ•øÕÎë>_ƒ¹sgcÕêµ yuO¶½íSÊ={öL0!›Ë–¯²Ù•§~ÒÔgŸ5³ã¬Y³šØ¡™xï^=ð÷ß±fÍz.RĪz:vlm¬»÷ì3wJëÖ­ÅÜ9³’|€¡‡µž=» 3f<êÕo`¨Ë’=«b! ·½ä¸\À ÷©£û°uí"ÔjØUj–ìˆX9—Îi1nþ\½p«ç™¾¬DÉòhÞy€°ñë•_pp×\»ü3ž=}Šÿ½ö:Ї—E•?EÚ´¯–ßöïØ„ý;6¢Ç°é8öýNœ‹=‰ Z Búbþ‡èïóÃAÜýã& ©ðúo£lÕÚ/kº5"ÎÇǤ¸ÜoÜÁ@nšU7lP¥K—Á‚…Kùþ¯¿þBÍU'OlÙúøû¹sgѦu ´jÕ}û%øšÒ¡CÑbÉæéÓ§xóÍ·P³f-´kßéÒ¥7äëÜ©=.^¼€­_ƒóçáÈ‘CøçŸðÞ{0pЇò*ûƳçÌCÅŠ {ég1eÊD|½u Zµn‹>}úáæÍ¢$xW¯\ÆÞ½{°mûÎDKÖ´Ä¿g÷w8|ä¤OŸÐ&šÕ¯\¹GÆü.f»Å‹£cÇÎ S›0yüø1–,Y„ï챡%ñví: Ðûï£e‹¦hÖ¬…胒héüË/7ââÅ‹däÏÿ>ùô3±ToœHDIL©?}ûöOò;¸oï 6X¬~Ð*%ZRïÒ¹ *¸¯‰Z…°05fÍŽ„ò@“6mZìÝwÐ`WYÖŠZ'fÕ–ÍüÇŽ%–Ëûõ(²$e/ÙdþÈÂm/9.Gz©|ÛËpâàwˆè5…ƒÃ“F }úŒ0a!þº{gŽïw~‰Ð+"X]¯åz ¹ÞÊ zøúóÅÈW°Š«K#mºô¸vé‘eóW_bêÔI¨[¯>þøýwñPðÖÛo‹Ùÿo¿ýŠF ë¡L™r˜¿àÕ6musz€1ßÃVê]³f5æÏ›‹î=z¡}û„×o&eÏê/œYFn{Éq¹€îÅÓ†âúå_0|ú*dÉö¿$GÄ£‡0iP;„”*‡žÀìûß~µ­ºFqu™„Ãë—±pÊT¬Ù}ÒÚÄÞÖÏãÔ‘½è:x2òHXê›;®nÿ~å«ÕCÆ ?Ä”þýç 6­œƒ ™³ IDoÃçÏþûãú¶Â;yßC·!SÅçO?Ä„þ(V­º ¶zTºp/\8«W­@ÿƒP¡BEÁM§Ó‹ýkÚS¥¥e³Ùs"‘í娠}د¾Ü$À”@©éÓ¦àüùŸÅ¬=C†WÁ$Šqq?âÈÑ Yßýû¡Fõ*¢ž…‹–âÃK|5bøPìÙó¾Úü5òåË/>7ÞK§ÙäÁðÃÇ1jÔX“å[¥Û¶‹wÞyG÷µk×°{Ï>ÃlÿéÓQ¡|Ô¬ù&MN7Ô¾øø8,_±ÚdéœV Z·jŽÒeÊbÁ‚„ÁË—ŠÙvŸ>ýѺM[C»é!bø°„YöºõQ¸p±ò0{öLÐJ²¯œÀV‡æÍãÖ­[8}Dˆ4ñ§ö÷ìÙí:¤8vëÖ©…»wïâÄÉ‘wÆô©Ø´é 1Ë&¦ô@¤¤ýûöbèÐAÂ.Ù§DiY?þüIñݺuíÛµõlܸ e-ÙK±ÁÉd`áv„— Ø·r¼+MÚ´93*Ù‘pᬫ"'˜,©¹j4'bФ%b†L)jÁdܼv½FÒq1•‰ÍOBß´}_„•®„çÏŸalï–bF>dÊRñï¤ ¶,ëñâùsLÔïæ-ˆîC~€/žû+çŽEÍQ­N«Gt  wï^Ýqüø1‹¼h)¹k·hÞ¼%(Ê\IÚ·Ëá4[3ZRþN³Bú‡íÛ’0ÿá´”'~@Ï]Å uÚtÓ#{Êìzó–mÈ›7Ÿa/=<¼¤Ø¯¦ca?ý)Sg R¥Ê&m¦~üø£Ñ‡Ž‰•œÝ»¿ÃÈC1tØ1;¦Díhѽz÷EÛ¶íÄ^8-ÛÓLuìXÓ-ÊO¸IÇÐè{Rûãšb¼îÞsÀdVLËü$„Ä‚˜P¢¼%J”À°á£±1} Ø]ßí‘û,GÁ`_lü  JqìV«ZQ<\)ApÊž³¥}û æ!jõJL™25jÖ¶‰!=Øcå3¥R £U„£G‹ Dó‡KöRl0 ·#ˆ¸l2V¸ÿüãfî!–¢Û÷Iü#cÌ,z÷VìÞú¹É’úÜñ}ñàÞŸb_™ÒOÿŸ¾­¡×ë’p=G pHI1;§À¸’e«á³ˆž&ež<úGömÇÏq§q÷öïÐé^˜ü]]º š´O˜EÞ³ »¶¬AÛžÃQ$¤”Õƒ=Ð…û£ZÕÄþòè1ã Ìd½^Ì´öíÛ#fË´MËÒ”h ˜–jsçɃuë6ŠÏh¹eËWbY˜örifkœÞxã ìüvøhíÚ(Ì‹œ#f¼µj}l’öÍ/\øEÌÎi&ªì¥Ó2ýåK—„à,]¶RÅ™'êa¢™3%ºu>ç¾iOIYR¦UZžŸ=k6lX‡Èy w£ü ÔŽ;‰ó?ÿŒV­šá£>ÆÄI ‹JR„[9†FBô ‘R"‘§Õ jçíÛà‡g,>Û¹sçj\CÌêivOþ¨R¹¼dÛþMâãrʃÅäÎG˜Úºu3&OJü ¢ÔCûöeË–Kîæp–ì¥ÔÏäþÎ3nGèqÙ€nš±|6*ü)>jÔ*Ù‘@ù(ÿð+‘%kv1¡cd¹ß{]&ìa^»ô3–L.„8¸dÙ$íÑ29Í®OÝ-k&Ú¯~üèL„‡þB™J¡PqµaÉó'Í =°u›´GùêõDÊ^øÐ©Ë‘-ûkVè@î{÷î¡Vͪ Ê•‰W[h–ÙµKG13ÝðÅ—(Tè}Ãgƒ0jôX!}z÷³öò*¢nzxíµþ7oÝĘÑ#Å옥(Ñ,˜fÃ;¿Ý7ÞxÓà'šµ’¸ÐÌ“’²—N3Yú;Õ5}Æ,T­ZÝÄ¿J?ÌÃV¬X†%‹Šå{jÚ—'›=OËþÊñ1:Ò–-[6›T_…ò¥Å¾3¹ÑƒÉ”ÉÅ–B‹¦ßÚ+¦½sÚï§}ÿU«V`ÑÂù0`0òäÍkq,Òƒ ˦D>ÂR¢ zàP‚ØnÜ  ¼:‰â;ä_šE:|ÜSBý þ¬X±Ú$øîÊ•ËbkÂØ_æí±d/¥6³p;BˆË&G `…û»-kqhÏ×hÑiBJ™^²alÖè^øçÉ#Œš•ð#ó×+˜?qÊV«‹úMöæÎýxkNF½fP®jBàRriû†åø!zzœ…·s'ìkRúvóÙ» õšv@¹j¦v¶|¾§ìC§ðÞûÅEþ9c{ãñß1jöš”ª4ù{ ·23lÒ¤f‘›"BJЕFÌÌEKª}ûö²xÎZ lëÜ¥:wî*ì7þ¬îÝ»‹ï1©ïêÕ+âoÆËÖÊ^:Y >RìG“núr‹ÉÒ½Ò¥ŠaÚO§%ëK—ÁܹóE$üÝ»Š%jJ$Rׯ_ÃÉSšD}7Ÿa+{è´d_¹r½’¶oÿÆöi?göL°f¼7œÜ lѼ‰Xi8ðýáDGÀŒËуE®SDþ—_mê´äNûþ–(hµ€ ÌÌh™œV/h[‚mƒÐ*Ëöo¾M‘Ÿ”=›¾pf™yÆí=.°Â½rî8\<§Qâ9s½•äH ýå1}Z ÀûÁèÐo¬Èsü{|5#zŽf]8‹U‘ã-ÎàŸþûÏžý'fëJ¢ÙùoW/Šãe©R%DS¢³á—ÏÇ‹}ïÿåxÝð9µcÚð.xòè!ÆF®CºôñüÙ3ŒéÝù E§þ¯–|­Ö,ÜJPÍœim)M2 ›7iXN¦™$‰¹2[Sfµ´GL¢kœHÐIØi¶M³8ŠÊ¦Y,-u/Yjzæ_Ù“8p0š5o)̈üòËy!04ë¦À0 £uŠTW’Ò:gNçÍgúvçqô¬y³&b–K×´R¢à+)Z 7¬¦å|ZÖ§}xÚW–Õ-]ñJûä´*±hñ2q™‰²LAmÜfœ(è+{ö&õ)šPÔ>m $•”‡(:SMg«)-^´@e#ž¹nœèòZ ¡,zТ¤¬lPvìü.QUÊ0 ¾£ýí”ìYóK. ·£»|À ÷„þmEÀ͸y Ki–†‰ëÂ)ƒQ±VÔþ4!ò{׿58¼w›É…'Ý=yPGdý_ô?ß Æ´Ì¹iu$~֞ I‹)s6±ôIw‹g-úŒ6½+jÁ$œ;ƒ¾cæâ·öæ(ÿö/–áÔá}È’-;†N]&>¿qíL„ 5˜D¥[3¤Y¸éÍ i¯ÚÒe?üp ú÷G·h–1cF F÷†ÓÒ+ý¿r¡ ÍØiæ®$ЧerÚkV®={ö'´mÓRÜÐFËÈÆIJÚ£¦èhe/f•QkÖ‰¬td«^Ý‘9s!ÄJ`õ#:ú aoÜØ.Eº·jÙLˆ/ÍNéºÌ…-£Óƒ‡ù#NeÞzë-±lO·•Q”8]©j¼z@6”ë?é¿•%w:Ï> “³Öô÷G‰‡Ú×VúDŸÓ«¦Mènƒ´"ðŽ–õõ{Åòeâœ7ímÓ>?±§¤<YºÇÝ|µ„ò§´NçÕª•J+Æ4–ìYócáv”—OŠ@@ ÷Ãû÷0eHGdȘ¡¥-¿(â­wò¢d¹j8ux/¶®[lˆ'Ê2;ƒ½›¿*Õj$~ävm‰Âá=ÛñVžü/]’J…¸3Çpíâ9|üi‘’r·xx™ÊhÜÎô ±²÷žç½Â¨^¯™x¸øáà.¼·Î݇Ï_ U·!È¿ ´'`ëç‹Ð¤}¨K›F§4äY¸éŠ 6¾ê”“.¡™. -]œBûʬD‰î O›6 èØ%šAÒþn–,Y0pÐPdËš¾ß+—/#K–¬8xð€8ÿMûßG¤IãE·ùìœ"Í)â\Y¾UÎ 7úäSŒ1ÚàFE<Œ¯,¥~P¼²7nîs%êš>7~È“'ODÛ=ú[ì[çÍ—OÓÚøÅqzaé²U†ãnöI£zâ‚î Ï‘=;âããñë¯×CR%fµtÞû§øx±_ºLq7ø–Í_‰ãp G‘òÆ‰Ž”ÑƒEãÓÒ6¿¢èø[7oŠÙ<íSW¯^#FŽ1yÑ ùƒ¾s3`žh VŒW"(€._1~€1/§lQ˜¯X²—Ò÷+¥¿óŒ;%Bü÷ä¤pS´öš““$²$¶Ê%-Æ3`Þ5 ¦àþ½ÛxóÝ|è1tš°E?nÇ~+Äž¢ÁUA©Ä™ëе¡ˆÑ/ÊÝâÆAfÆ¡[Ô¢¿ÛŠÿyŒ9ß{æT¬‰½ÛÖãèþâ€fïûw~).é3:o¾“Û¦‘¨ÂM¢EÑá–ÍéñR‹­Ä h””{ÃIŒHÌ•Dç½§M,fŽ9räÑâ]ºvB“'£YwªTA"/‰$õÃü’cÛÊ>0}fþzð ÛÛNžüA<°Ðå-ôB•;‹£ZƉ”V.]º(hhß­{q—ºù'Ôç%KâûûEd:í%ðaiqÝg)ÑLýúµ8}ê$èA!áE/¹ÄÖBý ]Ѫø#©`2 Zûã?LV"”Ú”-Kí ývÚw§‡Ú§W’%{6}Ù,dfáv”``—Hál—'ô>P…›}ϼ ·7xÁwÛÀÂí»¾s¨å,ÜáãÂLÀ!,Üá øÂ,Ü:X¸ÔñÜm¯ ÀÂínðÙF°pû¬ëk8 ·cü¸4p„ ·#ô¸, w€Žîuë:ÇÎÂí?.Í!ÀÂí=.Ë c€…;@ÏÝö ,Ü^áŸm ·ÏºÎ±†³p;ÆK3G°p;B˲pè`áPÇs·½‚ ·W¸ÁgÁÂí³®s¬á,ÜŽñãÒLÀ,ÜŽÐã²~#Üù coÚ@àÖo×@o-SRŒ&Î'Ç‚:,8Z’$Ã…óæwaÛ€„³2·ˆ‰yõrY–ibãm{Ù€ÛZÊy#Ÿü±&æ?ØÞ×—Úä/ÂíK̹­L€°pó8°•€Ï wxXp$©­­æü‰ È2®kbãòú"¾è5n³ Y^ŸðÎ`NLÀ >+Ü¡¡ÅBU’*J’¤Vô“³$A€D² )Ö=(UÐBãüô*ÞÎ& }†ŒÉš¹ùëÌŸ8ÀÇ—W¦¬åÅù|ƒ ·oø‰[Él"`Í‚N¯¯¢Õþm“aÌL0’JZm«xµ:1?¼Â#ý4š¸¹>ˆ€›ìgX¸ýÌ¡ÜÀ&Z8o”ækH5&‘.}¤KŸþúÓð±N¯úŸV«}Ä,‰7ñè4`<ÞÎ?‚ÿy‚iú˜œ¼$^0&|¹,ܾì=n;0"ÜP–¤ÕæKão¾“­»Ų™£Œ…ûaŒ&Î⺿BµE¼Ïû›×Ì…BÖÿª“Ñ6V(üÕÿþÔ/nò&÷%` ¨Õ!c%`Œ9€ð2•Ѹ]ññÐÎ Ô#HÖŠ÷Ô¡MV'dY†$Ie\“dÌÕAµ&PV+öKåÅgáöbçpÓ˜@JBCC³Iº¯!I&xÐÒxÝ&P²\Uaâò/ñX>kô+á"5š¸¾)Ù÷Ç¿§$Þ‰X½ms2ä(½^^óp%ÞÝ'nïö·Ž $I á(\Ð×’“3øÙ²çKãÆ{·gcOàóÅÓŒ…{œF76Pñ» UEžeU({ÞÇì0 Jƒ,ÿ IJŸ$+Z$Ì·ó,÷Õ»é]á«äÄ[§·ü€CO6Ì£ôúç‘ü ä ï¦MîÀô;÷ÚÇ ¨Õ!}%`Ž¥n¨ËVA½&L–ËÍ"ÊÔÄÆ›œóöq7ß’x[yZ¼r$Ñ-uÉ¿;A–£!KQ< wØ]o€…;à‡ðU/ïiŸküZS¥/hU½^3”¯^ݽéû¾ê¦,o‰§¥^NF‰·^n£ßf-$1 Wé# Ó^8ò$UŽŽ”AB”^ÿl Ï­¥ËùŒ °póx`>Nàe ]ÅiˆVºô¿¯#¼lUìß±ÑÐKèˆòäÜm_½üÀ‘{Ü_ÎÂi/¼AòÃKÞ¦Ó#J«ßîãÛïF,Ün„ÍU1W ->L¥RM¶æ /qg[íÒ´*Uš…GX7 WEò‘2[)^~k¾çG…{Ì|ˆ€˜%Jú«tÕ)ÝðE‰nùJ*ñQ0Ï8—®¤…Ú OvλxÆ?¾T+ ·/y‹ÛÊ,0Uѵœ²$͵4ËãˆrÏ£—³p .ŒHîH_¯êY?ysí,ÜÞìnH€ØKU©gÓéuatÈËýZºÚTì[)ÍàÝC áé´Œ.UJªF¾ØÅ=¾ð¥ZX¸}É[ÜV&`F <,ø ñ=å²…;È^õ™š®7ͦ“õcùV/ïFñÅ.Þç/l ·:…›Ä¬!`áÚSq='7YCÏ;óX{± d9Z'Ëãø'ÞéGW·Š…ÛÕ„À#IDATÙ>puX¤^0ÂÑâ.í!³Ö\¯šÈÔÖ<ä$UËÂí!ð\-p„€ùÞ6ï];Bӻ˦t± íëe]Þñn?:³u,ÜΤɶ˜€›„‡o3>Vijm7÷p5t¤ÌÒiñVåã™·‡ä¦êY¸Ýš«aÎ" ™Ti®Ù{£‰Ëæ,ûlÇû ¨Õ!cO ˆËÐêdUoï÷Ÿ£-dáv” —gn&h™ÜB$¹››ÄÕy€ÀË‹w´&gõehcbãÂ<ЮÒX¸Ý›«bÎ ðr¶5F±Å7¡9ƒªoÚ°øV3½ÜΑ{Ö}“D`µš…;°üͽõjuÈ\ èóJ¸.\ñƒ®qì `.Þtãš&6.Ÿ¦¸ˆ`áöGq3™€B@m|Ó_aÊcÃ|†ƒý{L°pû·¹w~H€…Ûê`—h¿;H¥¿¯˜áY·ƒ@½¼8 ·—;ˆ›ÇÌ °pó˜°DÀüe3ûà¿ã„…Û}Ë=óS,Ü~êX»eá´A?&n®ƒf¹¸`áöB§p“˜@rX¸y|X"ð2H-Ö°\ŒÓhâèå2œüŒ ·Ÿ9”»ãÿX¸ýßÇöö0\"„[–ibã+Ûk‹Ëy/nïõ ·Œ X$ÀÂÍ#)áêÊ»×é&5¾ŒÅ?Ç ·ú•{åÇX¸ýعvdžƒ}¤8 ·8Š›ÉüãÌc!)<6cl°p†Ÿ¹—~D€œýÈ™Nî 'õRs,Ü^ênàY[ °pÛJÌ7ó³pû¦ß¸ÕL€œØù)tÇF`Œ îÀð3÷Òð³9ÓÉ]á±ád ^jŽ…ÛKÃÍb¼TÎcÀV,ܶóÍü,ܾé7nuàçv>/•³ó°pó0`>F€…ÛÇæÆæòØp#lVÅÂíAø\5°‡ÿ8ÛC-0ÊðØ ?³p†Ÿ¹—~D€œýÈ™Nî 'õRs,Ü^ênHŠÿ8óØà±Øc€…;°ýϽ÷A,Ü>è475™Ç†›@{¸n;€«·Ÿ½X¥Rõ‘däµßŠ/–”B!!›¡å²틽p¤Í²­^4N«ÕÒÛ°|.¹nìº~lø:{Ÿ,ÌÂí^ Ð>„‡…ÄBBh€v?à»-‘M\__áëc×—Ùûâx1o3 ·?x1@û®‘´ëÜm²,ÒÄÆWöE¾>v}™½/Žnð÷Aðõ?v£c|Y<|}ìú2{ÇFw”æ·wø[aã¿|‹¢Ë IvXá"¾D`hçF†æú²xøâØõö¾4Þ“j+ ·?x1@ûà‹?~ê*§uÛ_ÄÃÇ®¿°wÚ`ô !nÂçª#à‹?~Žõ˜Kû‹xøâØõöþð-báö/h|ñÇ/@]å´nû‹xøâØõöNŒ4ÄÂíAø\µc|ñÇϱsi_»þÂÞ¾E,ÜþàÅíƒ/þø¨«œÖm_»þÂÞiƒÑƒ†X¸=Ÿ«vŒ€/þø9Öc.í/âá‹c×_Øû÷ˆ…Û¼ }ðÅ¿u•Óºí/âá‹c×_Ø;m0zÐ ·ásÕŽðÅ?ÇzÌ¥ýE<|qìú {ø±pûƒ´¾øã ®rZ·ýE<|qìú {§ Fbáö |®Ú1žüñ»qíL„ 5 NãÇ:’BéÃ{¶a×–5hÝ}(Š…~èÒº1®0)[­.ê7íàˆ©$Ëú‹xxrìÚëaooÿ½© ·7yƒÛbgýø=ÏOKTwÆÌY‘#çý JWþ*•ÊçÔ‘}Øúù"4ißêÒ®}ÏÅÆ•s =yC§.C¶ì9“d¤ô#((†LY†,Ùþg1ïÜñ}ñü¿ÿ0hÒb›x§”ùÔÑ}غv>kÛ %ËUM)»]÷ñ°wìþu÷6¦ïŠ…Cбÿ8Ão6­Äñ;-2͘) ò,‚J5"Ï{…Mò$eÏ’!ao×Àó²B,Ü^ænŽõìýñ3¯aï7_àû_¢XXi¼öú›âÏ2ôxôà!ÎÇŸÆ¿ÿ<Ákà“VÝ E·}± '~‡>£#ñæ;¹­o´9çŒí¿Þǘ9Ÿ'[ZéeªZ· jÖož(ÿóçÏ0¦W  û-» ²£5Iùæ‹å8~pzœ…·sçwªmŘ¿ˆ‡½c÷§ØX·x*Öj€ÚŸ¾ZéY:c®^<‡rÕë"UPjûºç¸ûÇ-\8§Ÿµê2HŒs%%e…Û%Ã×iFY¸†’ ¹›€½?~æíŒZ0çãN£ï˜¹xãí<&~xÿfŽê‰ÏÿèÙk‘!c&ñ÷ÅÓ†áæ¯—1.r‚R¥rYן?{†1½[ o¡¢èÜ|²õP?~ÿí ҥψ'bèÔåH•êÕ8¾qýL„Z [¢JíÏœÚî%3Fà·+0nþ†Dõ:«¢@î}Û7àÀ·_¡iÇþû BÂC¦,clŸ–‚ù¨Ùk,¢¾ôsVÌ#VlhåFI–ì%å+aבּèI;,Üž¤Ïu;DÀYÂ=eHGüûä1ÆD®GPPP¢6ÍÝ þqç¯ËÏÊeŽ\o¢÷ˆY†ü¿ß¸†C»·âÒù8üóø12g͆ü…‚Q«Q “%î};6âÀŽMè5b&~ùIƒ3Çàï‡!k¶BLK–«f°iØK¯^uš´3|sü{l^»ù EëîÃ.}P?ræz!%ËaëºÅhÒ®7Ôeª˜ôGYâo×{Þ/®6üí¬ö$~ø~—vzXÈ–ý5—,‡ªµ#MÚ´†|Ô÷ãß‹“‡÷âÞßŃLhéÊø¨QKLèßÙräDßÑs ùéÁçÀ·›p>Nƒ'"C¦,(X¤ª×oŠì¯å²Ùÿþ"öŽÝ¨“p>î úŸ×ßxGð»÷çï˜1¢; S£}ŸQI26¬ îß»ƒ±‘ëÅx¡dÉ ·ÍÃÒíX¸ÝŽœ+t{üŒë§™é„þx7!ôšxŸ›~èfŽì!iÐÄE¢èÝ;·Äg¥ÊUǧm{ˆÏnþz´\I³ž+ÖB¶¯á¯?o ‘£²½GÎFê4iDÞ Ëg"îô1,*½Tùêxöì?lß° woßKÍo½›Oäµ´—~ìÀNìØ´ÅÃÊ iǾH:˜aS?ÊU­ƒZZcÊÐŽBéáÀ8m[¿'íÆˆ«Åƒ¥ÝÛÖ#z×fä-XTìç§I“?ÇÇ þ̱Db°mÃRœˆÞÂ!%Q4¤ž={†cßïDþ‚EóC4Ô¥« IûÞÂ.=¬œ3VˆuxÙªâaàÏßoâ‡è]H•:5úŒškhƒµc"Ð…{òàŽbëfܼõ†˜‹¸˜ãذt*×þ 5li¥^¯³r½^‡qó¾0< Z²ÇÂmíhô\>nϱçš$à ᦽ¿UsÇ¡DÉò¨ÑðÕž0͘oýv‡÷| îZvŒÜù ‰+?”õ›uDÙªu {êÈ^4hÞïæ+hèÙÞmëñý®Íhßw  ŸÏÓw~ÿ Uk†šF?´'ïÁ×ë– a‹.(]ù#‘×|/}ÿŽMØ¿c£ØsoØ¢«áÇ[éǧmzˆﶬš=_£ëàÉÈ[ ˆ¡= §Áƒ{bÄŒUⳋç~ÄʹcQ$¤”ˆZ7ÀSfc݇NEîüï‹=Tz8!ÑŽè9Â`óÁ_bÆÈîнx:Û¡Búøïé¿ ½ù쯿‰ˆžÃ‘&M:C~í©#ظb¶è;1°%²p?~ô´¾ Ÿ(IyðjÕu0Š«Ë$ÂI«${¶ogÁê2hÙu°È“”=n[F¤gò²p{†;×êÎîèÝ_c÷ÖµI¶†òãOÚ"}†Œ†<{¾^ƒßmF×A“Ä,Õ<‘€½Ð½ ÍGØù%ï݆ö}F£P±0± =ºwsdÊœUì5R¸’”ÙuÖ]PºR‚pï¥ïþzŽìÛnqf¥ôƒfØoçy÷ïý‰#º¡xxi´è4Pس®Þ-¯`Q´ë3Z|¶|Ö(\¹p'.FŽœ¦K×4³¦v½¦P®Z]ÃJAÏ3ðNž&Ýž7in]¿‚ŽýÇ£@á`Þ·»¾ŠŒ²çLøS ý¢©CPª| |ÚæUÀŸ5C"…ûÂÙX¬Š/Æ%­Ž_ÎÆŠÏ3fÉú £^Gàê…ŸÅVOÎ\o¡ÓÀ È’5»È“”=nkF¢gó°p{–?×îg÷ËgãÇÓGÄL1kö× ­ùçñ߸úËYÄÅâܾ÷hÃRwÔü‰8c²WHKË'£¿ÃoW/âÉã¿õjФ%Béï § Æjâ“ÖÝLòíÚ…Ã{¶£Sÿqx¯pˆÉ^zî|…ÄuÍ-PµNãDö©?i~0 [¿d:ÎjOaÈ”¥Èú¿b–O³}eIõŸ'1¡!Â=†OOdSs"_®ŠÄÇŸ¶çÕÇ÷k4iÓcøô‰ò*ÂM|3eÆÂ)CðÛÕ Éz·B͆¨óY[›F@ ·òpöI«nø bM·IƒÚãÑÃû9J’$Vz ‡”ÛÆñ IÙcá¶iHz$3 ·G°s¥Î à áž5º'îÝùCí›'%ê¶n“(_½®ø3í ¦NÚp:z÷VìÞú9Þx;7ÊV­‹×r½•”ðÕ¢åf@ÂØÈuâÿOÞ+Ç·ëp³À±•sÇáâ9-FÏù\}){é4+§½IZò,[¥6ê7ÔŠn7 »vñ(Ò[j: NgÂ[t„ð²¸|>ËgA™ÊµÑ Eb›´ÄOKýMÛ÷ÅÛy `ö˜ž(Zâ´é1,Qý“¶ƒ*(æ%ˆúˆnñÆ;yăFR)×[ï&{.ÝR¹@î/–ÍÂgŽ¢çðx'oŠǣ‡0iP;¼W8ÌN¬_6SÄ)$u<Ï’½ä¾—þÂÞ¿=ž¶ÁÂíipývpT¸ÿûï©X:~ýÍwÑol¤Åv\»ô3–LnºR‚À(0¬U·Áxòø&n/–¾û_€´i_íåþýàžùü…Š£óÀ ¾ÜÕgô¼ùN^“:'Œ@êÔiÅ ™’²—ž9kv´è‹è™øaÏ‚=n§W—cávZ6ìjŽ ÷õËçÅ2 ^Ó},67îôQlX> k6DíÏÚ~ k4hŽjuš@™ÕªËVA“ˆ„hj%ÑÞö®ÍkP¾Z=ÔmÚ^|¼xÚPܸvãPdï«ým:6yP ûmº y•½ô.ƒ&#_Á"†rx¹ªhܶ—¡¥u›´GùêõLÚ@ÇÆ¾ŠšÏÚöD|ÌqЃ¢%T% Mé›qAz ™:¤#²ç|C<ԜӞÂÚES,^ñªoS‚íè’—Q=š& ¢Rìÿ¿½ó­²Œâø¹ú‡Tîj?PVbÅŠ…usµD0ª…Hj¿ÀP ÷Ï’ iÎÂ)årƒšE’·´üe%û#&˜”Á*û ÖUÑÄäZK7aaK+·ÑÝóÔ3ß÷î^ÆÝûâë9Ï÷þ3¶»÷yžó9ç>ßçç¹¼dσ¥Ñ¼´ÌúŠ];8ãUŠÚ†‹ƒÌ¶OwÒg»vÐÂêef)Üûâ>çÀ±µªy]Uz»PyîÑDå¥Â}陣ÆÛùåVû}Û^ú¤e Í_XM÷Ïy|X«8äÖ7Ö˜Ù¦=Ymó†/yvµ9‰mšxOërA=gºèÝ×V™ýn›”;RN¦rí¤Rzî¥õ¾úxÏœ÷Îç<¶˜f?²È¼Ç¿óŒŠ—ñí©ì-ë×ÐÉãGhyC’&•Þ`þÏÚQ³¢‘ÊʾrYD›ëŸ¦øÄkh ï‚ù¹ô^¾'ê»ð—Y(™p5Õ­Mú­Û7Rû·_Ðâš:š>ã>â;ê—ûV¸ŒîSôκ•4ÐßgNÞ'*ÿ;ÕœlZAݧöµ“ÿn· ª—½H·%*‹ŽW…;wåǂ۱ùu3 +´n…}î‚§¨jî‚!ޅʃp’‘<áŽ;* ƒ@Páný`µ³Ï—ê”Û5ÐßOg{ºéÄ±Ãæ*˜WL/æ ßjî%g2J6ÕQÏ™ÓfF>åÆ2êL§û?§Då,úro«9í{ïìGy«›x¹3ßìÜv°v@Àí`QåÃDÏ7mÖárÙ6e©µ£áÍ|§ßíCvŸžÏýýûvÓžß3WÆl²–£ÛM&9ï:>‘Î׺~M›m¾òÆwÎ9qË•%qs¢ÜÀãz~<ÔNÛß~…ÆÇ'Ь¦ññ‰”þé<ð5•'î1Kèù’ÝŒ® 7§’唲¹«*<£î=û[Áluçz§æú“8ˆýc™*Â=R^ïC¸/? £ T¸íIèܪùÏB§–•ÑõÞƒæ»Éžû×Z’gäüå,LãÆ]A·L»“æ?±„2™Az?Ùhö%y {ÊÍ·šDÞƒn¶n›”…Ó”ò€Àî¥çÎäùÿíõ{õ‹íøûüy_*K¯M¼Tº®~©„äûž׶ǬpbÞ{ŸY5o(¥¦-‹÷Êw·l£“'Žš;Û|­Œ³¹±í]iZûV‹Y‚·/¾nÄ’S¿¤i0ó]7¹Ô$§™ùÀC¾Ù}1®wU¸í ˆwUÅž%˜|ýÔ‚g4˜í‡›^5· ž|f%Ýñžò|åä-ìG²SÂûn ^Bó*ÜÀ*€ñ»ZØË‹úá-†pkð¢£6HìüuUhfk‰±«…}hÁaAîá£ê`$v~Á,ÆÓZÄCbìja¯áSáÖàEGmØù9êªÐÌÖ"cW ûЂ1‚ ÜÂGÕÁHìü‚YŒ§µˆ‡ÄØÕÂ^ç­Á‹ŽÚ ±ósÔU¡™­E<$Æ®ö¡c„A¸#„ªƒØù³Ok‰±«…½†O„[ƒµAbç稫B3[‹xHŒ]-ìC Æ ‚pGU# ±ó f1žÖ"cW { Ÿ"·/:jƒÄÎÏQW…f¶ñ»Z؇ŒáŽ>ªFÀÛù+ OK$Íf¿êøáp•ĶK]Éì%ÆKn›!Ü¼è¨ Ò;?GÝšÙ’ÅCzìJfZFX„;Bø¨:»ïJ¤b±Øô`¥ài©²D::ÕJl¿ôØ•Ì^b¼`Æ­Ák°Á¨¨¸½bllLm–è& qŒ@,–ór*•ê•h¹èØÎ^b¼@¸5x 6€€8KKåꆃ€H$á–è5´@@ÀYng]ÃA@$€pKôÚ   à,·³®‡á   @¸%z mp–„ÛY×Ãp‰ ܽ†6ƒ€8KÂí¬ëa8€€€Dn‰^C›A@œ%ávÖõ0@@@"·D¯¡Í  Îø„ê½@1½IEND®B`‚apache-commons-rdf-0.5.0/src/site/resources/images/class-diagram.nomnoml0000644000175000017500000000342013175455642026210 0ustar andriusandrius// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // To render, see http://www.nomnoml.com #fill: #bbccdd; #aabbcc #title: class-diagram #.like: fill=#fff italics [GraphLike] [TripleLike] [QuadLike] [RDFTerm] [BlankNodeOrIRI] [Graph] [Dataset] [Triple] [Quad] [Graph] [Literal] [IRI] [BlankNode] [GraphLike] -> 0..* [TripleLike] [GraphLike]<:-[Graph] [GraphLike]<:-[Dataset] [Graph] -> 0..* [Triple] [Dataset] -> 0..* [Quad] [Triple] -> 3 [RDFTerm] [Quad]->4 [RDFTerm] [TripleLike]<:-[Triple] [QuadLike]<:-[Quad] [TripleLike]<:-[QuadLike] [RDFTerm]<:-[Literal] [RDFTerm]<:-[BlankNodeOrIRI] [BlankNodeOrIRI]<:-[BlankNode] [BlankNodeOrIRI]<:-[IRI] #.factory: fill=#ccbbdd italics [RDF||createGraph()|createDataset()|createTriple(..)|createQuad(..)|..] // [RDF]<:-[Simple] // [RDF]<:-[JenaRDF] // [RDF]<:-[RDF4J] // [RDF]<:-[JsonLdRDF] apache-commons-rdf-0.5.0/src/site/resources/images/commonsrdf-logo.xcf0000644000175000017500000010721513175455642025716 0ustar andriusandriusgimp xcf filedBŽ=qBŽ=qgimp-image-grid(style solid) (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) (xspacing 10.000000) (yspacing 10.000000) (spacing-unit inches) (xoffset 0.000000) (yoffset 0.000000) (offset-unit inches) Û) TMÿ     |A=gimp-text-layer!(markup "TM") (font "Sans") (font-size 18.000000) (font-size-unit pixels) (antialias yes) (language "en-us") (base-direction ltr) (color (color-rgb 0.000000 0.000000 0.000000)) (justify left) (box-mode dynamic) (box-unit pixels) (hinting yes)  “ £šššÿüÿVýsÿþÿøÿÄÐÿþÿøÿ’O`†ÿþÿøÿ#ÉÐÿþÿøÿ¯•©ÿþÿøÿ=ÿ;ÿþÿþÿþÿx&Apache Commons RDF ÿ     <Ngimp-text-layer2(markup "Apache Commons RDF ") (font "Sans") (font-size 18.000000) (font-size-unit pixels) (antialias yes) (language "en-us") (base-direction ltr) (color (color-rgb 0.000000 0.000000 0.000000)) (justify left) (box-mode dynamic) (box-unit pixels) (hinting yes) 1x&Q·ÃÏx&u â wX  € € €Èþqÿÿþt9þÒÿÿþÕ8þ4ÿÿþ67ø•ÿÿýÿÿ—6öîÿÿ}ÿÿï5öXÿÿÛÜÿÿZÿ÷J¬àøëÀgô"fÉèøùç¿| ö¹ÿÿ{|ÿÿ»ÿý¦ÿÿýÐ ÿýõ\ ôýÿýýÿýÿþ›ÿÿýÝ ÿþW û|ÿÿ¸û¹ÿÿ}ÿù¤9 9¥ÿÿþ£ñØ‹R+ &hÜÿÿï ûÜÿÿVúWÿÿÝÿþtúyÿÿþ$ ú Çÿÿiú?ÿÿíúîÿÿ@ÿþÂúÅÿÿƒ û8ÿÿ­û ÿÿ“û”ÿÿ¡ÿþZû[ÿÿ¾ ûÿÿÝú ôÿÿ2ú3ÿÿõ ÿþ û!ÿÿåùOžÎíùÿÿþñûcÿÿÐûÑÿÿdÿþûÿÿ÷ý,Ôÿ ÿþþþÄÿ ÿþÅÿþûÿÿ÷ýíÿ ÿþ&ÿ ÿþ&ÿþ û!ÿÿåó•ÿÿöF ÿÿþ‡ÿ ÿþ‡ÿþZû[ÿÿ¾ûßÿÿOþÿÿúåÿÿOúKÿÿåÿþÁúÄÿÿƒûùÿÿ þwÿÿúJÿÿèúæÿÿJÿþtúxÿÿþ%ûîÿÿLý;ôÿÿû«ÿÿŒ û‰ÿÿ«ÿù¤8 8¥ÿÿþ¥ô´ÿÿñs" 7‘úÿÿúùÿÿ+ ú(ÿÿùÿþ›ÿÿýßý@þÿÿþ•ÿÿûnÿÿÉ ûÆÿÿmÿý¨ÿÿýÒýnüÿÿý™ÿÿûÏÿÿh ûeÿÿÏÿ÷N®áøìÁhõ1ŸÞøòÙœ=ÿÿÿ<ÿ<ÿ<ÿ<ÿ<ÿ<ÿc € € €“ÿ<ÿ<ÿ<ÿ<ÿ<ÿ-õy¼ä÷øä½€-ÿ÷:ŸÝ÷ðÌ}ö%‡ËêúéÀt ü|öÿÿÿüþÿÿýâ'üŒûÿÿýé> ý¨ÿ ÿÿþ‘ÿÿýÔý°ÿÿýù8 þzÿÿöÚh& B€Óÿøû3 4¯ÿÿþ[ð{ÿÿü›=aàÿÿÞùõÿÿ« ÿýúFû¶ÿÿ­úõÿúFúØÿÿ]úvÿÿÙ ÿþŒûBÿÿÞûrÿÿ‹ûOÿÿªû¹ÿÿh ÿþ/ûÿÿóû´ÿÿ2ûÿÿßûãÿÿ% ÿþþÿÿüâÿÿüüýþÿþôûöÿÿ ÿÿþõÿ ÿ û÷ÿÿ ÿÿþùÿ ÿ ûäÿÿ% ÿÿûæÿÿû¸ÿÿh ÿÿû¿ÿÿJútÿÿÙ ÿÿû|ÿÿ¸ùõÿÿª ÿÿùøÿÿ‚ý$³ þyÿÿöÙh% BÒÿÿþ‚ÿÿõÅ[  #]±ýÿ ý¨ÿ ÿÿÿý¯ÿ ÿ üøÿÿÿÿü…ùÿÿýÕI õ~Ãèú÷â»-ÿÿõ~ÂçùòÕ›E  € € €Êô m¯Øìûðݰy&1ü¡üÿÿýÃA.ýEíÿ ÿ.ýEüÿÿó¹f,"O†Ùÿÿ,ùíÿÿß7ý<¾,ú¢ÿÿÞ÷L£ÝõôÝ£KÿøU·å÷Ú—ýQú üÿÿ6ýÀÿÿý½ÿý¬ÿÿùî1 ®ÿûoÿÿ·ýÛÿÿýØÿþ›ÿÿúâ¯ÿÿû°ÿÿdþ¦ÿÿù¨: :©ÿÿþ¢ÿùïqˆÿÿû½ÿïqûÙÿÿ*ú'þÿÿ|úÿÿþ%ÿýó,þšÿÿýó,ûíÿÿú…ÿÿÅúÉÿÿ„ÿþ~þ7ÿÿþ}ûûÿÿûÁÿÿ\û^ÿÿ¿ÿþ*þ ÿÿþ*ûíÿÿûæÿÿ û"ÿÿåÿþþÿÿþûÙÿÿ*û÷ÿÿûÿÿ÷ÿÿû°ÿÿdû÷ÿÿûÿÿ÷ÿÿûoÿÿ·ûæÿÿ û"ÿÿåÿÿú!üÿÿ6ûÁÿÿZû]ÿÿ¿ÿÿú¢ÿÿÞû…ÿÿÂúÆÿÿƒÿÿù îÿÿÞ7ý<¾ú'þÿÿuú|ÿÿþ%ÿÿýFüÿÿó¹e+"N…Ùÿÿþ¦ÿÿù¤8 9§ÿÿþ¢ÿÿ ýFíÿ ÿýÛÿÿýØÿÿ ü ¢üÿÿýÁAýÁÿÿý¾ÿÿ ô o°Ùíüñݰx$÷M¥ÞõõÞ¤Lÿÿ € € €ù¶âùãž ÿøU·å÷Ú—÷Q¶âùãž ÷L£ÝõôÝ£Kÿýò7ÿý¬ÿÿúî1 ®ÿÿýò7ýÀÿÿý½ÿýß ÿþ›ÿÿüâ¯ÿÿýß ýÛÿÿýØû‡ÿÿþbÿùïqˆÿÿ÷½ÿïq‡ÿÿþbþ¦ÿÿù¨: :©ÿÿþ¢ûšÿÿ°ÿýó,þšÿÿýó,ûšÿÿ°ú'þÿÿ|úÿÿþ%û8ÿÿßÿþ~þ7ÿÿþ}û8ÿÿßú…ÿÿÅúÉÿÿ„ûÿÿôÿþ*þ ÿÿþ*ûÿÿôûÁÿÿ\û^ÿÿ¿þÿÿÿþþÿÿþþÿÿûæÿÿ û"ÿÿåÿÿÿÿû÷ÿÿûÿÿ÷ÿÿÿÿû÷ÿÿûÿÿ÷ÿÿÿÿûæÿÿ û"ÿÿåÿÿÿÿûÁÿÿZû]ÿÿ¿ÿÿÿÿû…ÿÿÂúÆÿÿƒÿÿÿÿú'þÿÿuú|ÿÿþ%ÿÿÿÿþ¦ÿÿù¤8 9§ÿÿþ¢ÿÿÿÿýÛÿÿýØÿÿÿÿýÁÿÿý¾ ÿÿÿÿ÷M¥ÞõõÞ¤L € € €ðÿúúíΚD2 ÿý¿0 ÿýÔ/ÿûN»ÿÿþq/ÿø¢ÿÿÄÿÿ÷:ŸÝ÷ðÌ}õ1•Ððüõ຀.ÿù%ÿÿíÿÿüþÿÿýâ'ý‡þÿÿÿùÿÿøÿÿþ‘ÿÿýÔþcÿ ÿÿù'ÿÿÜÿÿøû3 4¯ÿÿþ[óÎÿÿãZ>{Ðÿø¦ÿÿ¥ÿÿýúFû¶ÿÿ­û÷ÿÿ3ÿõN¾ÿÿþ3ÿÿþŒûBÿÿÞûðÿÿP ÿýþeÿþ/ûÿÿóþ­ÿÿûÚ”Y  ÿýÂ1ÿþþÿÿý$êÿÿüÞ‹  ÿýùaÿÿüœõÿÿý÷gÿ÷VÎÿÿüAÿÿú G¼öÿÿýþC ÿ÷¾ÿÿÛÿÿÿ ù [åÿÿ¶ ÿøðÿÿjÿÿÿ û@ÿÿí ÿùuÿÿáÿÿÿ û ÿÿü ÿù éÿÿaÿÿÿý¶)ûHÿÿë ÿúxÿÿØÿÿÿòÿþ¶`$ )zñÿÿ¬ ÿúïÿÿÿÿÿ ÿýø- ÿ ûƒÿÿÿÿÿýFÎÿÿýèDÿ ûôÿÿÿÿö>˜×õùæ¹nÿ ýÿÿPPPŽÿ÷þòäÕ°L ÿ ÿüí“ ÿÿýï^ ÿÿù&R‡ßÿÿþdÿÿøUèÿÿü9ÿÿ úáÿÿ¿ÿÿ þ6ÿÿþ5ÿÿ û³ÿÿ{ÿÿ ûcÿÿ»ÿÿ û*ÿÿÚ ÿÿ ûÿÿí ÿÿ ûÿÿû ÿÿ ûÿÿìÿÿ û+ÿÿÙÿÿ ûeÿÿ¹ÿÿ û´ÿÿyÿÿ þ7ÿÿþ3ÿÿ úáÿÿ½ÿþÿøTçÿÿû6ÿþUÿù%Q†ÞÿÿþaÿþÎÿýî[ÿýÿI ÿüí“ÿýÿÃÿ÷þóæ×²L ÿÖ¼^ /-1rdf_flyer.64.gifÿ     ¯œ-1°-1Àò¤ÿzÀbG ÿ狼X:sš¥”_ 2‚gí³º°îÿÿ¥odo.j…ï¾ÿü–  Šûèi³ÿÿý  ý#¹û³jÿÿý–  ü ÿü”êÿÿüÔ  ü Q‘÷a/óÚ  ü *Fú=Fûs ýú:Fÿ ýù³C)ÿ ü 2U÷áÐÏ üZŸøÿ82f ü8ÿû¤ñt  ü. ý'¯ùá¸k  þ  ú ’•þñþÃòñÿ.   û ¦ÿóáÓ꜀¼IõúòçU  øf²¿A  ûÃÿÒåÒòpM C¡P–Y|i Vÿûÿ‰`  ý‚ÖÒøU eµËÔ΋%3"  7¬ëááõa zgñìA )Üýÿß|IG„,  û tJø÷ñA íñíŒ1éÿþ„  û —ÿ ø¬. 1ñöÝäÿÿþ‚  û ´ÿ ùÿ Roü“ÿÿý  ú¥ÿñøÃ dˆ÷FãüÞß¡  û ;\Ò úQ c‡ûIõº ü D• úN c‡ú Zÿ= ü D• úN eŠû Zö ü 1‰ úN AWûQ)¾ ûŽg ÷Ò0 %Òû¢­ ü s ùû2 ×ú*d ù Šþá÷¤, r…úë~3 ûfbÿö•I ËûœT  Û  &\ϳҙ$Fç¤v_  ÷ IÅoµu  ü c¿ñíW 0«”b  gògŽ.  8ŠÿçŒ6 2jm18¼ÿÿàã :]ŒôÙq jóáèõ.J höÿá` uþ³þáùÃÕn  ø Lñÿÿý  ü Þøÿ] ¼ÿÿþ  ýuòñÿu :ÿùÍßj  ý ôñ¥1„ÿW"  ùÛaž× ùëk¢¢ ùÿ1y’ úP+ ú×^ ýqùÿx!  ü ¥ùñ9  üþüé7  û ]ýøñÿºf  ø&™ûÒòÀL}$ @¡ÑýÒòºÿšÏ‰UIKMt¸'ÿﺿ;j–³»®†Fd¡ŒíÆËULÃòÿÿ»’Š“aKŽ£ïÑPRÎÿý¯IDFFEFGB§ûíŽDÆÿÿý«BGGýYÊûÆ?Pÿÿý°BGGüFŸÿü®:ïÿÿüßSFGGüE|¬÷ˆböãI9>DGGûFA¼ÿóéÞﵟ µÍuøúõíEGGøJQ‹ÆÏpHGGûTÑÿÝåÝõ“y59GJ@?q¹{°œŽABGEJ€©ÿûÿ¦ˆDGGýJ ÖÝù€IAŠÇ×ßÚ§KA[eXHCGG>hÁïéé÷ˆCGGAšŒññpF^åþÿçœvt¢`EGGûF—vú÷ôpOGG:ñññ¨Bdïÿþ¢=ADD@EGGûFN°ÿ øÀbGEdôöåVNëÿÿþ¡AGGûFIÆÿ ùÿVGD}“üª8®ÿÿý BGGú=»ÿôøÒQGCŠ¥÷sPêýæç¸@GGûFk„Ý ú|FCŠ¥øNu÷Ë>;>GGüFr¯ úyFCŠ¥úEƒÿlCG GüFr¯ úyFC‹§ûHƒø?G Gýc¦ úzFEo€û|^ÎBG Gû=ªŒ ÷ÝcFF[Ýû¹8Â=G GýI• ùüdGG=áTü_ŠBG GùH¦þé÷º`GGA•£úðžDeEG Gû?Œˆÿö¯vIGGFRØûµ~>HGGÛC?Atíº˜†@GG÷EvÓ“Ç–PDGGüF‰Ïñò€HBc À¯‰HK·ŒòŒªaVJGGIUi¦ÿç¨hLDGBAe‘d?iÍÿÿèÒ¹¸k=„§ôã“UFGQ÷éèøavAGGEBB>øÿè‡R>@CUHH—þÆþéùÒà’FGGøExôÿÿþBGGüFKæøÿ…EGGOÍÿÿþCGGýA—òôÿ—BFkÿúÙçFGGþMôô¼dC¢ÿ€TYHGGùäˆA¶áTG GùðA¹¹HG GùÿcCš­DG Gú{L_ªDG GúàUN†SG Gý@”ùÿ™>UWFGGüFO»úôjDG GüE«þüîhEGGFý†þøôÿËŒJ@FGGøD=\²üÝòÏxZGGDo¸ÜýÝòÚÿÊæÀ¤žŸ µÙ‹ÿïÚݼ—°ÇÖÛÔ¿œ­ÍÂíáã¤ ßøÿÿÛÄÀÅ«ŸÃÎ÷碣åÿþÔžœœüšÐûõÛàÿÿýÒšý§ãûᘢÃÿÿýÕ›ýÌÿüÔ–öÿÿýí£üœ¹Óø¿«úðž•—ýªµú±µýÆ™ ý ¤û°´ÿž ý ¢ùá´©ÿ— üœ­»øóížšìœ üœ½Ùøÿ¯œœ­Áš üž¯ÿûÚùÇüœ«œ ý¨ÞùóâÚþœ ûšÓÔþùþçùùÿÒ«›ûš˜˜œûœšÛÿóóîöØÌÌ×ä¶ûúúõ»œøž¢Ááæ³žû¤çÿíåíúƸ”–ž™™³Ù¸Õ¼ÊÃššœž»Ñÿûÿп›ýŸÍÖíü»žšÁáêîëÐŸš¨­¦›˜¯Þ÷óóûÀ›šÉÂñ÷³©ñþÿòʵ´ÎªœûœÇ·ü÷ù²¡–÷ñ÷К¬öÿÿÍ˜š››™œûœ¡Õÿ øÞ«œ¬ùûñ¥¡ôÿÿýÍšüžáÿ ùÿ¥›ºÆüÒ•ÓÿÿýÌšú˜Ûÿùøç¢›ÁÏ÷µ¢ôþòòÙ™ü°¾í úºœ›ÀÏø¡¶û㘖™ý´Ô ú¸œ›ÀÏúœ½ÿ±› ý´Ô ú¸œ›ÁÐûž½û™ ý¬Ð ú¸œœ³¼û¹©äš û˜Ò ÷í¬œ¨íûÚ•Þ˜ ýžÇ ùþ­˜ï¤ü©Àš úÐþó÷ÚªšÆÎú÷Ë›­œ û˜ÂÀÿûÔ¶žý£êü׺˜Û›——šš¨¾ìáíÖ§›™˜™šµõÚÈ¿™÷œ¶èÅáÇ¢›ýÁæñø»žš¬ÌÝÔÀžŸØÂòÂÒ«¥žž¥¯ÐÿçЮ œ›š­ÃĬ™¯äÿÿóæÙÙ°˜¾ÑôðÆ¤œ£Ãúóèû«¶šœšš™Âûÿ󿣘™›¤žžÈþáþóùçîÄœøœ·ùÿÿþ›ýŸñøÿ½œ¡äÿÿþ›ýšÇòùÿÇš°ÿüëòÜþ õùÛ¬›Íÿ»¤¦ ùñÀšØï¤ ù÷ÚÚÙž ùÿ¬›ÉÓ› ú¹ŸªÑœ ú¾£ ý™ÆúÿȘ¤¦ ý¢Ûúù°› üœÒþüö®œûœ¾ÿøùÿ㟙œø›˜¨Öþíòå·Ë§›³ÙìþíüÜÿÿý üÿÿü·þ¸ÿ ÿüÛþ›ÿ ÿþÜþ6ÿÿþxý"ÿÿýåÿþÿþÿþÿþÿþü|ÿÿþþˆÿÿý‰þ\ÿÿþiülÿþÿÿýþÛþ û;Íÿÿüþÿýÿÿünýÿÿúþ÷ø÷ûÿÿüýÿûU›ÿÿøõGSQ¥ÿþÿÿý°‡ûJ©ÿþÿÿþwþŠÿÿøþÿÜJþ_ÿÿþpÿÿýþjÿÿþÿÿýù$ þjÿÿýþ¥ÿÿüþÿ1 ý!àÿÿþÿüþÿ þÆÿÿþÿþ$ þÇÿÿþÿþ2 þÇÿÿþÿþ2 þÇÿÿþÿþC þÇÿÿþÿûþÿ þÃÿÿýýÿþÿÿþº ýL÷ÿÿþÇþÿÿþI þgÿÿýæÿÿûþÿM5ü›ÿÿþ*üôþÿ ÿüþÿþÿÿøþÿð¶þ¼ÿÿûó¶ ÿþÿÿýøÆýuûÿÿû×÷ÿÿýÊYý×õÿÿüþíþNllþqûKlÿþÿÿþ×þ\ÿÿþëþˆÿÿú|ÿþÿÿþXÿÿþ2ÿÿþ5ÿÿý±ÿÿþ‘ÿÿþ—ÿ ÿýþÿü&ÿþÿ ÿþkÿþþãÿ ÿþQûqøÿþÿÿûþÿÿQý,ÿÿýqemantle-asf.pngÿ     ÿÿÿï)Ëe)çŽuŽe*=Ãc|ÀƒØƒàƒð†òŒÑŽmöÿÿ ÿ ÿ ÿ ÿ ÿÿÿý›Ñÿÿÿþáÿ ÿÿû÷ÿí{ÿÿÿü‰‚Þÿÿõ©…ÿзÿþÿÕÿÿùOyÐÿþÿ ÿôè‹ÿž¸¾ç›ŒÿÿöþòO!h½ÿþÿ ÿô¯³“ÿ¥Õt•ÿÿÿ÷þÿs$Ušÿ ÿô¶žœÝ¤¬“‹ÿÿÿø–$#@¤ÿÿôósœƒ¨®S¯`þÿÿöïa%" 0‡õÿÿõ£˜’YŸ™{ÿÿÿòþÿ¤4 "!" €ÜÿþÿÿôÚNl‹ˆSš†‹ÿÿ ÿöz$##$k»ÿÿôøÜc}ˆi•vÿøÿèýÿ?##"%M®ÿÿàéƒ|m‹fˆúåýÿÿÿûÿÿÿü¥#$##ò0ƒåçâuwnTÿÜÿüÿÿÿëýÿG#"! ! V»îlYgnÿÙ ÿüÿÿ ÿüM$##÷1˜QjSÿÜ ÿ ÿüZ!%%ø&$?Zÿâÿþÿ ÿûm6$##ú&"=žÿþáÿ ÿþÿ ÿõ²S ! !!#!ÿü‰‚ÞÿÿþäÿÿúÕJ"&%%ÿùOyÐÿþÿ ÿïîZt~ja[E8‘F'!%ÿöþòO!h½ÿþÿ ÿðñ¥]xŒxZY]\CÕÚP>ÿ÷þÿs$Ušÿÿíþÿ¦}¥‘…Q[e†X|ŸìÉ–€ÿø–$#@¤ÿÿí÷‹³…–©jk‰–Y‘rÿÿ’¸uÿ÷ïa%" 0‡ÿÿí §¢ô’”sª¦¥’¯ÿáÅÅÿ÷þÿ¤4 "!"ÿÿëþº}Ý´¨n¹¹h¨ƒþÿÞâÑž ÿûz$#ÿÿóÃûÈ‘ †Ê¸²ÿެÿÿû¶àÓÆÿûýÿ?ÿÿëþÿþÿÿùŒÁ¡þÿ¢™ÿÿÈãæÌá ÿý¥#ÿÿðå³®þÿÿšzÿÿÅîíÉñýÿÿÿþýÿÿþšÿÿþ™ÿÿúÉáíÌíÿþ´ÿÿûŒñÕíÿúþÙÁíÀ!ÿûþÿ¸€!ÿýþë"ÿþäÿÿ$ÿøîZt~ÿaÿ ÿ"ÿññ¥]xŒxZY]\CÕÚPÿÿ#ÿìþÿ¦}¥‘…Q[e†X|ŸìÉ–€Šÿÿ"ÿë÷‹³…–©jk‰–Y‘rÿÿ’¸u§ÿÿ"ÿè §¢ô’”sª¦¥’¯ÿáÅŹ±“ÿÿ!ÿæþº}Ý´¨n¹¹h¨ƒþÿÞâÑžÇÈ…Áÿ!ÿóÃûÈ‘ †Ê¸²ÿެÿÿö¶àÓÆÖÙzÔÄ!ÿæþÿþÿÿùŒÁ¡þÿ¢™ÿÿÈãæÌááârÝÓ ÿëå³®þÿÿšzÿÿÅîíÉñæèyëÝ! ÿþšÿÿþ™ÿÿõÉáíÌííñ|îå" ÿþ´ÿÿöŒñÕííñ–øì#ÿõþÙÁíÀïòµûí#üÿÿ ÿöþÿ¸€öõËíð&ÿøþëÚ÷å±ò&ÿúÇÙÿ“ø'ýÿÿÿûö¾’ô/ ÿþ4 ÿ5 ÿ6ÿ7ýÿÿÿ9ýÿÿÿ;ûÿÿÿ<þÿöÿÿ ÿ ÿ ÿ ÿ ÿÿÿý™Òÿÿÿþáÿ ÿÿûöÿì‚ÿÿÿü‰Þÿÿõ©…ÿÑÉÿþÿÕÿÿùGvÌÿþÿ ÿô曈ÿ¡É¾è˜ÿÿöþóJb¹ÿþÿ ÿô­Ï¡ÿ’¹Ö{§ÿÿÿ÷þÿsRŸÿ ÿô´¼µÛ½§¨“ÿÿÿø‘>£ÿÿôóƒ·¬Ê]Ê`þÿÿöëa'„÷ÿÿõ¡µ®Z·š°†ÿÿÿúþÿ¢1ú€ÜÿþÿÿôÚT}§¤\·¤ÿÿ ÿüyüd·ÿÿôøßb•¤{²Ž§ÿûÿûýÿ=ï K¯ÿÿà釖ƒ©w¡ùéýÿÿÿûÿÿÿü¤!ò,€åçä{„Y™ÿàÿüÿÿÿúýÿFôS»ñqew€ÿÚ ÿüÿÿ ÿüLö1›Xq[ÿÞ ÿ ÿüVø 7\ÿäÿþÿ ÿül5ú ? ÿþáÿ ÿþÿ ÿõ®Rÿü‰Þÿÿþäÿÿ÷ÓH ÿùGvÌÿþÿ ÿïîŽj†‰oiiK6’@&ÿöþóJb¹ÿþÿ ÿðð¤jŽ«ŽfbkjH×Ý8&ÿ÷þÿsRŸÿÿíþÿ¦’¯œZhr¢c“¥ìÅ(1ÿø‘>£ÿÿíö“Ñ’Ÿ¢y~ž³d¯ƒÿÿU,)ÿ÷ëa'„ÿÿí¦º¡ô•«|ÆÀ«²ÿ×("ÿúþÿ¢1ÿëþ¸ˆÜ³ŸÃyÓÐs“þÿ¢ ! ÿûyÿÿóÅùÉ”ãζÿžÃÿÿû/ÿûýÿ=ÿÿëþÿþÿÿ÷œÓ£þÿ±¬ÿÿÏ ÿý¤!ÿÿðãÅ·þÿÿ±yÿÿÆýÿÿÿþýÿÿþ¥ÿÿþ¦ÿÿúÒ ÿþ²ÿÿû?1ÿúþØ[R<!ÿûþÿ™L!ÿýþß"ÿþäÿÿ$ÿøîŽj†‰ÿiÿ ÿ"ÿñð¤jŽ«ŽfbkjH×Ý8ÿÿ#ÿìþÿ¦’¯œZhr¢c“¥ìÅ(14ÿÿ"ÿëö“Ñ’Ÿ¢y~ž³d¯ƒÿÿU,)/0ÿÿ"ÿ覺¡ô•«|ÆÀ«²ÿ×(")-,ÿÿ!ÿæþ¸ˆÜ³ŸÃyÓÐs“þÿ¢ !&(%,ÿ!ÿóÅùÉ”ãζÿžÃÿÿû/  ý$'!ÿæþÿþÿÿ÷œÓ£þÿ±¬ÿÿÏ ÿëãÅ·þÿÿ±yÿÿÆ! ÿþ¥ÿÿþ¦ÿÿûÒ ü" ÿþ²ÿÿû?1ý#ÿõþØ[R<0#üÿÿ ÿöþÿ™LdX?*&ÿøþßxxkZO&ÿú¹ƒ—Sz'ýÿÿÿü‰m›/ ÿþ€4 ÿ5 ÿ6ÿ7ýÿÿÿ9ýÿÿÿ;ûÿÿÿ<þÿöÿÿ ÿ ÿ ÿ ÿ ÿÿÿý›Òÿÿÿþâÿ ÿÿûöÿë…ÿÿÿüŠ‚Ýÿÿõ©†ÿÒÕÿþÿÕÿÿùLxËÿþÿ ÿôæ¤ÿ¥Ò¾è—“ÿÿöþóL d¶ÿþÿ ÿô¬â¬ÿ–ÆÖ³ÿÿÿ÷þÿs!S¤ÿ ÿô²ÑÆÙ”Χ·˜ÿÿÿø’#!B¤ÿÿôóËš¯ÝfÝbþÿÿöëb#!-†øÿÿõ¤ÊÃ\È­Àÿÿÿòþÿ£0! ƒÛÿþÿÿôÙZ‹¼¹dÌ®¶ÿÿ ÿö{#!""g³ÿÿôøàd¨¹‰È ¹þùÿèýÿ<#"#M±ÿÿáꎫ“¿…´øæýÿÿÿûÿÿÿë¢"!! ""-ƒæê倣”`­ÿÝÿüÿÿÿëýÿG"!!!V»ówo…ÿÖ ÿüÿÿ ÿûK"#""÷5awcÿÚ ÿ ÿñX$##$#=`ÿàÿþÿ ÿón5#""!$!A ÿþâÿ ÿþÿ ÿõ°T! !!ÿüŠ‚Ýÿÿþãÿÿ÷ÓH!$$#$ÿùLxËÿþÿ ÿïï‘x“’tqtS<“H)$ÿöþóL d¶ÿþÿ ÿðï£vžÁŸqlvvOÖÜILÿ÷þÿs!S¤ÿÿíþÿ¥¡×Å­bs~¶l¦«îÈyzÿø’#!B¤ÿÿíö˜åœ¦ž…®ÈoÆ‘ÿÿuv`ÿ÷ëb#!-†ÿÿí¨Æ¢ô˜»„ÚÓš×¾µÿÕ]kHÿ÷þÿ£0!ÿÿëþ¶Û²¨ÕƒäÝš|ÔŸÿÿ¶^ZO ÿû{#!ÿÿóÆ÷É–›|òÛ¹ÿ©ÒÿÿûSXPUÿûýÿ<ÿÿëþÿþÿÿö§Ü¦þÿ··ÿÿÌLRMR ÿý¢"ÿÿðãлþÿÿÀ{ÿÿ¼MPIQýÿÿÿþýÿÿþ«ÿÿþ®ÿÿúÏFMGOÿþ±ÿÿûDQJNÿúþßQSF!ÿûþÿžJ!ÿýþÚ"ÿþãÿÿ$ÿøï‘x“’ÿqÿ ÿ"ÿñï£vžÁŸqlvvOÖÜIÿÿ#ÿìþÿ¥¡×Å­bs~¶l¦«îÈyz–ÿÿ"ÿëö˜åœ¦ž…®ÈoÆ‘ÿÿuv`ƒÿÿ"ÿè¨Æ¢ô˜»„ÚÓš×¾µÿÕ]kHpveÿÿ!ÿæþ¶Û²¨ÕƒäÝš|ÔŸÿÿ¶^ZOgkVtÿ!ÿóÆ÷É–›|òÛ¹ÿ©ÒÿÿöSXPU[`Bhh!ÿæþÿþÿÿö§Ü¦þÿ··ÿÿÌLRMRWX<]] ÿëãлþÿÿÀ{ÿÿ¼MPIQQV5ZW! ÿþ«ÿÿþ®ÿÿõÏFMGONN5SU" ÿþ±ÿÿöDQJNMN:RP#ÿõþßQSFPOCRM#üÿÿ ÿöþÿžJZWLMO&ÿøþÚW_XJU&ÿú³YiC`'ýÿÿÿüsee/ ÿþf4 ÿ5 ÿ6ÿ7ýÿÿÿ9ýÿÿÿ;ûÿÿÿ<þÿööüý ú  û ô  ò  ò  ñ #&%!ð   ð #,31¿Ù/' í œ/,'! ð%+ŒDqÿx?6-#Ûÿÿ˜&81*"  "*ÃÐNÿÿ?O?§,â #Fÿþÿž,;3+#  +sþìVÿÿûŒÆè<â +MÿÿþÿŸ0=4-% #3vÿÿRÿÿý“Pø#1Pÿÿîy66.' +;{ÿÿÛÿÿýU]ö %2PÈÿÿóê880($%*4B~ÿÿþþÿÿý½]ô %02Ÿÿþÿÿõëƒ7;648?LyÿÿýÐkõ ",80Íÿÿù¡5FGLOÿÿýÒlô'176Šÿÿú¥ES_‰ÿÿýÛ—ó !*4>HÌÿÿü眈ÿÿýà• ô $-8=uÿÿþîÿÿýÙ–!ó '2A¦ÿ ÿ(ö(8Wÿþÿÿú¸»Êÿÿ'ù  0Pÿ ÿùðpsÕÿÿ&õ %)ÿÿíÃÿÿü¢s„ÿÿ'ö&mÿ—Âÿÿûápr–ÿÿ'õ ÿqÿ¬®ÿÿ÷œwÿÿ_liçÿÿ'ê :=Pnÿÿ“e`ÿî_f‘þÿÿ(ì ,7>ÉÿWXTÿÝ[^‰ÿÿ(ì )3+´>HHGÌ:OS‚ÿÿ(ì $+0578:c6@Fwÿÿ*ê  #&'*,.06"##¾"## '8M^NqjiGŽŒ’š8y^µ°´¿U•¡¡ŠÖÓ×àwŽÂËæèyëÝÍ»ÒÌÊ›®©•mh€`N-"##Á! !1BT_|zˆy`hmt ¤©ŠŒ—€ÈÌ͹ž«°µhíñ|îåÓ¼ÝÜØ©±¬¡j}fƒ|}q€qS6#"##¿"&'#! (HV5omV–™ŸLxxkÄÁÀÍh  ¤z­íñ–øì䏿ä⸽¹»j`‚}|s}|~„}kU4##¿"#'""&88pŠ”Œdhks`§°¸Œ“–Œ‡ŸïòµûíîìêêÊ˽k‚b…~|zk}~}{n~„|SA.##ü"#"&&à !9B#+D™ÿÿ ø#--&*&*((ã#&$#"!" Ic‹¾ÿÿÓ'0*.-',,-"(&#$$(&#! +cÉßùÿþÿÿô*2(0./0.**)((õ%(&%#!!   þ÷K`mf°ÿÿú*4(2(00×&0,,+'*+) &&$# $#!! 'DM\fjO+Sl›òÿÿç(204+423'0..,%.,'*(&$#"*&&$! í%83#5‘Œ›´ÿ ÿì(242244/2100.,0/&*)((ý*)((ã&!&&$$!,bz‚‰fU\d-)-,/14*3'  %-4544!44ô3*0..)300/#&&Ü#',*! $#$$")8&(%,+.'038,*ø")0-44ý+300ã(221%+)*(#0,)##! (&#&   ð$')$+./+660*   ñ$-0)54223441,,Ó+,-00!(&$#+))*"$%#! ""((+'653374+#í$*/*544'00..#31*,((Ù#.,+) (##& "$%554/6/7750( î!),0230/044%++)&100Ù!##!+((*! "65414-8450655+ î !'+"44.00,.&11ô+*&$&$+,+**â66416.85422466960+#è  $$004.3442')((#10.,,è076407-76461566õ7/694*'  ÷!$,/35++ý,-00Ô%0.dX?*887+.,3034225334+687.974.(!Ý!(+&533+400xxkZOD*:;9#)$**0-'00ì/2446(232+3304(#à!(-'143¹ƒ—Szn_@?0B78 "$!&",,ý-'..þ&00ð(.-41673%.(ê#ÿÿ‰m›ˆ†CpaPFc_ß+(*), &))&+-0#&(%'757/87-40-&!ÿô€¦¤–q‚{X„†1ù$&((ý! ""û*)*'  ý!.00ë,0/.00./1/**(!ÿÿä·¯Ÿzš˜}’—^ "!!"&&ý(ç*/+*%-,%++0&+,+378(/--"(ÿÿñ–ºe»›HB5%&  ý!ß ##"#%&&#))!(('!*)/'.-0.0+*7ÿ ÿñ¥†¾X‚snQ`VKý  ó !! ""!&&ò$&&("'.)!'*)+ÿ ÿôΧo¨™w„…dñBHA2%8.(%ð " ! !$#!"!!"&&ü$)$ÿ ÿæ©¿‚¼©«86…|ooAdfb'þ  û!!"þ(ÿÿøÅ«yÈ×Ç"ꯣ ›W‘‚ûþ  ù "$%ÿÿéÔÈÞé''ÙÆÇ¿O¸°´Wøï "654ÿ ÿäì·ó 47ÐñéΤÛ××ú6'õ66416.ÿÿÑ¢ÎÚ«2¦õêÜ%:7),-& ,pcU76407-76ÿÿÓÀMCM¹ÜÃDo`1b]Y2-•ƒƒ887+.,30342ÿÿÙîÓäwf{LWptR ‚¿D*:;9#)$**0-'00ÿÞ׿ÇåÝßÿêTGRD7n_@?0B78 "$!&",,þ-ÿ%ÿï¸SQˆ†CpaPFc_õ+(*), &))&ÿ#ÿõ¦¤–q‚{X„†1ù$&((ý! ""ú*)*' ÿÿä·¯Ÿzš˜}’—^ "!!"&&ý(û*/+*ÿÿñ–ºe»›HB5%&  ý!í ##"#%&&#))!((ÿÿñ¥†¾X‚snQ`VKý  ó !! ""!&&õ$&&("'.)!'ÿÿôΧo¨™w„…dñBHA2%8.(%ð " ! !$#!"!!"&&ù$(*)01ÿ ÿæ©¿‚¼©«86…|ooAdfb'þ  û!!ù"!!"!&ÿ ÿøÅ«yÈ×Ç"ꯣ ›W‘‚ûþ  úÿÿéÔÈÞé''ÙÆÇ¿O¸°´Wøùþþÿ=ÿÿ6ÿ0ÿ*ÿýÿ$ÿ !ÿÿôû”‹ãVåž–”ÿÿëÿÅN[Y.ZTN3LRMnÿ¤ª¦ÿþÿÿêìObaB\[W?XWWV@8INJVžÕÿÿâÀmgb=__Ca[ZZ:TOPM==ED>tªª¨œ®ôÿÿßinmQohU`bacA[WWT?RURRM;BOW\[M¬Î×ÿÿ ÝRwv@miKnigMa\[YK\[YX@=QMOPTGAGDDRœÿÿ Ùj|wXt_xoneZgba^N__^:PSROOP8MRPMPA4WnмÿÿÓ{„d„zSzv{BmkhgVmgbCWYVXRQC[RULU:HSPMPHrÌâûÿþÿÿÓŠŽT†w‚€€jlromkOmkYW_^[[XE^Z[Y[@UORPOS=EKPKy±ÿÿÏŠ•VYІ„J…wwt^ttq8ggca`@eb__]FZYWWRT=RTW[WF:dtóÿÿË„Œ}–f—’ŽV‚}zH{RxmlfcJqkigccL_\\[Tj„¯ÿÿè9„–˜Z—“]•Œv†}{wuI{wwßqkWkkeg4XWRR@X[YWO@UTWM>QPOSFtÚæÿÿ€„$# i˜œE—––•F—˜`‡„p}|{A|uooM^][YMba`\QDOLO@MRQSH@F[VXh„­Æîÿ$"$ D;‰œ™‚ƒ–”g‹‹‰‡W‘І„~RyzwxEbb`^Ufbg]LTROBUWWX:LY\`UE?HHFA[#$$#Â-TOŸ–‰—–‘Š–‘Œ‹‹PŠ„@nmkg=tomlGYWWRT^\aBQORP@LSROPG@G–yD""¶ Cu|¡—–—f›––—™8‰‰‡]rom_usrv=`\[Z?hdd7RMMB?[WWVF?Tegƒ…~}C& ""#8Y˜f––°Š——”Q€zwyJ„RigbaHomm=YURCLc\[[:KXWW3pve…a…S%$ $#Eq‘œ——.š––“^„~jއ„SkkôdWvuA][YOAbcc¥>NPOG6ZgkVtwyUƒŒœg[&! ! 8Y~nš–—c’‰‡ƒV‘’ŒIurslH…zgda_^.mkehBTROI=_[[`BhhkRw}c”–{^0%$$€„#+Dp‚]›˜’‹––†r{zwpsƒ„GlgdNtrpqGXQWV>ga_WX<]]_Yjlq_’…‘œ’h?"" """A]}aŸ—–R…„€?‘ŒazomkB}zvg[][Z9mebiQV5ZWTW]acWŒ†y˜‚œœ™uV0 #""€¹5Rm~‘’‡w—™Rvtr^‹„†Gba`Qqqor>NN5SUQFW\\V‹‚†–lž•–…›š_1#""%%")K`2š›p†||M‹ŒŠgrjffKvwwQpMN:RPKERUWM‰ƒ™t–•‹‘•—˜ —‚]<# """%!%A=yˆŒ~Ž–˜’UromQ„~nl{POCRMP=POOPŒ‡ƒw™p𙕑„•˜˜õ–v˜ž”\R2""ü"$$Ã7`b_bAUUXLiggiJUTGsptsMzuZttrXvyxšWƒvk4WÿÿÈÀ]tPryNSQ`b_bAUUXLiggiJUTGsptsÿÿÖÀ]tPryNSQ366A<084/,($  ùJC££¤£ÿÿã ·ÿž6D@373-)%" ýTÆÿ ÿ壥ñ£ŠA;840.,*'$  ý‚þÿÿæ¡¥•:5;4.(" ÿ1ÿò¢:6;3-(#ÿ4ÿõ¢:@:50,($!ÿ6ÿ÷§¥<9@<73ÿ:ÿ¦ý£;ÿÿþpÿ=ÿú8C«Äþÿ9ÿú)3>BÂÿ9ÿö#,5=gŸ±ÿ(ÿí &,3:AG^Ïÿ&ÿë !(.4;=Jp^áÿ!ÿ æ ").49=A?@DM¬ÂÅÂèÿÿ ã "&*.159=@@CFEr©Æ±¶ÿÿá  #&),/147;>?DF?N^d¯ÿÿ×  "%(+.0369<@C=]sk^``Ge©±ÅÇÿÿ× !#%),0369::<=>?ABCFCs§¨à !#%&''()*-/148:=?ð ô "%')+%é +þø 6úÿÀþÿ=ÿ7ÿüÿÿ,ÿ)ÿ&ÿ!ý³·ÿÿô¯µ‹†½½³•¤ïÿÿëÆ©¼éú÷öþÿ¿bŒºÊ«•¼º³ôÿÿê×òííìûʦ¬Ôûûÿ«Çýûüÿ¼Ãÿÿãàáåó»–Ú÷ðîóËùõöþÇŸ¬¥¸¾µžÊËóÿÿáÛÞÎÕìäêíö¤Îõïü±Êôïô䊼â࿵Âÿÿ ûÖ”•âÞÞãàìŒæèìïi¿àÝä÷œùõõûçÁ¬ž½²º£ûÿÿ ×g·ÍÒÓ×Ú܈çàæºlÓÌÓàÊséííôÊÁñý÷úâ§’r¡±ŸýÞÿÿѾÁÀÅÈ˽~Û×á‘„ÂÄÈГ“éäå÷”Éøòòê솋´»ÀÊÓ ¬ØÁªÐÃýÿÿЯ´¸¼Á¡‰ÐÌÖƒ“¬¯·ÊhºÓÚÝÚ{óïîïòÀgœœ¤§·“²þùâ ¸ÐÒ¶«áÿÿϤ¨¬·wŒ¼»ÍlŠ˜Ÿ¨»\ÁÄÌÖ¸Žëæéíö‘a€‡•§víöû¯žÛ×Ýàåò¹¤ÿÿÌ™œ¦`Ÿ¬°¾Np‡•¦Uµ·ÀĬ°ßááåíngijx~zóðù±ÅÈÍ×ÛêÝŵ¼ðÿ ÿ‹æX˜œ £Glpw†ŽZ¨£°¸”­ÑÓÛÚãnjiiãhszôîû€¬°·ÀÆÆ˜ÂâéöåÀ»°¾£¡§ÝÿÿåmaŒ‡?niiqma‘– ©±ÅÉÈÍØdkiiÄl|íæ÷v“ £«¾|¨÷ùöõîùøºª´Ýðóõß|µ¶¿À¯7OUY]YrmmkT`xˆ‹šm«´·½ÂÄ€ciiÚlkèÞêy‚‹—¤pìïòçðñÿ¢•Ýõñîôö‘áþúüúÿì(08@5\hm{‰b¯¤¨°¯³¥XiiòlfÙÓ×–fpw~„ñììëîòÆ|ÐÛàäèð£ úûøñøÿ¾¤##þ'##½# '"INcx…•¦HnmjilgÈÈË«\iihoŒäââæéø’œÌÍÒÚ墸÷õöõÿ»›ìõB/$"  º#""!%06?RE¬´ÈµXnmikoÝ×ÛÞÝí{«¸»ÃЬåõïðóû½–ãÿ³¹„vV£†g.D6/#'! !&''&!€¹!(0?M:°¾ÎÛÜâbŸ£¦³¶g»òêìíøÂ—Þÿʧýþ¡š™—U¸±µHˆƒc{x9F70($##!!""###)L.S_vˆˆöðíëò˦Þþý Õÿùû»½¹´µ[ɸÁE™‹ˆvz¨¨¤SmnljhP•phXB81)+%!!&"*4Ia‹TžÐëê¬ÿÿûÿ§cÚÎÎÈÏjÎÄÎT²¬¡—“¸·¶Tii€­g§§­³`mno:¤š–;URN?1F77% #;Me™]ÈáæÚÛ×ájÖËÕoÈÀ½ªÉȱZjqppQº½¼¼É\yr~^°¯¶Q{€ƒƒb¶µ·€iyooA‚ŽxBK8*ÚÇ­èååâípßÓÞ~ÚÒÓ ÅÑÖµk„‰]ÔÉÊÌÙV‘Š…›ÁÀžw“––ŸnÂÁÅ¡pž¦ƒªÿÿ¤ÿýñΑáଲééÁí{äÚà–æâã‘ÙÞÞ¯Š˜˜¢ßÛÛÚßk¡¤wÎÓ×—š¨¨§´ÙÑÑÈw¶¯¯°„íÿùúúÚêææ°¡õíí€8äˆéáà£ëæëëæêž©°«¬¯­åâéåÚ´»qçÞàœ§¹¼·Á‚èááê…ºÂÀÉ“¯ÿ¡àüø£ðêåÌ„úïôîß—èä×£óíõ•ïíô›¾ÀÁÀ¨¼íéíÈÎ{ïêÐÊÎÔˆÚïìø¯¥ÚÑÒÍŠ÷˺ÿè”ôìèï†ÖïöõвêæÜ¡øñôæïò¡¶ÒÑÒ¨Çðïïñ­ÅÓßöîóÖ’ÝÜÚ⬩öòõÕàâá옽ÿ¶¾ùëõ²žåûîØ¥ðìì‘îóù¦Ðø÷¡ëÝÞÆ®ûííø—Öáâ’ùõõÿ©ŸÖõìç Íöøÿª©óéìÒû§g»Ì€¸Äßð·§Óÿë“÷ë÷¦´þùȧÿùê™Ñóéä™àýøò²Áôôú÷öð÷½‘¾Ì®‹ÓÔàÒdÁö÷ÿ¿ÿÿÔñ»¼É¥¥ÑÓ{Ôöïí¦Ö÷˜ÂÿÿÚ¨½Êê³–«áä¡‘Ùùƒ¹êÿÿð¿ÐÿÿûŸÉÒ¾ÿÿî²ÇÆ·ÿÿØ×¥šÎÛç»ÿñóÿÿ÷þ¾ÿÿ霡ÞÿÐÿþÉÿ<ÿòÏjÎÄÎT²¬¡—“¸·ÿ#ÿ€Ž;Me™]Èáöÿÿ×ájÖËÕoÈÀ½ªÉȱZjqppQº½¼¼É\yr~^°¯¶Q{€ƒƒb¶µ·€iyooA‚ŽxBK8* #EaåâípßÓÞ~ÚÒÓ ÅÑÖµk„‰]ÔÉÊÌÙV‘Š…›ÁÀžw“––ŸnÂÁÅ¡pž¦ƒªÿÿ¤ÿýñΑ׽®VrÀþÿ=ÿ7ÿüÿÿ,ÿ)ÿ&ÿ!ý†¶ÿÿôl…“ok••š‰¯øÿÿë|;/BRYbh]2q›¢¡ˆ¢œ§öÿÿê1*7P`gtUiˆ …Îÿÿã $7F3Y`krsH3,Vl„¢ÒÓõÿÿá'-==%57B[v|€‘Áÿÿ û ä3P_v}qlf„œ›ùÿÿ ë!$!! #$" î1GCbv‰‰—kM#\‰¡ÿãÿÿÒ'#$$##"! ((&#$:RV\fjG"'(&'-v–’«ßÑÿÿ(Õ% "# *((&'!" $,<@&0,+)*!e™“–V#oéÿÿÏ+,(*#$(&&!1,,**"&$# 1100./+hv{c ! ¥ÿÿð.,/%+)(*!200.,%((Þ$" 344101(HLW;%$#" Àóÿ ÿ0ë&/,,-%5310/',+((%! ý544ö /*((&$$ñFqŒ˜˜‡’¯Ç©¥®âÿÿý1)00ñ,)54431)0.,,&%$$û" 344ý5É1,+()!6_ejuy€‡m<-E\r}|b­¢¥ªª$)++*/5545,0100/('(&##&"244ý5â200,-#6DLV^Q#"ATG\›Ã½ÃÉßð!#(#/3420',+)((ý%.44Û5#" 32101+*SŽ•“Ÿª¯þ!ýø!&(&)**54ø5%$## 044à3%%" 9gkutŠd„ÓÝ$!þ¿!#(,$&)&'.5445" )($&$!*6FJVaNpÎà—¥776'-(('#!   À !(,' "! '.+*()""'`½Û¨”ìì.334$1,0%:77.*-++&(#! ì(**+)á S¹Ï̇Èêâä(*)01#))+!3574'))*.553å(/+)($)$!"  à‡µ¿¿äÚÕØŠ!!"!&&!&&)"2-.2$((%.44þ3))ý*#55Ü%--+#--,("! 0ET{O£   ö"#$!&()(&##ý0433þ-&&Û#233#*(*)3021&,*+&/.-+npb5?0$ þ  ø!"" " 11ý0$""ô#"&001%$$#+..ë1#&$&"),./&ŽßߌÜÒίyþüúý.,,ý/!ð(+*' ,,**, ""ý #((ç&GØèÓÔÒ¿á/(*))&()#%&(&)ý&$$à ¤ÿ’ÉÙÓ.SB6-&&&þ$²#&$!""!" !""Sê³¥ä¥+-xxqeX#IFM7"" !;CGFM; "&(*5 ÷7SKWS)à³ä‡§Ü€T£œ…6bVH6arq_LttvYXY\_UHE:Ya~¥Ö×ùÿÿáYWV?ORUOMP?HQOTC;KRMPN<>KUVQvÃÿÿ ûaDCZWWå=ORMP€ìÿÿçtwqrHVlkj={{rt?gda_M?URPPê7‰‡~LY_aIW`\WWRS8¡ÿÿÌzOqpos9†}{IqmldYNYWWUW8’–™ŒŠ‰HTTX@idb`[ZYLK:ƒÅ÷ÿ ÿ䃂Q|z{xG›‘Œ‡{Q{tomUO^\YY\8™––ã—•CRMSEwomjddCGT_dd\Ts¬Ç«¨±äÿÿå€\†ƒ‚kOœ––’€\ˆ~{x\`dcc`_4“––ÄBPRQB†ztqpK@Y[[^]bcQDBISY\UaŸ‚tsˆ=Y^i`{Ÿ›™šk€Œ‡„…WemkecgG‹––Ä›=XWY;„‚{z@NOROTVZDNmA`kndwœ™–›I\[YWWRCsmjgdS:LSSäV[JKs^a›˜UvbU"U>4!$%%$€Ž! !'3NaHQ`c_]^T‚xslm@DROOMSDIqiX€ˆˆHuwtH£œŸxhrgfAV?4(!  "+%PWdlf?[WVUQEKo|{Um€|}mopr„Fpqv7“—ŠYrrmu›œ›•‘X{gaUES@5)($Õ$ $",4A1UlssZƒ€~€X=_ccej>jfny{||…FYY¯WTwtXX\^@rwrvyE`^^VLqoomOw‚O|}|pURRC>OMLMM>XWV?ORR:PRPBnoppmDUURRHXpqHUW[?_kljm=UUÚ?egfiM_‰Wq~|=SORE9XSROMZZY\OBVTWO;WWÀY;g{Uc~VAQPSAKhic\>RMO=WVV?R^^RJYWWKGb\\_DMTQ=][Z]D=KSSNAVdceI>RR¼DMf]‚Š[aGDH:Jdrn9QOQ@OeaTHhecAGROMA`kgfODQQCedcdeS?9Z^]e€\a`1FPTUFÿÿÕ¶¸º¸yˆ…VCNMM?E[eI]rtcNGAJ>@QcjTLHR4ZfqriXºÿÿûsmnÿÿñj]]jÿÿãÝ’v‡‹ŠŸÿÿøÃÿÿþxqôÿÐÿþpÿ<ÿòj>jfn;85310/-*&" ÿâ§¥¥?<;:C63.4.(# ÿþ©ÿÿç¤@:50-(%" ÿå­B>96=940+&! ÿ祤¥8=83.*&"  ÿê¬G<7<840,)%"  ÿë­¨=9@<840+&!  $ÿ鮦¤ 7?82+# þÿ(ÿ饤Ÿ05-% ÿ,ÿí¦<5-'" ÿ,ÿíþ·E@940-*(%$#! ÿ-ÿîþ¶§¥H9@>;97641/-*ÿ3ÿô§¦¥¤¥M><860ÿÿÿùª¨ª±ÅÒÿ*ÿúàÙÔ¶¿ÿÿýABDDõ@Lrstv§­ÃØÿÿþìÿÿ–wHFEGF?EGCE›­Â¯-./124689;=>@BCEI¨ÖØ©GG^`~¥¯³­KPNNEEGDDHiFCPœ§N8?:7544578:<==;= "#%&'(*,/269<99>=<<=>??õ>=<;;9:97788ù630,($""ù#$%&()**ï #&(**þ)((ý)+,,ú+*(('&&ü%$$%%×$! ýùú   ý  ýú   þ ü   ö   Ž@ÿ<ÿ8ÿ6 ÿ4 ÿ2þÞÿ ÿ0ú‡¡½£Óÿ ÿ.øÒÿàÊ™¨ ÿ ÿ-ö³´ÙýÿúÇx¢ÿ ÿ+ÿ÷àŸ¼äÿû¾¬ÿÿ*òûÿ—¼ÿÿúÊ»º¦Žøÿÿ)÷Ó¢üúù–¹æÿÿûüȶúÿÿ)íÐýðò™ÿúû÷ýÁ¨²Æ¢§ÿþÿÿ(íáöÿÿüù÷Ä­ïÿÿĪ´¢èÿÿ(í #Ea„¬°Îüõ°®èÿÿò¶ÿÿ(ì×½®Vr\?(#d‘´”¨Çª×ÿÿ(ú¡þú±õÿÿôºú·šÆ€=‹˜¹°ÿÿ(ìãÿÿšùúúá¤ÿäžñú­¾¥âÿÿ(íúõ|ÿÿ¢ÉÿóüŸ½ý̳í×Ýÿÿ(ïóûÿ‘Öÿ਻äûöÀ…Öoÿÿ(ò»¸ôÿÄ¢åÿÿφ½Óÿÿ(õãÁŸºÛ—‘¤Êÿ ÿ)ÿþÓÿÿ*ÿ+ÿ,ÿ-ÿ-ÿúÆ¢§ÿþÿÿ-òüù÷Ä­ïÿÿĪ´¢èÿÿ-ò„¬°Îüõ°®èÿÿò¶ÿÿ-ñ\?(#d‘´”¨Çª×ÿÿ-@ÿ<ÿ8ÿ6 ÿ4 ÿ2þÞÿ ÿ0útžµ–Õÿ ÿ.øÆ÷Õ·‡œžÿ ÿ-öœ£Îèýí±h£ÿ ÿ+ôðíðÍŽ¦Óåபÿÿ*òäîŠ©àØØ°¨Ÿ˜ˆúÿÿ)ðÁ†ÒÊÖˆœÐåäá㵪ûÿÿ)ùªÏÌÈzÖÏÏöÒ¤Œ—¢˜ÿþÿÿ(íºÈÕƒÑÍÊÈ¢‡ÃÔÔ§—–“æÿÿ(í ;QhŒ‘ ÎÆ”Â×ÜÒ­ÿÿ(죔F]O6"V€šx•²™Øÿÿ(ìŽêáÏÎÖԧ죌²w6r§§ÿÿ(ìÐyïô‡×ÓÎÀöÒ‹âîžœŽâÿÿ(Úïnïñ”«ÝÖÛŒ®ï¸£ÞÂÞÿÿ(íÞãïyÉõÔ”ÉäÚ§vÍdÿþÿÿ(ò¨£ãø³‘Øýò·t¼Õÿÿ(õ†Ò±¨Î‹—Ìÿ ÿ)ÿþÔÿÿ*ÿ+ÿ,ÿ-ÿ-ÿú¢˜ÿþÿÿ-òÍÊÈ¢‡ÃÔÔ§—–“æÿÿ-òhŒ‘ ÎÆ”Â×ÜÒ­ÿÿ-ñO6"V€šx•²™Øÿÿ-@ÿ<ÿ8ÿ6 ÿ4 ÿ2þàÿ ÿ0úQ›ž•Ùÿ ÿ.øn„tgLŒ©ÿ ÿ-^øq‡cS«ÿ ÿ+ô€‚sUcsynªÿÿ*ò}€Rc}hb`SŽüÿÿ)÷mV}z|Rat€€û{m–þÿÿ)íi|vwQ~||z}eX\dgÿþÿÿ(ípw€S|{zydVv~~g[\xéÿÿ(í.8LYZg{v\[t€‚y ÿÿ(ìoc\:C6+!%%:Y^OZhcÜÿÿ(ìV}]{|}a~_ThI3JR_¥ÿÿ(ìtM‚ƒS}}{rW„uT{]b[åÿÿ(í}zE‚Xg€z}Vd€j^yhãÿÿ(íz}ƒOo…tYbs}yaF‹Zÿþÿÿ(òca{…fWuˆƒg`¸Úÿÿ(õ`obSanmosÖÿ ÿ)ÿþÜÿÿ*ÿ+ÿ,ÿ-ÿ-ÿúdgÿþÿÿ-ò{zydVv~~g[\xéÿÿ-òLYZg{v\[t€‚y ÿÿ-ñ6+!%%:Y^OZhcÜÿÿ-@ü;ø 7ö 5ô&! 3ò94.)$ 1ð©C7:6/(" /îÿ´ÿ·©4;2+" -ÿñþÿ¢O:3*! ,ÿóºP81' * ÿôÂ>9/% ) ÿóþ¾¤26+" ( ÿ÷Q91% (ÿ÷½N3%'ÿù—-! 'ÿú0( 'ÿùþr,'ÿúo,'ÿùþo)'ÿ÷þÿ¥+# ' ÿö¶ª65(' ÿòÏp]>@:0& 'ÿïÁª¥^A@;5.'  (êKG\L?ÿß·kbezfwlB^Y2YWYy{||…FYY¯WTwtXX\^@rwrvyE`^^VLqoomOw‚O|}|pV}]{OMLMM>XWV?ORR:PRPBnoppmDUURRHXpqHUW[?_kljm=UUÚ?egfiM_‰Wq~|tM‚ƒS9XSROMZZY\OBVTWO;WWÀY;g{Uz}ƒOoPSAKhic\>RMO=WVV?R^^RJYWWKGb\\_DMTQ=][Z]D=KSSNAVdceI>RR·DMca{…faGDH:Jdrn9QOQ@OeaTHhecAGROMA`kgfODQQCedcdeS?9Z^]e€\a`1FPTUF`obSaÿÿÕ¶¸º¸yˆ…VCNMM?E[eI]rtcNGAJ>@QcjTLHR4ZfqriXºÿÿøsmnÿÿÜÿ ÿñj]]jÿÿãÝ’v‡‹ŠŸÿÿøÃÿÿþxqôÿÿ%ÿþÿÿ @ÿôºú·šÆ€=‹˜¹°ÿÿ-ñùúúá¤ÿäžñú­¾¥âÿÿ-ò¢ÉÿóüŸ½ý̳í×Ýÿÿ-ôÿ਻äûöÀ…Öoÿÿ-÷¢åÿÿφ½Óÿÿ-úÛ—‘¤Êÿ ÿ-ÿ-ÿ. ÿýÿ. ÿ4ÿýÿ4ÿ}ñÎÖԧ죌²w6r§§ÿÿ-ñ×ÓÎÀöÒ‹âîžœŽâÿÿ-ò”«ÝÖÛŒ®ï¸£ÞÂÞÿÿ-òõÔ”ÉäÚ§vÍdÿþÿÿ-÷‘Øýò·t¼Õÿÿ-ú΋—Ìÿ ÿ-ÿ-ÿ. ÿýÿ. ÿ4ÿýÿ4ÿ}ñ|}a~_ThI3JR_¥ÿÿ-}ó{rW„uT{]b[åÿÿ-òXg€z}Vd€j^yhãÿÿ-ò…tYbs}yaF‹Zÿþÿÿ-÷Wuˆƒg`¸Úÿÿ-únmosÖÿ ÿ-ÿ-ÿ. ÿýÿ. ÿ4ÿýÿ4ÿ} @$$$$€2@apache-commons-rdf-0.5.0/src/site/resources/images/apache-incubator-logo.png0000644000175000017500000001611113175455642026752 0ustar andriusandrius‰PNG  IHDRå9É5ìBsBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<ÆIDATxœíyœU•ø¿÷Ü[ïu“’@ØeI‚$¬"Šh  (ŠKpp@Q”Ew@æg«8²ÌˆúQÇEqTøøÃ}aTÐ%BØB@HL I§ûUÝ{îï[¯ûõËë¤_/~¾ïçSyU]÷UÝz©SçÜsÏ9e€H‡ž5¸†õb‹õ¢C‡Y}%ùìH‡9eK÷¢C‡Cée‡Ï2Üæ›tèÐa¤ôuÖ!çm±&ß›üû?;šcÒ˜²*ãÚ»þˆÓ÷ÕY—xo rCȹ`ê¹|ªÃä@öŒ å—ÿ³g»èØgÆŒíçLßaÇ™Fd+T×=½ö©‡V®üÛBovX|æ™gv¼Àžsô~eÖ'LäBc FÐÜ 9k¦LÞf{s梑ÞÓÏœP^~ù;m?eú1û¼àÅÇî´Ën3«Õ®É1D¿nýS_¹rù²5«W¬^õ÷åOõ×ú֢ůO;óßœ¨¾tè0Þô~yÖ¾ ` `5GBn _æn}Á’{Gx¨‰Êžž•§î5ï°#^õ¶=gí}ˆX碆âɕ˗<ðÀÝw¯}jÕ%xOòhŠâú·œuáÂñîϳˆsIN¶ßÜÂ}é0V~döxÔ{ _PËý¯N?ëçîüXP®ÿ/ðŠq:îh)HN¶þc ÷¥Ã(YyÞÞ;«‰‹0L´[Xm-«1ì´fúŠuaî´ ~d„‡œ8¡¼¤çœ]=ü¨s{é+Þ蜭jˆù²e÷ßtÏ_n¹ÍºJ¬‚$D ª¨÷ø¢ÀûœZ­?ø¾påÛßsÁÊ1vgà  »ÜV`àÑ1w,t„ò9NìArÎubã|,Øj¸RºØ5z©bwT³CŒLÞþÁ%Ûš« #%rÑEïÞý¥Gዟ¿À#y^{ú/‹nºzÅŠGŸÈ*]dÎ!6C¤aŠT*20sT-1?6F¾c̘âsÿ™$µr» œ4zÅ^P¶ø"ðà` ðy`Y¹ïàdàyÀt`5p?pECH^í€ù¤ÀàOÀwËõFŽ^l \S.Ì/û¶'ðw`iüÒ;’‹ï01,{lßóÄêühA,ø(Ja46’þûøŸ6r€qÕ”Ÿ¼àŒŽ<öuÑKŽ~³ˆH__ïŠ[~÷Ë«Öõ®[[­TpYç"R ¥ŠjZ¼÷ø¢F-Ïñµ>jyÞÞõ?>󜞑”[ñ{àpàGåök{¹ mþøN¹þ0­aß2`Ð|˜AaVƒ/V/&iÀkÊó4sð-5å `‡¦6¯®-×/"iÓ¸˜ Ln^F'^y‹ðð›÷}qÜjl¬ dñKÖÆ³Œc#õψ9zÇ‹ïûm‡ÎlÜ"zzÞwÚÔC_>ÿü½xþÉÖºj^«­ùý?ÿv] +Õn*• ÕJ…j¥›jµ›jµJVí&«Tq®‚s—¹$¸™CÄR©f‡¡[{/)׿W.„ìEÃ|ç£$øÉr{7àÍåúͤñè6€^’Ö|MÙæ äÅÀÎåù¾Úâ\Ë€7ïbPÀ^_~JÈX^Ãåß"pðÊá.ºÃÄqÏ‚}+Z˜ojÍT´fˆ¹ù15óÏZ34-‹ÚÈÆÅ|=òÈ#ÝÜCzÇËæpŠX[ñEmíM7þôŠ ž^W­td檸,iJêæ«‚Šà­8žE5Ã;õÙvÿýßíröÙþm];•d l~Rþ­—¤mÞB2)›ù!ð7`1ð¾²íå¾ßÿ| Øرá{Û—Ÿuá\F*%iÏhq®kIN(€w1¨9_U~$ ]Ç“² ö~Öâ˜&lƒ;_­˜´!ë ¬ÊÔr»a‰Ÿí9ÆE(O|åÁǾòø“Ïp.ëªÕjkn¾á§ßX·nõšîʤA YíNÐUÉDˆ"1ª€ ~ЫšQxG!B¦~’ ´ƒ! %¤ùÚ†uHã´0|†L ó$’f„dzžJÒV·Æw³t"L-?§t,µMÛuZHfk;ËÏΘòæÎ#™£5ÿoÆ ÆFȸå]IMiºÄÆßîzÅ}?Úü[3f¡\p¾»½âÕo:k«É“·‹1·Ýrý÷Ö®^µº«»W­ d¥BÕU1Ϊ$1ˆÅc±’–ïÉÄá3Ar‹ˆ›#¦M‡Ï<’“’嘦ýÛ¯&iÆV̶+×—”ë§”Ûÿ‡4Þ8ž¡B¹”dnÎ! s]ئ”ç\:Ìùš¯­ÞÎ'5ìëb踷Ã3€.7é )Œ‹UcyœÈîXl“–,¼•÷åûÂþtõxœ·m¡<á„·:ꕯ}³•ì{ï¼½oCïqå8²®%ÈUk“·ÕIB#&ˆ¸‰ "¢Nª!§ ±>Ö11 âÆ]›1cßv…Òo>Cò´šM7ïÐaÙw)2E‘Rðô 0oL2YÎÏEúˆñ:Œ·à¶Ç”•0eŸ9û´gïÚ;n»yIwwGºú’9ª®ŠË’cÇ9\] ]ÄŠ‚ £¨ŠdÎiž{+B Ôe²Y,ãÚ•U†:^6ÇwIs|uŽÞÞî5?Ëy#iª§‘Çoo¾¼ðßÈ­$ôsŠŸÏ>®}ï»CDˆk¢aª‰dÄd¡ ÑÐ lWYßÿñ:wÛBù‚ƒ_6oÆŒ]&=üàÝwŠuê²$ˆ‚i\šúpÖ†ú¸Ñ:2É‚Q€<ªDU#bÔ+‘ˆ‚Èp6y ×šæÿðM±C’ÖìahFÇs·’‚ ù#[F({Œ~ªs)ÏA¡ì*Š7cw,’Hø–‰î­õmƒ1šÈßàŠ;ÇÍÞ–PwÜì­gÎÞgß<¯mX¼øöG²Jç2œd¸,#sÉ|McI§2 Œ.8É‚µb”ˆMv¥1b´°‰A$6&º(©"¢¨‚-b6\ßZÐ5×Üá“`Ì;‹!£z°«¬ S ‘ˆb’žÌ}"ã:=ÕÖ˜r+˜µÓλoûè#KŒ!„LVÊI™ƹhŒ­ÏGª`4 j+$Ë‚­Ôç,E%Úh‘ØL0Ð%-ÿ ƒëÖdíTr¿›ŸÐ¿"¥Wuè0,¿Úý•{*v^ÀÔØGxS};`Q,ŠTöO/~èÖ1 4Ò–Ö˜±ýóöš±Ã.î†ÿýá²”¨ì'dRš®’¦ùˆq*âÔJ¦.s!FQkmHµ¾Œ !6F|à Tª´Ô‘eíž”5¢PÐ×Fw#)bç RhݽÀ×è¼Ð¨Ãfð¦ú&ƒšdª Þ„‘×›RC&s6–ó“ñËã}þ¶„rç]g>Å.¯ÕòbÒ¤”†ålŠSµ’%éDIš/Ö§D,V³J%X[ 1ƨš[kmTÌÑUUSwðhÚ&åu• ®5µÖ=kIF o[u‘R¡|Ëo$5ýBÒx4$Ŭ¶#È»“"y¦“R¶³e¦Yö^Lº¦¥¤( v,nÒo±k¹ý() £c;Ì EGíB ¼XB ÌéoïH×»{ù¿÷Œ¦#ym>%b+ñ%EJ§O,Ç”‚ydʶk¿;lŠÁ(±ùzÜq³«S§o»Ã²¥¬°bÉœEÄ"Î"’Ê{XÉh"1ÆÌ‰Æä¦Š"¢`5ƨΡ6Ú: &¨+ ŠQ¦^‰ è`UTyÿ§?Ý߯µIªм4LûS€GHÞÂïÂä‘4ì)Ã|§‘y¤H ‡I¹›ß"µ/~JºaZqIø—z4’´Ø÷ )$osM j¿ªì×JRýäÍ|ogR¹‘'IÕö¾[.7‘¢ ¾ÈÐ<ÒÍqFC¿[±?é÷yœTÔì[À÷IÃ¥å÷75•%À9¤àM¤ÿ»«H¡”móóÙÿ²µbÕÒLõF® ȉŠ% ,Rš¯öâ.qM×3b¡œlªÓ¬q²bŲµ)êÆ•eyÌaDb‰Î¹J'6J&е1Æ«UÀE„ Á (ÉlUUcJóµY0CÌ7c&Êô¼˜¤Qwm±ïùå¾Ïoâû—29gãHH Ë7“JK63×Ú¸ìÞ°¿yßLF—¶µ5ðRb÷ô9‚$ g04­ÎdàlÒCc¸Ê ÍLe°ßÍœC C|­­¶ÝHˆkhí¸3¤‡ÄçØ8±`Tl(Š#bKÜ£Í[© ¤–é£]øäÒ©­ªIŒ™ ek“V,l1&Џ(^¯J7°˜(BŒ¥óÆ£ÅF :G ã½—«FM0…ª$SÝc’–ôÁ¥j ¨5>9?iJáü´{7­S½ÎÎcó¿¥%MœÙVïÆŸ¹À/LÆ®sIcm¿Ñ76fçò;¡'“’F2Íõzàë-þ~ãü{ÖĽ¸îȹ:`ßÜ(åúÓyËI\ÝvQ¬‘0b¡Ì ºõÖÓÖ‹H ·ƒRÿ„A ¢ØXïµ÷ðbL@U•TP55Þ{QUShAЀ†€jQ fAиj®¿JÒ’#åc Õ„Ó~‰ÈO“ÆM[’½IsŠu„tÓ7Ï1nŠi¤ÜÎѰÉéÖN„Õ›ZŒÌòTÇ•'eÛç\Xr#Øçk£@F»Þ‹¼áÕüì¯ã}î:mM‰ômX_$!,£RKÁ¬ÇªÖk_X‘( Ž I†Z°!¨ !H*ªi)¼ ¨ÒxÒ{T=Z(<¾P|ðãu×™O{ã£=€C¶G¢!›ÙŠdniÎbP[Crê´Ë‰ 架ûH¿C»\а>‡#™FE=rÉìóvÈ%;tL¾% ÷i´kÃ4HÀÞ£;ò¡|榲ˆÆÌˆo(µYÆA!,µ£›T}:à9G Á@ jCVU­Ñ0 ”Q½D¯}$å+ ÔãK­j6Ì ó÷y¤Ž­˜S~ZZgÿ¯#=Ñ·!Ñz””kùpi<öL”ò¸ŸTþu$gU3U‹s½ªÅ~Huˆ^E25[Uùî^º™~¬!]{c9“[´‹¤!ÂTÒïÿD‹6‡’r]ah‰ÐF’†#.*ÖC‰oùÔÞç™kì¤ç…h¯TÜ‚RŸT¤§ßm3iu—ã§¹§&tZmÄS"±`½ X±6ýQ, ¬H%£ÄU•'o¼Q´¤ªŒ1>)´ÀI½¨/ÒxÒ‡§Þßó™æ"ÆãA+síi’×±žB×lbÕ5ëÎ ­8Pç ¤j¼°?iÑf)V'!,²>¸ªš¦8ªT¨‰Z¸›;™­…õê­Q/QU¼Ï-`|ù_”©ï ŠkÄD­Æ4u+|¸§aÝ 8œ•ÑìÚT©À’4¤#y1Ç+a]‹¿5›äÃ%POjúlä1†^˭ã1ù|=;ölÚ¶´ž–i.õÒJSÂ`_í0ûG•­ÑsOÏú͹àJ‰úQCüÍZ7é †8Ob¬¤?lŒyÓ¹÷]zËhŽß#6_ñ‹j–¸J |È@2ÇZ–Œ!¤õ4N4uíXXÕª/¬Q•Â{«1JŒQ‚/¤nªŸ§qeáÑà!øÅãwÉãÆ´.!y*ƒ7]½ZúoëHsŸß%Õù© d+  ž¢ÖJÃÐ €‡Zìß¡&ép™1uAXÑbß,†Îé4Ðx ´*½rI{íR¶ ´®µôzµ®cx¯êæ†1Æ KÏ=]çÏ<›ˆùu0B”ìÇjähEFF–‘kÕË3òþ™¶œ÷à@å’zˆ*Z?Xò¦ªª¨÷bTE‹ÂZX-’@zõ¶ðÞÆÒ|MΞ‚¢¨á}-iG_PxOðÅãçö|i¸Ò[’œ4YÝ̤H’+I&ã-ÚÜаÞêBòÒ~i˜s7:½n¦Í5$3ú:Ò<^+êf^+Ç…+÷_ü˜=Ì1iUúD€ÿ$iÞºÿM‹v;wZwÐzœ»š4.Wz–öô»Jõ˜`䊀ôöÓ0¶Hé *ÿ÷#^üÀxŸ»íeLøþÅ0ù°V»ÊLc4MoØŠh6ˆS´ íŽbÔˆ÷… !¤ÅñyŽÏ=¾æ“éZ$Ó5/üpfÓ³¯Óºlän ‚nÅ×Ö[ 6Àû‡ù»6}ç7$­Ý\X¬‹ô’¡á¸ƒäô:‡KØØ#:™ÁW6 g.6ò}à=#h÷Zÿ>Û“œJÃñ F¡ 7Çùû~üÀBõPg¸+¢ãÜhø’ì-›´ü†¯,úÊ3öÞ–¶4基b¥‰:`.%Û- Š–ê9^½õ­zoÕ—Z2;8%RÃ5¼Ï)ÊÅûŸ÷¯8ïß?7QãÉñà;@»…’~H*MYç>Zk˜M}ÿ±†mOª Ûx/ƒ&ô*†–°-`øâÖÜL l‡G˜×F“o=yÉ¥íùpaäòˆ¹Z‘ 1»è¯}âãýøuϤ@Â(Êä–Uh@CÚÒ¸jŒ‰¦P7MëÂèÕ[? ^B(lÈ ñyN-OoÜJÂY> öºq¿âñ%’žøwo®aÉ´~§È™Œ,X|%)»¿™+hý¡Và_ÙØCyƒo §3²‡Ì;IS.#aizé©ÑvjxL¼üèˆÆ¼¢«/þâÒ¿~ôÛVªí$?Œ+m å‡>ô_«bЛë¯Do|•]8n¼ªhŒÉ³ªÞªªxïm,Òû܆lôÁÖ|Z­Ô’yNÍ{|‘ŠüÏçœéD Œ7#ÍinJCD’f˜ÏÆÞYHñ¦¯!™†cÉiÒÊÑI‚ý>6}ã>L2i[¥RÈáGIY£eMÙÏϳiS³·l÷¥òÜÃq)ÎöÎM´<.ö,í鏸®LÀ`dŒ* ÿïé¹åÊ+.›A`î€@¥Ð£Nœ„è½"âŒÄ˜ü«1M•¨ªÄÄû`s_Ã×JSµV#/jø¼†µeOövµ=×ÔÄRÒ8©™FWû l<-ÑxC^ÂÆÓ&hqÌ5ÀHaw'“¼–SIY·“¼®›{Uü¯HS'g’<‘³HÍ{IÿY6]Ÿ(–m¾ZöápÒü£ e¬\˦5²'Ý6;’„f=­ÏVÚ®—l~YyœCH¡uÍÚ§ŸÝtyÙî0Ò¸r-éºDò\·âÎaú3ª*ÿºß%/TÚFL£~ilOOì³÷öÇuwmµow÷$º»º¨T»©Vº±•,•Ž4Vë5wRÆÇ ªQ|^3ýy?µ¾^úûúèëß@_ß:j½½OLÚÖÿ¤“zÚÉýëÐaL¼kÿKÏ[©>sõ=[ô¾ÛëÕ{zzøÙ®ùú áå…÷N2hxujb|EЉÄû‚<裡õ‘ç9EÞ¯ÕEÿƒ¬ð?é9»#žYjÝÂ9À˜‹H½ö§/üå¾öPtîåZÏ÷’™‘‰UÓp!–y’…ø<§V«‘çu³µ?ïùïN=ý#­BÁ:t˜PŽ™óþý—‡5ã>ÿ9ZÆ¥²Û±'½c5pí/ùƒé“£Û‡*û¢ºH0u°TQ¯ø"§ðµRCÖÖç¾vWþ…§žú‰*3Ñ¡Ã&yBŸ>»Í¶t?êŒk¹Åc=i5iêæ…×ÿd»þ®®VeF05zª!Ô¼÷Ú ÿ¤7ý{Â)Ë'°š@‡#"@×½ÏÓµN¤½‚J:üÃܹ§íµ÷Þoo.Ú½¥È8¦79wèðœ'È~Îuý|Kw£™Ž¦ìÐáÙAGSvèðld൤‚:l92*”:txðÿ&ÿ C¼r§IEND®B`‚apache-commons-rdf-0.5.0/src/site/resources/images/rdf-02.svg0000644000175000017500000003214613175455642023622 0ustar andriusandrius
<Bob>
&lt;Bob&gt;
<knows>
&lt;knows&gt;
<Alice>
&lt;Alice&gt;
<Charlie>
&lt;Charlie&gt;
<knows>
&lt;knows&gt;
<Football>
&lt;Football&gt;
<plays>
&lt;plays&gt;
<Tennis>
&lt;Tennis&gt;
<plays>
&lt;plays&gt;
<plays>
&lt;plays&gt;
apache-commons-rdf-0.5.0/src/site/resources/images/commonsrdf-logo.png0000644000175000017500000005252413175455642025724 0ustar andriusandrius‰PNG  IHDRd¨ËfwbKGDÿÿÿ ½§“ pHYs ð ðB¬4˜tIMEß9”Ðæ IDATxÚìw˜UÕ½þ?kí½O>Ì0Czï`ÅŠ( ¶EDƒ±Æ˜fMoÓî51&±w“X±5 T¥w˜a`z?m·µ~œ3x1–äæwo<ïó¬çô½×ÙgŸõî÷[!‡rÈ!‡rÈ!‡rÈáß‘;9äðÉ¡µß»kEá¬Cú­|ðå­C^YYK{ÌAJ!SG”qîÌ¡,üÆ’|½ù_‘̵þSaþoý“f‘[ö}Ý=„:÷óåð·Š³†ëÇ^ßyóκÎosåÓLŸPɈþ…DCm]6+67ñ•›ßbòŒÁ]7<¸úE`öeÿõ¦¸ãš£rçk9¢µ–=w²wõÏ,ìYÛ–€‘uÛ P™áÿ³ûË!‡Oƒ—Wìyñâ_½qb,éqïõGsÔ„JŠóƒ<òÊv–oj žòˆ†-^[½šÆóºýWÍö³‡V‹ï?9w®æðù%Œ20z,ðûÉ#{qÿ´ »ÖÚÈÌǬ̭‘µ x™áfn» åCŠ$3Wr“ÿo¾_w×Y?úëŦ,úþq;©¾Òܹd#ß¾s9¶«²ûÜ)@íúÜtÉ¡;®;wâÐÜQÌá? ò3Ž‘Yà@ˆdF8ó8XZk³{ÿ„äad>Ìl+(ÌŒ¼Ì>ó³öÌ"SkݽOKkme^³ºg^32#çûÉ᣾%~èâW·_ܳ¹ãš;©†Øž"a{˜†@Šô0¤@ˆô)´ îX²iÈKË÷|;w$søOÃgñtH0³àw›TF¸€Ó­´Öݦ&õTÌÌ%˜EJáÌcu÷wß|è´ÃúŒ7îl ØY*Èã߈à@Ÿ‰ÈzMg+%­u÷ýì×rŠ%‡ðÌÒjQqæCͽ‹#\tÊHæL«:àõ e >FÈ×µ$Xº¡ákZë»…͹£šÃçYÈ Èšš=?Ê,è…@AfägC$CÁ,% rõ/³ÔG·ò¥’É…@qkKó1»?nÜ}@Qf_Ýûˆöy™‘Ÿõžüƒ¼?[1³È°[¥ìŸgN­|¾1wz•þý7ŽÜÑÐãÇ §ðچݭüì¡ÕX¦ü8…ÍÚ-}~÷øúPîˆæðyW 23ô£>z‘J]´àüóî4hðÍ@IFØYJÁáŸE¶*ÑYÛëö{„ëÏþóíÛ·ïÈÿîw¿óæž½u7yâéË´ÖEB6nÜø­Ñ£Gÿ,³ðûY ¢§o¦ÙŽw/s¿Û‡âg½–í¤Wi‘‚Ψ•FN©|~°jkF–šl«í`Ê¥OÐÕžC‰s‰!„`KMñ”—;˜9|®YfŸèu×]{⪥Ë9æˆc.ýîõßÙòþª•—®Öº(Î(†nU¥‡Ÿ$CÝä uu³k:Ý#<#Ü­~oŸ×^{íõ†ÆÆwßqûÏ_xùoÇf¶Ý=ŠÒÌè•ÙV·¯¤,Cl¡¬÷eÍ/[Ñäe)”n•Ò=çP–RÉö©äÊ8¶ïí¤wq„PÀàŽ%‰%\¢!¢Ñ'4@c{‚»Ûr3‡ÏµÑYWë®ÖzïC->õüsÎ]òèâGyðÞÎ=õä ¿xΙ÷7kö-Zë’L"U¶"±³‰â@ŸJhÙ²¥ÆÈ©G‰Ýk——^GGÁöûWðß·Þqõ ±“¹ú²9¿Ï…Ø)å-¼ïž;NRÌ:mž^÷Èã Œg—bOÅ„ë/}àí¿¾Ô»´>uRc/ußE_þêíRñ€®Ì1ðøÀoÓS™è Æï¡d|­õþ÷å”É|?-0à¶ßÝúíŸÿâׇ´V¸ŽÃàá#¸ø’/7·à¼Û€2›Je†—™ƒ•ÙNA,;òÇ¿½û'£¦IÝæ5 ë_¦Æ‹‡oý% ¾v=OÿñgÜ{ïÝBÜߨÖ2ìñ)}²Q*"¾æaª¹ÚïC‹ÔHåñõ,P•Øh ¬4/éF$)fÚÅä•XÄÂËËò¨¹ø¤§N9Ìœ4|t»‹3óñ€X†È|÷î(3·Çð{Šê1r^ÿ‡PÝÐ%ªzçë÷¶·|ÿ¨¯=}C<å±òÎ3™þÕ§ˆOdºÚ¯`”æÌƒ8aj¿ª OQ“;º9|. $C"²‰„ù ºI¶77íªë®_ø×çŸ×áPTøJ¡”¢(¯€sÎ?·ùëW_u{$|6£~ÜÌâÚ›Œ[ôàÃ7Å{ DZm–=v³Î¿’š={©(/¥fã{Üøo¼ܵì•7~o}õq’ÊÁ.KmÌ‘ƒ±48* R>OÉ&NÒ¥µP>°qyN¶2¦4Ȥþù„ C…˜šev'Ûg}‰!Ã/Ãþ!#GîÏ‹ƒ‘‰×c¨êDçÔÉÿNtÄì7<¸ú¡ÛžÞø’ð5òmOR~ò¿N¿²(¿¸ôÐ+Î8jðm¹#›Ãçž@²H¤;7;ƒ<œ!“ ¿÷Ýèþû¯ B¤}Íé´«D*ŧÎåô/ÌydæIsî'­•gÛöèÚºúë~~Ãô™2“ha1Õ›ÞcìaGS½}3•••|sÞ ÛmÏ}å»CνlRþ0Aó—ÔrZãÐÚ㯆é!˜®‹…b…ÚÇlÝ _»˜h,¥Ø ;j#ИJQšÇE=aßç|Õ‹„ïaD%ºP)4ù›ÙÅÞj‡‘ñýL§¶T`}ñdN¼ô¢£2Dàd¾·ý1dâ„™+ç;ù_€ß­¹ò™¥Õ·ÞñÌ&´ ÑÓe|BòÐR®¯{å´_ÿ¸a¹#›CŽ@N"Ý&­î\ŽP7‘(¥"RÊÈ1G͸qëæS"á ÑøÒ$O2åÐ)\xñÅõgœ~ês@suuÍõáp˜;ï]„]ØŸŽ–z ˶ÕK†N+¦‡Bõ̱Ë(×¶T˜¾OPüÝìàm£‹Ic†PЧ7]#ûÁ”Éž~ìñ·eHÔþWÏZ^=óQö“JŽL>µr…yAýY>£µ>â–ÇÖýîÞç·LÞ²§ÓHG¹kÀu}\/E ˜˜Æ?þë(­q\¥úÞ±âÜã‡BìÉý:9ääàDÒ]Ë*»NV¶"‰Ö#?tøðã_ ¥ÉäèÑŠâ¹.Å¥E|ᬳ۾|ÉEÅRš¸¾Ë­·Ý…,B2ÖÁ¾ +sÌ\~|é™[wTï|õ‘ïýJ$¦ÞÙÍ0s –N𮳅iÖ,•‰¼€yÖÚÊDyý#—χ}'Y02‡±ng«1np‰ßØ–ÐK–ÖPÛCˆ´ ©ª"ÿÿýèÚÛ»á¢!ËéþLgÜ1 ¢¿®%®¿þ»¥<»´úó”a"ASŸ:½ÊžsÄ@‘¶ôOXe®ÜÜd*ýÑ?Gq~P-þÁñòÈña!D*÷ëä#L"Ùeس“»ÕH4£F¢'xÒÕk׬>!ÎGkIïöhí‹'8î¸ã¸äòK˜rèáüðÇ7ÒKQPRN0â–]uÛÖm›øýéÏ~¥ d².±”cC“iS”Š(Z( ¶×H>’B ¬}L&Š—üZfJQ­[ÉSŠá*DM@ûé¢ZÊç ÙÂYT¢ðÐL¥°<Â^.óʈ+'M*( 4¦6yÊj$8!Ä€²Ñ|‹6Û%1b<ÎÃ:í´Sï䃚aV‰¸¡PN|@ý®Ï;©¬ÝÑ"Æ)Õqç‹?¼wå¬û:/~æ•í`J¢A CK¸h ÇMîÃ' O<ùæ®3gÒ?ï­÷ëÔ¾gµtÚóï|f“´ |¥ X’“íÏa£ÊŸ¾êìñ›„ßÉ:×OþÕâ÷¿´©¦íìůl×f›–iH®>{ü·¸pÊ/sKL9ùôDòQj$¡¿%§Îó•åË–ŸŸ—Oúcú€™uvvÑoà@.»âr^zõm*+Ëihlæ±Ew¯Ü±kÛŠ›æ<õ•`$J]ì ÆD¦±!±œ‰¡Iñ¡x9±”³#G ½N4`iŸF¯‘ÞF9J€¥|žN.ãÊÀ4`*C+¾æav3φ­}*ÅЊ5~GÊ^¸:íKÑ€Ð.®<mà¢þe–ˆB+bÒlz¼¹·Öí1úŽM ²1aÓÎ9ûþâü¼û²¤§ï¤{|”ßDäþdòy!—”íýêüŸ¿ví‹ïî!žò¸höNŸ1ò¢0á‰ãú¼ºj/7-ZCgÂepŸ "éPíIWí¯gOºú°Ñ½ÅµçNØqôøÊ¯—‡Ÿ‡Âz³÷Oº_ºò–¿ßÿð_·íÿ|Êñ¹þÜ Ütéa¹ 9ääŸ ’ƒ©‘né.p Î;çÜ…o½öæL3diSZâƒuP „&e§H“¾ýÐwØ~辕{öV¿ýÝ™‹¾„ˆ« ÍJê“ïQžDH¹HáÑ{‡1á±X*­>BÊg‰½š9áÃ0”Ç»î&Î2†“RqL¥ (Kû¼®ë8:4Çs°2ªE( ¬õ8„RB¥b¢iW6k½zÎwK°-ŽJ‚¥&w¹õ ¬ 2‹"´ôq´A" n)Ù˼§ã»²°‚Tå°‡æž2ûö YX¤ódfîúGõ»¨,̇+ëlrùOè™ÒÜ‘üæôÊoÞÝØHUEÏüü$Uæ#…`w}÷<·™U[›PJ3c|ýÛv¶ïí<¨#\iÍWÏÃÆ]íÖ7ž CÓÿ¸ýûÍ%WlØÕö‡î:Wñ.›–.¤´0œ#rò/4ku;Ø#¤kNd ¿þµo,x÷ÝeS÷ì®-І#è¬uОïãº6GŒà ¿Ä+¿ØA(’GHæ‘R1ù´º{èg”biMH+òqH)—ZÕ³­mö$72ÍŒÐ>Am#0;¤Aʘ½|L–Ò<é®ãBk )|Ì ¡„}—m|YWâªôhŸ_šõ\"b(…T>ZJ”Ÿâ¹²Ž:´Œ‘…¸!„7v4S½±Êacñ†ôÁ™8æ¡ù§œ~{F•ü£H®žáÁ=KÔ«ƒ<ÇÇÌÿ³XKG²â¾¶Ô}çÎåŒ\‹¿>™ò¢0ZÃM‹Vóý»V`˜r¿ÃÛõAËøP®ÖšHÈâ†/Ou.?mô!ÄöO:‡Ç^ßyÅO\õ‡{;QJ3²ªˆ5wŸ%>‹3?‡ròÑj¤;Ü·[r`èîþþ3O>=åE‹&½ýÆ“Ãá0Bi‰– R€òŠ^V?ÆåŸ‚‡O‘ÕWÛH$»âo2,ïx|íP6¦0Øš\΄ðá¸*I»ßÈQ„­“D•BãVŠWíõžŒÒ^:1E€é9íÐä73PöÀòB†ä—Î*n÷†’Bƒv ûpW •yTàKC)L¥¨–):"Ì®*#Ѓ·íË:8Õ/Å652¬)›ìñ»øãqã9ûk—>Z˜Ÿ§÷«¼-CA,¥ÒS™¨ë}r0’ñ{Ñÿju²coÇÃÇ}ëÙù‰”Çš{¾@ß^ÑÌù7>´šŸÜ¿ŠPÀø˜s CèÅ?8^œ2mÀd!ÄšOyntÎ#¯5u¤ª<_qÊ´*ú—ç™·|mºŸ[^røO‡ùïØ‰BeÜ%¼wom¸oß~iÛwM,kî§­›{Æi+7®_ñµ×^;eõÊUD"y˜†A¦À:Ò4Ú¼F^m¹ KXŒ/œMŸà¤0éðšp´h’2€¡5Ín ‰aä±Ï^OU Cq¥¡L:ECò¥UH efLWšü€É3ñ÷˜>‚¸²1•ƒ-MÞtwòSFÓbjL–’¬6bœL§Ö¥ J2E8çX»X[3lðb¸™á­ùL½h75 vvÅù{y‘!.*©#°øûóœˆäMQ4u¸åƒG-.+­dôˆ‘~ß’âÛ³Hù£Us×G‰ÏÁuÖïÆÿ6RYò÷êùÕ5íÜzÝQûÉ#=¿´ªø$åFIW?üÃãÅ)Óä !âŸáÜÞUqƃû€*­¡$?HeI8·²ä#±)«g”–‰ä•ßü›ßÝ·j{}úõõ"†ÞÔ¼¯&œtüƒÑ¯±f—îjñþçžxŽê}ÕÄš[FC˜2iA¨ a<岦ýÞ—/Ð;0G'ñT'!£4Ùå70<:íAÚ„‰À$¨a©x;µ™ ‘A$´MDz(LéÓ>³˜f탴°„Ä‚”“"e˜éb^Ja›Šm2ÄDL\< +À^ßÇr\FÈ"âJVÛ]TRFž%I!÷j8vl —U¢ò LÏdcÒaÓÒ¬­uœÀnJ#oŸkç)v]¶ ì³ 1væÄ‰œ4ûÄ{8xrbˆ‡÷4qe“G¶²ù¨ŠÄtsüÿI&/¼»‡òŠ|N?r¾ÒÔ4¤Ãvß|¿ŽŸÜ¿êc«æj GŒ¯/¼»gØy' ‹ÖyLS!^Z^“± jrv«rò¯E¶3}åÝââ¢ê‹¿|ÁâŠgŸ=÷Å¥ë̾CGŽ|ä\š÷ì¤fóZzõ®‡°bóüP'ž~+àºó¾Fk«ÁÎäj $Ä”V:·D@“» €—›n!ß(¥wxR»ŒÍ?¤Nâh›Pp0í2&¤\llJC#i–a)$MØ’ü;Ó"ÓiÓ>¦R,½Á•ñÄÐX(<åñ'g#³C‡Ñ®Ü´Óͧ‘ÓD ©0¤£`{¨„Cu˜„©PÒâ§šoÒ›ÄnE²ÀÆ+éhgÆîСSŒÏ?œ¥°¤GW˸B Á–¾”„”æwf=óÍQÄ”‡,O¬ã¿/1ßEÄàýæ.^7|.ýˆ¡³•ÇŽæØÓÎx8ÜÍN{¿‡éé¼?XǃùWþGÌ^±¤KqAHÈä†V° ¬°õÿõ%…øÄ¥NrÈ!G Ÿà?EÄB;•ªøý=>:ò¨¹„ÞxAtìXC…‘âuô:†‘_Ö‡·ž^Ì´9ó©^¿¢cá•_0ùíã_n v¥°(åK½šNJh6Ä–RgïÁÖqLar’b“·›ºö­ ¡ØêKypÁáDÍJ žv÷OZ Qø4©6ÆœIƒb˜AÂÚgyìUÎNÀQJû…äYÓa$„KÉ–äûœK SI ­yC×qjh"-("ÒâµÄ{\&Ó‡©`«è`i(™ô¦IÙ˜Ò$¤àAvqÂÐb.ì]BªYÓëä§ïnçÊšƆòq¥ ŠÎ†…‹5¥q¶ÛŠ@¾ÏÈÊ<î?]˜[Þç±êzúõŠrfUÑÙªI" aÖòêoþt^pöÃGNÿ>èé“îÚØÓ¼Õ³KÏ‘­J´þ—–gé.5’´=Þ^WO$ô)Og-)bI¯øŸšH†/¤l¯í¤3îæV–rò/PÙ¾n±ÿôÔ’'ûOÛ{¯¶~ãËó6ÞûÀ¢#›Ê‡6öqØIsñ›-k–1ç‚Ëii¨cÆ„¡K£fóÆâ)ïÔ&Z@Ä©§„""f€„ׯTc ]Âc\á\ÞH¼OIx(;c«Ù“\K\»H BSÍt%›Ø{“€4) ÇQJƒ Š(®vÀûOrLé•xx( ަÔȧVš„Иxn3£ fóm, IíÒW Ú ‰‰iñmö„ )4ƒ”æéäJ¾-Ò&¦2éð+.×å$hÄR𸷫ü^$wJºš’¬/Lñèž6n#èÊW´iS‡)>ï`›×ÆÌÝyœ c'ªR¥)6Ú¬mébÁð>xI½Ç&4xW$ØübùM>ö⯜ùÒèª3å!’ýi0‚±'="„Ð#y‘À­¤#è>*c¾g·ÆƒÖùÊ8æÿi2™9µ/k¶5óÎÆ C|¦uÍÖf}þ‰Ã_Äeÿõ¦¸ãš£>õ|jb¤ÐÔ6Çyí–¹~w†|n‰É!G ÿº Dh­Å+/¿8sGM= rû&»yÌ]yvFåø,}þ N™!ø6ï¼»Œ†ÚFMñ騯®¹ò« WÒ_Q]Òß´¥Ú¨A ü$…Úe½ßÁø`­žg¤È÷cLñ£ó¦‘*žÍÊØ \csl¶öA+´’w§…ã êímÔ$ÖaH“«åÁAôcXÞ1YNQAmê=¦‡§÷“øÒÀÂãUÝÌ=)£XÚaCüï|94–våSÙ<ê×rDx /Î&ÝÂ%rMøH¥KÍr7˜GÓ¦–ï1 –x[ù†.§]+‚¾Ï¾‡ç ¾e¢S eÑbhþ¬Z˜¥‹˜D„TØ Ëw0”"œ4x"ÑÂèaæ•–’XŸ$¿Èâ9Ù^ŸbFG_$‚k¸X"Jû®8TïÁŠî`\å**Ö?5_+M—Dñ°ùùç>>ã¨#ïâYÿ¨¦WO³×d£µö…ŸÉ‰pÆŒA\ð£¿ê¶˜#<7ãñi‰XâÇ÷­äê?,{ù¿¿:mÖ§ý¼ë©9‡]þäÔtÄ—`[M;›ªÛ–ª*ž–[^røOÇÿt"a·ò’Îÿ0ß^º¬öð©“®ZõÞÚ›ß]±êñ°%÷ÕTŸ1óâëhmjÀ©ßyÏÜÙ³¶ýæ¾?ÿbÀ°Q|áÈq 3W½þ ÏúáèV«¢K§è2,ŠD‹¨a¾9œv’Ò`µ[Ljà0F_˜¬òj„BRíìe§³‡êÄZšt3B ,#Ð(4®o‘…Z•ô %ß(¡ÑÞÆ ¼£@û•ƒÆ¦KX˜"Ýæ4á·3Æm¦€0a4†öñ„Í:aPiDÐÞñ3‚ð” ÊçMÝÈÐp”Jg½‡…àÍÔF®µ‹éÒ6Rˆ(Íå‘z®£ÊA*EHKþ¦÷ ÐÌÕ½ñ”€Ý0OÁýbóý$¦p1|ƒï†š9[ôfâ+Ÿ ò)Õ.wÈfòœ_ѯ¿…ÞšƒŠ­±$M®K§“ jÀ âáéç½¼õ²_<òÞí»êº€t)“oœ5–›¿:=çÉ!G ÿVw®BXkÍ”Ðè'„0€R'•pëÃOßrÈa‡°û½å¿?ÿ¼yk…îCK^¼/éÒvéNú|÷½Ucúÿ㯀Øg¸”a°~kÔòU1ˆÐ&%­8”Šq8†ÅR¯•A…ShÕ KÅÙEfÛO°;¹‘ÚÔ&jÝÅR©D IDAT¸¾"`„2³WhtÚäø:Ý<1(ƒ[U”úQl ¤Ý­eHô(lB£ÙÙõ '†§ Ð”KÁ½ñט]t&)å²×ÞÀ9²׋c¢ˆ¢ø£»‰c¢G§|Ð ªƒ9ñ¾”iBQšÛô.NN%妰ð Aîv7rºÑŸrßÀB#t:¥;ûý1ÙÈ—T6š€ç²ÞjcI Èeb¶r*|¥hÄæO~5×ùý13î‹`¥ÉÆr‡u^œ¡UELì•O^i”Ô}þ¾>ASMŒÝL˜6‘¢q}i­(|ò‚ ¾œª®mRƒú•yÀm¤£îºë|Ù|P¦¥û¹ìDȃ•^9  KzÁº©=Yzëë×ýò‘÷*Ç*aÃî¶ÊO¹úÒ¹£…ç©Sï¹þèz!ÄŠzïž\/¾zÆX=ûºçïz{]ýÅJéÌ9Eyž¾éÄ1‡Œ,ߘ[brÈÈ?G"ÙE³K™Dà¾ÚÚ_¯®i9Ôílºùô_žéNèݵä¿ì~ç¯;vÓ?Œ¥Ë^3jö-×é°Ávi3R…ˆRZÜ"wq•F§öi—>­Ò 7i¢¤ä}£´èp\|šµÃf·‹’` v#•¡>éy*ŸÝîvZSÕìJm¥ÃkÀ”Á |ø¢Xᣵ‡@RdVPêO‰Ñ—¨YLYŠ‚?N‡n§N„™XH‚/1604“x¨¨ö›‘ÑqmcàÄ¢¡ã N’}1I'#6«öæ $ß‹t”×3É•œ‹áyh‘~ÞÐéªÀÚæ ÝÄùºŸˆ‚§¨£+Ò—£(D*Ó÷ É[n5às¶_Ž‹Fx%ÂçÝÌ!ƒ ˜PQ€cjR4áÎq¬meŒ²  ¥\"BNt±ª¨™¼Ù&cÑà94TžÁð©SéêìÔÓÇOv%ܵ¾ºGÏþ(•5OÏçþôÚŽÒÇ^ß¹ã±×wFò"–П@¿¸žÂ±=D<áhÃ4DÐJ'¦¦_éS UÞqõ9ã—NÖëd€g–V‹¹Ó«ØúK6¾òëGß?¾¦!†ç+”Ò!R0sJߨß9æ­ÊÒèÉ‹^Þ*Ìžó‡ä#ÏH ë\ÉŒÔ]<öËKæŸõ«Ìc}çâ'vé¹g|(ÌåëÞ›PqÄõ?ȋ٥eÌN&ðkYÇUþ’RÒ*<TœAF1Ú´ð€÷¥C¨×4\í×IÞõMJ"ìôNÆö’!ˆ¹mÊÑZÓAœšÄ{쉯¥Eµâi#“xؽ–i|L@ð|?]ö]{„d!Cƒ)0ËØ•\Ëô’ËQœ #Ëqp {. §Þglô(@DÑììà\Å÷Rhå‘/á.µ—Ãc@L õV¦P…T:—‚H×ëB±Ûo¢ÞmãDÙO("><®¶Q”7Jea  )R¡¹×ÙÈ™¢?•JT>†RøÚáYÇ·½r<4:*!Qd°Úì`ñ¾©/EH§ý,E¶'wP5S1gj?\ǧÁðøÛëõT¬ò¨h©5µQ›øYÇqèw¯\< ¼ô=ÔȇÌY©R<éKʬrªSÛ…ëÛh­Iªhi"¥DöØ~’V§‰Fw»R»htv€’߉OwS¬îpaS¸Ê$¦4±ý•Á‘€ÇáyGÒ‡B"¦IÊéd³U„)BHBÊ¡%þ'Êþ„µOÅz·–`ÁüLYù„jÇEQA!–N×ø2=‡¨¼no¤L0Ñ,G+M šûÜu (šI뤙[%)Eò@j—˜#1”OHûD|Eje£îä|¿WùBaawÉ:Þ«8›*¼tæ>–ò)k¼\?#ŸpAË’<[_OÛ«Ìa<íðÜt5MÏ%_ –齺é7_yé¼ùÜœ!›‡g—_ù(âð?i{*4½ßþeÝÊû^Ø2 3î„Úb6žŸ&zC Šò‚ôéá̃V\{î„ß!÷ºC Þ^WÏ{ÛZ8lt97^|ÇOî @uCŒ=]ì®ëÂ×pç3›Xº¶^Ÿâð¶ CJû^sî„\c©rò‰¤›²Ûß2Ãäƒ"Ýï‘Y# µlÛZÝ»þ†«î›”¥ë»˜‹`´hÞrcÌR…t.Â7x ØÂùn) vKèw$Iíâ*'¼½ƒƒÙØÄÈhl­QÊCI·‹r³Otw(QBÑ•ÚMQp0#@ÊM°)ñ­~‚{7mþ>P2Ë’Õ S~ÜæøI„4©†EYhùFo"f¦Œ0*±™< | „ÉÃ"ÆH£ €\–Æßâ˜è <H e1‚¼œXÍÑÁä+©5Òä·É¥ .>›Þ*IKy+Å“öj#‘x„ј^ŠzÇTq&¨(R¥ƒ¢L¥!ù‰¬Æî=)L~­(šÆäk|g`¾ á¨ÉkëÜ8Š^ÚÅÐ K+"ÊÅÔšB_Ó•ê¢M»×¦—cö‹3Ž=®cê”ɪ0/ôБ¹ P¼÷IösÝ‘]„ïªë:á®g6U>ùÖ.ÕØžÔ¾Ò*/déÓf Ô¿¼ü0+?øÍÇøAN™ö•§õ+‹ÞúÒŠZ ¤ãƒ}¥ñýtÿÏÓ\~Ú(nþê4ÂA“š†?ºo%/¯¨e_s!¦!©, ÓÚå €ËO½ù×_9|TnÉÉ!G ÿ<‘Y¤Ñ“<äA†„2ìÆKwÞwÂ;Ï<ö£ë*ŠÐ1Ÿuq7 Œ˜D$4·ø†ªÀàiƒmÓ5è8Ll\íòJ¬ž*£U=UÁ$ýº„A£Ú†# W¹¸H!x?¹aÑ)ÒÄ×.µÉ ŠŽF)pý$uÎêì±wÑ©ÑÊÇÖ~'üA>`àú)@ ¥b”9^Á¾ 3JÙë¶W8©b€¦&µ†±áÉø^‚>f¦ªÈªÄŽ Áô&Cø,J­aXÑY˜*AP¹j—ޱ2µ‘S­Ñ¸Ú&ßw ¡Øî×Sé8 •…Hî›’®ubðkµ¯òB´ö³æ-ˆ¢6?Áw…8†K¾àg%Œu'cªAaåPéî±kÙ…5Ødؘ|ö̳ÈÚR)¶%S¸Ñ*âý§QPÑ÷ѽ5µZy¾„ÃúЩSÄàþ}Í‹Ê2s9S¨ËQ]ë?¿?Éñ“FymØÝºàŽ%ºûÙ͈¬ªŒJiŽŸÒ—‡¿ÑtäÒšÐÌ{Xò#Îy°,Éš»Îlܧ°,·ìäðŸóß½ÃLe^8° ¬Ì"ƒÝZ€“é)ž7ë’…¯O™uäæÚ;~°¸¯}Jo·url<„Ž+Fî Ž8IS(RàÊ}ô%t)EŸT}Ẕ¨½ØH@Ê·Øè´1)G(ƒ‰@ãiPPc*_¥kZ¹Î^¢f%¾Ð 5I¿±ÑéÈèQtøqZMÉŽØJêÜzÚÜÝh <åbÉà~ÞîV(#´_±lõ÷±-ÑÀk~ Ë0(rwSìK‰5€v¯™j¿‹b³_»t¨b©í9„>¦©Iz ¼èÕ2¡è‹¸ÚÁB êTŒ˜]ÍaáÃhU "*ˆmš¬qj™L”^V!©LfŒ£|¢Jó6,ûÒä`ŠáƇù–]@§„bmò=ÙF9“˜Œa ×÷ ϻՌ-‹ó¥Q•ȀķA7hì#hQ ²a_œö5ïéXCUEpÞäÞŒò2jиz?Ø—7Ú)G!â{KÓF¦Îûó AUw1ÒÝ•³#¾ºo=ÀÓé/ó±áÂc–,ÒZm벯ìõ]û{ˆäE,¾ùÅqûÉÒåKþQå_! –p¹íé½rKN9ùבˆÊ¬¦Ùƒ,âèÙ¹¾Âï5p˜·ýØßÒËùÍðªbj^i"0¦œxÌáо嬪Ž1B‡ÑŠ`“¢+”ƒ%$Òí Ì·ˆHØßE•Õ7é ­Å^+ÅVƒ0érðZ@qÊft°ƒ°U¥(PÉŒ½Í§Îï¤ŸÛ ú¯ø&ÌÄžç°¼óYÊÃÃØëÔ²7¹[ÇðµÄÈdÉJ(cëô›èJ´R­W°5¶œaQb FE…Õ¿»›1‰bê$žÕ—)᩸x˜(!Ø“Ú@žYFEh"IíâȦ¬²×r”(À!:•"à§;0zfg¼Ýè¢sPâ@e ]?Wê¾t˜š<$?¥†¼Ò³H©8ž"ä „¥YÒ±”ïS€ÑRˆ»É&^àYˆˆ¤8dòPW]kSœÔUB…ÈÃÓ?îcz S‹»‰•I.9ºþåñ… ˜¨€Ä*Oñ‹?|ëì>£OŽöëmœ²¯:ùâÄ£gvŽ=ü×2Ifˆ#Ù}ÒƒHþaÞIGÌBˆok­c%ïÜ𛿬ÓÓÃúrüä¾8®Ïú]m”ùõ£ïïoZõQ î}~KnÅÉ!G ÿBÝ·=Ìj¢Ç}ɇë.y‡ÏšóNrÖœ™¯ýêšËuŸÁ•Þ ¦G[L­ÐÜ_[Ïäqe¤:\¢m.{­LÛíh«ë¢ÀÉ#Šæ)«…INòm'@™†?†Z \à b×ÑKçƒ!Q˜ôFRæÆp¤Aذ±ÜNªT+JJTʧUn£ªèx”rš&ƒ#èÂðð¶Z}8%8„j¯…=~;»íM4º4ªz<åc™Q$"S’J OЈ ´¸Õxʧ>µ;£4hˆ˜ùl’y„d!+Ÿ¸ÛȈ¼™„Œbâ"€¡ T‚wRk˜k %®|¥IŸ”L÷@éô›Øœ7býy8­Oqµ5„¦L›àu -½Î"¢%A"¨KÒØô?qûàJßICÐPHÓe}žË󺋳º*‰J# hS>¦ò ÅOnoÆ/ rþ‰CAŸÒtmï"5±,7w·°‡SÎìϸI §Tïl'_v´tÉ zòcÎNÉþ}鳚Hj$³ˆÄÎ6m}T&|w7A!Ä¿²mû¸Á%‹7ìjãäÃúpÁM¯±t}–%ilK`æú([qÊÉõ˜Ê!çù·#«¢ow(pˆC£€yËO.ûñÅÃÅŒ¨ ÐÖiS½­•aÅùl¸kG ÆRsï_žç‚ú4š¿ÑÎi²”v?푈>ëÃ…”Ë0¦L{š—ìÌ×eØR``ðL õ§SK„€u~ólEâNQÇ¡ùG“iS‡‡íu‘gÑ©mzkp¥…@c*[h Y@§ê`·Û@ .-*AÜÞM«jÁÃ'å¹"]¾þ`?ŸiH¼ý¥Å}<åcJ_{tÛ C2W'aôòò(“E”)A¾¥HäQŒäA:=Æ×>…!¸íÏq¡îÚÇ@³Ûoç颱䛕û}#AmÓ¿ñqæùéîSÚÅÔCø*Ér‘¼!L$áÛXÊ'¤<¢Jð*¸ý;8oü´)P‰Ð £‘¨Å+[Ø=ÐâŒÓ†ŽüíµZD†)ehŸdY·=Ū·kyú…vF1ï¯ç/8ë@}†8|{’ùåý#5²­¶còM‹Ö¬zð¥­ÜuíQLÓ›®~޶.ûSŸËñ—.Ê…ôæS ÿnµÂ¥Â»©n–i"üÝñÝç_|n\¯Ôš£-×µ ÷–WUÔž^¤‚Ì–åÄ Z)¶Ê)׋¼=Šš£e!/©V¦Ë¼t|±oðŽ·›r0Z»øøaÐË·)÷R$OLÑÚtÈOÇz1Y†I$«É7¢h4Ça '(²ºð=­5/»[™!ÆQ¤]ªí½ŒôA®¥Ø™ØÇ8kaP&ÊÈ•!Í|¤0Xßþ2'Ç’T]Ôçø»†óšiñÛióö!:N HÄþ+bmî§ÛOaHÉ/øé×]å‚–(RJ >¹–€Œ¶Š(5«èJ­ç2YE³ —oÐ(<N¹U…Ö>>†0¡u gUtS) %q"nu01r$ùÚ¡Íó ™Aò•ÏZ?AµWǼ¢Šür’»RŒ<ƒPÔâÍ­Íl,˜{ÅHf–äñì »Ì9kø IõŽ^{d#ý+ 9®ˆŸÿ`ž»ú„מ|ë„VïÈ·¾ðÅ/~?sá‘8‘HÀÕZ«ƒ©‘¢¼€ ûIzÅæF:bNnõÈ!§@þ¯M8“˜˜Ý *Èy%ÝIŠÝ*%ðî[oŒÐëïùÍáC{ëßþe»øæÙƒ©Û$ñøJ «Kñ—ö&æ‹2Rq…B±Òu© ´ÉÁÂ`©è`A\Ò&¡;šôÍdQ’>Zòž½ƒÓU>ž¶@8<‘-û $¼âWsJ`.š?¥ÖqVptæK žu603<´ ðy2ÕÈôàP\mÒf@•jÆ”k°S'HæOF¡ð‘ĵËîŽW™Ä·™jºX_Eyd ^¶Jó0…‰#¾ò„!$–L—„ùбÎ$Lº¾ ÂLçшt[aC‚:@HæQìKYJ‹[Çuv˜YH‘6È×E@ ~N0#8ÓO`h—|ecÁÓö:ÎJš¦ Hi)AŠh0Àr«ƒ Ó,N<$ƒ±bU=;šÛ8{Þ?åcF n¿{-êŠ9þ°~Å{››èH9褢ÙîÒõíG¼~ÅU_ß´Œ›3çNÖqž#rò¿—D²sFŒ,2éö“dP±XkÖléߺeÑÜÝï¬8í¢iõÓን;[S‘O(®AÞÞÕÂÄç-RRf< šÍÃ[9ïúíœ|åP&ïMßH ¼¹ºŽ/œ3 >ž«0 É£K63j`1㆕Òå;HO°xÉV.]0×N¸‡"`¼½¶žºú."Q“^ÑÛ› ¬èð¿Í»ìª[´Ö{…YDb“?À²iwëm³®}þò¤íqòáxuÕ^Ú?…+iÿ¿öÎ<<ŽâZû¿îž]»¬Å‹dy“lŒÍ1Æ“`Ìb0°²°]¸.;7_B b¸„À%$f3k°ÁLboØ€1¶,[–¬Åf4Kwt´šÍHš‘…]ïóÔ£ÑLUuwÕézëœ:u*¦ÿdáTé÷W‰(½‚@†¢YËJ&K²“‰ÛB&<óè ×Tå¶žö²B–¼UÏEGWâoíÆ%Ëüìž ÜZ[N@ÒÑ%™§+[¸jþx:Bò:!ŒÆëO51Ã5ÌpÓuž¬iäŠñ• K¨1߯iäòÎRbèHH,¦‹©@–H»9Û9žNÓTö \M%Ótôgu×è㈢£É +{9à H–dîÕ·rãHÐ!â”qãäáèf~äœB>ÅÃáu\T8›HT¦KrtèÄüQínøo©õ£Ô5®G»jz„IÁOn†(s¡á’<ÞH^ñ¹¦‹œÌ{ûs¥g&AtbZ7Ot¯e¤o*:1½‹ŽX þÈJu‰=È´éºÕ}Ȳ‚0€ˆÅ«äТëàuº@V¨ÔËðGL,ãíÍüû©Œ(÷QšïÆ›çåÑ¿ÈN?5¦£ª:š¦óÁ§{iÚåçÛÇŒ¡°È ñ56±{_Ÿ.ѦVpÂY×þ±|DÙÿ˜Òij"!;èº^sÓŸÖnýõôÊò\É!Ë4µ‡¤tär½N~ÕQW?·ú1욉}'{œD”¸ö‘@3qú;ï¬Üµ{嬵ëê‹/˜ï>½¢ }_„‡Î_Ã%é Lîƒc) ¨t«:Þ¨ÄS+ê9g•‡}’²Ì¿¤VNûÅ$:r5…†Î ±û;È‘x¤( ºe\ÝGRyÑÑɱz©¹Ù%F‹¤3R7LCªì`Od/5xQQkaj}†ãr€Gõ:.S‡ M%&;ðáä7|ÊUòdº¤(>ÉßÔm|Ï9‘nTIás=Dž¡J5Ö4š³$o…ޏõð¡oë"u\  ¡›Íš‡Æ"u;•'–ä¢ðù¾8Ó=]‹á–%Ö÷1Ùw8N5„"»@‡Ú®7Y蚌®E‘%™µÑzš¼#)Ôu‚º Z›qÜüråšýÞý°¯ÏIkG7þ@7M­bD£©xnŠŠŒ«, ¢ÌÇøò&MÈÃá”]Ça‡•îŽòÚºÝhQ£§ ¼4œ2Áoo›ÈÉg~šiÎÚgj!]ɹ:êÊôuŸîũȤ^WÕt~}é‘üÇYSF˲¼S ;‚@¾>æ-+™(­Ä™`½Ä ¸>Ùòi¹xæÚ’2ÿ7òrÜÜñ­Wøic)ZŽ‹%ùÍ\úï ¶ÇäFºUž[øó#‰É*Š·Í pÿÓtG‘2‹oâšÕy„$CÓø#{¸Z«¤[ÒxW 0C)ùâ0¨_JÛø•4™ ©•¬Töqf·ˆl˜å+ïái<-²„´ÒÍn­‹ÙZYÂpGÎAævçN~"'ä ñ \@Ý’„$É|@Õš\YÁ©IÔê­,-žN 98Q‰¢àÓ56Þà­œ.Œø`²y:Üæhc¶oa4¢’FY` 5zq.ŠÞÆVÏ0*”á(æ>¯âe½ÿM*ãÐ5‡ ŸÅšYï.à0e4º ^If{h7/ïâì3j‰'žÛÂù &£cbQ¶×ùyëÝ]œpòv×èèóô?vPQî¥ÙßÉÎÆ.šZ‚t£¸^"œxT)S'W1~¤“ÏwtPR™CUe>;£úÔcoºnÒÄñ¯íqM$4µwž~óòŠMÛ۾؞ šnhgÍËc7w¦"KÏ‹!G@È׋Ld›fb5qYàÝ63—ÜÜJÞ–÷ž©™~ÌñmËŸ[6¾êþ—/vmkýä¤..{hÆ– uÇøtW{ælaº/¨¤TUÖÿ®„y3+Ñc:::OÌ^Á™ÎáÄ$ {”0cqãÔdþ 7r­>?.$îQê¹QU'𠼋[**éèˆâë‚¥½\¯Ž"*³à÷iÇ¥G˜©|Ù¥ºŒCÓø·+ôQÑqá`©VÏ­Œ˜Ã‰ü]jå$5§¹~£ÚȶÒÙäkF³9§â¥Ö¿š‹ÔaľXͧ®qwŽÊ‘Êx]åCµsCà”8Y¥Ö£N>NТè8È“Þ ¼Ïyò(º"„´nžW‚ë¬&l~'i›ÇÖsÅ}“(.Ìáw~ÀU §îÉšÎç­þ¹~7^p±Æ²Ÿsüá£ñéxÐ4^û°9s+Y¹¬ŽM]L©)áÕ5u¬|£™Ó)'/ÏÃØIy„8ášùß=o¥©t&#Ž@XÊÏqñÚû ×<»ºöÎ%¯owûƒÝãR$ÙbËŠ©á°ª×TJ?=ç0~0oÒ™N‡,ÈC@È@&É´;™8-šJœpâ¡W:x—/¾åûÕS Êòs]ÊšMªtç‡5GnWË‹<.ÖèÒ°·JÉIDAT]„î­à´ùÕh]Qšý!¶¼Žé¥¨ªÎ"#7)#èT\a™»" ܪ SÖ¨*ÿr8Q-&"iä*5sõñèêŒÐæóÎêV¾ã(ûBsyWî C޲0Zd Ìšá ÷tp‰6Òˆu%é¼¥5q’ZH'𸲇 Ô2¢È8$—?9æàKDeÃÝWAEëü˜YZ*à–Tb*tÉA–æ2AŽ[’Xù˜ëCy„dYv°Bk Ç;†b)E–ˆj>Eauç.Õ†ߊçVš™á­Á£ÉhèxQx7Ö@Å/‹YpþdþºhÇÎIEa±ˆÆ^µ›g—låšëg€SâáEøþ‚ÉH1 ªÑèñÖú]œÙTv}ÖÁ«¯ÔrÖ¹ñæ:xé…iNýaý› ﺶ²rä«@ Õ9í«Öï*¿{ɦÒiÕ%>µò3[ƒ_ÇQ‡ç’“køÆ„aÿ9elñßEnC€ ƒÇÄå´‡Ãö»õøÒ L_±zùÔØ=/ÏÌ †*·ù”½9 J£+ZNž2¾ˆÚÆ.¶þü#ZA¤#Ê•·ò?Ó&¢F5¼1™¶îda}^4kë”gÄŠÊ:^ÍÁ}e\qùd­„ÊYçVãq*8r]üá®÷™»` ‡L)£®¶­ÚÅ0¯—C¦Q>ÊG4ãÝö°fý.Î8w\¸÷á'îF×u$©Ó4]u™DN7컀€ D&.ÉB ‰Î(Q|îXìYÿÉÖ1Á=›ÊTOe÷ðÑ£:#ÝQÙ%+ÔŒ©jüxoíèÍW>püÔΈ瑜–’Óý9rÎûÛg×½ È¼Tbø5c˜;cËÿσ{™­âWt|šÂJµ–9>Nœ_IYX¢³3Bs0Ì‹ê9E/!&GA“y¢ª §ŒÄÐqùá¹¶&&:ŒIE¹è:¼× öÕnæ)ø1öWìQì™ã´é£ðw{!rd…?ïÜűoxÉ‘ÝHºÊ ã[¸lÚba tŸ¬ðLC#ÁMaf†ò©’=„dˆjQ^)ïdê ¥R‘ÒqË2û¸}i󤂒Ñh»C~Þ›ïå¢EG°jy=jTã˜9#É)õ±æµ:vìèà;'Žfdõ0芲aMËV†7Ì<é»)1®uÊäê:³_"|ÖÄÞ$ ĈV_ +o=U¾z–d1‡É)ÌdVRIu½ø5Õ¯,ýFÛÃ+¥éÒÎî.yUYH[xvµ\Tîq¿|ÏÆ’Y{\y¹[vOR)r8ø§îgß¼B¦œ:’)ùù´ãé+ßãGãà\Uæy_;ùó ˜7®Œè¾ëýÔ¶øîQcˆDU:|Ï?µƒYë]ŒóäÔU¢ºÆÿÕ8ñœ**ósˆcDÜ:«67QðdÓy‡jü\}Ö8TUG×u" ·"ñN]›ßm!¶'´±uùŠ#\ïÔ£Ûk<õ';Ê+íùlNnž¿¢ó‡û7r¡\Ê Å‡ärà‘$VÑÁÆy#9ëÔvÔv²cG£Fä3¶&+õ7#A¹iX™#Z3㇯̘~ÈNÓ gfMöP&"l®€€ ¬‘Šõ¯} ·{}YIGNð×Z$Ú ™¨¬=(S̹ᄎ¬F’e)O“¥Ï:5ÿêiSÊ \²C-{úî¥ß[Û:qœ'‡°CG Â+¥~šŽsqâ¸2ÆùøËæ&+á›Õ¥àÙV×κ7÷Rº!L^ —µz€eJ/âÈ1Å(…nVnofßãÝ­'9cÃÆù¸«©ž#Ï«aÚ¨\J s‰ŽPˆõuíñƒÿíØ¹ùòèZÙüÆpbˆ‡ò—»ëÞs&ïk(ö#¥-n©õ¸ßÜ÷Û¼e{é”CÇÇ=¨T³œÆ—Ñví'&=µP‡€€ Á&h$Ñ&z#De’™Íä4‰«·ÏŽ—æÿû÷K[:ÓuäŽayOzéG¶64”ëÁˆ¼îíÿÝÕÑ0ñˆ‰E¾<¯Ã‘«ê‘Íjé¦ãO¼ø}?8eÐrûYˆUÅ`Ǫ¾=ö¸£ŽÙ¨Í~=ï¥?ß|ªÓÎùæi·?5vDN3†Ç[|“Iž)ÞNš…hâÑ™­)~Òeo)žç‹³ÖŹ€€ ¯¹H¶1ÙßtH@JQ¿Œ9ÄgÝNË l¿ï¯<¢-ÅvÉ2¨'“±ø mèµ$m&%![ÝB:šå³j#Õ–4[9]¬yù:K¢Ùú¿œd •R˜½zK‰<Íd› ÌJ$ ;l3ÿDeì$”ˆ|ây,Á ÞÛ3a!);‰$"”D„¡ Âr0j1qÓ”Dséís"—eûàœˆ@¤$bÄI@"‰dͪ­ØÍNÉÊ$Ó„ô$Ú= -C@@ˆ€`$IÒmDƒM£èÍ,–ŒH@ ‰´=I™têdšƒžäºR™iBMH†€€ ìh5Re@H91Ð  ˆEôÁ….Ú^@@à@œ:®¥§Ïýu¢YJŒ®ž>Z0B”ì¶/75¢©yÒ–,E€V`ð'àø Ô«aœ+Ól1åþçÀ©1Ú2uïÉRꌎ-ïO鿇eÚØd»™-BfÓê¼UÀ_0v”§+äoÇ qØÏ’(½ŒÈÒàÞ ,J³þlH"kHüÿ·-–'°!ÛcÕIâH!·Ì5_ =ËÂ. 0X¢›1‚|fºÞxj.‚ò`¾ùÿÅÀÙ~O°Ü¸jùü Ûž@æ&Ð:^.¦Ã06ãLÁ¼Ø*D`ˆ¼sS8xÍ–÷ÚÔëJ0̵gwµ ûíÇñ"ŒÖšZÈ "›ï©h³<àm6†õÙ=` ¤Ê¦yÔ3ûPþàu!Cè“€¿Zò¾áwYÎöXÊÅ€£†€±†ù°$I¾Œá»–‡Ûf6Ðg–ïÎ`'Ïž>Ç81n/° ¸Ìœ9ô†qæLøMFÝcÖ1윷¥ýxîrŒÅà e!³î`%ðÿ€©}xΣ?c,4‡0ß7 9¿÷UmÎtÞš1›Ì6»ÈÍ`ß[_´æl+Ó8Xl¶K0?/N€\ ,v™íý©©1NðŸ,êMÙÙ <Šá00”¯=í8P¹fT̲1óþ>^5ߣÃyÒVMÏõŠlLGuô\sJòMóóìlÈ+–‡»ÅüîVËw¯õ³“ÝÀ“ônçÛT¦Y_o© ¸ 3ˆ[1ÎÎî¯-Òú» üžžAí©˜˜â¾àn §Þî§ øVú}ŒÍt•éõ®2“ôRµïÊ4ˆË.WÏöR_›9¨äï%¯? k^;›í˜ ¹½3EùLœ}©ËeÉÛEk‘¶ò3†æ÷B%_®y¨¦­,Ñ÷£ûÑɧ)XÛâH<›y<ÍÀ³¬¿ßGú zÉÜÿd 7Átï) Ì`ßÿÄRß² ËU‘©Í¦û<Ÿ”«zs°>¼µ€wˆ^;›í8P¹ý!ƒëhÑ—º&Zò~–esôK &àªÉû+°jË{ÑLnëG'ÇÓã¦}0×LGOØò,NRß'Ào1°5_‡ùÒÕ—ÛÌmí)L<7Û®û©YG à3_”‘À·MÕûÃ4Ÿ3 Ü L7¯ïÁðl³"ç'©ï›=õaS-4Ÿwp‰i°šœœè{+aý(Ãre×<Ÿ6M%¹æÌühÓ6kÍó×>ÈU;Æâèh³ F¿N0#·æ­²ä½Ó–÷CôÚÙnÇÈí:Ëï;MSw…ùœNÓDü-S¶7 òˆµÝžÈ2ü0 kÍK ÖÁ×¾ùä\›– õƒ@zÛŒx=7íLèç3äÿ´ÔuE’|¥¦©+žïoôßAÀ¾‰é„^ò.µä}.ÁïÃ,÷•ª®a&©Æë»p}oõ¢šœA™šh3kÜÚKÞŸÙd :öîÄðK„?õ3ï iöõ`^;Ûí8P¹ Y~Ÿ>cU*/¬á^X¯ÛÚbúêM“mÒLXR¾8–ž Mvi»wÖœ>vò›iÌÖXòß>€g™•BØ®·äÙÊÀ¼Ë¬Ïywм߶i vü§å÷ߦqíù–üÏ à¬ÞWÅ”«_Yê]“bâ!a8GÄóÿ2öþï^ê›iË{[š2S›f_浳ݎ•Û}–ß 2¤“4àÇ6%›Ô¥Z°? ä1Ë /J’ç~Kž¿ô±3ÒñÞ:ß’ î .›¶”V“ÜåæK‘·Ð6+µãeËqíü4¾T°.Ö;2(W«-õ¦ãØp©=Yô4µ¥¼>äµ¶c ;Ìkg»*·Ï%0ß|¾{˜eš@ÞäKg†lˆÓf<($ÏÜT×tzz:åõ¡3Ò¢±–ü»’äQÌY÷£¦Ýµc9Yãw$©g§%Ou…9•&#¥Žzz®Ä“jI‰½]CPÙÝG—† ¤ÛÞö¶v _ö÷µ÷g;¦s0ÜÌ“½‡;L:SdÒ—8Œ±f8bÕ@Z²t!ëÂOª®ôoÇ¥;ûðXò‡ü>à ¤¯ªk"XÝv½Y´Çö5 §Ð_dk $”aèk{g:ïþºöþnÇtòI!Ã!Œ=_dés`8'œCÏ…ýéÅiè»t(=Mã¼ÝÏÁjÍ ÈHúŸ)Õ 9”$¼Ÿ$[^X‚@‰#8#Zí ¾ºÇJ¾3ž‹èÛè[,¬þàÇô tÀHͬšA2aYãs16=`Ö›KO»½œF'5dÉ„5Ðü»³dJJ…líɶéå`!ýÝŽø|ë›»,å—Ò;7‚ž üWf™@¬k˜7 rç äÎ4;c ‹èÖ eóSÔS•F'-';‹èÍÿ†å·yƒ(cÉÎNôÕ}” éÛâïÁB û»31ðÍ!ý"™¼—ÿ²ä­£÷ýRyF»çÝô@Û¬`~šåN±Ín”4juŠ:%›)íö^L;¾uÝF']GvÜxš¿·ÍœÙF6baYÝOÓqå~‡Ô®Ü#ìïvÌÄÀç¥çšÄ`ˆ#äO<ÿ%YxF{,¬•YlÇ!ƒy–ÙCúM¥ž—FC¥ÚHx#½o~²îA9µ—zfÓÓ£,Y'•Ðs±ï2³‘p ùGbÄë‰ÿþ RoÚœ€Ba ckç <¯}ÜõRþVú¾î`!ýÝŽ©ò/IQþ$Kù½ƒ¬õ[Ç—OH~jk¢ñ.Äæjuß=ò` ¿‘þF";~CÏ]ÜéH<”É,Œ…¶ó³=”É)l‹Ç2ŽÃXË5ºû0vÔ¦»°|“-ßVÓœUmÎZ\6ÔocìîÝ4H3¹_ðUg…óÍÞmj`ãM3Å‹|§,8ÄçüÃä؜h˜íº9;îí<'{‘F8›§è_Žƒ…@öw;¦Ê'«¥‡M0ß¡<“Xn6ßÛxùg™@ò1BÉÄËœÝz¦üWcDU¾ÃœdÙÇ›K2|ïCÃlf¡CûX~=ý¬‡¥h¨tƒ)Ö&©kéGú| ÍNÊF0ÅL¿LzÁ÷²µáè2{"a6ƒL²?Û1I7u“üh„l¦)/^f]&½é¦6’Ç·;àä?,±¶ŸuXí¬W§h(wƒõ&ŒðÞî9ÕÝ™3ä¾[û¹Íl´¿ $N"¿"=·Þ-ÀÉ–1æìµ/g¢¯&¹¯}=‚“¥×é[òƒ‰@ög;¦Ê=÷]$K{€ã3 Ÿý„‡ÙÌÛ'gˆ@âg¢Ïâ½9¬gà^HVŸçõi6Ôéç"Ô™ƒv‹ùB\NzÑd§ax³Ã,ï7Í'`D¬ío'U`Ä6zËò†ÿ|=FTÍŸÑ·¥2%@ñûzÓ´³†ÍgÞbjusI/°å@ˆä'ûD¶š/KÌ4Gl7¿¿‘ôƒ_žfš(w`¬Au™Ÿ§÷µ-A û·ÓÍÿ-àÀÇæ=…1ÖK_1'€’ËþÂ÷XʽÕÑ0B¸ì6ŸíæÄóT’Ëðµ%iˆÜ‡>ïI@@@@ …ùC@@@@@@ˆ€€€€€ A ‚@ øÿÒ4÷NíÌ IEND®B`‚apache-commons-rdf-0.5.0/src/conf/0000755000175000017500000000000014132221255016564 5ustar andriusandriusapache-commons-rdf-0.5.0/src/conf/checkstyle-suppressions.xml0000644000175000017500000000275713175455642024251 0ustar andriusandrius apache-commons-rdf-0.5.0/src/conf/pmd.xml0000644000175000017500000000221113175455642020101 0ustar andriusandrius Excludes from default PMD rules. apache-commons-rdf-0.5.0/src/conf/findbugs-exclude-filter.xml0000644000175000017500000000203513175455642024040 0ustar andriusandrius apache-commons-rdf-0.5.0/src/conf/checkstyle.xml0000644000175000017500000001600013175455642021460 0ustar andriusandrius apache-commons-rdf-0.5.0/NOTICE0000644000175000017500000000025413212356336015764 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-examples/0000755000175000017500000000000014132221255021110 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-examples/src/0000755000175000017500000000000013175733174021715 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-examples/src/example/0000755000175000017500000000000013175733174023350 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-examples/src/example/UserGuideTest.java0000644000175000017500000002243513175733174026755 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package example; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.QuadLike; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.api.TripleLike; import org.apache.commons.rdf.simple.SimpleRDF; import org.apache.commons.rdf.simple.Types; import org.junit.Before; import org.junit.Test; public class UserGuideTest { private RDF factory; @Before public void factory() { factory = new SimpleRDF(); } @Test public void creating() throws Exception { BlankNode aliceBlankNode = factory.createBlankNode(); IRI nameIri = factory.createIRI("http://example.com/name"); Literal aliceLiteral = factory.createLiteral("Alice"); Triple triple = factory.createTriple(aliceBlankNode, nameIri, aliceLiteral); System.out.println(aliceBlankNode.ntriplesString()); System.out.println(nameIri.ntriplesString()); System.out.println(aliceLiteral.ntriplesString()); } @Test public void ntriples() throws Exception { IRI iri = factory.createIRI("http://example.com/alice"); System.out.println(iri.getIRIString()); IRI iri2 = factory.createIRI("http://example.com/alice"); System.out.println(iri.equals(iri2)); IRI iri3 = factory.createIRI("http://example.com/alice/./"); System.out.println(iri.equals(iri3)); System.out.println(iri.equals("http://example.com/alice")); System.out.println(iri.equals(factory.createLiteral("http://example.com/alice"))); } @Test public void blanknode() throws Exception { BlankNode bnode = factory.createBlankNode(); System.out.println(bnode.equals(bnode)); System.out.println(bnode.equals(factory.createBlankNode())); BlankNode b1 = factory.createBlankNode("b1"); System.out.println(b1.ntriplesString()); System.out.println(b1.equals(factory.createBlankNode("b1"))); System.out.println(b1.equals(new SimpleRDF().createBlankNode("b1"))); System.out.println(bnode.uniqueReference()); } @Test public void literal() throws Exception { Literal literal = factory.createLiteral("Hello world!"); System.out.println(literal.ntriplesString()); String lexical = literal.getLexicalForm(); System.out.println(lexical); IRI datatype = literal.getDatatype(); System.out.println(datatype.ntriplesString()); IRI xsdDouble = factory.createIRI("http://www.w3.org/2001/XMLSchema#double"); Literal literalDouble = factory.createLiteral("13.37", xsdDouble); System.out.println(literalDouble.ntriplesString()); Literal literalDouble2 = factory.createLiteral("13.37", Types.XSD_DOUBLE); System.out.println(Types.XSD_STRING.equals(literal.getDatatype())); Literal inSpanish = factory.createLiteral("¡Hola, Mundo!", "es"); System.out.println(inSpanish.ntriplesString()); System.out.println(inSpanish.getLexicalForm()); System.out.println(inSpanish.getDatatype().ntriplesString()); Optional tag = inSpanish.getLanguageTag(); if (tag.isPresent()) { System.out.println(tag.get()); } System.out.println(literal.getLanguageTag().isPresent()); System.out.println(literalDouble.getLanguageTag().isPresent()); } @Test public void triple() throws Exception { BlankNodeOrIRI subject = factory.createBlankNode(); IRI predicate = factory.createIRI("http://example.com/says"); RDFTerm object = factory.createLiteral("Hello"); Triple triple = factory.createTriple(subject, predicate, object); BlankNodeOrIRI subj = triple.getSubject(); System.out.println(subj.ntriplesString()); IRI pred = triple.getPredicate(); System.out.println(pred.getIRIString()); RDFTerm obj = triple.getObject(); System.out.println(obj.ntriplesString()); if (subj instanceof IRI) { String s = ((IRI) subj).getIRIString(); System.out.println(s); } // .. if (obj instanceof Literal) { IRI type = ((Literal) obj).getDatatype(); System.out.println(type); } // Equal triples must have same s,p,o System.out.println(triple.equals(factory.createTriple(subj, pred, obj))); } @Test public void quad() throws Exception { BlankNodeOrIRI graph = factory.createIRI("http://example.com/graph"); BlankNodeOrIRI subject = factory.createBlankNode(); IRI predicate = factory.createIRI("http://example.com/says"); RDFTerm object = factory.createLiteral("Hello"); Quad quad = factory.createQuad(graph, subject, predicate, object); Optional g = quad.getGraphName(); if (g.isPresent()) { System.out.println(g.get().ntriplesString()); } BlankNodeOrIRI subj = quad.getSubject(); System.out.println(subj.ntriplesString()); // null means default graph Quad otherQuad = factory.createQuad(null, subject, predicate, object); // Equal quads must have same g,s,p,o System.out.println(quad.equals(otherQuad)); // all quads can be viewed as triples - "stripping" the graph Triple asTriple = quad.asTriple(); Triple otherAsTriple = quad.asTriple(); System.out.println(asTriple.equals(otherAsTriple)); // NOTE: Quad does NOT extend Triple, however both Triple and Quad // extend TripleLike TripleLike a = quad; TripleLike b = quad.asTriple(); // Unlike Triple and Quad, TripleLike does not mandate any .equals(), // it just provides common access to getSubject(), getPredicate(), // getObject() // TripleLike supports generalized RDF - therefore all s/p/o are of type // RDFTerm RDFTerm s = a.getSubject(); } @Test public void graph() throws Exception { IRI nameIri = factory.createIRI("http://example.com/name"); BlankNode aliceBlankNode = factory.createBlankNode(); Literal aliceLiteral = factory.createLiteral("Alice"); Triple triple = factory.createTriple(aliceBlankNode, nameIri, aliceLiteral); Graph graph = factory.createGraph(); graph.add(triple); IRI bob = factory.createIRI("http://example.com/bob"); Literal bobName = factory.createLiteral("Bob"); graph.add(bob, nameIri, bobName); System.out.println(graph.contains(triple)); System.out.println(graph.contains(null, nameIri, bobName)); System.out.println(graph.size()); for (Triple t : graph.iterate()) { System.out.println(t.getObject()); } for (Triple t : graph.iterate(null, null, bobName)) { System.out.println(t.getPredicate()); } try (Stream triples = graph.stream()) { Stream subjects = triples.map(t -> t.getObject()); String s = subjects.map(RDFTerm::ntriplesString).collect(Collectors.joining(" ")); System.out.println(s); } try (Stream named = graph.stream(null, nameIri, null)) { Stream namedB = named.filter(t -> t.getObject().ntriplesString().contains("B")); System.out.println(namedB.map(t -> t.getSubject()).findAny().get()); } graph.remove(triple); System.out.println(graph.contains(triple)); graph.remove(null, nameIri, null); graph.clear(); System.out.println(graph.contains(null, null, null)); } public static String tripleAsString(Triple t) { return t.getSubject().ntriplesString() + " " + t.getPredicate().ntriplesString() + " " + t.getObject().ntriplesString() + " ."; } public static void writeGraph(Graph graph, Path graphFile) throws Exception { Stream stream = graph.stream().map(UserGuideTest::tripleAsString); Files.write(graphFile, stream::iterator, StandardCharsets.UTF_8); } } apache-commons-rdf-0.5.0/commons-rdf-examples/src/example/IntroToRDFTest.java0000644000175000017500000000173213175733174027010 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package example; import org.junit.Before; import org.junit.Test; public class IntroToRDFTest { @Test public void runIntroToRDF() { IntroToRDF.main(new String[0]); } } apache-commons-rdf-0.5.0/commons-rdf-examples/src/example/IntroToRDF.java0000644000175000017500000001267013175733174026153 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package example; import java.util.Optional; import org.apache.commons.rdf.api.*; import org.apache.commons.rdf.simple.SimpleRDF; import org.apache.commons.rdf.simple.Types; /** See http://commonsrdf.incubator.apache.org/introduction.html */ public class IntroToRDF { public static void main(String[] args) { RDF rdf = new SimpleRDF(); IRI alice = rdf.createIRI("Alice"); System.out.println(alice.ntriplesString()); IRI knows = rdf.createIRI("knows"); IRI bob = rdf.createIRI("Bob"); Triple aliceKnowsBob = rdf.createTriple(alice, knows, bob); System.out.println(aliceKnowsBob.getSubject().ntriplesString()); System.out.println(aliceKnowsBob); Graph graph = rdf.createGraph(); graph.add(aliceKnowsBob); IRI charlie = rdf.createIRI("Charlie"); IRI plays = rdf.createIRI("plays"); IRI football = rdf.createIRI("Football"); IRI tennis = rdf.createIRI("Tennis"); graph.add(alice, knows, charlie); graph.add(alice, plays, tennis); graph.add(bob, knows, charlie); graph.add(bob, plays, football); graph.add(charlie, plays, tennis); System.out.println("Who plays Tennis?"); for (Triple triple : graph.iterate(null, plays, tennis)) { System.out.println(triple.getSubject()); System.out.println(plays.equals(triple.getPredicate())); System.out.println(tennis.equals(triple.getObject())); } System.out.println("Who does Alice know?"); for (Triple triple : graph.iterate(alice, knows, null)) { System.out.println(triple.getObject()); } System.out.println("Does Alice anyone that plays Football?"); for (Triple triple : graph.iterate(alice, knows, null)) { RDFTerm aliceFriend = triple.getObject(); if (! (aliceFriend instanceof BlankNodeOrIRI)) { continue; } if (graph.contains( (BlankNodeOrIRI)aliceFriend, plays, football)) { System.out.println("Yes, it is " + aliceFriend); } } Literal aliceName = rdf.createLiteral("Alice W. Land"); IRI name = rdf.createIRI("name"); graph.add(alice, name, aliceName); Optional nameTriple = graph.stream(alice, name, null).findAny(); if (nameTriple.isPresent()) { System.out.println(nameTriple.get()); } graph.stream(alice, name, null) .findAny().map(Triple::getObject) .filter(obj -> obj instanceof Literal) .map(literalName -> ((Literal)literalName).getLexicalForm()) .ifPresent(System.out::println); IRI playerRating = rdf.createIRI("playerRating"); Literal aliceRating = rdf.createLiteral("13.37", Types.XSD_FLOAT); graph.add(alice, playerRating, aliceRating); Literal footballInEnglish = rdf.createLiteral("football", "en"); Literal footballInNorwegian = rdf.createLiteral("fotball", "no"); graph.add(football, name, footballInEnglish); graph.add(football, name, footballInNorwegian); Literal footballInAmericanEnglish = rdf.createLiteral("soccer", "en-US"); graph.add(football, name, footballInAmericanEnglish); BlankNode someone = rdf.createBlankNode(); graph.add(charlie, knows, someone); graph.add(someone, plays, football); BlankNode someoneElse = rdf.createBlankNode(); graph.add(charlie, knows, someoneElse); for (Triple heKnows : graph.iterate(charlie, knows, null)) { if (! (heKnows.getObject() instanceof BlankNodeOrIRI)) { continue; } BlankNodeOrIRI who = (BlankNodeOrIRI)heKnows.getObject(); System.out.println("Charlie knows "+ who); for (Triple whoPlays : graph.iterate(who, plays, null)) { System.out.println(" who plays " + whoPlays.getObject()); } } // Delete previous BlankNode statements graph.remove(null,null,someone); graph.remove(someone,null,null); // no Java variable for the new BlankNode instance graph.add(charlie, knows, rdf.createBlankNode("someone")); // at any point later (with the same RDF instance) graph.add(rdf.createBlankNode("someone"), plays, football); for (Triple heKnows : graph.iterate(charlie, knows, null)) { if (! (heKnows.getObject() instanceof BlankNodeOrIRI)) { continue; } BlankNodeOrIRI who = (BlankNodeOrIRI)heKnows.getObject(); System.out.println("Charlie knows "+ who); for (Triple whoPlays : graph.iterate(who, plays, null)) { System.out.println(" who plays " + whoPlays.getObject()); } } } } apache-commons-rdf-0.5.0/commons-rdf-examples/pom.xml0000644000175000017500000000606313212355376022444 0ustar andriusandrius 4.0.0 Commons RDF: Examples com.example commons-rdf-examples 0.1 1.8 1.8 0.5.0 src src-2 commonsrdf-api-site scm:svn:${commons.scmPubUrl}/examples/ org.apache.commons commons-rdf-api ${commons.rdf.version} org.apache.commons commons-rdf-simple ${commons.rdf.version} junit junit 4.12 test apache.snapshots Apache Snapshot Repository http://repository.apache.org/snapshots false apache-commons-rdf-0.5.0/commons-rdf-examples/README.md0000644000175000017500000000242213175733174022405 0ustar andriusandrius # Examples of using Commons RDF [UserGuideTest.java](src/example/UserGuideTest.java) contains the source code of the examples in the [Commons RDF user guide](http://commonsrdf.incubator.apache.org/userguide.html). ## Usage Update [pom.xml](pom.xml) to the latest versions of `commons-rdf-api` and `commons-rdf-simple`. Ensure you have Java 8 installed and configured as `JAVA_HOME`. Use [Apache Maven 3](http://maven.apache.org/download.cgi) and run: mvn clean install apache-commons-rdf-0.5.0/commons-rdf-jena/0000755000175000017500000000000014132221255020207 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/0000755000175000017500000000000014132221255020776 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/0000755000175000017500000000000013175733174021740 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/0000755000175000017500000000000013175733174022661 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/0000755000175000017500000000000013175733174023450 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/0000755000175000017500000000000013175733174024671 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/0000755000175000017500000000000013175733174026344 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/0000755000175000017500000000000013175733174027117 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/0000755000175000017500000000000013175737326030037 5ustar andriusandrius././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaBlankNode.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaBlankNode.ja0000644000175000017500000000217713175733174033012 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.BlankNode; import org.apache.jena.graph.Node; /** * A Jena-backed {@link BlankNode}. *

* The underlying Jena {@link Node} can be accessed from {@link #asJenaNode()}. * * @see Node#isBlank() */ public interface JenaBlankNode extends JenaRDFTerm, BlankNode { } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaIRI.java0000644000175000017500000000214413175733174032121 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.IRI; import org.apache.jena.graph.Node; /** * A Jena-backed {@link IRI}. *

* The underlying Jena {@link Node} can be accessed from {@link #asJenaNode()}. * * @see Node#isURI() */ public interface JenaIRI extends JenaRDFTerm, IRI { } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/experimental/0000755000175000017500000000000013175733174032531 5ustar andriusandrius././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/experimental/package-info.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/experimental/pac0000644000175000017500000000252013175733174033216 0ustar andriusandrius/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Experimental Commons RDF Jena implementations. *

* Classes in this package should be considered at risk; they * might change or be removed in the next minor update of Commons RDF. *

* When a class has stabilized, it will move to the * {@link org.apache.commons.rdf.jena} package. *

    *
  • {@link org.apache.commons.rdf.jena.experimental.JenaRDFParser} - a Jena-backed implementations of * {@link org.apache.commons.rdf.experimental.RDFParser}.
  • *
*/ package org.apache.commons.rdf.jena.experimental;././@LongLink0000644000000000000000000000016400000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/experimental/JenaRDFParser.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/experimental/Jen0000644000175000017500000001004613175733174033171 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.experimental; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.util.function.Consumer; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.QuadLike; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.TripleLike; import org.apache.commons.rdf.jena.JenaGraph; import org.apache.commons.rdf.jena.JenaRDF; import org.apache.commons.rdf.simple.experimental.AbstractRDFParser; import org.apache.jena.graph.Graph; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFParser; import org.apache.jena.riot.system.StreamRDF; import org.apache.jena.riot.system.StreamRDFLib; public class JenaRDFParser extends AbstractRDFParser { private Consumer generalizedConsumerTriple; private Consumer> generalizedConsumerQuad; @Override protected RDF createRDFTermFactory() { return new JenaRDF(); } public JenaRDFParser targetGeneralizedTriple(final Consumer consumer) { final JenaRDFParser c = this.clone(); c.resetTarget(); c.generalizedConsumerTriple = consumer; return c; } public JenaRDFParser targetGeneralizedQuad(final Consumer> consumer) { final JenaRDFParser c = this.clone(); c.resetTarget(); c.generalizedConsumerQuad = consumer; return c; } @Override protected void resetTarget() { super.resetTarget(); this.generalizedConsumerTriple = null; this.generalizedConsumerQuad = null; } @Override protected void parseSynchronusly() throws IOException { StreamRDF dest; final JenaRDF jenaRDF = getJenaFactory(); if (getTargetGraph().isPresent() && getTargetGraph().get() instanceof JenaGraph) { final Graph jenaGraph = ((JenaGraph) getTargetGraph().get()).asJenaGraph(); dest = StreamRDFLib.graph(jenaGraph); } else { if (generalizedConsumerQuad != null) { dest = jenaRDF.streamJenaToGeneralizedQuad(generalizedConsumerQuad); } else if (generalizedConsumerTriple != null) { dest = jenaRDF.streamJenaToGeneralizedTriple(generalizedConsumerTriple); } else { dest = JenaRDF.streamJenaToQuad(getRdfTermFactory().get(), getTarget()); } } final Lang lang = getContentTypeSyntax().flatMap(jenaRDF::asJenaLang).orElse(null); final String baseStr = getBase().map(IRI::getIRIString).orElse(null); if (getSourceIri().isPresent()) { RDFParser.source(getSourceIri().get().toString()).base(baseStr).lang(lang).parse(dest); } else if (getSourceFile().isPresent()) { try (InputStream s = Files.newInputStream(getSourceFile().get())) { RDFParser.source(s).base(baseStr).lang(lang).parse(dest); } } else { RDFParser.source(getSourceInputStream().get()).base(baseStr).lang(lang).parse(dest); } } private JenaRDF getJenaFactory() { return (JenaRDF) getRdfTermFactory().filter(JenaRDF.class::isInstance).orElseGet(this::createRDFTermFactory); } } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaDataset.java0000644000175000017500000000353613175737326033074 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.jena.sparql.core.DatasetGraph; /** * A Jena-backed {@link Dataset}. *

* The underlying Jena {@link DatasetGraph} can be accessed with * {@link #asJenaDatasetGraph()}. */ public interface JenaDataset extends Dataset { /** * Return the underlying Jena {@link DatasetGraph}. *

* Changes to the Jena dataset graph are reflected in the Commons * RDF dataset and vice versa. * * @return A Jena {@link DatasetGraph} */ DatasetGraph asJenaDatasetGraph(); /** * Return a union graph view of this dataset. *

* The union graph contains triples in any graph (including the * default graph). *

* Changes in the union graph are reflected in the Commons RDF dataset and * vice versa. Triples added to the graph are added to the default graph. * * @return A union {@link Graph} */ JenaGraph getUnionGraph(); } ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/ConversionException.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/ConversionExcept0000644000175000017500000000311113175733174033251 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; /** * Exception thrown when a problem arises across the Jena-CommonRDF boundary. *

* This should not happen in well-formed RDF data but, for example, Jena triples * allow * * generalized RDF. */ public class ConversionException extends RuntimeException { private static final long serialVersionUID = -898179977312382568L; public ConversionException() { super(); } public ConversionException(final String message) { super(message); } public ConversionException(final Throwable cause) { super(cause); } public ConversionException(final String message, final Throwable cause) { super(message, cause); } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaTripleLike.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaTripleLike.j0000644000175000017500000000273513175733174033060 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.TripleLike; import org.apache.jena.graph.Triple; /** * A {@link TripleLike} wrapper of a Jena {@link Triple}. *

* This is a marker interface common to its specializations {@link JenaTriple}, * {@link JenaGeneralizedTripleLike}, {@link JenaQuad} and * {@link JenaGeneralizedQuadLike}. * * @see JenaTriple * @see JenaGeneralizedTripleLike * @see JenaQuad * @see JenaGeneralizedQuadLike * */ public interface JenaTripleLike extends org.apache.commons.rdf.api.TripleLike { /** * Return the adapted Jena triple * * @return Adapted Jena {@link Triple}. */ Triple asJenaTriple(); } ././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedTripleLike.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedT0000644000175000017500000000274713175733174033144 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; /** * A generalized triple representation. *

* A generalized triple is a triple-like object which allow any * {@link RDFTerm} type for its {@link #getSubject()}, {@link #getPredicate()} * and {@link #getObject()}. This might be useful with some serializations like * JSON-LD. *

* Note that unlike {@link Triple}, this type does not have fixed semantics for * {@link Object#equals(Object)} or {@link Object#hashCode()} beyond object * identity. * * @see JenaGeneralizedQuadLike */ public interface JenaGeneralizedTripleLike extends JenaTripleLike { } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/0000755000175000017500000000000013176451570030773 5ustar andriusandrius././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractJenaRDFTerm.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractJen0000644000175000017500000000267513175733174033132 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import org.apache.commons.rdf.jena.JenaRDFTerm; import org.apache.jena.graph.Node; import org.apache.jena.riot.out.NodeFmtLib; class AbstractJenaRDFTerm implements JenaRDFTerm { private final Node node; // static private PrefixMapping empty = new PrefixMappingImpl(); protected AbstractJenaRDFTerm(final Node node) { this.node = node; } @Override public Node asJenaNode() { return node; } @Override public String ntriplesString() { return NodeFmtLib.str(node); } @Override public String toString() { return ntriplesString(); } } ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphIm0000644000175000017500000001261513175733174033052 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import java.io.StringWriter; import java.util.UUID; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.jena.JenaGraph; import org.apache.commons.rdf.jena.JenaRDF; import org.apache.jena.atlas.iterator.Iter; import org.apache.jena.graph.Node; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFDataMgr; class JenaGraphImpl implements JenaGraph { private final org.apache.jena.graph.Graph graph; private final UUID salt; private final transient JenaRDF factory; private Model model; JenaGraphImpl(final org.apache.jena.graph.Graph graph, final UUID salt) { this.graph = graph; this.salt = salt; this.factory = new JenaRDF(salt); } JenaGraphImpl(final Model model, final UUID salt) { this.model = model; this.graph = model.getGraph(); this.salt = salt; this.factory = new JenaRDF(salt); } @Override public void add(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { graph.add(org.apache.jena.graph.Triple.create(factory.asJenaNode(subject), factory.asJenaNode(predicate), factory.asJenaNode(object))); } @Override public void add(final Triple triple) { graph.add(factory.asJenaTriple(triple)); } @Override public org.apache.jena.graph.Graph asJenaGraph() { return graph; } @Override public void clear() { graph.clear(); } @Override public void close() { graph.close(); } @Override public boolean contains(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return graph.contains(toJenaPattern(subject), toJenaPattern(predicate), toJenaPattern(object)); } @Override public boolean contains(final Triple triple) { return graph.contains(factory.asJenaTriple(triple)); } @Override public void remove(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { graph.remove(toJenaPattern(subject), toJenaPattern(predicate), toJenaPattern(object)); } private Node toJenaPattern(final RDFTerm pattern) { if (pattern == null) { return Node.ANY; } return factory.asJenaNode(pattern); } @Override public void remove(final Triple triple) { if ((triple.getObject() instanceof Literal) && ((Literal) triple.getObject()).getLanguageTag().isPresent()) { // COMMONSRDF-51: graph.delete(Triple) would be too restrictive // as it won't delete triples with different lang tag - so // we'll need to use the pattern matching graph.remove instead() graph.remove( factory.asJenaNode(triple.getSubject()), factory.asJenaNode(triple.getPredicate()), factory.asJenaNode(triple.getObject())); } else { graph.delete(factory.asJenaTriple(triple)); } } @Override public long size() { return graph.size(); } @Override public Stream stream() { final JenaRDF factory = new JenaRDF(salt); return Iter.asStream(graph.find(null, null, null), true).map(factory::asTriple); } @Override public Stream stream(final BlankNodeOrIRI s, final IRI p, final RDFTerm o) { final JenaRDF factory = new JenaRDF(salt); return Iter.asStream(graph.find(toJenaAny(s), toJenaAny(p), toJenaAny(o)), true).map(factory::asTriple); } private Node toJenaAny(final RDFTerm term) { if (term == null) { return Node.ANY; } return factory.asJenaNode(term); } @Override public String toString() { final StringWriter sw = new StringWriter(); RDFDataMgr.write(sw, graph, Lang.NT); return sw.toString(); } @Override public Model asJenaModel() { if (model == null) { synchronized (this) { // As Model can be used for locks, we should make sure we don't // make // more than one model if (model == null) { model = ModelFactory.createModelForGraph(graph); } } } return model; } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDataset0000644000175000017500000001457513176451570033115 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import static org.apache.jena.graph.Node.ANY; import java.io.StringWriter; import java.util.Optional; import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.jena.JenaDataset; import org.apache.commons.rdf.jena.JenaGraph; import org.apache.commons.rdf.jena.JenaRDF; import org.apache.jena.atlas.iterator.Iter; import org.apache.jena.graph.Node; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFDataMgr; import org.apache.jena.sparql.core.DatasetGraph; import org.apache.jena.sparql.core.GraphView; class JenaDatasetImpl implements JenaDataset { private final DatasetGraph datasetGraph; private final UUID salt; private final JenaRDF factory; JenaDatasetImpl(final DatasetGraph datasetGraph, final UUID salt) { this.datasetGraph = datasetGraph; this.salt = salt; this.factory = new JenaRDF(salt); } @Override public void add(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { datasetGraph.add(org.apache.jena.sparql.core.Quad.create(factory.asJenaNode(graphName), factory.asJenaNode(subject), factory.asJenaNode(predicate), factory.asJenaNode(object))); } @Override public void add(final Quad quad) { datasetGraph.add(factory.asJenaQuad(quad)); } @Override public DatasetGraph asJenaDatasetGraph() { return datasetGraph; } @Override public void clear() { datasetGraph.clear(); } @Override public void close() { datasetGraph.close(); } @Override public boolean contains(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return datasetGraph.contains(toJenaPattern(graphName), toJenaPattern(subject), toJenaPattern(predicate), toJenaPattern(object)); } private Node toJenaPattern(final Optional graphName) { // In theory we could have done: // factory.toJena(graphName.orElse(internalJenaFactory::createAnyVariable)) // but because of generics casting rules that doesn't work :( if (graphName == null) { return ANY; } // null: default datasetGraph return factory.asJenaNode(graphName.orElse(null)); } private Node toJenaPattern(final RDFTerm term) { if (term == null) { return ANY; } return factory.asJenaNode(term); } @Override public boolean contains(final Quad quad) { return datasetGraph.contains(factory.asJenaQuad(quad)); } @Override public void remove(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { datasetGraph.deleteAny(toJenaPattern(graphName), toJenaPattern(subject), toJenaPattern(predicate), toJenaPattern(object)); } @Override public void remove(final Quad quad) { // COMMONSRDF-51: datasetGraph.deleteAny( toJenaPattern(quad.getGraphName()), toJenaPattern(quad.getSubject()), toJenaPattern(quad.getPredicate()), toJenaPattern(quad.getObject())); } @Override public long size() { final long quads = Iter.asStream(datasetGraph.listGraphNodes()) .map(datasetGraph::getGraph) .collect(Collectors.summingLong(org.apache.jena.graph.Graph::size)); return quads + datasetGraph.getDefaultGraph().size(); } @Override public Stream stream() { final JenaRDF factory = new JenaRDF(salt); return Iter.asStream(datasetGraph.find(ANY, ANY, ANY, ANY), true).map(factory::asQuad); } @Override public Stream stream(final Optional g, final BlankNodeOrIRI s, final IRI p, final RDFTerm o) { final JenaRDF factory = new JenaRDF(salt); return Iter.asStream(datasetGraph.find(toJenaPattern(g), toJenaPattern(s), toJenaPattern(p), toJenaPattern(o)), true) .map(factory::asQuad); } @Override public String toString() { final StringWriter sw = new StringWriter(); RDFDataMgr.write(sw, datasetGraph, Lang.NQUADS); return sw.toString(); } @Override public Graph getGraph() { final GraphView g = GraphView.createDefaultGraph(datasetGraph); return new JenaGraphImpl(g, salt); } @Override public JenaGraph getUnionGraph() { final GraphView gv = GraphView.createUnionGraph(datasetGraph); return new JenaGraphImpl(gv, salt); } @Override public Optional getGraph(final BlankNodeOrIRI graphName) { final GraphView gv = GraphView.createNamedGraph(datasetGraph, factory.asJenaNode(graphName)); return Optional.of(new JenaGraphImpl(gv, salt)); } @Override public Stream getGraphNames() { final JenaRDF factory = new JenaRDF(salt); return Iter.asStream(datasetGraph.listGraphNodes()).map(node -> (BlankNodeOrIRI) factory.asRDFTerm(node)); } @Override public Iterable iterate() { final JenaRDF factory = new JenaRDF(salt); return Iter.asStream(datasetGraph.find(), false).map(q -> (Quad) factory.asQuad(q))::iterator; } } ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractQuadLike.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractQua0000644000175000017500000001706313175733174033141 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import java.util.Objects; import java.util.Optional; import java.util.UUID; import org.apache.commons.rdf.api.QuadLike; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.jena.JenaQuad; import org.apache.commons.rdf.jena.JenaQuadLike; import org.apache.commons.rdf.jena.JenaRDF; import org.apache.commons.rdf.jena.JenaRDFTerm; import org.apache.commons.rdf.jena.JenaTriple; import org.apache.jena.graph.Triple; import org.apache.jena.sparql.core.Quad; /** * A generalized {@link QuadLike}, backed by a Jena {@link Quad} or * {@link Triple}. *

* This class does not implement any particular {@link #equals(Object)} or * {@link #hashCode()} but can otherwise be used as a base class for both a * {@link JenaTriple} and a {@link JenaQuad}. * * @see JenaTripleImpl * @see JenaQuadImpl * @see internalJenaFactory#createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm) * @see internalJenaFactory#createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, * RDFTerm) * */ abstract class AbstractQuadLike implements JenaQuadLike { private static InternalJenaFactory internalJenaFactory = new InternalJenaFactory() { }; /** * COMMONSRDF-55 - special handling of urn:x-arq:DefaultGraph and friends *

* This can recognize and * from any IRI instance, so they can be * replaced with Optional.empty(). Note that this code does not hardcode the * internal Jena IRIs but uses Jena's constants {@link Quad#defaultGraphIRI} * and {@link Quad#defaultGraphNodeGenerated}. */ private static class DefaultGraphChecker { // Fixed UUID for comparison of defaultGraphNodeGenerated private final UUID salt = UUID.fromString("aaa6bf96-ea58-4a55-9485-3733403a1f24"); private final RDFTerm defaultGraph = internalJenaFactory.createRDFTerm(Quad.defaultGraphIRI, salt); private final RDFTerm defaultGraphNodeGenerated = internalJenaFactory.createRDFTerm(Quad.defaultGraphNodeGenerated, salt); /** * Check if RDFTerm is an IRI that matches the two Jena default graph * constants (Even if they are from another RDF implementation). *

* This checker is "softer" than {@link #isNotDefaultGraphJenaNode(RDFTerm)} * * @param graphName * potential graph name IRI or BlankNode * @return true if the RDFTerm does not indicate a default * graph in Jena */ public boolean isNotDefaultGraph(final RDFTerm graphName) { return !(graphName.equals(defaultGraph) || graphName.equals(defaultGraphNodeGenerated)); } /** * Check if RDFTerm has an IRI that matches the two Jena default graph * constants (but only if it is an JenaRDFTerm instance) * * @param graphName * potential graph name IRI or BlankNode * @return true if the RDFTerm does not indicate a default * graph in Jena */ public boolean isNotDefaultGraphJenaNode(final RDFTerm graphName) { return ! (graphName instanceof JenaRDFTerm) || ! Quad.isDefaultGraph(((JenaRDFTerm)graphName).asJenaNode()); } } private static DefaultGraphChecker defaultGraphChecker = new DefaultGraphChecker(); final Optional graphName; final S subject; final P predicate; final O object; org.apache.jena.sparql.core.Quad quad = null; org.apache.jena.graph.Triple triple = null; AbstractQuadLike(final S subject, final P predicate, final O object, final Optional graphName) { this.subject = Objects.requireNonNull(subject); this.predicate = Objects.requireNonNull(predicate); this.object = Objects.requireNonNull(object); // Enforce this.graphName = Objects.requireNonNull(graphName).filter(defaultGraphChecker::isNotDefaultGraphJenaNode); } AbstractQuadLike(final S subject, final P predicate, final O object) { this(subject, predicate, object, Optional.empty()); } @SuppressWarnings("unchecked") AbstractQuadLike(final org.apache.jena.sparql.core.Quad quad, final UUID salt) { this.quad = Objects.requireNonNull(quad); this.subject = (S) internalJenaFactory.createRDFTerm(quad.getSubject(), salt); this.predicate = (P) internalJenaFactory.createRDFTerm(quad.getPredicate(), salt); this.object = (O) internalJenaFactory.createRDFTerm(quad.getObject(), salt); if (quad.isDefaultGraph()) { this.graphName = Optional.empty(); } else { this.graphName = Optional.of((G) internalJenaFactory.createRDFTerm(quad.getGraph(), salt)); } } @SuppressWarnings("unchecked") AbstractQuadLike(final org.apache.jena.graph.Triple triple, final UUID salt) { this.triple = Objects.requireNonNull(triple); this.subject = (S) internalJenaFactory.createRDFTerm(triple.getSubject(), salt); this.predicate = (P) internalJenaFactory.createRDFTerm(triple.getPredicate(), salt); this.object = (O) internalJenaFactory.createRDFTerm(triple.getObject(), salt); this.graphName = Optional.empty(); } @Override public org.apache.jena.sparql.core.Quad asJenaQuad() { final JenaRDF factory = new JenaRDF(); if (quad == null) { quad = org.apache.jena.sparql.core.Quad.create( graphName.map(factory::asJenaNode).orElse(Quad.defaultGraphIRI), factory.asJenaNode(subject), factory.asJenaNode(predicate), factory.asJenaNode(object)); } return quad; } @Override public org.apache.jena.graph.Triple asJenaTriple() { final JenaRDF factory = new JenaRDF(); if (triple == null) { triple = org.apache.jena.graph.Triple.create( factory.asJenaNode(subject), factory.asJenaNode(predicate), factory.asJenaNode(object)); } return triple; } @Override public S getSubject() { return subject; } @Override public P getPredicate() { return predicate; } @Override public O getObject() { return object; } @Override public Optional getGraphName() { return graphName; } @Override public String toString() { // kind of nquad syntax return getSubject().ntriplesString() + " " + getPredicate().ntriplesString() + " " + getObject().ntriplesString() + " " + getGraphName().map(RDFTerm::ntriplesString).orElse("") + "."; } } ././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJenaFactory.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJen0000644000175000017500000001524513175733174033140 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import java.util.Optional; import java.util.UUID; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.jena.ConversionException; import org.apache.commons.rdf.jena.JenaBlankNode; import org.apache.commons.rdf.jena.JenaDataset; import org.apache.commons.rdf.jena.JenaGeneralizedQuadLike; import org.apache.commons.rdf.jena.JenaGeneralizedTripleLike; import org.apache.commons.rdf.jena.JenaGraph; import org.apache.commons.rdf.jena.JenaIRI; import org.apache.commons.rdf.jena.JenaLiteral; import org.apache.commons.rdf.jena.JenaQuad; import org.apache.commons.rdf.jena.JenaRDF; import org.apache.commons.rdf.jena.JenaRDFTerm; import org.apache.commons.rdf.jena.JenaTriple; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.rdf.model.Model; import org.apache.jena.sparql.core.DatasetGraph; import org.apache.jena.sparql.core.DatasetGraphFactory; import org.apache.jena.sparql.graph.GraphFactory; import org.apache.jena.system.JenaSystem; /** * Construct Jena implementations of Commons RDF. *

* This class is deliberately an abstract class, as it is an internal helper * which may change in any minor version update; users should * instead use {@link JenaRDF}. *

* For the purpose of blank node identity, some of these methods require a * {@link UUID} to use as a salt. See {@link BlankNode#uniqueReference()} for * details. * */ public abstract class InternalJenaFactory { static { // http://jena.apache.org/documentation/notes/system-initialization.html JenaSystem.init(); } public JenaBlankNode createBlankNode(final String id, final UUID salt) { return new JenaBlankNodeImpl(NodeFactory.createBlankNode(id), salt); } public JenaBlankNode createBlankNode(final UUID salt) { return new JenaBlankNodeImpl(NodeFactory.createBlankNode(), salt); } public JenaDataset createDataset(final DatasetGraph datasetGraph, final UUID salt) { return new JenaDatasetImpl(datasetGraph, salt); } public JenaDataset createDataset(final UUID salt) { final DatasetGraph dg = DatasetGraphFactory.createGeneral(); // Or which createMethod() -- a bit confusing with lots of choice.. return new JenaDatasetImpl(dg, salt); } public JenaGeneralizedQuadLike createGeneralizedQuad(final org.apache.jena.sparql.core.Quad quad, final UUID salt) { return new JenaGeneralizedQuadLikeImpl(quad, salt); } public JenaGeneralizedQuadLike createGeneralizedQuad(final RDFTerm subject, final RDFTerm predicate, final RDFTerm object, final RDFTerm graphName) { return new JenaGeneralizedQuadLikeImpl(subject, predicate, object, Optional.ofNullable(graphName)); } public JenaGeneralizedTripleLike createGeneralizedTriple(final org.apache.jena.graph.Triple triple, final UUID salt) { return new JenaGeneralizedTripleLikeImpl(triple, salt); } public JenaGeneralizedTripleLike createGeneralizedTriple(final RDFTerm subject, final RDFTerm predicate, final RDFTerm object) { return new JenaGeneralizedTripleLikeImpl(subject, predicate, object); } public JenaGraph createGraph(final Model model, final UUID salt) { return new JenaGraphImpl(model, salt); } public JenaGraph createGraph(final org.apache.jena.graph.Graph graph, final UUID salt) { return new JenaGraphImpl(graph, salt); } public JenaGraph createGraph(final UUID salt) { return new JenaGraphImpl(GraphFactory.createDefaultGraph(), salt); } public JenaIRI createIRI(final String iriStr) { return new JenaIRIImpl(iriStr); } public JenaLiteral createLiteral(final String lexStr) { return new JenaLiteralImpl(NodeFactory.createLiteral(lexStr)); } public JenaLiteral createLiteralDT(final String lexStr, final String datatypeIRI) { return new JenaLiteralImpl(NodeFactory.createLiteral(lexStr, NodeFactory.getType(datatypeIRI))); } public JenaLiteral createLiteralLang(final String lexStr, final String langTag) { return new JenaLiteralImpl(NodeFactory.createLiteral(lexStr, langTag)); } public JenaQuad createQuad(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object, final BlankNodeOrIRI graphName) { return new JenaQuadImpl(subject, predicate, object, Optional.ofNullable(graphName)); } public JenaQuad createQuad(final org.apache.jena.sparql.core.Quad quad, final UUID salt) { return new JenaQuadImpl(quad, salt); } public JenaRDFTerm createRDFTerm(final Node node, final UUID salt) throws ConversionException { if (!node.isConcrete()) { throw new ConversionException("Node is not a concrete RDF Term: " + node); } if (node.isURI()) { return new JenaIRIImpl(node); } if (node.isLiteral()) { return new JenaLiteralImpl(node); } if (node.isBlank()) { return new JenaBlankNodeImpl(node, salt); } if (node.equals(Node.ANY)) { // NOTE: JenaAny no longer supported by Commons RDF // return JenaAnyImpl.Singleton.instance; } if (node.isVariable()) { // NOTE: JenaVariable no longer supported by Commons RDF // return new JenaVariableImpl(node); } throw new ConversionException("Unrecognized node type: " + node); } public JenaTriple createTriple(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return new JenaTripleImpl(subject, predicate, object); } public JenaTriple createTriple(final org.apache.jena.graph.Triple triple, final UUID salt) { return new JenaTripleImpl(triple, salt); } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImp0000644000175000017500000000500413175733174033055 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import java.util.Objects; import java.util.Optional; import java.util.UUID; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.jena.ConversionException; import org.apache.commons.rdf.jena.JenaQuad; class JenaQuadImpl extends AbstractQuadLike implements JenaQuad { JenaQuadImpl(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object, final Optional graphName) { super(subject, predicate, object, graphName); } JenaQuadImpl(final org.apache.jena.sparql.core.Quad quad, final UUID salt) { super(quad, salt); // Check the conversion if ((graphName.isPresent() && !(graphName.get() instanceof BlankNodeOrIRI)) || !(subject instanceof BlankNodeOrIRI) || !(predicate instanceof IRI) || !(object instanceof RDFTerm)) { throw new ConversionException("Can't adapt generalized quad: " + quad); } } @Override public boolean equals(final Object other) { if (other == this) { return true; } if (!(other instanceof Quad)) { return false; } final Quad quad = (Quad) other; return getGraphName().equals(quad.getGraphName()) && getSubject().equals(quad.getSubject()) && getPredicate().equals(quad.getPredicate()) && getObject().equals(quad.getObject()); } @Override public int hashCode() { return Objects.hash(getSubject(), getPredicate(), getObject(), getGraphName()); } } ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNo0000644000175000017500000000365113175733174033047 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import java.util.UUID; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.jena.JenaBlankNode; import org.apache.jena.graph.Node; class JenaBlankNodeImpl extends AbstractJenaRDFTerm implements JenaBlankNode { private final UUID salt; JenaBlankNodeImpl(final Node node, final UUID salt) { super(node); if (!node.isBlank()) { throw new IllegalArgumentException("Node is not a blank node: " + node); } this.salt = salt; } @Override public boolean equals(final Object other) { if (other == this) { return true; } if (other == null) { return false; } if (!(other instanceof BlankNode)) { return false; } final BlankNode bNode = (BlankNode) other; return uniqueReference().equals(bNode.uniqueReference()); } @Override public int hashCode() { return uniqueReference().hashCode(); } @Override public String uniqueReference() { return salt + asJenaNode().getBlankNodeLabel(); } } ././@LongLink0000644000000000000000000000017400000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedTripleLikeImpl.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneral0000644000175000017500000000262613175733174033101 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import java.util.UUID; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.jena.JenaGeneralizedTripleLike; import org.apache.jena.graph.Triple; class JenaGeneralizedTripleLikeImpl extends AbstractQuadLike implements JenaGeneralizedTripleLike { JenaGeneralizedTripleLikeImpl(final RDFTerm subject, final RDFTerm predicate, final RDFTerm object) { super(subject, predicate, object); } JenaGeneralizedTripleLikeImpl(final Triple triple, final UUID salt) { super(triple, salt); } } ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleI0000644000175000017500000000457413175733174033100 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import java.util.Objects; import java.util.UUID; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.jena.ConversionException; import org.apache.commons.rdf.jena.JenaTriple; class JenaTripleImpl extends AbstractQuadLike implements JenaTriple { JenaTripleImpl(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { super(subject, predicate, object); } JenaTripleImpl(final org.apache.jena.graph.Triple triple, final UUID salt) throws ConversionException { super(triple, salt); // Check the conversion if (!(subject instanceof BlankNodeOrIRI) || !(predicate instanceof IRI) || !(object instanceof RDFTerm)) { throw new ConversionException("Can't adapt generalized triple: " + quad); } } @Override public boolean equals(final Object other) { if (other == this) { return true; } if (other == null) { return false; } if (!(other instanceof Triple)) { return false; } final Triple triple = (Triple) other; return getSubject().equals(triple.getSubject()) && getPredicate().equals(triple.getPredicate()) && getObject().equals(triple.getObject()); } @Override public int hashCode() { return Objects.hash(getSubject(), getPredicate(), getObject()); } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteral0000644000175000017500000000544313175733174033120 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import java.util.Locale; import java.util.Objects; import java.util.Optional; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.jena.JenaLiteral; import org.apache.jena.graph.Node; class JenaLiteralImpl extends AbstractJenaRDFTerm implements JenaLiteral { private static InternalJenaFactory internalJenaFactory = new InternalJenaFactory() { }; JenaLiteralImpl(final Node node) { super(node); if (!node.isLiteral()) { throw new IllegalArgumentException("Node is not a literal: " + node); } } private static String lowerCase(final String langTag) { return langTag.toLowerCase(Locale.ROOT); } @Override public boolean equals(final Object other) { if (other == this) { return true; } if (other == null) { return false; } if (!(other instanceof Literal)) { return false; } final Literal literal = (Literal) other; return getLexicalForm().equals(literal.getLexicalForm()) && getDatatype().equals(literal.getDatatype()) && getLanguageTag().map(JenaLiteralImpl::lowerCase).equals( literal.getLanguageTag().map(JenaLiteralImpl::lowerCase)); } @Override public IRI getDatatype() { return internalJenaFactory.createIRI(asJenaNode().getLiteralDatatype().getURI()); } @Override public Optional getLanguageTag() { final String x = asJenaNode().getLiteralLanguage(); if (x == null || x.isEmpty()) { return Optional.empty(); } return Optional.of(x); } @Override public String getLexicalForm() { return asJenaNode().getLiteralLexicalForm(); } @Override public int hashCode() { return Objects.hash(getLexicalForm(), getDatatype(), getLanguageTag().map(JenaLiteralImpl::lowerCase)); } } ././@LongLink0000644000000000000000000000017200000000000011603 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedQuadLikeImpl.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneral0000644000175000017500000000272513175733174033101 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import java.util.Optional; import java.util.UUID; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.jena.JenaGeneralizedQuadLike; import org.apache.jena.sparql.core.Quad; class JenaGeneralizedQuadLikeImpl extends AbstractQuadLike implements JenaGeneralizedQuadLike { JenaGeneralizedQuadLikeImpl(final RDFTerm subject, final RDFTerm predicate, final RDFTerm object, final Optional ofNullable) { super(subject, predicate, object, ofNullable); } JenaGeneralizedQuadLikeImpl(final Quad quad, final UUID salt) { super(quad, salt); } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl0000644000175000017500000000357113175733174032771 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena.impl; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.jena.JenaIRI; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; class JenaIRIImpl extends AbstractJenaRDFTerm implements JenaIRI { JenaIRIImpl(final Node node) { super(node); if (!node.isURI()) { throw new IllegalArgumentException("Node is not an IRI node: " + node); } } JenaIRIImpl(final String iriStr) { super(NodeFactory.createURI(iriStr)); } @Override public boolean equals(final Object other) { if (other == this) { return true; } if (other == null) { return false; } if (!(other instanceof IRI)) { return false; } final IRI iri = (IRI) other; return getIRIString().equals(iri.getIRIString()); } @Override public String getIRIString() { return asJenaNode().getURI(); } @Override public int hashCode() { return getIRIString().hashCode(); } } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaGraph.java0000644000175000017500000000365613175733174032550 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; // NOTE: To avoid confusion, don't import Graph as it exists in both APIs import org.apache.jena.rdf.model.Model; // /** * A Jena-backed {@link org.apache.commons.rdf.api.Graph}. *

* The underlying Jena {@link org.apache.jena.graph.Graph} can be accessed with * {@link #asJenaGraph()}. */ public interface JenaGraph extends org.apache.commons.rdf.api.Graph { /** * Return the underlying Jena {@link org.apache.jena.graph.Graph}. *

* Changes to the Jena graph are reflected in the Commons RDF graph and vice * versa. * * @return A Jena {@link org.apache.jena.graph.Graph} */ public org.apache.jena.graph.Graph asJenaGraph(); /** * Return the graph as a Jena {@link Model}. *

* Changes to the Jena model are reflected in the Commons RDF graph and vice * versa. *

* Note that in some cases there is no underlying Jena {@link Model}, in * which case this method will create one. Subsequent calls should return * the same model. * * @return A Jena {@link Model} */ public Model asJenaModel(); } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaQuad.java0000644000175000017500000000223413175733174032370 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.BlankNodeOrIRI; /** * A Jena-backed {@link org.apache.commons.rdf.api.Quad}. *

* The underlying Jena {@link org.apache.jena.sparql.core.Quad} can be accessed * with {@link #asJenaQuad()}. */ public interface JenaQuad extends org.apache.commons.rdf.api.Quad, JenaQuadLike { } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTerm.java0000644000175000017500000000225313175733174032742 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.RDFTerm; import org.apache.jena.graph.Node; /** * A Jena-backed {@link RDFTerm}. *

* The underlying Jena {@link Node} can be retrieved with {@link #asJenaNode()}. * * @see JenaIRI * @see JenaLiteral * @see JenaBlankNode */ public interface JenaRDFTerm extends RDFTerm { public Node asJenaNode(); } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaLiteral.java0000644000175000017500000000216313175733174033073 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.Literal; import org.apache.jena.graph.Node; /** * A Jena-backed {@link Literal} * * The underlying Jena {@link Node} can be accessed from {@link #asJenaNode()}. * * @see Node#isLiteral() */ public interface JenaLiteral extends JenaRDFTerm, Literal { } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaTriple.java0000644000175000017500000000213713175733174032737 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; /** * A Jena-backed {@link org.apache.commons.rdf.api.Triple}. *

* The underlying Jena {@link org.apache.jena.graph.Triple} can be accessed with * {@link #asJenaTriple()}. */ public interface JenaTriple extends org.apache.commons.rdf.api.Triple, JenaTripleLike { } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java0000644000175000017500000007762113175733174032125 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import java.util.Optional; import java.util.UUID; import java.util.function.Consumer; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.QuadLike; import org.apache.commons.rdf.api.RDFSyntax; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.api.TripleLike; import org.apache.commons.rdf.jena.impl.InternalJenaFactory; import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.datatypes.xsd.XSDDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFDataMgr; import org.apache.jena.riot.RDFLanguages; import org.apache.jena.riot.system.StreamRDF; import org.apache.jena.riot.system.StreamRDFBase; import org.apache.jena.sparql.core.DatasetGraph; import org.apache.jena.sparql.graph.GraphFactory; /** * Apache Jena RDF implementation. *

* Instances of JenaRDF can also convert existing objects from Jena with methods * like {@link #asRDFTerm(Node)} and * {@link #asGraph(org.apache.jena.graph.Graph)}, and vice versa from any * Commons RDF object to Jena with the asJena* methods like * {@link #asJenaNode(RDFTerm)} and {@link #asJenaGraph(Graph)}. *

* Note that Commons RDF objects created by this class implement the * specializations interfaces like {@link JenaRDFTerm}, {@link JenaGraph} and * {@link JenaTriple}, which provide access to the underlying Jena objects, e.g. * with {@link JenaRDFTerm#asJenaNode()}. *

* For the purpose of {@link BlankNode} identity when using * {@link #createBlankNode(String)} (see {@link BlankNode#equals(Object)} and * {@link BlankNode#uniqueReference()}), each instance of JenaRDF uses an * internal random state. If for some reason consistent/reproducible BlankNode * identity is desired, it is possible to retrieve the state as a UUID using * {@link #salt()} for subsequent use with {@link JenaRDF#JenaRDF(UUID)} - note * that such consistency is only guaranteed within the same minor version of * Commons RDF. * * @see RDF */ public final class JenaRDF implements RDF { private static InternalJenaFactory internalJenaFactory = new InternalJenaFactory() { }; private final UUID salt; /** * Create a JenaRDF. *

* This constructor will use a randomly generated {@link UUID} as a salt for * the purposes of {@link BlankNode} identity, see {@link #salt()}. */ public JenaRDF() { this.salt = UUID.randomUUID(); } /** * Create a JenaRDF. *

* This constructor will use the specified {@link UUID} as a salt for the * purposes of {@link BlankNode} identity, and should only be used in cases * where predictable and consistent {@link BlankNode#uniqueReference()} are * important. * * @param salt * {@link UUID} to use as salt for {@link BlankNode} equality */ public JenaRDF(final UUID salt) { this.salt = salt; } @Override public JenaBlankNode createBlankNode() { return internalJenaFactory.createBlankNode(salt()); } @Override public JenaBlankNode createBlankNode(final String name) { return internalJenaFactory.createBlankNode(name, salt()); } @Override public JenaDataset createDataset() { return internalJenaFactory.createDataset(salt()); } @Override public JenaGraph createGraph() { return internalJenaFactory.createGraph(salt()); } @Override public JenaIRI createIRI(final String iri) { validateIRI(iri); return internalJenaFactory.createIRI(iri); } @Override public JenaLiteral createLiteral(final String lexicalForm) { return internalJenaFactory.createLiteral(lexicalForm); } @Override public JenaLiteral createLiteral(final String lexicalForm, final IRI dataType) { return internalJenaFactory.createLiteralDT(lexicalForm, dataType.getIRIString()); } @Override public JenaLiteral createLiteral(final String lexicalForm, final String languageTag) { validateLang(languageTag); return internalJenaFactory.createLiteralLang(lexicalForm, languageTag); } @Override public JenaTriple createTriple(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return internalJenaFactory.createTriple(subject, predicate, object); } /** * {@inheritDoc} *

* In addition to supporting a graphName of null * for representing a triple in the default graph, this method also * recognize a {@link JenaIRI} which {@link JenaRDFTerm#asJenaNode()} * represent the default graph according to * {@link org.apache.jena.sparql.core.Quad#isDefaultGraph(Node)}, in which * case the returned JenaQuad will have a {@link Quad#getGraphName()} of * {@link Optional#empty()} rather than the provided IRI. * */ @Override public JenaQuad createQuad(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) throws IllegalArgumentException, UnsupportedOperationException { return internalJenaFactory.createQuad(subject, predicate, object, graphName); } /** * Create a generalized Jena triple. *

* The generalized triple supports any {@link RDFTerm} as its * {@link TripleLike#getSubject()} {@link TripleLike#getPredicate()} or * {@link TripleLike#getObject()}. * * @see #createTriple(BlankNodeOrIRI, IRI, RDFTerm) * @see #createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, RDFTerm) * * @param subject * The subject of the statement * @param predicate * The predicate of the statement * @param object * The object of the statement * @return Generalized {@link TripleLike}. Note that the generalized triple * does not implement {@link Triple#equals(Object)} * or {@link Triple#hashCode()}. */ public JenaGeneralizedTripleLike createGeneralizedTriple(final RDFTerm subject, final RDFTerm predicate, final RDFTerm object) { return internalJenaFactory.createGeneralizedTriple(subject, predicate, object); } /** * Create a generalized Jena quad. *

* The generalized quad supports any {@link RDFTerm} as its * {@link QuadLike#getSubject()} {@link QuadLike#getPredicate()}, * {@link QuadLike#getObject()} or {@link QuadLike#getObject()}. *

* In addition to supporting a graphName of null * for representing a triple in the default graph, this method also * recognize a {@link JenaIRI} which {@link JenaRDFTerm#asJenaNode()} * represent the default graph according to * {@link org.apache.jena.sparql.core.Quad#isDefaultGraph(Node)}, in which * case the returned JenaQuad will have a {@link Quad#getGraphName()} of * {@link Optional#empty()} rather than the provided IRI. * * @see #createQuad(BlankNodeOrIRI, BlankNodeOrIRI, IRI, RDFTerm) * @see #createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm) * * @param subject * The subject of the statement * @param predicate * The predicate of the statement * @param object * The object of the statement * @param graphName * The graph name of the statement * @return Generalized {@link QuadLike}. Note that the generalized quad does * not implement {@link Quad#equals(Object)} or * {@link Quad#hashCode()}. */ public JenaGeneralizedQuadLike createGeneralizedQuad(final RDFTerm subject, final RDFTerm predicate, final RDFTerm object, final RDFTerm graphName) { return internalJenaFactory.createGeneralizedQuad(subject, predicate, object, graphName); } /** * Adapt an existing Jena Node to CommonsRDF {@link RDFTerm}. *

* If {@link Node#isLiteral()}, then the returned value is a * {@link Literal}. If {@link Node#isURI()}, the returned value is a IRI. If * {$@link Node#isBlank()}, the returned value is a {@link BlankNode}, which * will use a {@link UUID} salt from this {@link JenaRDF} instance in * combination with {@link Node#getBlankNodeId()} for the purpose of its * {@link BlankNode#uniqueReference()}. * * @see #asRDFTerm(RDF, Node) * * @param node * The Jena Node to adapt. It's {@link Node#isConcrete()} must be * true. * @return Adapted {@link JenaRDFTerm} * @throws ConversionException * If the {@link Node} can't be represented as an * {@link RDFTerm}, e.g. if the node is not concrete or * represents a variable in Jena. */ public JenaRDFTerm asRDFTerm(final Node node) throws ConversionException { return internalJenaFactory.createRDFTerm(node, salt()); } /** * Convert from Jena {@link Node} to any Commons RDF implementation. *

* Note that if the {@link Node#isBlank()}, then the factory's * {@link RDF#createBlankNode(String)} will be used, meaning that care * should be taken if reusing an {@link RDF} instance for multiple * conversion sessions. * * @see #asRDFTerm(Node) * * @param factory * {@link RDF} to use for creating {@link RDFTerm}. * @param node * The Jena Node to adapt. It's {@link Node#isConcrete()} must be * true. * @return Adapted {@link RDFTerm} * @throws ConversionException * If the {@link Node} can't be represented as an * {@link RDFTerm}, e.g. if the node is not concrete or * represents a variable in Jena. */ public static RDFTerm asRDFTerm(final RDF factory, final Node node) { if (node == null) { return null; } if (factory instanceof JenaRDF) { // No need to convert, just wrap return ((JenaRDF) factory).asRDFTerm(node); } if (node.isURI()) { return factory.createIRI(node.getURI()); } if (node.isLiteral()) { final String lang = node.getLiteralLanguage(); if (lang != null && !lang.isEmpty()) { return factory.createLiteral(node.getLiteralLexicalForm(), lang); } if (node.getLiteralDatatype().equals(XSDDatatype.XSDstring)) { return factory.createLiteral(node.getLiteralLexicalForm()); } final IRI dt = factory.createIRI(node.getLiteralDatatype().getURI()); return factory.createLiteral(node.getLiteralLexicalForm(), dt); } if (node.isBlank()) { // The factory return factory.createBlankNode(node.getBlankNodeLabel()); } throw new ConversionException("Node is not a concrete RDF Term: " + node); } /** * Adapt an existing Jena Triple to CommonsRDF {@link Triple}. *

* If the triple contains any {@link Node#isBlank()}, then any corresponding * {@link BlankNode} will use a {@link UUID} salt from this {@link JenaRDF} * instance in combination with {@link Node#getBlankNodeId()} for the * purpose of its {@link BlankNode#uniqueReference()}. * * @see #asTriple(RDF, org.apache.jena.graph.Triple) * * @param triple * Jena {@link org.apache.jena.graph.Triple} to adapt * @return Adapted {@link JenaTriple} * @throws ConversionException * if any of the triple's nodes are not concrete or the triple * is a generalized triple */ public JenaTriple asTriple(final org.apache.jena.graph.Triple triple) throws ConversionException { return internalJenaFactory.createTriple(triple, salt()); } /** * Adapt a generalized Jena {@link org.apache.jena.graph.Triple} to a * CommonsRDF {@link TripleLike}. *

* The generalized triple supports any {@link RDFTerm} as its * {@link TripleLike#getSubject()} {@link TripleLike#getPredicate()} or * {@link TripleLike#getObject()}. *

* If the Jena triple contains any {@link Node#isBlank()}, then any * corresponding {@link BlankNode} will use a {@link UUID} salt from this * {@link JenaRDF} instance in combination with * {@link Node#getBlankNodeId()} for the purpose of its * {@link BlankNode#uniqueReference()}. * * @see #asTriple(RDF, org.apache.jena.graph.Triple) * * @param triple * Jena triple * @return Adapted {@link TripleLike}. Note that the generalized triple does * not implement {@link Triple#equals(Object)} or * {@link Triple#hashCode()}. * @throws ConversionException * if any of the triple's nodes are not concrete */ public JenaTripleLike asGeneralizedTriple(final org.apache.jena.graph.Triple triple) throws ConversionException { return internalJenaFactory.createGeneralizedTriple(triple, salt()); } /** * Adapt a generalized Jena {@link org.apache.jena.sparql.core.Quad} to a * CommonsRDF {@link QuadLike}. *

* The generalized quad supports any {@link RDFTerm} as its * {@link QuadLike#getGraphName()}, {@link QuadLike#getSubject()} * {@link QuadLike#getPredicate()} or {@link QuadLike#getObject()}. *

* If the Jena quad contains any {@link Node#isBlank()}, then any * corresponding {@link BlankNode} will use a {@link UUID} salt from this * {@link JenaRDF} instance in combination with * {@link Node#getBlankNodeId()} for the purpose of its * {@link BlankNode#uniqueReference()}. *

* If the provided quad {@link org.apache.jena.sparql.core.Quad#isDefaultGraph()}, * the returned {@link JenaQuadLike} has a {@link JenaQuadLike#getGraphName()} * of {@link Optional#empty()}. * * @see #asQuad(org.apache.jena.sparql.core.Quad) * @see #asGeneralizedTriple(org.apache.jena.graph.Triple) * * @param quad * Jena quad * @return Adapted {@link QuadLike}. Note that the generalized quad does * not implement {@link Quad#equals(Object)} or * {@link Quad#hashCode()}. * @throws ConversionException * if any of the quad nodes are not concrete */ public JenaQuadLike asGeneralizedQuad(final org.apache.jena.sparql.core.Quad quad) throws ConversionException { return internalJenaFactory.createGeneralizedQuad(quad, salt()); } /** * Convert from Jena {@link org.apache.jena.graph.Triple} to a Commons RDF * {@link Triple}. *

* Note that if any of the triple's nodes {@link Node#isBlank()}, then the * factory's {@link RDF#createBlankNode(String)} will be used, meaning that * care should be taken if reusing an {@link RDF} instance for multiple * conversion sessions. * * @see #asTriple(org.apache.jena.graph.Triple) * * @param factory * {@link RDF} to use for creating the {@link Triple} and its * {@link RDFTerm}s. * @param triple * Jena triple * @return Converted triple * @throws ConversionException * if any of the triple's nodes are not concrete or the triple * is a generalized triple */ public static Triple asTriple(final RDF factory, final org.apache.jena.graph.Triple triple) throws ConversionException { if (factory instanceof JenaRDF) { // No need to convert, just wrap return ((JenaRDF) factory).asTriple(triple); } final BlankNodeOrIRI subject; final IRI predicate; try { subject = (BlankNodeOrIRI) asRDFTerm(factory, triple.getSubject()); predicate = (IRI) asRDFTerm(factory, triple.getPredicate()); } catch (final ClassCastException ex) { throw new ConversionException("Can't convert generalized triple: " + triple, ex); } final RDFTerm object = asRDFTerm(factory, triple.getObject()); return factory.createTriple(subject, predicate, object); } /** * Adapt an existing Jena {@link org.apache.jena.sparql.core.Quad} to * CommonsRDF {@link Quad}. *

* If the quad contains any {@link Node#isBlank()}, then any corresponding * {@link BlankNode} will use a {@link UUID} salt from this {@link JenaRDF} * instance in combination with {@link Node#getBlankNodeId()} for the * purpose of its {@link BlankNode#uniqueReference()}. *

* If the provided quad {@link org.apache.jena.sparql.core.Quad#isDefaultGraph()}, * the returned {@link JenaQuad} has a {@link Quad#getGraphName()} * of {@link Optional#empty()}. * * @param quad * Jena quad * @return Adapted quad */ public JenaQuad asQuad(final org.apache.jena.sparql.core.Quad quad) { return internalJenaFactory.createQuad(quad, salt()); } /** * Adapt an existing Jena {@link org.apache.jena.graph.Graph} to CommonsRDF * {@link Graph}. *

* This does not take a copy, changes to the CommonsRDF Graph are reflected * in the jena graph, which is accessible from * {@link JenaGraph#asJenaGraph()}. *

* If the graph contains any {@link Node#isBlank()}, then any corresponding * {@link BlankNode} will use a {@link UUID} salt from this {@link JenaRDF} * instance in combination with {@link Node#getBlankNodeId()} for the * purpose of its {@link BlankNode#uniqueReference()}. * * @param graph * Jena {@link org.apache.jena.graph.Graph} to adapt * @return Adapted {@link JenaGraph} */ public JenaGraph asGraph(final org.apache.jena.graph.Graph graph) { return internalJenaFactory.createGraph(graph, salt()); } /** * Adapt an existing Jena {@link org.apache.jena.rdf.model.Model} to * CommonsRDF {@link Graph}. *

* This does not ake a copy, changes to the CommonsRDF Graph are reflected * in the jena graph, which is accessible from * {@link JenaGraph#asJenaGraph()}. *

* If the graph contains any {@link Node#isBlank()}, then any corresponding * {@link BlankNode} will use a {@link UUID} salt from this {@link JenaRDF} * instance in combination with {@link Node#getBlankNodeId()} for the * purpose of its {@link BlankNode#uniqueReference()}. * * @param model * Jena {@link org.apache.jena.rdf.model.Model} to adapt * @return Adapted {@link JenaGraph} */ public JenaGraph asGraph(final org.apache.jena.rdf.model.Model model) { return internalJenaFactory.createGraph(model, salt()); } /** * Adapt an existing Jena {@link DatasetGraph} to CommonsRDF * {@link Dataset}. *

* This does not take a copy, changes to the CommonsRDF Dataset are * reflected in the jena dataset graph, which is accessible from * {@link JenaDataset#asJenaDatasetGraph()}. *

* If the dataset contains any {@link Node#isBlank()}, then any * corresponding {@link BlankNode} will use a {@link UUID} salt from this * {@link JenaRDF} instance in combination with * {@link Node#getBlankNodeId()} for the purpose of its * {@link BlankNode#uniqueReference()}. * * @param datasetGraph * Jena {@link DatasetGraph} to adapt * @return Adapted {@link JenaDataset} */ public JenaDataset asDataset(final DatasetGraph datasetGraph) { return internalJenaFactory.createDataset(datasetGraph, salt()); } /** * Adapt an existing Jena {@link org.apache.jena.query.Dataset} to * CommonsRDF {@link Dataset}. *

* This does not take a copy, changes to the CommonsRDF Dataset are * reflected in the jena dataset graph, which is accessible from * {@link JenaDataset#asJenaDatasetGraph()}. *

* If the dataset contains any {@link Node#isBlank()}, then any * corresponding {@link BlankNode} will use a {@link UUID} salt from this * {@link JenaRDF} instance in combination with * {@link Node#getBlankNodeId()} for the purpose of its * {@link BlankNode#uniqueReference()}. * * @param datasetGraph * Jena {@link org.apache.jena.query.Dataset} to adapt * @return Adapted {@link JenaDataset} */ public JenaDataset asDataset(final org.apache.jena.query.Dataset datasetGraph) { return internalJenaFactory.createDataset(datasetGraph.asDatasetGraph(), salt()); } /** * Convert from Jena {@link org.apache.jena.sparql.core.Quad} to a Commons * RDF {@link Quad}. *

* Note that if any of the quad's nodes {@link Node#isBlank()}, then the * factory's {@link RDF#createBlankNode(String)} will be used, meaning that * care should be taken if reusing an {@link RDF} instance for multiple * conversion sessions. *

* If the provided quad {@link org.apache.jena.sparql.core.Quad#isDefaultGraph()}, * the returned {@link JenaQuadLike} has a {@link JenaQuadLike#getGraphName()} * of {@link Optional#empty()}. * * @see #asQuad(org.apache.jena.sparql.core.Quad) * @see #asGeneralizedQuad(org.apache.jena.sparql.core.Quad) * * @param factory * {@link RDF} to use for creating the {@link Triple} and its * {@link RDFTerm}s. * @param quad * Jena {@link org.apache.jena.sparql.core.Quad} to adapt * @return Converted {@link Quad} * @throws ConversionException * if any of the quad's nodes are not concrete or the quad is a * generalized quad */ public static Quad asQuad(final RDF factory, final org.apache.jena.sparql.core.Quad quad) { if (factory instanceof JenaRDF) { // No need to convert, just wrap return ((JenaRDF) factory).asQuad(quad); } final BlankNodeOrIRI graphName = (BlankNodeOrIRI) (asRDFTerm(factory, quad.getGraph())); final BlankNodeOrIRI subject = (BlankNodeOrIRI) (asRDFTerm(factory, quad.getSubject())); final IRI predicate = (IRI) (asRDFTerm(factory, quad.getPredicate())); final RDFTerm object = asRDFTerm(factory, quad.getObject()); return factory.createQuad(graphName, subject, predicate, object); } /** * Return {@link RDFSyntax} corresponding to a Jena {@link Lang}. * * @param lang * {@link Lang} to convert * @return Matched {@link RDFSyntax}, otherwise {@link Optional#empty()} */ public Optional asRDFSyntax(final Lang lang) { return RDFSyntax.byMediaType(lang.getContentType().getContentType()); } /** * Return Jena {@link Lang} corresponding to a {@link RDFSyntax}. * * @param rdfSyntax * {@link RDFSyntax} to convert * @return Matched {@link Lang}, otherwise {@link Optional#empty()} */ public Optional asJenaLang(final RDFSyntax rdfSyntax) { return Optional.ofNullable(RDFLanguages.contentTypeToLang(rdfSyntax.mediaType())); } /** * Create a {@link StreamRDF} instance that inserts the converted * {@link Quad}s. into a the provided {@link Consumer}. *

* The returned {@link StreamRDF} can be used for instance with Jena's * {@link RDFDataMgr#parse(StreamRDF, String)}. * * @param factory * {@link RDF} to use for creating {@link RDFTerm}s and * {@link Quad}s. * @param consumer * A {@link Consumer} of {@link Quad}s * @return A {@link StreamRDF} that will stream converted quads to the * consumer */ public static StreamRDF streamJenaToQuad(final RDF factory, final Consumer consumer) { return new StreamRDFBase() { @Override public void quad(final org.apache.jena.sparql.core.Quad quad) { consumer.accept(asQuad(factory, quad)); } }; } /** * Create a {@link StreamRDF} instance that inserts generalized * {@link TripleLike}s. into a the provided {@link Consumer}. *

* A generalized triple allows any {@link RDFTerm} for * {@link TripleLike#getSubject()}, {@link TripleLike#getPredicate()} and * {@link TripleLike#getObject()}. *

* The returned {@link StreamRDF} can be used for instance with Jena's * {@link RDFDataMgr#parse(StreamRDF, String)}. * * @param generalizedConsumer * A {@link Consumer} of generalized {@link TripleLike}s * @return A {@link StreamRDF} that will stream generalized triples to the * consumer */ public StreamRDF streamJenaToGeneralizedTriple(final Consumer generalizedConsumer) { return new StreamRDFBase() { @Override public void triple(final org.apache.jena.graph.Triple triple) { generalizedConsumer.accept(asGeneralizedTriple(triple)); } }; } /** * Create a {@link StreamRDF} instance that inserts generalized * {@link QuadLike}s. into a the provided {@link Consumer}. *

* A generalized quad allows any {@link RDFTerm} for * {@link QuadLike#getSubject()}, {@link TripleLike#getPredicate()}, * {@link QuadLike#getObject()} and {@link QuadLike#getGraphName()} . *

* The returned {@link StreamRDF} can be used for instance with Jena's * {@link RDFDataMgr#parse(StreamRDF, String)}. * * @param generalizedConsumer * A {@link Consumer} of generalized {@link QuadLike}s * @return A {@link StreamRDF} that will stream generalized quads to the * consumer */ public StreamRDF streamJenaToGeneralizedQuad(final Consumer> generalizedConsumer) { return new StreamRDFBase() { @Override public void quad(final org.apache.jena.sparql.core.Quad quad) { generalizedConsumer.accept(asGeneralizedQuad(quad)); } }; } /** * Convert a CommonsRDF Graph to a Jena Graph. If the Graph was from Jena * originally, return that original object else create a copy using Jena * objects. * * @param graph * Commons RDF {@link Graph} to convert * @return Converted Jena {@link org.apache.jena.graph.Graph} */ public org.apache.jena.graph.Graph asJenaGraph(final Graph graph) { if (graph instanceof JenaGraph) { return ((JenaGraph) graph).asJenaGraph(); } final org.apache.jena.graph.Graph g = GraphFactory.createGraphMem(); graph.stream().forEach(t -> g.add(asJenaTriple(t))); return g; } /** * Convert a CommonsRDF RDFTerm to a Jena Node. If the RDFTerm was from Jena * originally, return that original object, else create a copy using Jena * objects. * * @param term * Commons RDF {@link RDFTerm} to convert * @return Converted Jena {@link Node} */ public Node asJenaNode(final RDFTerm term) { if (term == null) { return null; } if (term instanceof JenaRDFTerm) { // TODO: What if it's a JenaBlankNodeImpl with // a different salt? Do we need to rewrite the // jena blanknode identifier? return ((JenaRDFTerm) term).asJenaNode(); } if (term instanceof IRI) { return NodeFactory.createURI(((IRI) term).getIRIString()); } if (term instanceof Literal) { final Literal lit = (Literal) term; final RDFDatatype dt = NodeFactory.getType(lit.getDatatype().getIRIString()); final String lang = lit.getLanguageTag().orElse(""); return NodeFactory.createLiteral(lit.getLexicalForm(), lang, dt); } if (term instanceof BlankNode) { final String id = ((BlankNode) term).uniqueReference(); return NodeFactory.createBlankNode(id); } throw new ConversionException("Not a concrete RDF Term: " + term); } /** * Convert a CommonsRDF {@link Triple} to a Jena * {@link org.apache.jena.graph.Triple}. *

* If the triple was from Jena originally, return that original object, else * create a copy using Jena objects. * * @param triple * Commons RDF {@link Triple} to convert * @return Converted Jena {@link org.apache.jena.graph.Triple} */ public org.apache.jena.graph.Triple asJenaTriple(final Triple triple) { if (triple instanceof JenaTriple) { return ((JenaTriple) triple).asJenaTriple(); } return org.apache.jena.graph.Triple.create(asJenaNode(triple.getSubject()), asJenaNode(triple.getPredicate()), asJenaNode(triple.getObject())); } /** * Convert a CommonsRDF {@link Quad} to a Jena * {@link org.apache.jena.sparql.core.Quad}. *

* If the quad was from Jena originally, return that original object, * otherwise create a copy using Jena objects. * * @param quad * Commons RDF {@link Quad} to convert * @return Converted Jena {@link org.apache.jena.sparql.core.Quad} */ public org.apache.jena.sparql.core.Quad asJenaQuad(final Quad quad) { if (quad instanceof JenaQuad) { return ((JenaQuad) quad).asJenaQuad(); } return org.apache.jena.sparql.core.Quad.create( asJenaNode(quad.getGraphName().orElse(null)), asJenaNode(quad.getSubject()), asJenaNode(quad.getPredicate()), asJenaNode(quad.getObject())); } // Some simple validations - full IRI parsing is not cheap. private void validateIRI(final String iri) { if (iri.contains(" ")) { throw new IllegalArgumentException(); } if (iri.contains("<")) { throw new IllegalArgumentException(); } if (iri.contains(">")) { throw new IllegalArgumentException(); } } private static void validateLang(final String languageTag) { if (languageTag.contains(" ")) { throw new IllegalArgumentException("Invalid language tag: " + languageTag); } } /** * Return the {@link UUID} salt used by this factory. *

* The salt is used for the purposes of {@link BlankNode} identity, see * {@link BlankNode#uniqueReference()} for details. *

* This salt can be used with the constructor {@link JenaRDF#JenaRDF(UUID)} * if consistent or reproducible {@link BlankNode}s are desirable. * * @return The {@link UUID} used as salt */ public UUID salt() { return salt; } } ././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedQuadLike.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedQ0000644000175000017500000000277413175733174033141 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; /** * A generalized quad representation. *

* A generalized quad is a quad-like object which allow any * {@link RDFTerm} type for its {@link #getSubject()}, {@link #getPredicate()} * {@link #getObject()} and {@link #getGraphName()}. This might be useful with * some serializations like JSON-LD. *

* Note that unlike {@link Quad}, this type does not have fixed semantics for * {@link Object#equals(Object)} or {@link Object#hashCode()} beyond object * identity. * * @see JenaGeneralizedTripleLike */ public interface JenaGeneralizedQuadLike extends JenaQuadLike { } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.jav0000644000175000017500000000263513175733174033041 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.QuadLike; import org.apache.commons.rdf.api.RDFTerm; import org.apache.jena.sparql.core.Quad; /** * A {@link QuadLike} wrapper of a Jena {@link Quad}. *

* This is a marker interface common to its specializations {@link JenaQuad} and * {@link JenaGeneralizedQuadLike}. * * @see JenaQuad * @see JenaGeneralizedQuadLike * */ public interface JenaQuadLike extends JenaTripleLike, QuadLike { /** * Return the adapted Jena quad * * @return Adapted Jena {@link Quad}. */ public Quad asJenaQuad(); } apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/resources/0000755000175000017500000000000013175733174023752 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/resources/META-INF/0000755000175000017500000000000013212356336025103 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/resources/META-INF/NOTICE0000644000175000017500000000025413212356336026010 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/resources/META-INF/services/0000755000175000017500000000000013175733174026735 5ustar andriusandrius././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/resources/META-INF/services/org.apache.commons.rdf.api.RDFapache-commons-rdf-0.5.0/commons-rdf-jena/src/main/resources/META-INF/services/org.apache.commons.rd0000644000175000017500000000004413175733174032743 0ustar andriusandriusorg.apache.commons.rdf.jena.JenaRDF apache-commons-rdf-0.5.0/commons-rdf-jena/src/main/resources/META-INF/LICENSE0000644000175000017500000002613613212356336026120 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-jena/src/site/0000755000175000017500000000000013175733174021760 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/site/resources/0000755000175000017500000000000013175733174023772 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/site/resources/profile.jacoco0000644000175000017500000000000013175733174026600 0ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/0000755000175000017500000000000014132221255021755 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/0000755000175000017500000000000014132221255022676 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/0000755000175000017500000000000013175733174023503 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/0000755000175000017500000000000013175733174024724 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/0000755000175000017500000000000013175733174026377 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/0000755000175000017500000000000013175733174027152 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/0000755000175000017500000000000013176451570030065 5ustar andriusandrius././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/JenaServiceLoaderTest.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/JenaServiceLoade0000644000175000017500000000247513175733174033165 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import static org.junit.Assert.fail; import java.util.ServiceLoader; import org.apache.commons.rdf.api.RDF; import org.junit.Test; public class JenaServiceLoaderTest { @Test public void testServiceLoaderLookup() { final ServiceLoader loader = ServiceLoader.load(RDF.class); for (final RDF impl : loader) { if (impl instanceof JenaRDF) { return; // yay } } fail("JenaRDF not found in ServiceLoader"); } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.ja0000644000175000017500000000207113175733174033102 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.AbstractGraphTest; import org.apache.commons.rdf.api.RDF; public class TestGraphJena extends AbstractGraphTest { @Override public RDF createFactory() { return new JenaRDF(); } } ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFQuadTest.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFQu0000644000175000017500000001250513175733174033110 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import static org.junit.Assert.*; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.RDFTerm; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.sparql.core.Quad; import org.junit.Test; public class GeneralizedRDFQuadTest { private final JenaRDF jena = new JenaRDF(); @Test public void bnodeProperty() throws Exception { final BlankNode b1 = jena.createBlankNode("b1"); final JenaIRI ex1 = jena.createIRI("http://example.com/ex1"); final JenaIRI ex2 = jena.createIRI("http://example.com/ex2"); final JenaIRI ex3 = jena.createIRI("http://example.com/ex3"); final JenaGeneralizedQuadLike q = jena.createGeneralizedQuad(ex1, b1, ex2, ex3); assertEquals(ex1, q.getSubject()); assertEquals(ex2, q.getObject()); assertEquals(b1, q.getPredicate()); // it's a bnode! assertEquals(ex3, q.getGraphName().get()); assertTrue(q.asJenaQuad().getPredicate().isBlank()); } @Test public void literalPredicate() throws Exception { final JenaIRI ex1 = jena.createIRI("http://example.com/ex1"); final JenaIRI ex2 = jena.createIRI("http://example.com/ex2"); final JenaIRI ex3 = jena.createIRI("http://example.com/ex3"); final JenaLiteral lit = jena.createLiteral("Hello"); final JenaGeneralizedQuadLike q = jena.createGeneralizedQuad(ex1, lit, ex2, ex3); assertEquals(ex1, q.getSubject()); assertEquals(ex2, q.getObject()); assertEquals(lit, q.getPredicate()); // it's a literal! assertEquals(ex3, q.getGraphName().get()); assertTrue(q.asJenaQuad().getPredicate().isLiteral()); } @Test public void literalSubject() throws Exception { final JenaIRI ex1 = jena.createIRI("http://example.com/ex1"); final JenaIRI ex2 = jena.createIRI("http://example.com/ex2"); final JenaIRI ex3 = jena.createIRI("http://example.com/ex3"); final JenaLiteral lit = jena.createLiteral("Hello"); final JenaGeneralizedQuadLike q = jena.createGeneralizedQuad(lit, ex1, ex2, ex3); assertEquals(lit, q.getSubject()); // it's a literal! assertEquals(ex1, q.getPredicate()); assertEquals(ex2, q.getObject()); assertEquals(ex3, q.getGraphName().get()); assertTrue(q.asJenaQuad().getSubject().isLiteral()); } @Test public void literalSubjectDefaultGraphGen() throws Exception { final JenaIRI ex1 = jena.createIRI("http://example.com/ex1"); final JenaIRI ex2 = jena.createIRI("http://example.com/ex2"); // No need to cast to JenaIRI final JenaRDFTerm defG = jena.asRDFTerm(Quad.defaultGraphNodeGenerated); final JenaLiteral lit = jena.createLiteral("Hello"); final JenaGeneralizedQuadLike q = jena.createGeneralizedQuad(lit, ex1, ex2, defG); assertEquals(lit, q.getSubject()); // it's a literal! assertEquals(ex1, q.getPredicate()); assertEquals(ex2, q.getObject()); assertTrue(q.asJenaQuad().getSubject().isLiteral()); assertFalse(q.getGraphName().isPresent()); assertTrue(q.asJenaQuad().isDefaultGraph()); } @Test public void asGeneralizedQuad() throws Exception { final Node s = NodeFactory.createLiteral("Hello"); final Node p = NodeFactory.createBlankNode(); final Node o = NodeFactory.createURI("http://example.com/ex"); final Node g = Quad.defaultGraphIRI; final Quad jq = Quad.create(g, s, p, o); final JenaQuadLike q = jena.asGeneralizedQuad(jq); assertEquals(jena.createLiteral("Hello"), q.getSubject()); assertEquals(jena.asRDFTerm(p), q.getPredicate()); assertEquals(jena.createIRI("http://example.com/ex"), q.getObject()); assertFalse(q.getGraphName().isPresent()); } @Test public void literalGraph() throws Exception { final JenaIRI ex1 = jena.createIRI("http://example.com/ex1"); final JenaIRI ex2 = jena.createIRI("http://example.com/ex2"); final JenaIRI ex3 = jena.createIRI("http://example.com/ex3"); final JenaLiteral lit = jena.createLiteral("Hello"); final JenaGeneralizedQuadLike q = jena.createGeneralizedQuad(ex1, ex2, ex3, lit); assertEquals(ex1, q.getSubject()); assertEquals(ex2, q.getPredicate()); assertEquals(ex3, q.getObject()); assertEquals(lit, q.getGraphName().get()); // it's a literal! assertTrue(q.asJenaQuad().getGraph().isLiteral()); } } apache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/JenaRDFTest.java0000644000175000017500000000206213175733174033003 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import org.apache.commons.rdf.api.AbstractRDFTest; import org.apache.commons.rdf.api.RDF; public class JenaRDFTest extends AbstractRDFTest { @Override public RDF createFactory() { return new JenaRDF(); } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBui0000644000175000017500000000427113175733174033106 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import static org.junit.Assert.assertEquals; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.RDFSyntax; import org.apache.commons.rdf.experimental.RDFParser.ParseResult; import org.apache.commons.rdf.jena.experimental.JenaRDFParser; import org.junit.After; import org.junit.Before; import org.junit.Test; public class TestRDFParserBuilder { private Path turtleFile; @Before public void preparePath() throws IOException { turtleFile = Files.createTempFile("commonsrdf", "test.ttl"); Files.copy(getClass().getResourceAsStream("/D.ttl"), turtleFile, StandardCopyOption.REPLACE_EXISTING); } @After public void deletePath() throws IOException { if (turtleFile != null) { Files.deleteIfExists(turtleFile); } } @Test public void parseTurtle() throws Exception { try (final Graph g = new JenaRDF().createGraph()) { final Future gFuture = new JenaRDFParser().contentType(RDFSyntax.TURTLE).source(turtleFile) .target(g).parse(); gFuture.get(5, TimeUnit.SECONDS); assertEquals(3, g.size()); } } } ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/DefaultGraphInQuadTest.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/DefaultGraphInQu0000644000175000017500000001420113175733174033153 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.simple.SimpleRDF; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.sparql.core.Quad; import org.junit.Test; /** * COMMONSRDF-55: Handling of * Jena's default graph IRI urn:x-arq:DefaultGraph */ public class DefaultGraphInQuadTest { JenaRDF rdf = new JenaRDF(); SimpleRDF simpleRDF = new SimpleRDF(); IRI example = rdf.createIRI("http://example.com/"); Node exampleJena = NodeFactory.createURI("http://example.com/"); @Test public void createFromNull() throws Exception { final JenaQuad q = rdf.createQuad(null, example, example, example); assertFalse(q.getGraphName().isPresent()); assertTrue(q.asJenaQuad().isDefaultGraph()); assertEquals(Quad.defaultGraphIRI, q.asJenaQuad().getGraph()); } @Test public void createFromDefaultGraphIRI() throws Exception { final JenaIRI defaultGraph = (JenaIRI) rdf.asRDFTerm(Quad.defaultGraphIRI); final JenaQuad q = rdf.createQuad(defaultGraph, example, example, example); // NOTE: JenaRDF specially recognize this JenaIRI constant, // even if this breaks the SHOULD of RDF.createQuad() assertTrue(q.asJenaQuad().isDefaultGraph()); assertEquals(Quad.defaultGraphIRI, q.asJenaQuad().getGraph()); assertFalse(q.getGraphName().isPresent()); // thus we can't require //assertEquals(defaultGraph, q.getGraphName().get()); } @Test public void createFromForeignDefaultGraph() throws Exception { // What if appear in a non-Jena IRI? final IRI foreignDefaultGraph = simpleRDF.createIRI(Quad.defaultGraphIRI.getURI()); final JenaQuad q = rdf.createQuad(foreignDefaultGraph, example, example, example); // As the IRI was NOT a JenaIRI we preserve it as-is, // rather than replacing it with Optional.empty() assertTrue(q.asJenaQuad().isDefaultGraph()); assertTrue(q.getGraphName().isPresent()); // INCONSISTENT with above assertEquals(Quad.defaultGraphIRI, q.asJenaQuad().getGraph()); assertEquals(foreignDefaultGraph, q.getGraphName().get()); // Note that adding such a quad to a Dataset would still "convert" it to // Optional.empty() } @Test public void createFromDefaultGraphNodeGeneratedIRINode() throws Exception { // What if appear as an IRI instance? final IRI foreignDefaultGraph = rdf.createIRI(Quad.defaultGraphNodeGenerated.getURI()); final JenaQuad q = rdf.createQuad(foreignDefaultGraph, example, example, example); // NOTE: JenaRDF specially recognize this JenaIRI constant, // even if this breaks the SHOULD of RDF.createQuad() assertTrue(q.asJenaQuad().isDefaultGraph()); assertFalse(q.getGraphName().isPresent()); // CONSISTENT with above // Unfortunately Quad.defaultGraphNodeGenerated is not preserved: //assertEquals(Quad.defaultGraphNodeGenerated, q.asJenaQuad().getGraph()); } @Test public void createFromDefaultGraphNodeGeneratedIRIString() throws Exception { // What if appear in a non-Jena IRI? final IRI foreignDefaultGraph = simpleRDF.createIRI(Quad.defaultGraphNodeGenerated.getURI()); final JenaQuad q = rdf.createQuad(foreignDefaultGraph, example, example, example); // We'll expect JenaRDF to preserve the graph IRI as-is assertTrue(q.asJenaQuad().isDefaultGraph()); assertTrue(q.getGraphName().isPresent()); // INCONSISTENT WITH above // Now Quad.defaultGraphNodeGenerated is preserved at both ends assertEquals(Quad.defaultGraphNodeGenerated, q.asJenaQuad().getGraph()); assertEquals(foreignDefaultGraph, q.getGraphName().get()); } @Test public void defaultGraphIRI() throws Exception { final Quad jenaQuad = Quad.create(Quad.defaultGraphIRI, exampleJena, exampleJena, exampleJena); final JenaQuad q = rdf.asQuad(jenaQuad); assertFalse(q.getGraphName().isPresent()); assertTrue(q.asJenaQuad().isDefaultGraph()); } @Test public void defaultGraphNodeGenerated() throws Exception { // might appear in parser output final Quad jenaQuad = Quad.create(Quad.defaultGraphNodeGenerated, exampleJena, exampleJena, exampleJena); final JenaQuad q = rdf.asQuad(jenaQuad); assertFalse(q.getGraphName().isPresent()); assertTrue(q.asJenaQuad().isDefaultGraph()); // Preserves assertEquals(Quad.defaultGraphNodeGenerated, q.asJenaQuad().getGraph()); } @Test public void unionGraph() throws Exception { // unionGraph shouldn't really appear as a quad except // in a pattern final Quad jenaQuad = Quad.create(Quad.unionGraph, exampleJena, exampleJena, exampleJena); final JenaQuad q = rdf.asQuad(jenaQuad); // But at least we can agree it is NOT (necessarily) in the // default graph assertFalse(q.asJenaQuad().isDefaultGraph()); assertTrue(q.getGraphName().isPresent()); } } ././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFTripleTest.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFTr0000644000175000017500000000665013175733174033114 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.apache.commons.rdf.api.BlankNode; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.Triple; import org.junit.Test; public class GeneralizedRDFTripleTest { private final JenaRDF jena = new JenaRDF(); @Test public void bnodeProperty() throws Exception { final BlankNode b1 = jena.createBlankNode("b1"); final JenaIRI ex1 = jena.createIRI("http://example.com/ex1"); final JenaIRI ex2 = jena.createIRI("http://example.com/ex2"); final JenaGeneralizedTripleLike t = jena.createGeneralizedTriple(ex1, b1, ex2); assertEquals(ex1, t.getSubject()); assertEquals(ex2, t.getObject()); assertEquals(b1, t.getPredicate()); // it's a bnode! assertTrue(t.asJenaTriple().getPredicate().isBlank()); } @Test public void literalPredicate() throws Exception { final JenaIRI ex1 = jena.createIRI("http://example.com/ex1"); final JenaIRI ex2 = jena.createIRI("http://example.com/ex2"); final JenaLiteral lit = jena.createLiteral("Hello"); final JenaGeneralizedTripleLike t = jena.createGeneralizedTriple(ex1, lit, ex2); assertEquals(ex1, t.getSubject()); assertEquals(ex2, t.getObject()); assertEquals(lit, t.getPredicate()); // it's a literal! assertTrue(t.asJenaTriple().getPredicate().isLiteral()); } @Test public void literalSubject() throws Exception { final JenaIRI ex1 = jena.createIRI("http://example.com/ex1"); final JenaIRI ex2 = jena.createIRI("http://example.com/ex2"); final JenaLiteral lit = jena.createLiteral("Hello"); final JenaGeneralizedTripleLike t = jena.createGeneralizedTriple(lit, ex1, ex2); assertEquals(lit, t.getSubject()); // it's a literal! assertEquals(ex1, t.getPredicate()); assertEquals(ex2, t.getObject()); assertTrue(t.asJenaTriple().getSubject().isLiteral()); } @Test public void asGeneralizedTriple() throws Exception { final Node s = NodeFactory.createLiteral("Hello"); final Node p = NodeFactory.createBlankNode(); final Node o = NodeFactory.createURI("http://example.com/ex"); final Triple jt = Triple.create(s, p, o); final JenaTripleLike t = jena.asGeneralizedTriple(jt); assertEquals(jena.createLiteral("Hello"), t.getSubject()); assertEquals(jena.asRDFTerm(p), t.getPredicate()); assertEquals(jena.createIRI("http://example.com/ex"), t.getObject()); } } ././@LongLink0000644000000000000000000000017000000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToC0000644000175000017500000001165213175733174033124 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.simple.Types; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFDataMgr; import org.apache.jena.sparql.graph.GraphFactory; import org.junit.After; import org.junit.Before; import org.junit.Test; /** Adapt a Jena Graph after parsing data into it */ public class TestJenaGraphToCommonsRDFGraph { private static final boolean DEBUG = false; private Path turtleFile; @Before public void preparePath() throws IOException { turtleFile = Files.createTempFile("commonsrdf", "test.ttl"); Files.copy(getClass().getResourceAsStream("/D.ttl"), turtleFile, StandardCopyOption.REPLACE_EXISTING); } @After public void deletePath() throws IOException { if (turtleFile != null) { Files.deleteIfExists(turtleFile); } } @Test public void jenaToCommonsRDF() throws Exception { final org.apache.jena.graph.Graph jGraph = GraphFactory.createGraphMem(); RDFDataMgr.read(jGraph, turtleFile.toUri().toString()); final JenaRDF factory = new JenaRDF(); // "graph" is a CommonsRDF graph try (final Graph graph = factory.asGraph(jGraph)) { // The below check expected statements from D.ttl final JenaIRI p = factory.createIRI("http://example.com/p"); final JenaIRI s = factory.createIRI("http://example.com/s"); final JenaLiteral literal123 = factory.createLiteral("123", Types.XSD_INTEGER); assertTrue(graph.contains(s, p, literal123)); final JenaIRI p1 = factory.createIRI("http://example.com/p1"); // Let's look up the BlankNode final BlankNodeOrIRI bnode1 = graph.stream(null, p1, null).findFirst().map(Triple::getSubject).get(); assertTrue(bnode1 instanceof BlankNode); // Verify we can use BlankNode in query again final RDFTerm obj = graph.stream(bnode1, p1, null).findFirst().map(Triple::getObject).get(); // Let's look up also that nested blank node assertTrue(obj instanceof BlankNode); final BlankNode bnode2 = (BlankNode) obj; final JenaIRI q = factory.createIRI("http://example.com/q"); final JenaLiteral literalR = factory.createLiteral("r", "en"); assertTrue(graph.contains(bnode2, q, literalR)); // Can we add the same triple again as s/p/o // without affecting graph size? // Just to be evil we add a blanknode-iri-blanknode statement assertEquals(3, graph.size()); graph.add(bnode1, p1, bnode2); assertEquals(3, graph.size()); // Add the same Triple again graph.stream(bnode2, null, null).findFirst().ifPresent(graph::add); assertEquals(3, graph.size()); // Add to CommonsRDF Graph final JenaIRI s2 = factory.createIRI("http://example/s2"); final JenaIRI p2 = factory.createIRI("http://example/p2"); final JenaLiteral foo = factory.createLiteral("foo"); graph.add(s2, p2, foo); assertEquals(4, graph.size()); assertTrue(graph.contains(s2, p2, foo)); // Verify the corresponding Jena Nodes are in Jena graph assertTrue(jGraph.contains(s2.asJenaNode(), p2.asJenaNode(), foo.asJenaNode())); if (DEBUG) { System.out.println("==== Write CommonsRDF graph\n"); graph.stream().forEach(System.out::println); // And its in the Jena graph System.out.println("\n==== Write Jena graph directly\n"); RDFDataMgr.write(System.out, jGraph, Lang.TTL); } } } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJen0000644000175000017500000000311713175733174033146 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import java.util.UUID; import org.apache.commons.rdf.api.AbstractBlankNodeTest; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.jena.impl.InternalJenaFactory; public class TestBlankNodeJena extends AbstractBlankNodeTest { InternalJenaFactory internalJenaFactory = new InternalJenaFactory() { }; /** * Fixed salt for the purpose of this test. */ private static final UUID SALT = UUID.fromString("ccfde817-55b8-4a5f-bc2d-6bfd8eaa41ce"); @Override protected BlankNode getBlankNode() { return internalJenaFactory.createBlankNode(SALT); } @Override protected BlankNode getBlankNode(final String identifier) { return internalJenaFactory.createBlankNode(identifier, SALT); } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/DatasetJenaTest.javaapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/java/org/apache/commons/rdf/jena/DatasetJenaTest.0000644000175000017500000000372313176451570033116 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jena; import static org.junit.Assert.assertEquals; import org.apache.commons.rdf.api.AbstractDatasetTest; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.simple.Types; import org.junit.Test; public class DatasetJenaTest extends AbstractDatasetTest { @Override public RDF createFactory() { return new JenaRDF(); } @Test public void datasetImplToStringTest() { RDF rdf = createFactory(); JenaDataset jena = (JenaDataset) rdf.createDataset(); final IRI graph = rdf.createIRI("http://example.com/"); final IRI s = rdf.createIRI("http://example.com/s"); final IRI p = rdf.createIRI("http://example.com/p"); final Literal literal123 = rdf.createLiteral("123", Types.XSD_INTEGER); jena.add(graph, s, p, literal123); String out = jena.toString(); assertEquals(" \"123\"^^ .\n", out); assertEquals(10L, dataset.size()); } } apache-commons-rdf-0.5.0/commons-rdf-jena/src/test/resources/0000755000175000017500000000000013212356336023776 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/resources/D.ttl0000644000175000017500000000152713175733174024722 0ustar andriusandrius# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. prefix : :s :p 123 . [ :p1 [ :q "r"@en ] ] . apache-commons-rdf-0.5.0/commons-rdf-jena/src/test/resources/META-INF/0000755000175000017500000000000013212356336025136 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jena/src/test/resources/META-INF/NOTICE0000644000175000017500000000025413212356336026043 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-jena/src/test/resources/META-INF/LICENSE0000644000175000017500000002613613212356336026153 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-jena/pom.xml0000644000175000017500000000746713212356730021547 0ustar andriusandrius 4.0.0 org.apache.commons commons-rdf-parent 0.5.0 commons-rdf-jena jar Commons RDF impl: Jena Apache Jena implementation of Commons RDF API commonsrdf-api-site scm:svn:${commons.scmPubUrl}/jena/ ${project.parent.groupId} commons-rdf-api ${project.version} ${project.parent.groupId} commons-rdf-simple ${project.version} org.apache.jena jena-osgi ${jena.version} org.apache.servicemix.bundles org.apache.servicemix.bundles.xerces ${servicemix.xerces.version} com.github.andrewoma.dexx collection ${dexx.collection.version} ${project.parent.groupId} commons-rdf-api ${project.version} tests test org.apache.felix maven-bundle-plugin org.apache.commons.rdf.jena org.apache.commons.rdf.jena osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional osgi.serviceloader; osgi.serviceloader=org.apache.commons.rdf.api.RDF apache-commons-rdf-0.5.0/RELEASE-NOTES.txt0000644000175000017500000000712513212355376017576 0ustar andriusandrius# Apache Commons RDF ## 1.0.0-SNAPSHOT See https://issues.apache.org/jira/browse/COMMONSRDF/ for issues fixed since the last release. ## 0.5.0 (2017-11) This is the first release after graduation. Although there are not API changes nor big improvements, it updates different core aspects and dependencies. * [COMMONSRDF-47] - RDFSyntax should be interface, not enum * [COMMONSRDF-51] - RDF-1.1 specifies that language tags need to be compared using lower-case * [COMMONSRDF-52] - Duplicate Bundle-SymbolicName values across all components * [COMMONSRDF-55] - Stream of Jena quads use wrong IRI for default graph * [COMMONSRDF-57] - Use newer dependency Jena/RDF4J/JSONLD Java * [COMMONSRDF-62] - japicmp-maven-plugin breaking build because there is at least one incompatibility * [COMMONSRDF-63] - AbstractRDFParserTest.parseFile and parseFileContentType broken under Mac OS X * [COMMONSRDF-66] - JenaDatasetImpl.toString() throws RIOT exception * [COMMONSRDF-53] - Add ServiceLoader support in OSGi * [COMMONSRDF-54] - overloaded versions of RDF4J#asRDFTerm(org.eclipse.rdf4j.model.Value) * [COMMONSRDF-59] - Fix javadocs warnings * [COMMONSRDF-64] - Add Automatic-Module-Name to bundle manifest * [COMMONSRDF-65] - Upgrade to Jena 3.4.0, RDF4J 2.2.2 * [COMMONSRDF-70] - Upgrade Jena version to 3.5.0 ## 0.3.0-incubating (2016-11) This release adds RDF implementations based on Apache Jena, Eclipse RDF4J and JSONLD-Java. New interfaces include Dataset and Quad. Note that the interface RDFTermFactory has been deprecated and been replaced by the interface RDF. Graph.getTriples() has been deprecated and replaced by Graph.iterate(). This release adds an experimental interface RDFParser, note that this may evolve or be removed in the next release. * [COMMONSRDF-7] - Document that RDFTerm, Triple and Quad are immutable * [COMMONSRDF-33] - Jena integration * [COMMONSRDF-34] - Add DatasetImpl using Jena * [COMMONSRDF-35] - rdf4j integration * [COMMONSRDF-36] - jsonld-java integratoin * [COMMONSRDF-37] - Quad and Dataset support * [COMMONSRDF-38] - simple Graph.contains(Triple) now maps bnodes consistently * [COMMONSRDF-39] - Add RDFParser interface (experimental) * [COMMONSRDF-46] - Rename RDFTermFactory to RDF ## 0.2.0-incubating (2016-04) This release clarifies .equals() and .hashCode() for RDFTerms so that they can be compared across graphs and implementations. * [COMMONSRDF-14] - Define value returned by hashCode() * [COMMONSRDF-20] - ServiceLoader mechanism to load RDFTermFactory * [COMMONSRDF-21] - Remove BlankNode requirements from RDFTermFactory.createGraph() * [COMMONSRDF-25] - Remove mentions of "local scope" in .equals() * [COMMONSRDF-26] - Add RDFSyntax constants (e.g. TURTLE) * [COMMONSRDF-27] - RDFTermFactory no longer require BlankNode mapping * [COMMONSRDF-28] - Add internal SimpleRDFTerm marker interface ## 0.1.0-incubating (2015-05) This is the first release after moving to Apache Incubator. * [COMMONSRDF-2] - Change to package name org.apache.commons.rdf.api * [COMMONSRDF-6] - Contract around the internal string of a blank node * [COMMONSRDF-8] - simple .GraphImpl.add() must clone BlankNode * [COMMONSRDF-11] - Simple should be extendable classes * [COMMONSRDF-12] - Graph to be Iterable * [COMMONSRDF-29] - BlankNode.internalIdentifier() renamed to BlankNode.uniqueReference() * [COMMONSRDF-30] - Add "simple" implementation and unit tests * [COMMONSRDF-31] - Add RDFTermFactory * Added user guide to website ## 0.0.2 (2014-08-04) * Change to package name com.github.commonsrdf.api * BlankNode.getLabel() renamed to BlankNode.internalIdentifier() * Removed Quad ## 0.0.1 (2014-07-18) * First release apache-commons-rdf-0.5.0/pom.xml0000644000175000017500000006411013212356730016374 0ustar andriusandrius 4.0.0 org.apache.commons commons-parent 42 commons-rdf-parent 0.5.0 pom Commons RDF Commons Java API for RDF 1.1 https://commons.apache.org/proper/commons-rdf/ 2015 1.8 1.8 UTF-8 UTF-8 rdf org.apache.commons.rdf 0.5.0 COMMONSRDF 12316620 rdf https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-rdf/ https://docs.oracle.com/javase/8/docs/api/ 0.11.0 0.11.1 2.2.2 3.5.0 0.7 2.11.0_1 1.7.25 4.12 false https://git-wip-us.apache.org/repos/asf/commons-rdf.git scm:git:https://git-wip-us.apache.org/repos/asf/commons-rdf.git scm:git:https://git-wip-us.apache.org/repos/asf/commons-rdf.git 0.5.0 Jira https://issues.apache.org/jira/browse/COMMONSRDF jenkins https://builds.apache.org/ lewismc Lewis John McGibbney lewismc[at]apache[dot]org Committer Emeritus PPMC Member Emeritus Champion +1 ggregory Gary Gregory ggregory[at]apache[dot]org Committer Emeritus PPMC Member Emeritus Mentor +1 wikier Sergio Fernández wikier[at]apache[dot]org http://www.wikier.org Committer Emeritus PPMC Member +1 stain Stian Soiland-Reyes stain[at]apache[dot]org http://orcid.org/0000-0001-9842-9718 Committer PMC Member Emeritus PPMC Member +0 enridaga Enrico Daga enridaga[at]apache[dot]org Committer Emeritus PPMC Member +0 britter Benedikt Ritter britter[at]apache[dot]org Committer PMC Member Emeritus PPMC Member +1 ansell Peter Ansell ansell[at]apache[dot]org https://github.com/ansell Reviewer Emeritus Committer Emeritus PPMC Member Reto Gmür reto[at]apache[dot]org Emeritus Committer Emeritus PPMC Member +1 Andy Seaborne andy[at]apache[dot]org Emeritus Committer Emeritus PPPMC Member Reviewer +0 Rob Vesse rvesse[at]apache[dot]org Emeritus Mentor +0 John D Ament johndament[at]apache[dot]org Emeritus PPMC Member Emeritus Mentor +1 Aaron Coburn acoburn[at]apache[dot]org Contributor +1 Adam Soroka ajs6f[at]apache[dot]org Reviewer +0 Guohui Xiao gx.xiao[at]gmail[dot]com http://orcid.org/0000-0002-5115-4769 Contributor +1 commons-rdf-api commons-rdf-simple commons-rdf-rdf4j commons-rdf-jena commons-rdf-jsonld-java commons-rdf-integration-tests junit junit ${junit.version} org.slf4j slf4j-simple ${slf4j.version} junit junit test org.slf4j slf4j-simple test org.apache.maven.plugins maven-jar-plugin true false org.apache.maven.plugins maven-source-plugin jar test-jar true org.apache.maven.plugins maven-assembly-plugin apache-commons-rdf-${project.version} true org.apache.maven.plugins maven-javadoc-plugin attach-javadocs jar -Xdoclint:all ${commons.javadoc.java.link} https://jena.apache.org/documentation/javadoc/jena/ https://jena.apache.org/documentation/javadoc/arq/ http://rdf4j.org/javadoc/2.0/ org.apache.maven.plugins maven-release-plugin true release deploy true true @{version} clean install false scm:git:file://`pwd`/.git org.eluder.coveralls coveralls-maven-plugin 4.3.0 org.codehaus.mojo jdepend-maven-plugin ${commons.jdepend.version} guru.nidi jdepend 2.9.5 org.apache.maven.plugins maven-site-plugin org.apache.maven.doxia doxia-module-markdown 1.7 org.eclipse.m2e lifecycle-mapping 1.0.0 org.apache.maven.plugins maven-antrun-plugin [1.8,) run org.apache.felix maven-bundle-plugin [2.5.3,) manifest com.github.siom79.japicmp japicmp-maven-plugin ${commons.japicmp.version} \d+\.\d+\.\d+\-incubating true org.apache.rat apache-rat-plugin ${commons.rat.version} .travis.yml examples/.settings/** examples/.project examples/.classpath **/META-INF/services/* **/src/main/resources/NOTICE **/src/main/resources/LICENSE org.apache.maven.plugins maven-javadoc-plugin -Xdoclint:all javadoc test-javadoc aggregate false aggregate org.apache.maven.plugins maven-checkstyle-plugin ${checkstyle.plugin.version} ${project.basedir}/src/conf/checkstyle.xml config_loc=${project.basedir} false checkstyle-aggregate maven-pmd-plugin 3.8 ${maven.compiler.target} true pmd-report pmd pmd-aggregate false pmd true org.codehaus.mojo findbugs-maven-plugin ${commons.findbugs.version} Normal Default src/conf/findbugs-exclude-filter.xml true -Duser.language=en ignore-japicmp true false release false org.apache.maven.plugins maven-gpg-plugin **/*.asc **/*.md5 **/*.sha1 commonsrdf-site Apache Commons Site SVN scm:svn:${commons.scmPubUrl} ${project.url}download.html apache-commons-rdf-0.5.0/commons-rdf-integration-tests/0000755000175000017500000000000014132221255022755 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/0000755000175000017500000000000014132221255023544 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/0000755000175000017500000000000014132221255024523 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/0000755000175000017500000000000014132221255025444 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/org/0000755000175000017500000000000014132221255026233 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/org/apache/0000755000175000017500000000000014132221255027454 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/org/apache/commons/0000755000175000017500000000000014132221255031127 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/0000755000175000017500000000000014132221255031702 5ustar andriusandrius././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/apache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrat0000755000175000017500000000000014132221255033440 5ustar andriusandrius././@LongLink0000644000000000000000000000020400000000000011577 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/JSONLDParsingTest.javaapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrat0000644000175000017500000001416313175733174033465 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.integrationtests; import static org.junit.Assert.assertTrue; import java.io.InputStream; import java.net.URL; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.jena.JenaDataset; import org.apache.commons.rdf.jena.JenaRDF; import org.apache.commons.rdf.jsonldjava.JsonLdGraph; import org.apache.commons.rdf.jsonldjava.JsonLdRDF; import org.apache.commons.rdf.rdf4j.RDF4J; import org.apache.commons.rdf.rdf4j.RDF4JGraph; import org.apache.commons.rdf.simple.SimpleRDF; import org.apache.jena.riot.RDFDataMgr; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.rio.RDFFormat; import org.eclipse.rdf4j.rio.Rio; import org.junit.Before; import org.junit.Test; import com.github.jsonldjava.core.JsonLdOptions; import com.github.jsonldjava.core.JsonLdProcessor; import com.github.jsonldjava.core.RDFDataset; import com.github.jsonldjava.utils.JsonUtils; /** * COMMONSRDF-57 etc: For upgrades, ensure JSONLD-Java parses well in all * implementations even if they might have slightly incompatible versions of * their dependencies. *

* The *Embedded tests parse alice-embedded.jsonld * from the test classpath through Jena, RDF4J and JSONLD-Java and verifies it * contains the expected triples using {@link #checkGraph(Graph)}. This ensures * that the versions of JSONLD-Java and Jackson are compatible with Jena and * RDF4J. *

* The *Cached tests parse alice-cached.jsonld, which * references an external @context of http://example.com/context - * but using the jarcache.json * mechanism of JSONLD-Java, this context will be loaded from * contexts/example.jsonld on the test classpath instead. This * ensures that the versions of HTTPClient is compatible with JSONLD-Java * (however it does not check that it is compatible with Jena and * RDF4J's external fetching of RDF documents). * */ public class JSONLDParsingTest { static RDF rdf = new SimpleRDF(); static IRI alice = rdf.createIRI("http://example.com/Alice"); static IRI name = rdf.createIRI("http://schema.org/name"); static IRI type = rdf.createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); static IRI person = rdf.createIRI("http://schema.org/Person"); static Literal aliceWLand = rdf.createLiteral("Alice W. Land"); URL aliceCached = getClass().getResource("/alice-cached.jsonld"); URL aliceEmbedded = getClass().getResource("/alice-embedded.jsonld"); /** * Pre-test that src/test/resources files are on the classpath * */ @Before public void checkTestResources() throws Exception { aliceCached.openStream().close(); aliceEmbedded.openStream().close(); // Used by JSONLD-Java to avoid external dependencies. See // https://github.com/jsonld-java/jsonld-java#loading-contexts-from-classpathjar getClass().getResourceAsStream("/jarcache.json").close(); getClass().getResourceAsStream("/contexts/example.jsonld").close(); // (We'll use these to ensure our HTTPClient dependency works) } private void checkGraph(final Graph g) { assertTrue(g.contains(alice, name, aliceWLand)); assertTrue(g.contains(alice, type, person)); } @Test public void jenaParseEmbedded() throws Exception { jenaParse(aliceEmbedded); } @Test public void jenaParseCached() throws Exception { // Check if HTTPClient cache is used from // jarcache.json jenaParse(aliceCached); } private void jenaParse(final URL url) throws Exception { try (final JenaDataset dataset = new JenaRDF().createDataset()) { RDFDataMgr.read(dataset.asJenaDatasetGraph(), url.toExternalForm()); checkGraph(dataset.getGraph()); } } @Test public void rdf4jParseEmbedded() throws Exception { rdf4jParse(aliceEmbedded); } @Test public void rdf4jParseCached() throws Exception { // Check if HTTPClient cache is used from // jarcache.json rdf4jParse(aliceCached); } private void rdf4jParse(final URL url) throws Exception { Model model; try (InputStream in = url.openStream()) { model = Rio.parse(in, url.toExternalForm(), RDFFormat.JSONLD); } try (final RDF4JGraph graph = new RDF4J().asGraph(model)) { checkGraph(graph); } } @Test public void jsonldParseEmbedded() throws Exception { jsonldParse(aliceEmbedded); } @Test public void jsonldParseCached() throws Exception { // Check if HTTPClient cache is used from // jarcache.json jsonldParse(aliceCached); } private void jsonldParse(final URL url) throws Exception { final Object aliceJson = JsonUtils.fromURL(url, JsonUtils.getDefaultHttpClient()); final JsonLdOptions options = new JsonLdOptions(); options.setBase(url.toExternalForm()); final RDFDataset ds = (RDFDataset) JsonLdProcessor.toRDF(aliceJson); try (final JsonLdGraph graph = new JsonLdRDF().asGraph(ds)) { checkGraph(graph); } } } ././@LongLink0000644000000000000000000000017700000000000011610 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.javaapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/java/org/apache/commons/rdf/integrat0000644000175000017500000001524413175733174033466 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.integrationtests; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.jena.JenaRDF; import org.apache.commons.rdf.jsonldjava.JsonLdRDF; import org.apache.commons.rdf.rdf4j.RDF4J; import org.apache.commons.rdf.simple.SimpleRDF; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class AllToAllTest { private final RDF nodeFactory; private final RDF graphFactory; public AllToAllTest(final Class from, final Class to) throws InstantiationException, IllegalAccessException { this.nodeFactory = from.newInstance(); this.graphFactory = to.newInstance(); } @SuppressWarnings("rawtypes") @Parameters(name = "{index}: {0}->{1}") public static Collection data() { final List factories = Arrays.asList(SimpleRDF.class, JenaRDF.class, RDF4J.class, JsonLdRDF.class); final Collection allToAll = new ArrayList<>(); for (final Class from : factories) { for (final Class to : factories) { // NOTE: we deliberately include self-to-self here // to test two instances of the same implementation allToAll.add(new Object[] { from, to }); } } return allToAll; } /** * This test creates a {@link Graph} with the first {@link RDF}, * then inserts/queries with triples using {@link RDFTerm}s created with the * second factory. * * @throws Exception * Just in case.. */ @Test public void addTermsFromOtherFactory() throws Exception { try (final Graph g = graphFactory.createGraph()) { final BlankNode s = nodeFactory.createBlankNode(); final IRI p = nodeFactory.createIRI("http://example.com/p"); final Literal o = nodeFactory.createLiteral("Hello"); g.add(s, p, o); // blankNode should still work with g.contains() assertTrue(g.contains(s, p, o)); final Triple t1 = g.stream().findAny().get(); // Can't make assumptions about BlankNode equality - it might // have been mapped to a different BlankNode.uniqueReference() // assertEquals(s, t.getSubject()); assertEquals(p, t1.getPredicate()); assertEquals(o, t1.getObject()); final IRI s2 = nodeFactory.createIRI("http://example.com/s2"); g.add(s2, p, s); assertTrue(g.contains(s2, p, s)); // This should be mapped to the same BlankNode // (even if it has a different identifier), e.g. // we should be able to do: final Triple t2 = g.stream(s2, p, null).findAny().get(); final BlankNode bnode = (BlankNode) t2.getObject(); // And that (possibly adapted) BlankNode object should // match the subject of t1 statement assertEquals(bnode, t1.getSubject()); // And can be used as a key: final Triple t3 = g.stream(bnode, p, null).findAny().get(); assertEquals(t1, t3); } } /** * This is a variation of {@link #addTermsFromOtherFactory()}, but here * {@link Triple} is created in the "foreign" nodeFactory before adding to * the graph. * * @throws Exception * Just in case.. */ @Test public void addTriplesFromOtherFactory() throws Exception { try (final Graph g = graphFactory.createGraph()) { final BlankNode s = nodeFactory.createBlankNode(); final IRI p = nodeFactory.createIRI("http://example.com/p"); final Literal o = nodeFactory.createLiteral("Hello"); final Triple srcT1 = nodeFactory.createTriple(s, p, o); // This should work even with BlankNode as they are from the same // factory assertEquals(s, srcT1.getSubject()); assertEquals(p, srcT1.getPredicate()); assertEquals(o, srcT1.getObject()); g.add(srcT1); // what about the blankNode within? assertTrue(g.contains(srcT1)); final Triple t1 = g.stream().findAny().get(); // Can't make assumptions about BlankNode equality - it might // have been mapped to a different BlankNode.uniqueReference() // assertEquals(srcT1, t1); // assertEquals(s, t1.getSubject()); assertEquals(p, t1.getPredicate()); assertEquals(o, t1.getObject()); final IRI s2 = nodeFactory.createIRI("http://example.com/s2"); final Triple srcT2 = nodeFactory.createTriple(s2, p, s); g.add(srcT2); assertTrue(g.contains(srcT2)); // This should be mapped to the same BlankNode // (even if it has a different identifier), e.g. // we should be able to do: final Triple t2 = g.stream(s2, p, null).findAny().get(); final BlankNode bnode = (BlankNode) t2.getObject(); // And that (possibly adapted) BlankNode object should // match the subject of t1 statement assertEquals(bnode, t1.getSubject()); // And can be used as a key: final Triple t3 = g.stream(bnode, p, null).findAny().get(); assertEquals(t1, t3); } } } apache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/resources/0000755000175000017500000000000014132221255026535 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/resources/jarcache.json0000644000175000017500000000170613175733174031212 0ustar andriusandrius[ { "X-License": "Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOTICE file distributed with\n this work for additional information regarding copyright ownership.\n The ASF licenses this file to You under the Apache License, Version 2.0\n (the \"License\"); you may not use this file except in compliance with\n the License. You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n", "Content-Location": "http://example.com/context", "X-Classpath": "contexts/example.jsonld", "Content-Type": "application/ld+json" } ]apache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/resources/contexts/0000755000175000017500000000000014132221255030404 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/resources/contexts/example.jsonld0000644000175000017500000000200113175733174033261 0ustar andriusandrius{ "http://purl.org/dc/terms/license" : "Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOTICE file distributed with\n this work for additional information regarding copyright ownership.\n The ASF licenses this file to You under the Apache License, Version 2.0\n (the \"License\"); you may not use this file except in compliance with\n the License. You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n", "@context": { "xsd": "http://www.w3.org/2001/XMLSchema#", "schema": "http://schema.org/", "ex": "http://example.com/", "name": "schema:name", "Person": "schema:Person" } } apache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/resources/alice-cached.jsonld0000644000175000017500000000166213175733174032255 0ustar andriusandrius{ "http://purl.org/dc/terms/license" : "Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOTICE file distributed with\n this work for additional information regarding copyright ownership.\n The ASF licenses this file to You under the Apache License, Version 2.0\n (the \"License\"); you may not use this file except in compliance with\n the License. You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n", "@context": "http://example.com/context", "@id": "ex:Alice", "@type": "Person", "name": "Alice W. Land" } apache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/resources/alice-embedded.jsonld0000644000175000017500000000211313175733174032567 0ustar andriusandrius{ "http://purl.org/dc/terms/license" : "Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOTICE file distributed with\n this work for additional information regarding copyright ownership.\n The ASF licenses this file to You under the Apache License, Version 2.0\n (the \"License\"); you may not use this file except in compliance with\n the License. You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n", "@context": { "xsd": "http://www.w3.org/2001/XMLSchema#", "schema": "http://schema.org/", "ex": "http://example.com/", "name": "schema:name", "Person": "schema:Person" }, "@id": "ex:Alice", "@type": "Person", "name": "Alice W. Land" } apache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/resources/META-INF/0000755000175000017500000000000014132221255027675 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/resources/META-INF/NOTICE0000644000175000017500000000025413212356336030611 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-integration-tests/src/test/resources/META-INF/LICENSE0000644000175000017500000002613613212356336030721 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-integration-tests/pom.xml0000644000175000017500000000436013212356730024302 0ustar andriusandrius 4.0.0 org.apache.commons commons-rdf-parent 0.5.0 commons-rdf-integration-tests Commons RDF Integration tests ${project.groupId} commons-rdf-api ${project.version} ${project.groupId} commons-rdf-simple ${project.version} ${project.groupId} commons-rdf-rdf4j ${project.version} ${project.groupId} commons-rdf-jena ${project.version} ${project.groupId} commons-rdf-jsonld-java ${project.version} apache-commons-rdf-0.5.0/commons-rdf-jsonld-java/0000755000175000017500000000000014132221255021502 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/0000755000175000017500000000000014132221255022271 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/0000755000175000017500000000000014132221255023215 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/0000755000175000017500000000000014132221255024136 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/0000755000175000017500000000000014132221255024725 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/0000755000175000017500000000000014132221255026146 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/0000755000175000017500000000000014132221255027621 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/0000755000175000017500000000000014132221255030374 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/0000755000175000017500000000000014132221255032527 5ustar andriusandrius././@LongLink0000644000000000000000000000016600000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNode.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000417313175733174033230 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import org.apache.commons.rdf.api.BlankNode; import com.github.jsonldjava.core.RDFDataset.Node; public interface JsonLdBlankNode extends JsonLdTerm, BlankNode { } final class JsonLdBlankNodeImpl extends JsonLdTermImpl implements JsonLdBlankNode { private final String blankNodePrefix; JsonLdBlankNodeImpl(final Node node, final String blankNodePrefix) { super(node); this.blankNodePrefix = blankNodePrefix; if (!node.isBlankNode()) { throw new IllegalArgumentException("Node is not a BlankNode:" + node); } } @Override public String ntriplesString() { // TODO: Escape if this is not valid ntriples string (e.g. contains :) return node.getValue(); } @Override public String uniqueReference() { return blankNodePrefix + node.getValue(); } @Override public boolean equals(final Object obj) { if (!(obj instanceof BlankNode)) { return false; } final BlankNode other = (BlankNode) obj; return uniqueReference().equals(other.uniqueReference()); } @Override public int hashCode() { return uniqueReference().hashCode(); } @Override public String toString() { return ntriplesString() + " [" + uniqueReference() + "]"; } } ././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraph.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000741713175733174033234 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import com.github.jsonldjava.core.RDFDataset; /** * A {@link Graph} view of a JsonLd {@link RDFDataset}. * */ public interface JsonLdGraph extends JsonLdGraphLike, Graph { } class JsonLdGraphImpl extends AbstractJsonLdGraphLike implements JsonLdGraph { private final Optional graphName; JsonLdGraphImpl(final RDFDataset rdfDataSet) { super(rdfDataSet); this.graphName = Optional.empty(); } JsonLdGraphImpl(final RDFDataset rdfDataSet, final Optional graphName, final String bnodePrefix) { super(rdfDataSet, bnodePrefix); this.graphName = Objects.requireNonNull(graphName); } JsonLdGraphImpl(final String bnodePrefix) { super(bnodePrefix); this.graphName = Optional.empty(); } @Override public void clear() { filteredGraphs(graphName).forEach(l -> l.clear()); } @Override public void add(final Triple t) { // Ensure it's added in the correct graph super.add(graphName.orElse(null), t.getSubject(), t.getPredicate(), t.getObject()); } @Override public void add(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { super.add(graphName.orElse(null), subject, predicate, object); } @Override public boolean contains(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return super.contains(graphName, subject, predicate, object); } @Override public boolean contains(final Triple t) { return contains(graphName, t.getSubject(), t.getPredicate(), t.getObject()); } @Override public void remove(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { super.remove(graphName, subject, predicate, object); } @Override public void remove(final Triple t) { // Only remove from the particular graph remove(graphName, t.getSubject(), t.getPredicate(), t.getObject()); } @Override public long size() { final String g = graphName.map(factory::asJsonLdString).orElse("@default"); return Optional.ofNullable(rdfDataSet.getQuads(g)).map(List::size).orElse(0); } @Override public Stream stream(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return filteredGraphs(graphName).flatMap(List::stream).filter(quadFilter(subject, predicate, object)) .map(factory::asTriple); } @Override JsonLdTriple asTripleOrQuad(final com.github.jsonldjava.core.RDFDataset.Quad jsonldQuad) { return factory.asTriple(jsonldQuad); } } ././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/package-info.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/pac0000644000175000017500000000213113175733174033230 0ustar andriusandrius/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Integration with jsonld-java * * @see org.apache.commons.rdf.jsonldjava.JsonLdRDF * @see org.apache.commons.rdf.jsonldjava.JsonLdGraph * @see org.apache.commons.rdf.jsonldjava.JsonLdUnionGraph * @see org.apache.commons.rdf.jsonldjava.JsonLdDataset * */ package org.apache.commons.rdf.jsonldjava;././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/apache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/exp0000755000175000017500000000000014132221255033244 5ustar andriusandrius././@LongLink0000644000000000000000000000020000000000000011573 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/package-info.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/exp0000644000175000017500000000250113175733174033262 0ustar andriusandrius/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Experimental Commons RDF JSONLD-Java implementations. *

* Classes in this package should be considered at risk; they * might change or be removed in the next minor update of Commons RDF. *

* When a class has stabilized, it will move to the * {@link org.apache.commons.rdf.jsonldjava} package. *

    *
  • {@link JsonLdParser} - an JSONLD-Java-backed implementations of * {@link org.apache.commons.rdf.experimental.RDFParser}.
  • *
*/ package org.apache.commons.rdf.jsonldjava.experimental;././@LongLink0000644000000000000000000000020000000000000011573 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/JsonLdParser.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/exp0000644000175000017500000001525113175733174033270 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava.experimental; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; import java.util.function.Predicate; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFSyntax; import org.apache.commons.rdf.jsonldjava.JsonLdDataset; import org.apache.commons.rdf.jsonldjava.JsonLdGraph; import org.apache.commons.rdf.jsonldjava.JsonLdRDF; import org.apache.commons.rdf.simple.experimental.AbstractRDFParser; import com.github.jsonldjava.core.JsonLdError; import com.github.jsonldjava.core.JsonLdOptions; import com.github.jsonldjava.core.JsonLdProcessor; import com.github.jsonldjava.core.RDFDataset; import com.github.jsonldjava.utils.JsonUtils; public class JsonLdParser extends AbstractRDFParser { @Override protected JsonLdRDF createRDFTermFactory() { return new JsonLdRDF(); } @Override public JsonLdParser contentType(final RDFSyntax rdfSyntax) throws IllegalArgumentException { if (rdfSyntax != null && rdfSyntax != RDFSyntax.JSONLD) { throw new IllegalArgumentException("Unsupported contentType: " + rdfSyntax); } return super.contentType(rdfSyntax); } @Override public JsonLdParser contentType(final String contentType) throws IllegalArgumentException { final JsonLdParser c = super.contentType(contentType); if (c.getContentType().filter(Predicate.isEqual(RDFSyntax.JSONLD).negate()).isPresent()) { throw new IllegalArgumentException("Unsupported contentType: " + contentType); } return c; } private static URL asURL(final IRI iri) throws IllegalStateException { try { return new URI(iri.getIRIString()).toURL(); } catch (MalformedURLException | URISyntaxException e) { throw new IllegalStateException("Invalid URL: " + iri.getIRIString()); } } @Override protected void checkSource() throws IOException { super.checkSource(); // Might throw IllegalStateException if invalid getSourceIri().map(JsonLdParser::asURL); } @Override protected void parseSynchronusly() throws IOException { final Object json = readSource(); final JsonLdOptions options = new JsonLdOptions(); getBase().map(IRI::getIRIString).ifPresent(options::setBase); // TODO: base from readSource() (after redirection and Content-Location // header) // should be forwarded // TODO: Modify JsonLdProcessor to accept the target RDFDataset RDFDataset rdfDataset; try { rdfDataset = (RDFDataset) JsonLdProcessor.toRDF(json, options); } catch (final JsonLdError e) { throw new IOException("Could not parse Json-LD", e); } if (getTargetGraph().isPresent()) { final Graph intoGraph = getTargetGraph().get(); if (intoGraph instanceof JsonLdGraph && !intoGraph.contains(null, null, null)) { // Empty graph, we can just move over the map content directly: final JsonLdGraph jsonLdGraph = (JsonLdGraph) intoGraph; jsonLdGraph.getRdfDataSet().putAll(rdfDataset); return; // otherwise we have to merge as normal } // TODO: Modify JsonLdProcessor to have an actual triple callback final Graph parsedGraph = getJsonLdFactory().asGraph(rdfDataset); // sequential() as we don't know if destination is thread safe :-/ parsedGraph.stream().sequential().forEach(intoGraph::add); } else if (getTargetDataset().isPresent()) { final Dataset intoDataset = getTargetDataset().get(); if (intoDataset instanceof JsonLdDataset && !intoDataset.contains(null, null, null, null)) { final JsonLdDataset jsonLdDataset = (JsonLdDataset) intoDataset; // Empty - we can just do a brave replace! jsonLdDataset.getRdfDataSet().putAll(rdfDataset); return; // otherwise we have to merge.. but also avoid duplicate // triples, // map blank nodes etc, so we'll fall back to normal Dataset // appending. } final Dataset fromDataset = getJsonLdFactory().asDataset(rdfDataset); // .sequential() as we don't know if destination is thread-safe :-/ fromDataset.stream().sequential().forEach(intoDataset::add); } else { final Dataset fromDataset = getJsonLdFactory().asDataset(rdfDataset); // No need for .sequential() here fromDataset.stream().forEach(getTarget()); } } private JsonLdRDF getJsonLdFactory() { if (getRdfTermFactory().isPresent() && getRdfTermFactory().get() instanceof JsonLdRDF) { return (JsonLdRDF) getRdfTermFactory().get(); } return createRDFTermFactory(); } private Object readSource() throws IOException { // Due to checked IOException we can't easily // do this with .map and .orElseGet() if (getSourceInputStream().isPresent()) { return JsonUtils.fromInputStream(getSourceInputStream().get()); } if (getSourceIri().isPresent()) { // TODO: propagate @base from content return JsonUtils.fromURL(asURL(getSourceIri().get()), JsonUtils.getDefaultHttpClient()); } if (getSourceFile().isPresent()) { try (InputStream inputStream = Files.newInputStream(getSourceFile().get())) { return JsonUtils.fromInputStream(inputStream); } } throw new IllegalStateException("No known source found"); } } ././@LongLink0000644000000000000000000000016700000000000011607 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000230313175733174033221 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import org.apache.commons.rdf.api.TripleLike; public interface JsonLdTripleLike extends TripleLike { /** * Return the underlying JsonLD * {@link com.github.jsonldjava.core.RDFDataset.Quad} * * @return The JsonLD {@link com.github.jsonldjava.core.RDFDataset.Quad} */ public com.github.jsonldjava.core.RDFDataset.Quad asJsonLdQuad(); } ././@LongLink0000644000000000000000000000016600000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphLike.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000002222713175733174033230 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.UUID; import java.util.function.Predicate; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.GraphLike; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.RDFTerm; // NOTE: To avod confusion, don't importing either of the Quad import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.api.TripleLike; import com.github.jsonldjava.core.RDFDataset; import com.github.jsonldjava.core.RDFDataset.Node; /** * Common abstract {@link GraphLike}. *

* Specialised by {@link JsonLdGraph}, {@link JsonLdUnionGraph} and * {@link JsonLdDataset}. * * @param * specialisation of {@link TripleLike}, e.g. {@link Triple} or * {@link org.apache.commons.rdf.api.Quad} */ public interface JsonLdGraphLike extends GraphLike { /** * Return the underlying JSONLD-Java {@link RDFDataset}. *

* Changes in the JSONLD-Java dataset is reflected in this class and vice * versa. * * @return The underlying JSONLD-JAva RDFDataset */ public RDFDataset getRdfDataSet(); } abstract class AbstractJsonLdGraphLike implements JsonLdGraphLike { /** * Used by {@link #bnodePrefix()} to get a unique UUID per JVM run */ private static UUID SALT = UUID.randomUUID(); /** * Prefix to use in blank node identifiers */ final String bnodePrefix; final JsonLdRDF factory; /** * The underlying JSON-LD {@link RDFDataset}. *

* Note: This is NOT final as it is reset to null by * {@link #close()} (to free memory). */ RDFDataset rdfDataSet; AbstractJsonLdGraphLike(final RDFDataset rdfDataSet) { this(rdfDataSet, "urn:uuid:" + SALT + "#" + "g" + System.identityHashCode(rdfDataSet)); } AbstractJsonLdGraphLike(final RDFDataset rdfDataSet, final String bnodePrefix) { this.rdfDataSet = Objects.requireNonNull(rdfDataSet); this.bnodePrefix = Objects.requireNonNull(bnodePrefix); this.factory = new JsonLdRDF(bnodePrefix); } AbstractJsonLdGraphLike(final String bnodePrefix) { this(new RDFDataset(), bnodePrefix); } @Override public void add(final T t) { // add triples to default graph by default BlankNodeOrIRI graphName = null; if (t instanceof org.apache.commons.rdf.api.Quad) { final org.apache.commons.rdf.api.Quad q = (org.apache.commons.rdf.api.Quad) t; graphName = q.getGraphName().orElse(null); } // FIXME: JSON-LD's rdfDataSet.addQuad method does not support // generalized RDF, so we have to do a naive cast here add(graphName, (BlankNodeOrIRI) t.getSubject(), (IRI) t.getPredicate(), t.getObject()); } void add(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final String g = factory.asJsonLdString(graphName); final String s = factory.asJsonLdString(subject); final String p = factory.asJsonLdString(predicate); if (object instanceof BlankNodeOrIRI) { final String o = factory.asJsonLdString((BlankNodeOrIRI) object); rdfDataSet.addQuad(s, p, o, g); } else if (object instanceof Literal) { final Literal literal = (Literal) object; final String language = literal.getLanguageTag().orElse(null); final String datatype = literal.getDatatype().getIRIString(); rdfDataSet.addQuad(s, p, literal.getLexicalForm(), datatype, language, g); } } public void close() { // Drop the memory reference, but don't clear it rdfDataSet = null; } @Override public void clear() { filteredGraphs(null).forEach(s -> s.clear()); // In theory we could use // rdfDataSet.clear(); // but then we would need to also do // rdfDataSet.put("@default", new ArrayList()); // .. both of which seems to be touching too much on JsonLd-Java's // internal structure } @Override public boolean contains(final T tripleOrQuad) { return stream().anyMatch(Predicate.isEqual(tripleOrQuad)); } @Override public RDFDataset getRdfDataSet() { return rdfDataSet; } @Override public Stream stream() { return rdfDataSet.graphNames().parallelStream().map(rdfDataSet::getQuads) .flatMap(List::parallelStream).map(this::asTripleOrQuad); } /** * Convert JsonLd Quad to a Commons RDF {@link Triple} or * {@link org.apache.commons.rdf.api.Quad} * * * @see JsonLdRDF#asTriple(Quad) * @see JsonLdRDF#asQuad(Quad) * @param jsonldQuad * jsonld quad to convert * @return converted {@link TripleLike} */ abstract T asTripleOrQuad(RDFDataset.Quad jsonldQuad); // This will be made public in JsonLdDataset // and is used by the other methods. boolean contains(final Optional graphName, final BlankNodeOrIRI s, final IRI p, final RDFTerm o) { return filteredGraphs(graphName).flatMap(List::stream).anyMatch(quadFilter(s, p, o)); } Stream> filteredGraphs(final Optional graphName) { return rdfDataSet.graphNames().parallelStream() // if graphName == null (wildcard), select all graphs, // otherwise check its jsonld string // (including @default for default graph) .filter(g -> graphName == null || g.equals(graphName.map(factory::asJsonLdString).orElse("@default"))) // remove the quads which match our filter (which could have // nulls as wildcards) .map(rdfDataSet::getQuads); } String graphNameAsJsonLdString(final T tripleOrQuad) { if (tripleOrQuad instanceof org.apache.commons.rdf.api.Quad) { final org.apache.commons.rdf.api.Quad quad = (org.apache.commons.rdf.api.Quad) tripleOrQuad; return quad.getGraphName().map(factory::asJsonLdString).orElse("@default"); } return "@default"; } Predicate quadFilter(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Optional subjectNode = Optional.ofNullable(subject).map(factory::asJsonLdNode); final Optional predicateNode = Optional.ofNullable(predicate).map(factory::asJsonLdNode); final Optional objectNode = Optional.ofNullable(object).map(factory::asJsonLdNode); return q -> { if (subjectNode.isPresent() && subjectNode.get().compareTo(q.getSubject()) != 0) { return false; } if (predicateNode.isPresent() && predicateNode.get().compareTo(q.getPredicate()) != 0) { return false; } if (objectNode.isPresent()) { if (object instanceof Literal && q.getObject().isLiteral()) { // Special handling for COMMONSRDF-56, COMMONSRDF-51: // Less efficient wrapper to a Commons RDF Literal so // we can use our RDF 1.1-compliant .equals() final RDFTerm otherObj = factory.asRDFTerm(q.getObject()); if (! (object.equals(otherObj))) { return false; } } else { // JSONLD-Java's .compareTo can handle IRI, BlankNode and type-mismatch if (objectNode.get().compareTo(q.getObject()) != 0) { return false; } } } // All patterns checked, must be good! return true; }; } // NOTE: This is made public in JsonLdDataset and is used by the other // remove methods. void remove(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { // remove the quads which match our filter (which could have nulls as // wildcards) filteredGraphs(graphName).forEach(t -> t.removeIf(quadFilter(subject, predicate, object))); } } ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdRDF.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000003027513175733174033232 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import java.nio.charset.StandardCharsets; import java.util.Objects; import java.util.UUID; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.simple.Types; import com.github.jsonldjava.core.RDFDataset; import com.github.jsonldjava.core.RDFDataset.Node; /** * JSON-LD Java RDF implementation. */ public final class JsonLdRDF implements RDF { final String bnodePrefix; public JsonLdRDF() { // An "outside Graph" bnodePrefix this("urn:uuid:" + UUID.randomUUID() + "#b"); } JsonLdRDF(final String bnodePrefix) { this.bnodePrefix = Objects.requireNonNull(bnodePrefix); } /** * Adapt a JsonLd {@link RDFDataset} as a Commons RDF {@link Dataset}. *

* Changes to the Commons RDF {@link Dataset} are reflected in the JsonLd * {@link RDFDataset} and vice versa. * * @see #asGraph(RDFDataset) * @param rdfDataSet * JsonLd {@link RDFDataset} to adapt * @return Adapted {@link Dataset} */ public JsonLdDataset asDataset(final RDFDataset rdfDataSet) { return new JsonLdDatasetImpl(rdfDataSet); } /** * Adapt a JsonLd {@link RDFDataset} as a Commons RDF {@link Graph}. *

* Only triples in the default graph are included. To retrieve any * other graph, {@link #asDataset(RDFDataset)} together with * {@link Dataset#getGraph(BlankNodeOrIRI)}. *

* Changes to the Commons RDF {@link Graph} are reflected in the JsonLd * {@link RDFDataset} and vice versa. * * @see #asDataset(RDFDataset) * @see #asUnionGraph(RDFDataset) * @param rdfDataSet * JsonLd {@link RDFDataset} to adapt * @return Adapted {@link Graph} covering the default graph */ public JsonLdGraph asGraph(final RDFDataset rdfDataSet) { return new JsonLdGraphImpl(rdfDataSet); } public Node asJsonLdNode(final RDFTerm term) { if (term instanceof JsonLdBlankNode) { final JsonLdBlankNode jsonLdBlankNode = (JsonLdBlankNode) term; if (jsonLdBlankNode.uniqueReference().startsWith(bnodePrefix)) { // Only return blank nodes 'as is' if they have the same prefix return jsonLdBlankNode.asJsonLdNode(); } } else if (term instanceof JsonLdTerm) { // non-Bnodes can always be return as-is return ((JsonLdTerm) term).asJsonLdNode(); } if (term instanceof IRI) { return new RDFDataset.IRI(((IRI) term).getIRIString()); } if (term instanceof BlankNode) { final String ref = ((BlankNode) term).uniqueReference(); if (ref.startsWith(bnodePrefix)) { // one of our own (but no longer a JsonLdBlankNode), // we can recover the label after our unique prefix return new RDFDataset.BlankNode(ref.replace(bnodePrefix, "")); } // The "foreign" unique reference might not be a valid bnode string, // we'll convert to a UUID final UUID uuid = UUID.nameUUIDFromBytes(ref.getBytes(StandardCharsets.UTF_8)); return new RDFDataset.BlankNode("_:" + uuid); } if (term instanceof Literal) { final Literal literal = (Literal) term; return new RDFDataset.Literal(literal.getLexicalForm(), literal.getDatatype().getIRIString(), literal.getLanguageTag().orElse(null)); } throw new IllegalArgumentException("RDFTerm not instanceof IRI, BlankNode or Literal: " + term); } /** * Adapt a Commons RDF {@link org.apache.commons.rdf.api.Quad} as a JsonLd * {@link com.github.jsonldjava.core.RDFDataset.Quad}. * * @param quad * Commons RDF {@link org.apache.commons.rdf.api.Quad} to adapt * @return Adapted JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} */ public RDFDataset.Quad asJsonLdQuad(final org.apache.commons.rdf.api.Quad quad) { final BlankNodeOrIRI g = quad.getGraphName().orElse(null); return createJsonLdQuad(g, quad.getSubject(), quad.getPredicate(), quad.getObject()); } /** * Adapt a Commons RDF {@link Triple} as a JsonLd * {@link com.github.jsonldjava.core.RDFDataset.Quad}. * * @param triple * Commons RDF {@link Triple} to adapt * @return Adapted JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} */ public RDFDataset.Quad asJsonLdQuad(final Triple triple) { return createJsonLdQuad(null, triple.getSubject(), triple.getPredicate(), triple.getObject()); } /** * Adapt a JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} as a * Commons RDF {@link org.apache.commons.rdf.api.Quad}. *

* The underlying JsonLd quad can be retrieved with * {@link JsonLdQuad#asJsonLdQuad()}. * * @param quad * A JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} to * adapt * @return Adapted {@link JsonLdQuad} */ public JsonLdQuad asQuad(final RDFDataset.Quad quad) { return new JsonLdQuadImpl(quad, bnodePrefix); } /** * Adapt a JsonLd {@link Node} as a Commons RDF {@link RDFTerm}. *

* The underlying node can be retrieved with * {@link JsonLdTerm#asJsonLdNode()}. * * @param node * A JsonLd {@link Node} to adapt * @return Adapted {@link JsonLdTerm} */ public JsonLdTerm asRDFTerm(final Node node) { return asRDFTerm(node, bnodePrefix); } /** * Adapt a JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} as a * Commons RDF {@link org.apache.commons.rdf.api.Triple}. *

* The underlying JsonLd quad can be retrieved with * {@link JsonLdTriple#asJsonLdQuad()}. * * @param quad * A JsonLd {@link com.github.jsonldjava.core.RDFDataset.Quad} to * adapt * @return Adapted {@link JsonLdTriple} */ public JsonLdTriple asTriple(final RDFDataset.Quad quad) { return new JsonLdTripleImpl(quad, bnodePrefix); } /** * Adapt a JsonLd {@link RDFDataset} as a Commons RDF {@link Graph}. *

* The graph can be seen as a union graph as it will contains all * the triples across all the graphs of the underlying {@link RDFDataset}. *

* Note that some triple operations on a union graph can be inefficient as * they need to remove any duplicate triples across the graphs. *

* Changes to the Commons RDF {@link Graph} are reflected in the JsonLd * {@link RDFDataset} and vice versa. Triples removed from the graph are * removed from all graphs, while triples added are added * to the default graph. * * @param rdfDataSet * JsonLd {@link RDFDataset} to adapt * @return Adapted {@link Dataset} */ public JsonLdUnionGraph asUnionGraph(final RDFDataset rdfDataSet) { return new JsonLdUnionGraphImpl(rdfDataSet); } @Override public JsonLdBlankNode createBlankNode() { final String id = "_:" + UUID.randomUUID().toString(); return new JsonLdBlankNodeImpl(new RDFDataset.BlankNode(id), bnodePrefix); } @Override public JsonLdBlankNode createBlankNode(final String name) { final String id = "_:" + name; // TODO: Check if name is valid JSON-LD BlankNode identifier return new JsonLdBlankNodeImpl(new RDFDataset.BlankNode(id), bnodePrefix); } @Override public JsonLdDataset createDataset() { return new JsonLdDatasetImpl(bnodePrefix); } @Override public JsonLdGraph createGraph() { return new JsonLdGraphImpl(bnodePrefix); } @Override public JsonLdIRI createIRI(final String iri) { return new JsonLdIRIImpl(iri); } @Override public JsonLdLiteral createLiteral(final String literal) { return new JsonLdLiteralImpl(new RDFDataset.Literal(literal, null, null)); } @Override public JsonLdLiteral createLiteral(final String literal, final IRI dataType) { return new JsonLdLiteralImpl(new RDFDataset.Literal(literal, dataType.getIRIString(), null)); } @Override public JsonLdLiteral createLiteral(final String literal, final String language) { return new JsonLdLiteralImpl(new RDFDataset.Literal(literal, Types.RDF_LANGSTRING.getIRIString(), language)); } @Override public JsonLdQuad createQuad(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) throws IllegalArgumentException, UnsupportedOperationException { return new JsonLdQuadImpl(createJsonLdQuad(graphName, subject, predicate, object), bnodePrefix); } @Override public JsonLdTriple createTriple(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return new JsonLdTripleImpl(createJsonLdQuad(null, subject, predicate, object), bnodePrefix); } String asJsonLdString(final BlankNodeOrIRI blankNodeOrIRI) { if (blankNodeOrIRI == null) { return null; } if (blankNodeOrIRI instanceof IRI) { return ((IRI) blankNodeOrIRI).getIRIString(); } else if (blankNodeOrIRI instanceof BlankNode) { final BlankNode blankNode = (BlankNode) blankNodeOrIRI; final String ref = blankNode.uniqueReference(); if (ref.startsWith(bnodePrefix)) { // One of ours (but possibly not a JsonLdBlankNode) - // we can use the suffix directly return ref.replace(bnodePrefix, ""); } // Map to unique bnode identifier, e.g. // _:0dbd92ee-ab1a-45e7-bba2-7ade54f87ec5 final UUID uuid = UUID.nameUUIDFromBytes(ref.getBytes(StandardCharsets.UTF_8)); return "_:" + uuid; } else { throw new IllegalArgumentException("Expected a BlankNode or IRI, not: " + blankNodeOrIRI); } } JsonLdTerm asRDFTerm(final Node node, final String blankNodePrefix) { if (node == null) { return null; // e.g. default graph } if (node.isIRI()) { return new JsonLdIRIImpl(node); } else if (node.isBlankNode()) { return new JsonLdBlankNodeImpl(node, blankNodePrefix); } else if (node.isLiteral()) { // TODO: Our own JsonLdLiteral if (node.getLanguage() != null) { return createLiteral(node.getValue(), node.getLanguage()); } return createLiteral(node.getValue(), createIRI(node.getDatatype())); } else { throw new IllegalArgumentException("Node is neither IRI, BlankNode nor Literal: " + node); } } RDFDataset.Quad createJsonLdQuad(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return new RDFDataset.Quad(asJsonLdNode(subject), asJsonLdNode(predicate), asJsonLdNode(object), asJsonLdString(graphName)); } }././@LongLink0000644000000000000000000000016500000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000477313175733174033236 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import java.util.Optional; import org.apache.commons.rdf.api.QuadLike; import org.apache.commons.rdf.api.RDFTerm; import com.github.jsonldjava.core.RDFDataset.Quad; public interface JsonLdQuadLike extends QuadLike, JsonLdTripleLike { } class JsonLdQuadLikeImpl implements JsonLdQuadLike { // Note: We always pass the blankNodePrefix and don't rely on the internal // blankNodePrefix in this static factory private static JsonLdRDF rdfTermFactory = new JsonLdRDF(); private final Quad quad; private final String blankNodePrefix; JsonLdQuadLikeImpl(final Quad jsonldQuad, final String blankNodePrefix) { this.quad = jsonldQuad; this.blankNodePrefix = blankNodePrefix; } @SuppressWarnings("unchecked") @Override public Optional getGraphName() { final G g = (G) rdfTermFactory.asRDFTerm(quad.getGraph(), blankNodePrefix); return Optional.ofNullable(g); } @SuppressWarnings("unchecked") @Override public S getSubject() { return (S) rdfTermFactory.asRDFTerm(quad.getSubject(), blankNodePrefix); } @SuppressWarnings("unchecked") @Override public P getPredicate() { return (P) rdfTermFactory.asRDFTerm(quad.getPredicate(), blankNodePrefix); } @SuppressWarnings("unchecked") @Override public O getObject() { return (O) rdfTermFactory.asRDFTerm(quad.getObject(), blankNodePrefix); } @Override public Quad asJsonLdQuad() { return quad; } @Override public String toString() { return quad.toString(); } } ././@LongLink0000644000000000000000000000016400000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdDataset.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000773113175733174033233 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import java.util.List; import java.util.Optional; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import com.github.jsonldjava.core.RDFDataset; public interface JsonLdDataset extends JsonLdGraphLike, Dataset { } class JsonLdDatasetImpl extends AbstractJsonLdGraphLike implements JsonLdDataset { JsonLdDatasetImpl(final RDFDataset rdfDataSet) { super(rdfDataSet); } JsonLdDatasetImpl(final RDFDataset rdfDataset, final String bnodePrefix) { super(rdfDataset, bnodePrefix); } JsonLdDatasetImpl(final String bnodePrefix) { super(bnodePrefix); } @Override public void add(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { super.add(graphName, subject, predicate, object); } @Override public boolean contains(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return super.contains(graphName, subject, predicate, object); } @Override public Graph getGraph() { return new JsonLdGraphImpl(rdfDataSet, Optional.empty(), bnodePrefix); } @Override public Optional getGraph(final BlankNodeOrIRI graphName) { if (graphName == null) { return Optional.of(getGraph()); } return Optional.of(new JsonLdGraphImpl(rdfDataSet, Optional.of(graphName), bnodePrefix)); } @Override public Stream getGraphNames() { return rdfDataSet.graphNames().parallelStream().filter(Predicate.isEqual("@default").negate()) .map(s -> s.startsWith("_:") ? new RDFDataset.BlankNode(s) : new RDFDataset.IRI(s)) .map(n -> (BlankNodeOrIRI) factory.asRDFTerm(n)); } @Override public void remove(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { super.remove(graphName, subject, predicate, object); } @Override public void remove(final Quad q) { remove(q.getGraphName(), q.getSubject(), q.getPredicate(), q.getObject()); } @Override public Stream stream(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return filteredGraphs(graphName).flatMap(List::stream).filter(quadFilter(subject, predicate, object)) .map(factory::asQuad); } @Override public long size() { return rdfDataSet.graphNames().stream().map(rdfDataSet::getQuads) .collect(Collectors.summingLong(List::size)); } @Override Quad asTripleOrQuad(final com.github.jsonldjava.core.RDFDataset.Quad jsonldQuad) { return factory.asQuad(jsonldQuad); } } ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdIRI.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000356013175733174033227 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import org.apache.commons.rdf.api.IRI; import com.github.jsonldjava.core.RDFDataset; import com.github.jsonldjava.core.RDFDataset.Node; public interface JsonLdIRI extends JsonLdTerm, IRI { } final class JsonLdIRIImpl extends JsonLdTermImpl implements JsonLdIRI { JsonLdIRIImpl(final Node node) { super(node); if (!node.isIRI()) { throw new IllegalArgumentException("Node is not an IRI:" + node); } } JsonLdIRIImpl(final String iri) { super(new RDFDataset.IRI(iri)); } @Override public String ntriplesString() { return "<" + node.getValue() + ">"; } @Override public String getIRIString() { return node.getValue(); } @Override public int hashCode() { return node.getValue().hashCode(); } @Override public boolean equals(final Object obj) { if (!(obj instanceof IRI)) { return false; } final IRI other = (IRI) obj; return node.getValue().equals(other.getIRIString()); } } ././@LongLink0000644000000000000000000000016400000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdLiteral.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000647213175733174033234 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import java.util.Locale; import java.util.Objects; import java.util.Optional; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.simple.Types; import com.github.jsonldjava.core.RDFDataset.Node; public interface JsonLdLiteral extends JsonLdTerm, Literal { } class JsonLdLiteralImpl extends JsonLdTermImpl implements JsonLdLiteral { JsonLdLiteralImpl(final Node node) { super(node); if (!node.isLiteral()) { throw new IllegalArgumentException("Node is not a Literal:" + node); } } private static String lowerCase(final String langTag) { return langTag.toLowerCase(Locale.ROOT); } @Override public String ntriplesString() { final StringBuilder sb = new StringBuilder(); sb.append('"'); // Escape special characters sb.append(getLexicalForm().replace("\\", "\\\\"). // escaped to \\ replace("\"", "\\\""). // escaped to \" replace("\r", "\\r"). // escaped to \r replace("\n", "\\n")); // escaped to \n sb.append('"'); if (getLanguageTag().isPresent()) { sb.append("@"); sb.append(getLanguageTag().get()); } else if (!getDatatype().equals(Types.XSD_STRING)) { sb.append("^^"); sb.append(getDatatype().ntriplesString()); } return sb.toString(); } @Override public String getLexicalForm() { return node.getValue(); } @Override public IRI getDatatype() { return new JsonLdIRIImpl(node.getDatatype()); } @Override public Optional getLanguageTag() { return Optional.ofNullable(node.getLanguage()); } @Override public int hashCode() { return Objects.hash(node.getValue(), node.getDatatype(), getLanguageTag().map(JsonLdLiteralImpl::lowerCase)); } @Override public boolean equals(final Object obj) { // COMMONSRDF-56: Do **not** use // asJsonLdNode().compareTo(other.asJsonLdNode()) if (obj instanceof Literal) { final Literal other = (Literal) obj; return getLexicalForm().equals(other.getLexicalForm()) && getDatatype().equals(other.getDatatype()) && getLanguageTag().map(JsonLdLiteralImpl::lowerCase) .equals(other.getLanguageTag().map(JsonLdLiteralImpl::lowerCase)); } return false; } } ././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuad.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000407413175733174033230 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import java.util.Objects; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFTerm; // Note: To avoid confusion - don't import either Quad public interface JsonLdQuad extends org.apache.commons.rdf.api.Quad, JsonLdTripleLike { } final class JsonLdQuadImpl extends JsonLdQuadLikeImpl implements JsonLdQuad { JsonLdQuadImpl(final com.github.jsonldjava.core.RDFDataset.Quad quad, final String blankNodePrefix) { super(quad, blankNodePrefix); } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.commons.rdf.api.Quad)) { return false; } final org.apache.commons.rdf.api.Quad other = (org.apache.commons.rdf.api.Quad) obj; return getGraphName().equals(other.getGraphName()) && getSubject().equals(other.getSubject()) && getPredicate().equals(other.getPredicate()) && getObject().equals(other.getObject()); } @Override public int hashCode() { return Objects.hash(getGraphName(), getSubject(), getPredicate(), getObject()); } } ././@LongLink0000644000000000000000000000016700000000000011607 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdUnionGraph.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000001003013175733174033215 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import java.util.List; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import com.github.jsonldjava.core.RDFDataset; /** * A union graph representation of a JsonLd {@link RDFDataset}. *

* A union graph contains all the triples of the dataset, irregardless of their * graph names. *

* {@link #add(Triple)} and {@link #add(BlankNodeOrIRI, IRI, RDFTerm)} will add * the triple to the default graph (e.g. @default in JSON-LD), * while the remaining methods (including {@link #remove(Triple)} or * {@link #remove(BlankNodeOrIRI, IRI, RDFTerm)}) relate to triples from * all graphs. *

* Note: Some operations like {@link #stream()} and * {@link #size()} are inefficient as they skip any duplicate triples from * multiple graphs. */ public interface JsonLdUnionGraph extends JsonLdGraphLike, Graph { } class JsonLdUnionGraphImpl extends AbstractJsonLdGraphLike implements JsonLdUnionGraph { JsonLdUnionGraphImpl(final String bnodePrefix) { super(bnodePrefix); } JsonLdUnionGraphImpl(final RDFDataset rdfDataSet) { super(rdfDataSet); } JsonLdUnionGraphImpl(final RDFDataset rdfDataSet, final String bnodePrefix) { super(rdfDataSet, bnodePrefix); } @Override public void add(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { super.add(null, subject, predicate, object); } @Override public boolean contains(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return super.contains(null, subject, predicate, object); } @Override public void remove(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { super.remove(null, subject, predicate, object); } @Override public void remove(final Triple t) { // Remove from ALL graphs, not just default graph super.remove(null, t.getSubject(), t.getPredicate(), t.getObject()); } @Override public Stream stream(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return filteredGraphs(null).flatMap(List::stream).filter(quadFilter(subject, predicate, object)) .map(factory::asTriple) // Make sure we don't have duplicate triples // NOTE: This can be quite inefficient .distinct(); } @Override public Stream stream() { // NOTE: inefficient as we have to remove duplicate triples // in different graphs :-( return super.stream().distinct(); } @Override JsonLdTriple asTripleOrQuad(final com.github.jsonldjava.core.RDFDataset.Quad jsonldQuad) { return factory.asTriple(jsonldQuad); } @Override public long size() { // Note: Our specialized stream() already removes duplicates using // .distinct() return stream().count(); } } ././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000352513175733174033230 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import java.util.Objects; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import com.github.jsonldjava.core.RDFDataset.Quad; public interface JsonLdTriple extends Triple, JsonLdTripleLike { } final class JsonLdTripleImpl extends JsonLdQuadLikeImpl implements JsonLdTriple { JsonLdTripleImpl(final Quad quad, final String blankNodePrefix) { super(quad, blankNodePrefix); } @Override public boolean equals(final Object obj) { if (!(obj instanceof Triple)) { return false; } final Triple other = (Triple) obj; return getSubject().equals(other.getSubject()) && getPredicate().equals(other.getPredicate()) && getObject().equals(other.getObject()); } @Override public int hashCode() { return Objects.hash(getSubject(), getPredicate(), getObject()); } } ././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTerm.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000263513175733174033231 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import org.apache.commons.rdf.api.RDFTerm; import com.github.jsonldjava.core.RDFDataset.Node; public interface JsonLdTerm extends RDFTerm { /** * Return the underlying JsonLd {@link Node}. * * @return JsonLd {@link Node} */ Node asJsonLdNode(); } abstract class JsonLdTermImpl implements JsonLdTerm { final Node node; JsonLdTermImpl(final Node node) { this.node = node; } @Override public Node asJsonLdNode() { return node; } @Override public String toString() { return ntriplesString(); } } apache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/resources/0000755000175000017500000000000014132221255025227 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/resources/test.jsonld0000644000175000017500000000316013175733174027437 0ustar andriusandrius{ "http://purl.org/dc/elements/1.1/rights": "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ", "@context": { "xsd": "http://www.w3.org/2001/XMLSchema#", "pred1": "http://example.com/pred1", "pred2": { "@id": "http://example.com/pred2", "@type": "@id" }, "pred3": { "@id": "http://example.com/pred3", "@type": "xsd:integer" }, "pred4": { "@id": "http://example.com/pred4", "@type": "@id" }, "Type": "http://example.com/Type" } , "@id": "http://example.com/test", "@type": "Type", "pred1": "Hello", "pred2": "http://example.com/other", "pred3": 1337, "pred4": { "@id": "http://example.com/graph", "@graph": [ { "@id": "http://example.com/test", "pred1": "Other value", "pred2": "http://example.com/graph" } ] } } apache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/resources/META-INF/0000755000175000017500000000000014132221255026367 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/resources/META-INF/NOTICE0000644000175000017500000000025413212356336027303 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/resources/META-INF/services/0000755000175000017500000000000014132221255030212 5ustar andriusandrius././@LongLink0000644000000000000000000000016500000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/resources/META-INF/services/org.apache.commons.rdf.api.RDFapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/resources/META-INF/services/org.apache.com0000644000175000017500000000005413175733174032736 0ustar andriusandriusorg.apache.commons.rdf.jsonldjava.JsonLdRDF apache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/main/resources/META-INF/LICENSE0000644000175000017500000002613613212356336027413 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/site/0000755000175000017500000000000014132221255023235 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/site/resources/0000755000175000017500000000000014132221255025247 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/site/resources/profile.jacoco0000644000175000017500000000000013175733174030073 0ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/0000755000175000017500000000000014132221255023250 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/0000755000175000017500000000000014132221255024171 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/0000755000175000017500000000000014132221255024760 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/0000755000175000017500000000000014132221255026201 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/0000755000175000017500000000000014132221255027654 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/0000755000175000017500000000000014132221255030427 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/0000755000175000017500000000000014132221255032562 5ustar andriusandrius././@LongLink0000644000000000000000000000017600000000000011607 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdParserBuilderTest.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000001111413175733174033254 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.InputStream; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.util.concurrent.TimeUnit; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.RDFSyntax; import org.apache.commons.rdf.jsonldjava.experimental.JsonLdParser; import org.apache.commons.rdf.simple.Types; import org.junit.Test; public class JsonLdParserBuilderTest { private static final String TEST_JSONLD = "/test.jsonld"; static JsonLdRDF factory = new JsonLdRDF(); IRI test = factory.createIRI("http://example.com/test"); IRI Type = factory.createIRI("http://example.com/Type"); IRI type = factory.createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); IRI pred1 = factory.createIRI("http://example.com/pred1"); IRI pred2 = factory.createIRI("http://example.com/pred2"); IRI pred3 = factory.createIRI("http://example.com/pred3"); IRI pred4 = factory.createIRI("http://example.com/pred4"); IRI other = factory.createIRI("http://example.com/other"); IRI graph = factory.createIRI("http://example.com/graph"); @Test public void parseByUrl() throws Exception { final URL url = getClass().getResource(TEST_JSONLD); assertNotNull("Test resource not found: " + TEST_JSONLD, url); final IRI iri = factory.createIRI(url.toString()); try (final Graph g = factory.createGraph()) { new JsonLdParser().contentType(RDFSyntax.JSONLD).source(iri).target(g).parse().get(10, TimeUnit.SECONDS); checkGraph(g); } } @Test public void parseByPath() throws Exception { final Path path = Files.createTempFile("test", ".jsonld"); path.toFile().deleteOnExit(); try (InputStream is = getClass().getResourceAsStream(TEST_JSONLD)) { assertNotNull("Test resource not found: " + TEST_JSONLD, is); Files.copy(is, path, StandardCopyOption.REPLACE_EXISTING); } try (final Graph g = factory.createGraph()) { new JsonLdParser().contentType(RDFSyntax.JSONLD).source(path).target(g).parse().get(10, TimeUnit.SECONDS); checkGraph(g); } } @Test public void parseByStream() throws Exception { try (final Graph g = factory.createGraph()) { try (InputStream is = getClass().getResourceAsStream(TEST_JSONLD)) { assertNotNull("Test resource not found: " + TEST_JSONLD, is); new JsonLdParser().base("http://example.com/base/").contentType(RDFSyntax.JSONLD).source(is).target(g) .parse().get(10, TimeUnit.SECONDS); } checkGraph(g); } } private void checkGraph(final Graph g) { assertTrue(g.contains(test, type, Type)); // Should not include statements from the named graph assertEquals(1, g.stream(test, pred1, null).count()); assertEquals(1, g.stream(test, pred2, null).count()); assertEquals("Hello", ((Literal) g.stream(test, pred1, null).findFirst().get().getObject()).getLexicalForm()); assertTrue(g.contains(test, pred2, other)); assertEquals("1337", ((Literal) g.stream(test, pred3, null).findFirst().get().getObject()).getLexicalForm()); assertEquals(Types.XSD_INTEGER, ((Literal) g.stream(test, pred3, null).findFirst().get().getObject()).getDatatype()); // While the named graph 'graph' is not included, the relationship // to that @id is included. assertTrue(g.contains(test, pred4, graph)); } } ././@LongLink0000644000000000000000000000017600000000000011607 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdServiceLoaderTest.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000251113175733174033255 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import static org.junit.Assert.fail; import java.util.ServiceLoader; import org.apache.commons.rdf.api.RDF; import org.junit.Test; public class JsonLdServiceLoaderTest { @Test public void testServiceLoaderLookup() { final ServiceLoader loader = ServiceLoader.load(RDF.class); for (final RDF impl : loader) { if (impl instanceof JsonLdRDF) { return; // yay } } fail("JsonLdRDF not found in ServiceLoader"); } } ././@LongLink0000644000000000000000000000017000000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdDatasetTest.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000210613175733174033255 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import org.apache.commons.rdf.api.AbstractDatasetTest; import org.apache.commons.rdf.api.RDF; public class JsonLdDatasetTest extends AbstractDatasetTest { @Override public RDF createFactory() { return new JsonLdRDF(); } } ././@LongLink0000644000000000000000000000016400000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdRDFTest.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000343213175733174033260 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import org.apache.commons.rdf.api.AbstractRDFTest; import org.apache.commons.rdf.api.RDF; import org.junit.Ignore; import org.junit.Test; public class JsonLdRDFTest extends AbstractRDFTest { @Override public RDF createFactory() { return new JsonLdRDF(); } // TODO: Add support for checking for invalid lang/iri/blanknode IDs @Ignore("JSONLD-Java does not validate lang strings") @Test @Override public void testInvalidLiteralLang() throws Exception { super.testInvalidLiteralLang(); } @Ignore("JSONLD-Java does not validate IRIs") @Test @Override public void testInvalidIRI() throws Exception { super.testInvalidIRI(); } @Ignore("JSONLD-Java does not validate blanknode identifiers") @Test @Override public void testPossiblyInvalidBlankNode() throws Exception { // TODO: Fix blank node in ntriplesString() super.testPossiblyInvalidBlankNode(); } } ././@LongLink0000644000000000000000000000016600000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphTest.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000210013175733174033247 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import org.apache.commons.rdf.api.AbstractGraphTest; import org.apache.commons.rdf.api.RDF; public class JsonLdGraphTest extends AbstractGraphTest { @Override public RDF createFactory() { return new JsonLdRDF(); } } ././@LongLink0000644000000000000000000000017200000000000011603 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000000267713175733174033272 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import java.util.UUID; import org.apache.commons.rdf.api.AbstractBlankNodeTest; import org.apache.commons.rdf.api.BlankNode; import com.github.jsonldjava.core.RDFDataset; public class JsonLdBlankNodeTest extends AbstractBlankNodeTest { String fixedPrefix = "urn:uuid:d028ca89-8b2f-4e18-90a0-8959f955038d#"; @Override protected BlankNode getBlankNode() { return getBlankNode(UUID.randomUUID().toString()); } @Override protected BlankNode getBlankNode(final String identifier) { return new JsonLdBlankNodeImpl(new RDFDataset.BlankNode("_:" + identifier), fixedPrefix); } } ././@LongLink0000644000000000000000000000017300000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdComparisonTest.javaapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/Jso0000644000175000017500000001366713175733174033273 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.jsonldjava; import static org.junit.Assert.*; import java.util.Optional; import org.apache.commons.rdf.simple.Types; import org.junit.Test; /** * COMMONSRDF-56: Test Literal comparisons with JSONLD-Java */ public class JsonLdComparisonTest { JsonLdRDF rdf = new JsonLdRDF(); @Test public void literalEqual() throws Exception { final JsonLdLiteral lit1 = rdf.createLiteral("Hello"); final JsonLdLiteral lit2 = rdf.createLiteral("Hello"); final JsonLdLiteral lit3 = rdf.createLiteral("Hello", Types.XSD_STRING); assertEquals(lit1, lit2); assertEquals(lit1, lit3); } @Test public void literalNotEqual() throws Exception { final JsonLdLiteral lit1 = rdf.createLiteral("Hello"); final JsonLdLiteral lit2 = rdf.createLiteral("Hello there"); assertNotEquals(lit1, lit2); } @Test public void literalEqualLang() throws Exception { final JsonLdLiteral lit1 = rdf.createLiteral("Allo Allo", "fr"); final JsonLdLiteral lit2 = rdf.createLiteral("Allo Allo", "fr"); assertEquals(lit1, lit2); } @Test public void literalNotEqualLang() throws Exception { final JsonLdLiteral lit1 = rdf.createLiteral("Hello", "en"); final JsonLdLiteral lit2 = rdf.createLiteral("Hello", "en-us"); assertNotEquals(lit1, lit2); } @Test public void literalEqualType() throws Exception { final JsonLdLiteral lit1 = rdf.createLiteral("1", Types.XSD_INTEGER); final JsonLdLiteral lit2 = rdf.createLiteral("1", Types.XSD_INTEGER); assertEquals(lit1, lit2); } @Test public void literalNotEqualType() throws Exception { final JsonLdLiteral lit1 = rdf.createLiteral("1", Types.XSD_INTEGER); final JsonLdLiteral lit2 = rdf.createLiteral("2", Types.XSD_INTEGER); final JsonLdLiteral lit3 = rdf.createLiteral("1", Types.XSD_STRING); assertNotEquals(lit1, lit2); assertNotEquals(lit1, lit3); } @Test public void grahContains() throws Exception { try (final JsonLdGraph graph = rdf.createGraph()) { final JsonLdIRI s = rdf.createIRI("http://example.com/s"); final JsonLdIRI p = rdf.createIRI("http://example.com/p"); final JsonLdLiteral lit1 = rdf.createLiteral("Hello"); graph.add(s, p, lit1); assertTrue(graph.contains(s, p, rdf.createLiteral("Hello"))); assertTrue(graph.contains(s, p, rdf.createLiteral("Hello", Types.XSD_STRING))); assertFalse(graph.contains(s, p, rdf.createLiteral("Hello", Types.XSD_NORMALIZEDSTRING))); assertFalse(graph.contains(s, p, rdf.createLiteral("Hello", "en"))); assertFalse(graph.contains(s, p, rdf.createLiteral("Other"))); } } @Test public void datasetContains() throws Exception { try (final JsonLdDataset dataset = rdf.createDataset()) { final JsonLdIRI s = rdf.createIRI("http://example.com/s"); final JsonLdIRI p = rdf.createIRI("http://example.com/p"); final JsonLdLiteral lit1 = rdf.createLiteral("Hello"); dataset.add(null, s, p, lit1); assertTrue(dataset.contains(Optional.empty(), s, p, rdf.createLiteral("Hello"))); assertTrue(dataset.contains(Optional.empty(), s, p, rdf.createLiteral("Hello", Types.XSD_STRING))); assertFalse( dataset.contains(Optional.empty(), s, p, rdf.createLiteral("Hello", Types.XSD_NORMALIZEDSTRING))); assertFalse(dataset.contains(Optional.empty(), s, p, rdf.createLiteral("Hello", "en"))); assertFalse(dataset.contains(Optional.empty(), s, p, rdf.createLiteral("Other"))); } } @Test public void datasetRemove() throws Exception { try (final JsonLdDataset dataset = rdf.createDataset()) { final JsonLdIRI s = rdf.createIRI("http://example.com/s"); final JsonLdIRI p = rdf.createIRI("http://example.com/p"); final JsonLdLiteral lit1 = rdf.createLiteral("Hello"); dataset.add(null, s, p, lit1); assertTrue(dataset.contains(Optional.empty(), s, p, lit1)); dataset.remove(null, null, null, rdf.createLiteral("Other")); // should NOT match assertTrue(dataset.contains(Optional.empty(), s, p, lit1)); dataset.remove(null, null, null, rdf.createLiteral("Hello", Types.XSD_STRING)); // SHOULD match assertFalse(dataset.contains(Optional.empty(), s, p, lit1)); } } @Test public void datasetStream() throws Exception { try (final JsonLdDataset dataset = rdf.createDataset()) { final JsonLdIRI s = rdf.createIRI("http://example.com/s"); final JsonLdIRI p = rdf.createIRI("http://example.com/p"); final JsonLdLiteral lit1 = rdf.createLiteral("Hello"); final JsonLdLiteral lit2 = rdf.createLiteral("Other"); dataset.add(null, s, p, lit1); assertTrue(dataset.stream(Optional.empty(), s, p, lit1).findAny().isPresent()); assertFalse(dataset.stream(Optional.empty(), s, p, lit2).findAny().isPresent()); } } } apache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/resources/0000755000175000017500000000000014132221255025262 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/resources/NOTICE0000644000175000017500000000025413212356336026176 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-jsonld-java/src/test/resources/LICENSE0000644000175000017500000002613613212356336026306 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-jsonld-java/pom.xml0000644000175000017500000000633613212356730023034 0ustar andriusandrius 4.0.0 org.apache.commons commons-rdf-parent 0.5.0 commons-rdf-jsonld-java jar Commons RDF impl: JSON-LD Java Parser integration of JSON-LD Java commonsrdf-api-site scm:svn:${commons.scmPubUrl}/jsonld-java/ ${project.parent.groupId} commons-rdf-api ${project.version} ${project.parent.groupId} commons-rdf-api ${project.version} tests test ${project.parent.groupId} commons-rdf-simple ${project.version} com.github.jsonld-java jsonld-java ${jsonldjava.version} org.apache.felix maven-bundle-plugin org.apache.commons.rdf.jsonldjava org.apache.commons.rdf.jsonldjava osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional osgi.serviceloader; osgi.serviceloader=org.apache.commons.rdf.api.RDF apache-commons-rdf-0.5.0/README.md0000644000175000017500000002121313212355376016340 0ustar andriusandrius# Apache Commons RDF [![Build Status](https://travis-ci.org/apache/commons-rdf.svg?branch=master)](https://travis-ci.org/apache/commons-rdf) [![Coverage Status](https://coveralls.io/repos/apache/commons-rdf/badge.svg?branch=master&service=github)](https://coveralls.io/github/apache/commons-rdf?branch=master) [Commons RDF](https://commons.apache.org/proper/commons-rdf/) aims to provide a common library for [RDF 1.1](http://www.w3.org/TR/rdf11-concepts/) with implementations for common Java RDF frameworks like [RDF4J](http://rdf4j.org/), [Apache Jena](http://jena.apache.org/) as well as for other libraries such as [OWLAPI](http://owlapi.sourceforge.net/), [Clerezza](http://clerezza.apache.org/) and other JVM languages. The main motivation behind this simple library is to revise an historical incompatibility issue between these toolkits. This library does not pretend to be a generic API wrapping those libraries, but is a [set of common Java interfaces](https://commons.apache.org/proper/commons-rdf/apidocs/index.html?org/apache/commons/rdf/api/package-summary.html) for the RDF 1.1 concepts, e.g. `IRI`, `BlankNode`, `Graph`, accompanied with unit test cases for their expected behaviour, and a `simple` implementation, which main purpose is to clarify the tests and interfaces. In particular, Commons RDF aims to provide a type-safe, non-general API that covers RDF 1.1. A diagram of the interfaces included in Commons RDF: Class diagram Everybody is welcomed to join the project and [contribute](https://commons.apache.org/proper/commons-rdf/contributing.html)! See the [Commons RDF homepage](httasp://commons.apache.org/proper/commons-rdf/) for more details. ## License Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the [NOTICE](NOTICE) file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ## Contributing Feel free to subscribe to the [dev@commons](https://lists.apache.org/list.html?dev@commons.apache.org) mailing list, use the [Subject tag `[RDF]`](https://lists.apache.org/list.html?dev@commons.apache.org:lte=1M:%5BRDF%5D) to follow the ongoing development of Commons RDF, ask questions about its usage, or help shape Commons RDF by [contributing](https://commons.apache.org/proper/commons-rdf/contributing.html) your ideas, code and use cases. ## Building Building has been tested with [Apache Maven 3.2](http://maven.apache.org/download.cgi) and [Java JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/). $ mvn clean install [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] Commons RDF [INFO] Commons RDF: API [INFO] Commons RDF: Simple impl [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Commons RDF 0.5.0 .... [INFO] Installing /home/johndoe/src/commons-rdf/commons-rdf-api/target/commons-rdf-api-0.5.0-javadoc.jar to /home/johndoe/.m2/repository/org/apache/commons/commons-rdf/commons-rdf-api/0.5.0/commons-rdf-api-0.5.0-javadoc.jar [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Commons RDF ........................................ SUCCESS [ 0.404 s] [INFO] Commons RDF: API ................................... SUCCESS [ 0.031 s] [INFO] Commons RDF: Simple Implementation ................. SUCCESS [ 0.010 s] [INFO] Commons RDF: Integration: RDF4j .................... SUCCESS [ 0.012 s] [INFO] Commons RDF: Integration: Apache Jena .............. SUCCESS [ 0.011 s] [INFO] Commons RDF: Integration: JSON-LD Java ............. SUCCESS [ 0.009 s] [INFO] Commons RDF: Integration tests ..................... SUCCESS [ 0.005 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7.718 s [INFO] Finished at: 2015-01-26T02:09:10+00:00 [INFO] Final Memory: 22M/309M [INFO] ------------------------------------------------------------------------ To then use this build from your project, add to Maven (update `` to match the Maven output): org.apache.commons commons-rdf-api 0.5.0 .. and an equivalent `` for the [implementation](https://commons.apache.org/proper/commons-rdf/implementations.html) you would like, e.g. `commons-rdf-simple`. The `` above might not be up to date, see the [downloads](https://commons.apache.org/proper/commons-rdf/download.html) to use the latest stable release published in Maven Central. ## Snapshot repository The Apache Commons RDF project is aiming to regularly release early previews releases (0.x.y versions) and publish these to Maven Central. See the [downloads](https://commons.apache.org/proper/commons-rdf/download.html) to use the latest stable release. However, if you are following the ongoing development on [dev@commons](https://lists.apache.org/list.html?dev@commons.apache.org), (using subject tag `[RDF]`) you may want to try the [snapshot builds](https://builds.apache.org/job/commons-rdf/), which are automatically deployed to the [Apache snapshot repository](https://repository.apache.org/content/groups/snapshots/org/apache/commons/commons-rdf-api/). To use these snapshots from your Maven project, depend on the latest `*-SNAPSHOT` version as found in the current [pom.xml](pom.xml), and add to your own `pom.xml`: ```xml apache.snapshots Apache Snapshot Repository http://repository.apache.org/snapshots false ``` ## Simple implementation The [commons-rdf-simple](simple) module contains a simple (if not naive) implementation of the Commons RDF API using in-memory POJO objects. Note that although this module fully implements the commons-rdf API, it should *not* be considered a reference implementation. It is not thread-safe nor scalable, but may be useful for testing and simple usage (e.g. output from an independent RDF parser). ## Testing The abstract classes [AbstractGraphTest](commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractGraphTest.java), [AbstractDatasetTest](commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractDatasetTest.java), [AbstractBlankNodeTest](commons-rdf-api/src/test/java/org/apache/commons/rdf/api/AbstractBlankNodeTest.java) and [AbstractRDFTest](api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTest.java) can be realised as JUnit tests by implementations in order to verify that they pass the minimal requirements of this API. In order for this to work, your project will need to depend on the `tests` classifier for the commons-rdf-api module, for example (for Maven): junit junit 4.12 test org.apache.commons commons-rdf-api 0.5.0 tests test The extensions of each Test class need to provide a [RDF](api/src/main/java/org/apache/commons/rdf/api/RDF.java) instance that can create the corresponding implementations of a `Graph`, `IRI`, etc. For an example, see [SimpleGraphTest](commons-rdf-simple/src/test/java/org/apache/commons/rdf/simple/SimpleGraphTest.java). apache-commons-rdf-0.5.0/SITE.md0000644000175000017500000000342313175455642016157 0ustar andriusandrius # Commons RDF Site Some common tasks: * Build the site: `mvn clean package site` and then access the generated site at `target/site/index.html` * Publish the site: `mvn clean package site scm-publish:publish-scm` You will need to have `svn` installed. Further details at https://commons.apache.org/site-publish.html The first time you publish, you might need to tell `svn` your Apache password by doing the commit manually: ``` stain@biggie:~/src/incubator-commonsrdf$ cd target/site-content/ stain@biggie:~/src/incubator-commonsrdf/target/site-content$ svn commit -m "Updated website" Authentication realm: ASF Committers Password for 'stain': ******************* Sending apidocs/org/apache/commons/rdf/api/BlankNode.html Sending apidocs/org/apache/commons/rdf/api/IRI.html Sending index.html Sending mail-lists.html Sending project-info.html Transmitting file data ...................... Committed revision 961349. ``` apache-commons-rdf-0.5.0/commons-rdf-rdf4j/0000755000175000017500000000000014132221255020303 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/0000755000175000017500000000000014132221255021072 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/0000755000175000017500000000000014132221255022016 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/0000755000175000017500000000000014132221255022737 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/0000755000175000017500000000000014132221255023526 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/0000755000175000017500000000000014132221255024747 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/0000755000175000017500000000000014132221255026422 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/0000755000175000017500000000000014132221255027175 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/0000755000175000017500000000000014132221255030206 5ustar andriusandrius././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JLiteral.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JLiteral.j0000644000175000017500000000227413175733174032532 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; /** * Marker interface for RDF4J implementations of Commons RDF * {@link org.apache.commons.rdf.api.Literal}. *

* The underlying RDF4J {@link org.eclipse.rdf4j.model.Literal} instance can be * retrieved with {@link #asValue()}. * * @see RDF4J#createLiteral(String) */ public interface RDF4JLiteral extends RDF4JTerm, org.apache.commons.rdf.api.Literal { } apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JQuad.java0000644000175000017500000000227013175733174032514 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.Quad; /** * Marker interface for RDF4J implementations of Quad. * * @see RDF4J#createQuad(org.apache.commons.rdf.api.BlankNodeOrIRI, * org.apache.commons.rdf.api.BlankNodeOrIRI, * org.apache.commons.rdf.api.IRI, org.apache.commons.rdf.api.RDFTerm) */ public interface RDF4JQuad extends Quad, RDF4JTripleLike { } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JDataset.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JDataset.j0000644000175000017500000001116413175733174032521 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import java.util.Optional; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.rdf4j.RDF4J.Option; /** * Marker interface for RDF4J implementations of Dataset. * * @see RDF4J#createDataset() * @see RDF4J#asDataset(org.eclipse.rdf4j.repository.Repository, Option...) */ public interface RDF4JDataset extends Dataset, RDF4JGraphLike { /** * {@inheritDoc} *

* Note that for datasets backed by a repository ({@link #asRepository()} is * present), the stream must be closed with * {@link Stream#close()}. *

* This can generally achieved using a try-with-resources block, e.g.: * *

     * int subjects;
     * try (Stream<RDF4JQuad> s : graph.stream()) {
     *   subjects = s.map(RDF4JQuad::getSubject).distinct().count()
     * }
     * 
*/ @Override Stream stream(); /** * {@inheritDoc} *

* Note that for datasets backed by a repository ({@link #asRepository()} is * present), the stream must be closed with * {@link Stream#close()}. *

* This can generally achieved using a try-with-resources block, e.g.: * *

     * int subjects;
     * try (Stream<RDF4JQuad> s : graph.stream()) {
     *   subjects = s.map(RDF4JQuad::getSubject).distinct().count()
     * }
     * 
*/ @Override Stream stream(Optional graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object); /** * {@inheritDoc} *

* Note that for datasets backed by a repository ({@link #asRepository()} is * present), the stream must be closed with * {@link Stream#close()}. *

* This can generally achieved using a try-with-resources block, e.g.: * *

     * int graphs;
     * try (Stream<BlankNodeOrIRI> s : graph.stream()) {
     *   graphs = s.count()
     * }
     * 
*/ @Override Stream getGraphNames(); /** * {@inheritDoc} *

* Note that for datasets backed by a repository ({@link #asRepository()} is * present), the iterable must be closed with * {@link ClosableIterable#close()}. *

* This can generally achieved using a try-with-resources block, e.g.: * *

     * try (ClosableIterable<Quad> s : graph.iterate()) {
     *   for (Quad q : quads) {
     *       return q; // OK to terminate for-loop early
     *   }
     * }
     * 
* * If you don't use a try-with-resources block, the iterator will attempt to * close the ClosableIterable when reaching the end of the iteration. */ @Override ClosableIterable iterate(); /** * {@inheritDoc} *

* Note that for datasets backed by a repository ({@link #asRepository()} is * present), the iterable must be closed with * {@link ClosableIterable#close()}. *

* This can generally achieved using a try-with-resources block, e.g.: * *

     * try (ClosableIterable<Quad> s : graph.iterate(g,s,p,o)) {
     *   for (Quad q : quads) {
     *       return q; // OK to terminate for-loop early
     *   }
     * }
     * 
* * If you don't use a try-with-resources block, the iterator will attempt to * close the ClosableIterable when reaching the end of the iteration. */ @Override ClosableIterable iterate(Optional graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object); } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/package-info.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/package-info.j0000644000175000017500000000544413175733174032732 0ustar andriusandrius/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Commons RDF integration with RDF4J. *

* Use the {@link org.apache.commons.rdf.rdf4j.RDF4J} to convert between Commons RDF and RDF4J types, for * instance {@link org.apache.commons.rdf.rdf4j.RDF4J#asQuad(org.eclipse.rdf4j.model.Statement)} converts a * RDF4J {@link org.eclipse.rdf4j.model.Statement} to a * {@link org.apache.commons.rdf.api.Quad}. Converted RDF terms implement the * {@link org.apache.commons.rdf.rdf4j.RDF4JTerm} interface, and converted statements the * {@link org.apache.commons.rdf.rdf4j.RDF4JTripleLike} interface, which provide convenience access to the * underlying RDF4J implementations. *

* RDF4J {@link org.eclipse.rdf4j.model.Model}s and * {@link org.eclipse.rdf4j.repository.Repository} instances can be adapted to * Commons RDF {@link org.apache.commons.rdf.api.Graph} and {@link org.apache.commons.rdf.api.Dataset}, e.g. using * {@link org.apache.commons.rdf.rdf4j.RDF4J#asGraph(org.eclipse.rdf4j.model.Model)} or * {@link org.apache.commons.rdf.rdf4j.RDF4J#asDataset(org.eclipse.rdf4j.repository.Repository, RDF4J.Option...)} * The returned adapted graph/dataset is directly mapped, so changes are * propagated both ways. For convenience, the marker interface * {@link org.apache.commons.rdf.rdf4j.RDF4JGraph} and {@link org.apache.commons.rdf.rdf4j.RDF4JDataset} provide access to the underlying * RDF4J implementations. *

* The {@link org.apache.commons.rdf.rdf4j.experimental.RDF4JParser} can be used to parse RDF files using RDF4j. It should * be most efficient if used with {@link org.apache.commons.rdf.rdf4j.experimental.RDF4JParser#target(Dataset)} and an * adapted {@link org.apache.commons.rdf.rdf4j.RDF4JDataset}, or {@link org.apache.commons.rdf.rdf4j.experimental.RDF4JParser#target(Graph)} and a an * adapted {@link org.apache.commons.rdf.rdf4j.RDF4JGraph} * * */ package org.apache.commons.rdf.rdf4j; // Imports for Javadoc, do not remove import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/0000755000175000017500000000000013175733174032721 5ustar andriusandrius././@LongLink0000644000000000000000000000016500000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/package-info.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/p0000644000175000017500000000252413175733174033106 0ustar andriusandrius/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Experimental Commons RDF RDF4J implementations. *

* Classes in this package should be considered at risk; they * might change or be removed in the next minor update of Commons RDF. *

* When a class has stabilized, it will move to the * {@link org.apache.commons.rdf.rdf4j} package. *

    *
  • {@link org.apache.commons.rdf.rdf4j.experimental.RDF4JParser} - an RDF4J-backed implementations of * {@link org.apache.commons.rdf.experimental.RDFParser}.
  • *
*/ package org.apache.commons.rdf.rdf4j.experimental;././@LongLink0000644000000000000000000000016400000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/RDF4JParser.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/R0000644000175000017500000002347713175733174033062 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.experimental; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.util.Optional; import java.util.function.Consumer; import java.util.stream.Stream; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFSyntax; import org.apache.commons.rdf.rdf4j.RDF4J; import org.apache.commons.rdf.rdf4j.RDF4JBlankNodeOrIRI; import org.apache.commons.rdf.rdf4j.RDF4JDataset; import org.apache.commons.rdf.rdf4j.RDF4JGraph; import org.apache.commons.rdf.simple.experimental.AbstractRDFParser; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.repository.util.RDFInserter; import org.eclipse.rdf4j.repository.util.RDFLoader; import org.eclipse.rdf4j.rio.ParserConfig; import org.eclipse.rdf4j.rio.RDFFormat; import org.eclipse.rdf4j.rio.RDFHandler; import org.eclipse.rdf4j.rio.RDFHandlerException; import org.eclipse.rdf4j.rio.Rio; import org.eclipse.rdf4j.rio.helpers.AbstractRDFHandler; /** * RDF4J-based parser. *

* This can handle the RDF syntaxes {@link RDFSyntax#JSONLD}, * {@link RDFSyntax#NQUADS}, {@link RDFSyntax#NTRIPLES}, * {@link RDFSyntax#RDFXML}, {@link RDFSyntax#TRIG} and {@link RDFSyntax#TURTLE} * - additional syntaxes can be supported by including the corresponding * rdf4j-rio-* module on the classpath. * */ public class RDF4JParser extends AbstractRDFParser { private final class AddToQuadConsumer extends AbstractRDFHandler { private final Consumer quadTarget; private AddToQuadConsumer(final Consumer quadTarget) { this.quadTarget = quadTarget; } @Override public void handleStatement(final org.eclipse.rdf4j.model.Statement st) throws org.eclipse.rdf4j.rio.RDFHandlerException { // TODO: if getRdfTermFactory() is a non-rdf4j factory, should // we use factory.createQuad() instead? // Unsure what is the promise of setting getRdfTermFactory() -- // does it go all the way down to creating BlankNode, IRI and // Literal? quadTarget.accept(rdf4jTermFactory.asQuad(st)); // Performance note: // Graph/Quad.add should pick up again our // RDF4JGraphLike.asStatement() // and avoid double conversion. // Additionally the RDF4JQuad and RDF4JTriple implementations // are lazily converting subj/obj/pred/graph.s } } private final static class AddToModel extends AbstractRDFHandler { private final Model model; public AddToModel(final Model model) { this.model = model; } @Override public void handleStatement(final org.eclipse.rdf4j.model.Statement st) throws org.eclipse.rdf4j.rio.RDFHandlerException { model.add(st); } @Override public void handleNamespace(final String prefix, final String uri) throws RDFHandlerException { model.setNamespace(prefix, uri); } } private RDF4J rdf4jTermFactory; private ParserConfig parserConfig = new ParserConfig(); @Override protected RDF4J createRDFTermFactory() { return new RDF4J(); } @Override protected RDF4JParser prepareForParsing() throws IOException, IllegalStateException { final RDF4JParser c = super.prepareForParsing(); // Ensure we have an RDF4J for conversion. // We'll make a new one if user has provided a non-RDF4J factory c.rdf4jTermFactory = (RDF4J) getRdfTermFactory().filter(RDF4J.class::isInstance) .orElseGet(c::createRDFTermFactory); return c; } @Override protected void parseSynchronusly() throws IOException { final Optional formatByMimeType = getContentType().flatMap(Rio::getParserFormatForMIMEType); final String base = getBase().map(IRI::getIRIString).orElse(null); final ParserConfig parserConfig = getParserConfig(); // TODO: Should we need to set anything? final RDFLoader loader = new RDFLoader(parserConfig, rdf4jTermFactory.getValueFactory()); final RDFHandler rdfHandler = makeRDFHandler(); if (getSourceFile().isPresent()) { // NOTE: While we could have used // loader.load(sourcePath.toFile() // if the path fs provider == FileSystems.getDefault(), // that RDFLoader method does not use absolute path // as the base URI, so to be consistent // we'll always do it with our own input stream // // That means we may have to guess format by extensions: final Optional formatByFilename = getSourceFile().map(Path::getFileName).map(Path::toString) .flatMap(Rio::getParserFormatForFileName); // TODO: for the excited.. what about the extension after following // symlinks? final RDFFormat format = formatByMimeType.orElse(formatByFilename.orElse(null)); try (InputStream in = Files.newInputStream(getSourceFile().get())) { loader.load(in, base, format, rdfHandler); } } else if (getSourceIri().isPresent()) { try { // TODO: Handle international IRIs properly // (Unicode support for for hostname, path and query) final URL url = new URL(getSourceIri().get().getIRIString()); // TODO: This probably does not support https:// -> http:// // redirections loader.load(url, base, formatByMimeType.orElse(null), makeRDFHandler()); } catch (final MalformedURLException ex) { throw new IOException("Can't handle source URL: " + getSourceIri().get(), ex); } } // must be getSourceInputStream then, this is guaranteed by // super.checkSource(); loader.load(getSourceInputStream().get(), base, formatByMimeType.orElse(null), rdfHandler); } /** * Get the RDF4J {@link ParserConfig} to use. *

* If no parser config is set, the default configuration is provided. *

* Note: The parser config is mutable - changes in the * returned config is reflected in this instance of the parser. To avoid * mutation, create a new {@link ParserConfig} and set * {@link #setParserConfig(ParserConfig)}. * * @return The RDF4J {@link ParserConfig} */ public ParserConfig getParserConfig() { return parserConfig; } /** * Set an RDF4J {@link ParserConfig} to use * * @param parserConfig * Parser configuration */ public void setParserConfig(final ParserConfig parserConfig) { this.parserConfig = parserConfig; } protected RDFHandler makeRDFHandler() { // TODO: Can we join the below DF4JDataset and RDF4JGraph cases // using RDF4JGraphLike> // or will that need tricky generics types? if (getTargetDataset().filter(RDF4JDataset.class::isInstance).isPresent()) { // One of us, we can add them as Statements directly final RDF4JDataset dataset = (RDF4JDataset) getTargetDataset().get(); if (dataset.asRepository().isPresent()) { return new RDFInserter(dataset.asRepository().get().getConnection()); } if (dataset.asModel().isPresent()) { final Model model = dataset.asModel().get(); return new AddToModel(model); } // Not backed by Repository or Model? // Third-party RDF4JDataset subclass, so we'll fall through to the // getTarget() handling further down } else if (getTargetGraph().filter(RDF4JGraph.class::isInstance).isPresent()) { final RDF4JGraph graph = (RDF4JGraph) getTargetGraph().get(); if (graph.asRepository().isPresent()) { final RDFInserter inserter = new RDFInserter(graph.asRepository().get().getConnection()); if (!graph.getContextMask().isEmpty()) { final Stream b = graph.getContextMask().stream(); final Stream c = b.map(RDF4JBlankNodeOrIRI::asValue); final Resource[] contexts = c.toArray(Resource[]::new); inserter.enforceContext(contexts); } return inserter; } if (graph.asModel().isPresent() && graph.getContextMask().isEmpty()) { // the model accepts any quad final Model model = graph.asModel().get(); return new AddToModel(model); } // else - fall through } // Fall thorough: let target() consume our converted quads. return new AddToQuadConsumer(getTarget()); } } apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTerm.java0000644000175000017500000000255313175733174032535 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.RDFTerm; import org.eclipse.rdf4j.model.BNode; import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Literal; import org.eclipse.rdf4j.model.Value; /** * Marker interface for RDF4J implementations of RDFTerm. * */ public interface RDF4JTerm extends RDFTerm { /** * Return the RDF4J {@link Value} that this RDFTerm represents. * * @return The wrapped {@link Value} (e.g. a {@link Literal}, {@link IRI} or * {@link BNode}. */ public Value asValue(); } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraph.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraph.jav0000644000175000017500000001343613175733174032530 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import java.util.ConcurrentModificationException; import java.util.Set; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.repository.Repository; import org.apache.commons.rdf.rdf4j.RDF4J.Option; /** * Marker interface for RDF4J implementations of Graph. * * @see RDF4J#createGraph() * @see RDF4J#asGraph(Model) * @see RDF4J#asGraph(Repository, Option...) * @see RDF4J#asGraphUnion(Repository, Option...) * @see RDF4JDataset#getGraph() * @see RDF4JDataset#getGraph(BlankNodeOrIRI) */ public interface RDF4JGraph extends Graph, RDF4JGraphLike { /** * Return a copy of the context mask as a {@link Set} of * {@link RDF4JBlankNodeOrIRI} graph names. *

* If the set is not {@link Set#isEmpty()}, the mask determines which * contexts in the corresponding RDF4J {@link Model} or * {@link Repository} that this graph reflect. Modifications to the graph * (e.g. {@link #add(Triple)} will be performed for all the specified * contexts, while retrieval (e.g. {@link #contains(Triple)}) will succeed * if the triple is in at least one of the specified contexts. *

* The context mask array may contain null, indicating the * default context (the default graph in RDF datasets). *

* If the context mask is {@link Set#isEmpty()}, then this is a union * graph which triples reflect statements in any contexts. Triples * added to the graph will be added in the default context, e.g. equivalent * to new Resource[1]{null}) in RDF4J. *

* Note that the context mask itself cannot be null. *

* The returned set is an immutable copy; to specify a different mask, use * {@link RDF4J#asGraph(Repository, Set, Option...)} * * @return The context mask as a set of {@link BlankNodeOrIRI} graph names, * which may contain the value null. */ public Set getContextMask(); /** * {@inheritDoc} *

* Note that for graphs backed by a repository ({@link #asRepository()} is * present), the stream must be closed with * {@link Stream#close()}. *

* This can generally achieved using a try-with-resources block, e.g.: * *

     * int subjects;
     * try (Stream<RDF4JTriple> s : graph.stream()) {
     *   subjects = s.map(RDF4JTriple::getSubject).distinct().count()
     * }
     * 
*/ @Override Stream stream(); /** * {@inheritDoc} *

* Note that for graphs backed by a repository ({@link #asRepository()} is * present), the stream must be closed with * {@link Stream#close()}. *

* This can generally achieved using a try-with-resources block, e.g.: * *

     * int subjects;
     * try (Stream<RDF4JTriple> s : graph.stream(s,p,o)) {
     *   subjects = s.map(RDF4JTriple::getSubject).distinct().count()
     * }
     * 
*/ @Override Stream stream(BlankNodeOrIRI subject, IRI predicate, RDFTerm object); /** * {@inheritDoc} *

* Note that for graphs backed by a repository ({@link #asRepository()} is * present), the iterable must be closed with * {@link ClosableIterable#close()}. *

* This can generally achieved using a try-with-resources block, e.g.: * *

     * try (ClosableIterable<Triple> s : graph.iterate()) {
     *   for (Triple t : triples) {
     *       return t; // OK to terminate for-loop early
     *   }
     * }
     * 
* * If you don't use a try-with-resources block, the iterator will attempt to * close the ClosableIterable when reaching the end of the iteration. */ @Override ClosableIterable iterate() throws ConcurrentModificationException, IllegalStateException; /** * {@inheritDoc} *

* Note that for graphs backed by a repository ({@link #asRepository()} is * present), the iterable must be closed with * {@link ClosableIterable#close()}. *

* This can generally achieved using a try-with-resources block, e.g.: * *

     * try (ClosableIterable<Triple> s : graph.iterate(s,p,o)) {
     *   for (Triple t : triples) {
     *       return t; // OK to terminate for-loop early
     *   }
     * }
     * 
* * If you don't use a try-with-resources block, the iterator will attempt to * close the ClosableIterable when reaching the end of the iteration. */ @Override ClosableIterable iterate(BlankNodeOrIRI subject, IRI predicate, RDFTerm object); } apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/0000755000175000017500000000000013175733174031165 5ustar andriusandrius././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/LiteralImpl.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/LiteralIm0000644000175000017500000000613713175733174033001 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import java.util.Locale; import java.util.Objects; import java.util.Optional; import org.apache.commons.rdf.rdf4j.RDF4JLiteral; import org.eclipse.rdf4j.model.vocabulary.XMLSchema; import org.eclipse.rdf4j.rio.turtle.TurtleUtil; final class LiteralImpl extends AbstractRDFTerm implements RDF4JLiteral { private static final String QUOTE = "\""; LiteralImpl(final org.eclipse.rdf4j.model.Literal literal) { super(literal); } private static String lowerCase(final String langTag) { return langTag.toLowerCase(Locale.ROOT); } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (obj instanceof org.apache.commons.rdf.api.Literal) { final org.apache.commons.rdf.api.Literal other = (org.apache.commons.rdf.api.Literal) obj; return getLexicalForm().equals(other.getLexicalForm()) && getDatatype().equals(other.getDatatype()) && getLanguageTag().map(LiteralImpl::lowerCase).equals( other.getLanguageTag().map(LiteralImpl::lowerCase)); } return false; } @Override public org.apache.commons.rdf.api.IRI getDatatype() { return new IRIImpl(value.getDatatype()); } @Override public Optional getLanguageTag() { return value.getLanguage(); } @Override public String getLexicalForm() { return value.getLabel(); } @Override public int hashCode() { return Objects.hash(value.getLabel(), value.getDatatype(), getLanguageTag().map(LiteralImpl::lowerCase)); } @Override public String ntriplesString() { // TODO: Use a more efficient StringBuffer final String escaped = QUOTE + TurtleUtil.encodeString(value.getLabel()) + QUOTE; if (value.getLanguage().isPresent()) { return escaped + "@" + value.getLanguage().get(); } if (value.getDatatype().equals(XMLSchema.STRING)) { return escaped; } return escaped + "^^<" + TurtleUtil.encodeURIString(value.getDatatype().toString()) + ">"; } @Override public String toString() { return ntriplesString(); } }././@LongLink0000644000000000000000000000017400000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRepositoryGraphLike.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractR0000644000175000017500000000516713175733174033006 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import java.util.Optional; import java.util.UUID; import org.apache.commons.rdf.api.TripleLike; import org.apache.commons.rdf.rdf4j.RDF4JGraphLike; import org.apache.commons.rdf.rdf4j.RDF4J; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; abstract class AbstractRepositoryGraphLike implements RDF4JGraphLike { protected final Repository repository; protected final boolean includeInferred; protected final boolean handleInitAndShutdown; protected final RDF4J rdf4jTermFactory; protected final UUID salt; AbstractRepositoryGraphLike(final Repository repository, final UUID salt, final boolean handleInitAndShutdown, final boolean includeInferred) { this.repository = repository; this.salt = salt; this.includeInferred = includeInferred; this.handleInitAndShutdown = handleInitAndShutdown; if (handleInitAndShutdown && !repository.isInitialized()) { repository.initialize(); } rdf4jTermFactory = new RDF4J(repository.getValueFactory(), salt); } @Override public void close() throws Exception { if (handleInitAndShutdown) { repository.shutDown(); } // else: repository was initialized outside, so we should not shut it // down } protected abstract T asTripleLike(Statement s); protected RepositoryConnection getRepositoryConnection() { return repository.getConnection(); } @Override public Optional asRepository() { return Optional.of(repository); } @Override public Optional asModel() { return Optional.empty(); } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/TripleImpl.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/TripleImp0000644000175000017500000000470213175733174033020 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import java.util.Objects; import java.util.UUID; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.rdf4j.RDF4J; import org.apache.commons.rdf.rdf4j.RDF4JTriple; import org.eclipse.rdf4j.model.Statement; final class TripleImpl implements RDF4JTriple { private final UUID salt; private final Statement statement; TripleImpl(final Statement statement, final UUID salt) { this.statement = statement; this.salt = salt; } @Override public Statement asStatement() { return statement; } @Override public boolean equals(final Object obj) { if (obj instanceof Triple) { final Triple triple = (Triple) obj; return getSubject().equals(triple.getSubject()) && getPredicate().equals(triple.getPredicate()) && getObject().equals(triple.getObject()); } return false; } @Override public RDFTerm getObject() { return RDF4J.asRDFTerm(statement.getObject(), salt); } @Override public org.apache.commons.rdf.api.IRI getPredicate() { return (org.apache.commons.rdf.api.IRI) RDF4J.asRDFTerm(statement.getPredicate(), null); } @Override public BlankNodeOrIRI getSubject() { return (BlankNodeOrIRI) RDF4J.asRDFTerm(statement.getSubject(), salt); } @Override public int hashCode() { return Objects.hash(getSubject(), getPredicate(), getObject()); } @Override public String toString() { return statement.toString(); } }././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/ModelGraphImpl.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/ModelGrap0000644000175000017500000001261413175733174032766 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import java.util.Collections; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.Optional; import java.util.Set; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.rdf4j.ClosableIterable; import org.apache.commons.rdf.rdf4j.RDF4JBlankNodeOrIRI; import org.apache.commons.rdf.rdf4j.RDF4JGraph; import org.apache.commons.rdf.rdf4j.RDF4J; import org.apache.commons.rdf.rdf4j.RDF4JTriple; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.repository.Repository; final class ModelGraphImpl implements RDF4JGraph { private final Model model; private final RDF4J rdf4jTermFactory; ModelGraphImpl(final Model model, final RDF4J rdf4jTermFactory) { this.model = model; this.rdf4jTermFactory = rdf4jTermFactory; } @Override public void add(final BlankNodeOrIRI subject, final org.apache.commons.rdf.api.IRI predicate, final RDFTerm object) { model.add((Resource) rdf4jTermFactory.asValue(subject), (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate), rdf4jTermFactory.asValue(object)); } @Override public void add(final Triple triple) { model.add(rdf4jTermFactory.asStatement(triple)); } @Override public Optional asModel() { return Optional.of(model); } @Override public Optional asRepository() { return Optional.empty(); } @Override public void clear() { model.clear(); } @Override public boolean contains(final BlankNodeOrIRI subject, final org.apache.commons.rdf.api.IRI predicate, final RDFTerm object) { return model.contains((Resource) rdf4jTermFactory.asValue(subject), (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate), rdf4jTermFactory.asValue(object)); } @Override public boolean contains(final Triple triple) { return model.contains(rdf4jTermFactory.asStatement(triple)); } @Override public void remove(final BlankNodeOrIRI subject, final org.apache.commons.rdf.api.IRI predicate, final RDFTerm object) { model.remove((Resource) rdf4jTermFactory.asValue(subject), (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate), rdf4jTermFactory.asValue(object)); } @Override public void remove(final Triple triple) { model.remove(rdf4jTermFactory.asStatement(triple)); } @Override public long size() { final int size = model.size(); if (size < Integer.MAX_VALUE) { return size; } // TODO: Check if this can really happen with RDF4J models // Collection.size() can't help us, we'll have to count return model.parallelStream().count(); } @Override public Stream stream() { return model.parallelStream().map(rdf4jTermFactory::asTriple); } @Override public Stream stream(final BlankNodeOrIRI subject, final org.apache.commons.rdf.api.IRI predicate, final RDFTerm object) { return model.filter((Resource) rdf4jTermFactory.asValue(subject), (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate), rdf4jTermFactory.asValue(object)) .parallelStream().map(rdf4jTermFactory::asTriple); } @Override public Set getContextMask() { // ModelGraph always do the unionGraph return Collections.emptySet(); // TODO: Should we support contextMask like in RepositoryGraphImpl? } @Override public ClosableIterable iterate(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return new ClosableIterable() { @SuppressWarnings("unchecked") @Override public Iterator iterator() { // double-cast to fight Java generics.. final Stream s = stream(subject, predicate, object); return (Iterator) s.iterator(); } @Override public void close() throws Exception { // no-op as Model don't have transaction } }; } @Override public ClosableIterable iterate() throws ConcurrentModificationException, IllegalStateException { return iterate(null, null, null); } }././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/IRIImpl.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/IRIImpl.j0000644000175000017500000000370313175733174032610 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import org.apache.commons.rdf.rdf4j.RDF4JIRI; final class IRIImpl extends AbstractRDFTerm implements RDF4JIRI { IRIImpl(final org.eclipse.rdf4j.model.IRI iri) { super(iri); } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (obj instanceof IRIImpl) { final IRIImpl impl = (IRIImpl) obj; return asValue().equals(impl.asValue()); } if (obj instanceof org.apache.commons.rdf.api.IRI) { final org.apache.commons.rdf.api.IRI iri = (org.apache.commons.rdf.api.IRI) obj; return value.toString().equals(iri.getIRIString()); } return false; } @Override public String getIRIString() { return value.toString(); } @Override public int hashCode() { // Same definition return value.hashCode(); } @Override public String ntriplesString() { return "<" + value.toString() + ">"; } @Override public String toString() { return value.toString(); } }././@LongLink0000644000000000000000000000016400000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/ConvertedStatements.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/Converted0000644000175000017500000000466213175733174033051 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import java.util.Iterator; import java.util.function.Function; import java.util.function.Supplier; import org.apache.commons.rdf.rdf4j.ClosableIterable; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.Value; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryResult; final class ConvertedStatements implements ClosableIterable { private final RepositoryConnection conn; private final RepositoryResult results; private final Function statementAdapter; ConvertedStatements(final Supplier repositoryConnector, final Function statementAdapter, final Resource subj, final org.eclipse.rdf4j.model.IRI pred, final Value obj, final Resource... contexts) { this.statementAdapter = statementAdapter; this.conn = repositoryConnector.get(); this.results = conn.getStatements(subj, pred, obj, contexts); } @Override public Iterator iterator() { return new ConvertedIterator(); } @Override public void close() { results.close(); conn.close(); } private final class ConvertedIterator implements Iterator { @Override public boolean hasNext() { final boolean hasNext = results.hasNext(); if (!hasNext) { close(); } return hasNext; } @Override public T next() { return statementAdapter.apply(results.next()); } } }././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/BlankNodeImpl.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/BlankNode0000644000175000017500000000622213175733174032747 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import java.nio.charset.StandardCharsets; import java.util.UUID; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.rdf4j.RDF4JBlankNode; import org.eclipse.rdf4j.model.BNode; import org.eclipse.rdf4j.rio.turtle.TurtleUtil; final class BlankNodeImpl extends AbstractRDFTerm implements RDF4JBlankNode { private transient int hashCode = 0; private final long saltUUIDleast; private final long saltUUIDmost; BlankNodeImpl(final BNode bNode, final UUID salt) { super(bNode); // Space-efficient storage of salt UUID saltUUIDmost = salt.getMostSignificantBits(); saltUUIDleast = salt.getLeastSignificantBits(); } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } // NOTE: Do NOT use Bnode.equals() as it has a more generous // equality based only on the value.getID(); if (obj instanceof BlankNode) { final BlankNode blankNode = (BlankNode) obj; return uniqueReference().equals(blankNode.uniqueReference()); } return false; } @Override public int hashCode() { if (hashCode != 0) { return hashCode; } return hashCode = uniqueReference().hashCode(); } private boolean isValidBlankNodeLabel(final String id) { // FIXME: Replace with a regular expression? if (id.isEmpty()) { return false; } if (!TurtleUtil.isBLANK_NODE_LABEL_StartChar(id.codePointAt(0))) { return false; } for (int i = 1; i < id.length(); i++) { if (!TurtleUtil.isBLANK_NODE_LABEL_Char(id.codePointAt(i))) { return false; } } return true; } @Override public String ntriplesString() { if (isValidBlankNodeLabel(value.getID())) { return "_:" + value.getID(); } return "_:" + UUID.nameUUIDFromBytes(value.getID().getBytes(StandardCharsets.UTF_8)); } @Override public String uniqueReference() { final UUID uuid = new UUID(saltUUIDmost, saltUUIDleast); return "urn:uuid:" + uuid + "#" + value.getID(); } @Override public String toString() { return ntriplesString() + " [" + uniqueReference() + "]"; } }././@LongLink0000644000000000000000000000016500000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalRDF4JFactory.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalR0000644000175000017500000001561013175733174033011 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import java.util.UUID; import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.rdf4j.RDF4JBlankNode; import org.apache.commons.rdf.rdf4j.RDF4JDataset; import org.apache.commons.rdf.rdf4j.RDF4JGraph; import org.apache.commons.rdf.rdf4j.RDF4JIRI; import org.apache.commons.rdf.rdf4j.RDF4JLiteral; import org.apache.commons.rdf.rdf4j.RDF4JQuad; import org.apache.commons.rdf.rdf4j.RDF4JTerm; import org.apache.commons.rdf.rdf4j.RDF4J; import org.apache.commons.rdf.rdf4j.RDF4J.Option; import org.apache.commons.rdf.rdf4j.RDF4JTriple; import org.eclipse.rdf4j.model.BNode; import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Literal; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.repository.Repository; /** * Factory for {@link RDF4JTerm} instances. *

* Internal class: This "abstract" class is intended for * internal use by Commons RDF and may change in any minor update. Use instead * {@link RDF4J} methods like {@link RDF4J#createBlankNode()}, * {@link RDF4J#asRDFTerm(org.eclipse.rdf4j.model.Value)} and * {@link RDF4J#asGraph(Repository, Option...)} *

* This class exists as a public bridge between the packages * {@link org.apache.commons.rdf.rdf4j} and * {@link org.apache.commons.rdf.rdf4j.impl} by exposing the package-public * constructors. * * @see RDF4J */ public abstract class InternalRDF4JFactory { /** * Construct a {@link RDF4JBlankNode} from a RDF4J {@link BNode}. * * @param bNode * RDF4J {@link BNode} to adapt * @param salt * {@link UUID} to use for {@link BlankNode#uniqueReference()} in * combination with {@link BNode#getID()} * @return Adapted {@link RDF4JBlankNode} */ public RDF4JBlankNode createBlankNodeImpl(final BNode bNode, final UUID salt) { return new BlankNodeImpl(bNode, salt); } /** * Construct a {@link RDF4JIRI} from a RDF4J {@link IRI}. * * @param iri * RDF4J {@link IRI} to adapt * @return Adapted {@link RDF4JIRI} */ public RDF4JIRI createIRIImpl(final IRI iri) { return new IRIImpl(iri); } /** * Construct a {@link RDF4JLiteral} from a RDF4J {@link Literal}. * * @param literal * RDF4J {@link Literal} * @return Adapted {@link RDF4JLiteral} */ public RDF4JLiteral createLiteralImpl(final Literal literal) { return new LiteralImpl(literal); } /** * Construct a {@link RDF4JGraph} from a RDF4J {@link Model}. *

* Changes in the graph will be reflected in the model, and vice versa. * * @param model * RDF4J {@link Model} to adapt * @param rdf4jTermFactory * factory to use for adapting graph triples * @return Adapted {@link RDF4JGraph} */ public RDF4JGraph createModelGraphImpl(final Model model, final RDF4J rdf4jTermFactory) { return new ModelGraphImpl(model, rdf4jTermFactory); } /** * Construct a {@link RDF4JQuad} from a RDF4J {@link Statement}. * * @param statement * RDF4J {@link Statement} to adapt * @param salt * {@link UUID} for adapting any {@link BNode}s * @return Adapted {@link RDF4JQuad} */ public RDF4JQuad createQuadImpl(final Statement statement, final UUID salt) { return new QuadImpl(statement, salt); } /** * Construct a {@link RDF4JDataset} from a RDF4J {@link Repository}. *

* Changes in the dataset will be reflected in the repsitory, and vice * versa. * * @param repository * RDF4J {@link Repository} to adapt * @param handleInitAndShutdown * If true, the {@link RDF4JDataset} will initialize * the repository (if needed), and shut it down on * {@link RDF4JDataset#close()}. * @param includeInferred * If true, any inferred quads are included in the dataset * * @return Adapted {@link RDF4JDataset} */ public RDF4JDataset createRepositoryDatasetImpl(final Repository repository, final boolean handleInitAndShutdown, final boolean includeInferred) { return new RepositoryDatasetImpl(repository, UUID.randomUUID(), handleInitAndShutdown, includeInferred); } /** * Construct a {@link RDF4JGraph} from a RDF4J {@link Model}. *

* Changes in the graph will be reflected in the model, and vice versa. * * @param repository * RDF4J {@link Repository} to adapt * @param handleInitAndShutdown * If true, the {@link RDF4JGraph} will initialize * the repository (if needed), and shut it down on * {@link RDF4JGraph#close()}. * @param includeInferred * If true, any inferred quads are included in the dataset * @param contextMask * Zero or more {@link Resource}s contexts. The array may contain * the value null for the default graph - however * care must be taken to not provide a null-array * (Resource[]) null. * @return Adapted {@link RDF4JGraph} */ public RDF4JGraph createRepositoryGraphImpl(final Repository repository, final boolean handleInitAndShutdown, final boolean includeInferred, final Resource... contextMask) { return new RepositoryGraphImpl(repository, UUID.randomUUID(), handleInitAndShutdown, includeInferred, contextMask); } /** * Construct a {@link RDF4JTriple} from a RDF4J {@link Statement}. * * @param statement * RDF4J {@link Statement} to adapt * @param salt * {@link UUID} for adapting any {@link BNode}s * @return Adapted {@link RDF4JTriple} */ public RDF4JTriple createTripleImpl(final Statement statement, final UUID salt) { return new TripleImpl(statement, salt); } } ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRDFTerm.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractR0000644000175000017500000000221013175733174032770 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import org.apache.commons.rdf.rdf4j.RDF4JTerm; import org.eclipse.rdf4j.model.Value; abstract class AbstractRDFTerm implements RDF4JTerm { T value; AbstractRDFTerm(final T value) { this.value = value; } @Override public T asValue() { return value; } }././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/QuadImpl.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/QuadImpl.0000644000175000017500000000612713175733174032710 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import java.util.Objects; import java.util.Optional; import java.util.UUID; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.rdf4j.RDF4J; import org.apache.commons.rdf.rdf4j.RDF4JQuad; import org.eclipse.rdf4j.model.Statement; final class QuadImpl implements RDF4JQuad { private transient int hashCode = 0; private final UUID salt; private final Statement statement; QuadImpl(final Statement statement, final UUID salt) { this.statement = statement; this.salt = salt; } @Override public Statement asStatement() { return statement; } @Override public Triple asTriple() { return new TripleImpl(statement, salt); } @Override public boolean equals(final Object obj) { if (obj instanceof Quad) { final Quad quad = (Quad) obj; return getGraphName().equals(quad.getGraphName()) && getSubject().equals(quad.getSubject()) && getPredicate().equals(quad.getPredicate()) && getObject().equals(quad.getObject()); } return false; } @Override public Optional getGraphName() { if (statement.getContext() == null) { return Optional.empty(); } final BlankNodeOrIRI g = (BlankNodeOrIRI) RDF4J.asRDFTerm(statement.getContext(), salt); return Optional.of(g); } @Override public RDFTerm getObject() { return RDF4J.asRDFTerm(statement.getObject(), salt); } @Override public org.apache.commons.rdf.api.IRI getPredicate() { return (org.apache.commons.rdf.api.IRI) RDF4J.asRDFTerm(statement.getPredicate(), null); } @Override public BlankNodeOrIRI getSubject() { return (BlankNodeOrIRI) RDF4J.asRDFTerm(statement.getSubject(), salt); } @Override public int hashCode() { if (hashCode != 0) { return hashCode; } return hashCode = Objects.hash(getSubject(), getPredicate(), getObject(), getGraphName()); } @Override public String toString() { return statement.toString(); } }././@LongLink0000644000000000000000000000016400000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/RepositoryGraphImpl.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/Repositor0000644000175000017500000001742313175733174033105 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import java.util.Collections; import java.util.ConcurrentModificationException; import java.util.HashSet; import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.rdf4j.ClosableIterable; import org.apache.commons.rdf.rdf4j.RDF4JBlankNodeOrIRI; import org.apache.commons.rdf.rdf4j.RDF4JGraph; import org.apache.commons.rdf.rdf4j.RDF4JTriple; import org.eclipse.rdf4j.common.iteration.Iterations; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.Value; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryResult; class RepositoryGraphImpl extends AbstractRepositoryGraphLike implements RDF4JGraph { private final Resource[] contextMask; RepositoryGraphImpl(final Repository repository, final UUID salt, final boolean handleInitAndShutdown, final boolean includeInferred, final Resource... contextMask) { super(repository, salt, handleInitAndShutdown, includeInferred); this.contextMask = Objects.requireNonNull(contextMask); } @Override public void add(final Triple tripleLike) { final Statement statement = rdf4jTermFactory.asStatement(tripleLike); try (RepositoryConnection conn = getRepositoryConnection()) { conn.add(statement, contextMask); conn.commit(); } } @Override public boolean contains(final Triple tripleLike) { final Statement statement = rdf4jTermFactory.asStatement(tripleLike); try (RepositoryConnection conn = getRepositoryConnection()) { return conn.hasStatement(statement, includeInferred, contextMask); } } @Override public void remove(final Triple tripleLike) { final Statement statement = rdf4jTermFactory.asStatement(tripleLike); try (RepositoryConnection conn = getRepositoryConnection()) { conn.remove(statement, contextMask); conn.commit(); } } @Override public void clear() { try (RepositoryConnection conn = getRepositoryConnection()) { conn.clear(contextMask); conn.commit(); } } @Override public long size() { if (!includeInferred && contextMask.length == 0) { try (RepositoryConnection conn = getRepositoryConnection()) { return conn.size(); } } try (Stream stream = stream()) { return stream.count(); } } @Override public void add(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Resource subj = (Resource) rdf4jTermFactory.asValue(subject); final org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); final Value obj = rdf4jTermFactory.asValue(object); try (RepositoryConnection conn = getRepositoryConnection()) { conn.add(subj, pred, obj, contextMask); conn.commit(); } } @Override public boolean contains(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Resource subj = (Resource) rdf4jTermFactory.asValue(subject); final org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); final Value obj = rdf4jTermFactory.asValue(object); try (RepositoryConnection conn = getRepositoryConnection()) { return conn.hasStatement(subj, pred, obj, includeInferred, contextMask); } } @Override public void remove(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Resource subj = (Resource) rdf4jTermFactory.asValue(subject); final org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); final Value obj = rdf4jTermFactory.asValue(object); try (RepositoryConnection conn = getRepositoryConnection()) { conn.remove(subj, pred, obj, contextMask); conn.commit(); } } @Override public ClosableIterable iterate() throws ConcurrentModificationException, IllegalStateException { return iterate(null, null, null); } @Override public ClosableIterable iterate(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) throws ConcurrentModificationException, IllegalStateException { final Resource subj = (Resource) rdf4jTermFactory.asValue(subject); final org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); final Value obj = rdf4jTermFactory.asValue(object); return new ConvertedStatements<>(this::getRepositoryConnection, rdf4jTermFactory::asTriple, subj, pred, obj, contextMask); } @Override public Stream stream() { return stream(null, null, null); } @Override public Stream stream(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Resource subj = (Resource) rdf4jTermFactory.asValue(subject); final org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); final Value obj = rdf4jTermFactory.asValue(object); // NOTE: We can't do the usual try..with closing of the // RepositoryConnection here as it will have to be closed outside // by the user of the returned stream final RepositoryConnection conn = getRepositoryConnection(); Stream stream = null; try { final RepositoryResult statements = conn.getStatements(subj, pred, obj, includeInferred, contextMask); // NOTE: Iterations.stream should close RepositoryResult as long as // our caller closes the stream stream = Iterations.stream(statements).map(this::asTripleLike); } finally { if (stream == null) { // Some exception before we made the stream, close connection // here conn.close(); } } // Make sure the RepositoryConnection is closed return stream.onClose(conn::close); } @Override protected RDF4JTriple asTripleLike(final Statement statement) { return rdf4jTermFactory.asTriple(statement); } @Override public Set getContextMask() { final Set mask = new HashSet<>(); for (final Resource s : contextMask) { mask.add(rdf4jTermFactory.asRDFTerm(s)); } return Collections.unmodifiableSet(mask); } } ././@LongLink0000644000000000000000000000016600000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/RepositoryDatasetImpl.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/Repositor0000644000175000017500000002226313175733174033103 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j.impl; import java.util.ConcurrentModificationException; import java.util.Optional; import java.util.UUID; import java.util.stream.Stream; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.rdf4j.ClosableIterable; import org.apache.commons.rdf.rdf4j.RDF4JDataset; import org.apache.commons.rdf.rdf4j.RDF4JQuad; import org.eclipse.rdf4j.common.iteration.Iterations; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.Value; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryResult; class RepositoryDatasetImpl extends AbstractRepositoryGraphLike implements RDF4JDataset { RepositoryDatasetImpl(final Repository repository, final UUID salt, final boolean handleInitAndShutdown, final boolean includeInferred) { super(repository, salt, handleInitAndShutdown, includeInferred); } @Override public void add(final Quad tripleLike) { final Statement statement = rdf4jTermFactory.asStatement(tripleLike); try (RepositoryConnection conn = getRepositoryConnection()) { conn.add(statement); conn.commit(); } } @Override public boolean contains(final Quad tripleLike) { final Statement statement = rdf4jTermFactory.asStatement(tripleLike); try (RepositoryConnection conn = getRepositoryConnection()) { return conn.hasStatement(statement, includeInferred); } } @Override public void remove(final Quad tripleLike) { final Statement statement = rdf4jTermFactory.asStatement(tripleLike); try (RepositoryConnection conn = getRepositoryConnection()) { conn.remove(statement); conn.commit(); } } @Override public void clear() { try (RepositoryConnection conn = getRepositoryConnection()) { conn.clear(); conn.commit(); } } @Override public long size() { if (includeInferred) { // We'll need to count them all return stream().count(); } // else: Ask directly try (RepositoryConnection conn = getRepositoryConnection()) { return conn.size(); } } @Override public void add(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Resource context = (Resource) rdf4jTermFactory.asValue(graphName); final Resource subj = (Resource) rdf4jTermFactory.asValue(subject); final org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); final Value obj = rdf4jTermFactory.asValue(object); try (RepositoryConnection conn = getRepositoryConnection()) { conn.add(subj, pred, obj, context); conn.commit(); } } @Override public boolean contains(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Resource subj = (Resource) rdf4jTermFactory.asValue(subject); final org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); final Value obj = rdf4jTermFactory.asValue(object); final Resource[] contexts = asContexts(graphName); try (RepositoryConnection conn = getRepositoryConnection()) { return conn.hasStatement(subj, pred, obj, includeInferred, contexts); } } private Resource[] asContexts(final Optional graphName) { Resource[] contexts; if (graphName == null) { // no contexts == any contexts contexts = new Resource[0]; } else { final BlankNodeOrIRI g = graphName.orElse(null); final Resource context = (Resource) rdf4jTermFactory.asValue(g); contexts = new Resource[] { context }; } return contexts; } @Override public void remove(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Resource subj = (Resource) rdf4jTermFactory.asValue(subject); final org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); final Value obj = rdf4jTermFactory.asValue(object); final Resource[] contexts = asContexts(graphName); try (RepositoryConnection conn = getRepositoryConnection()) { conn.remove(subj, pred, obj, contexts); conn.commit(); } } @Override public Stream stream() { return stream(null, null, null, null); } @Override public Stream stream(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { final Resource subj = (Resource) rdf4jTermFactory.asValue(subject); final org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); final Value obj = rdf4jTermFactory.asValue(object); final Resource[] contexts = asContexts(graphName); // NOTE: We can't do the usual try..with closing of the // RepositoryConnection here as it will have to be closed outside // by the user of the returned stream final RepositoryConnection conn = getRepositoryConnection(); Stream stream = null; try { final RepositoryResult statements = conn.getStatements(subj, pred, obj, includeInferred, contexts); // NOTE: Iterations.stream should close RepositoryResult as long as // our caller closes the stream stream = Iterations.stream(statements).map(rdf4jTermFactory::asQuad); } finally { if (stream == null) { // Some exception before we made the stream, close connection // here conn.close(); } } // Make sure the RepositoryConnection is closed return stream.onClose(conn::close); } @Override public ClosableIterable iterate() throws ConcurrentModificationException, IllegalStateException { return iterate(null, null, null, null); } @Override public ClosableIterable iterate(final Optional graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) throws ConcurrentModificationException, IllegalStateException { final Resource[] contexts = asContexts(graphName); final Resource subj = (Resource) rdf4jTermFactory.asValue(subject); final org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); final Value obj = rdf4jTermFactory.asValue(object); return new ConvertedStatements<>(this::getRepositoryConnection, rdf4jTermFactory::asQuad, subj, pred, obj, contexts); } @Override protected RDF4JQuad asTripleLike(final Statement s) { return rdf4jTermFactory.asQuad(s); } @Override public Graph getGraph() { // default context only // NOTE: We carry over the 'salt' as the graph's BlankNode should be // equal to our BlankNodes return new RepositoryGraphImpl(repository, salt, false, includeInferred, (Resource) null); } @Override public Optional getGraph(final BlankNodeOrIRI graphName) { // NOTE: May be null to indicate default context final Resource context = (Resource) rdf4jTermFactory.asValue(graphName); // NOTE: We carry over the 'salt' as the graph's BlankNode should be // equal to our BlankNodes return Optional.of(new RepositoryGraphImpl(repository, salt, false, includeInferred, context)); } @Override public Stream getGraphNames() { final RepositoryConnection conn = getRepositoryConnection(); final RepositoryResult contexts = conn.getContextIDs(); return Iterations.stream(contexts).map(g -> (BlankNodeOrIRI) rdf4jTermFactory.asRDFTerm(g)) .onClose(conn::close); } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTriple.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTriple.ja0000644000175000017500000000221713175733174032533 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.Triple; /** * Marker interface for RDF4J implementations of Triple. * * @see RDF4J#createTriple(org.apache.commons.rdf.api.BlankNodeOrIRI, * org.apache.commons.rdf.api.IRI, org.apache.commons.rdf.api.RDFTerm) */ public interface RDF4JTriple extends Triple, RDF4JTripleLike { } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike0000644000175000017500000000435413175733174032555 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import java.util.Optional; import org.apache.commons.rdf.api.GraphLike; import org.apache.commons.rdf.api.TripleLike; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.repository.Repository; /** * Marker interface for RDF4J implementations of GraphLike. *

* This is a common interface for {@link RDF4JGraph} and {@link RDF4JDataset} * which provides access to the underlying RDF4J {@link Model} and/or * {@link Repository}. *

* At least one of {@link #asModel()} or {@link #asRepository()} will always be * {@link Optional#isPresent()}. * * @see RDF4JDataset * @see RDF4JGraph */ public interface RDF4JGraphLike extends GraphLike, AutoCloseable { /** * Return the corresponding RDF4J {@link Model}, if present. *

* The return value is {@link Optional#isPresent()} if this is backed by a * Model. *

* Changes to the Model are reflected in both directions. * * @return The corresponding RDF4J Model. */ public Optional asModel(); /** * Return the corresponding RDF4J {@link Repository}, if present. *

* The return value is {@link Optional#isPresent()} if this is backed by a * Repository. *

* Changes to the Repository are reflected in both directions. * * @return The corresponding RDF4J Repository. */ public Optional asRepository(); } ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterab0000644000175000017500000000266713175733174033035 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; /** * An {@link Iterable} which should be {@link #close()}d after use. *

* A good pattern to use this iterator is with an outer try-with-resources * block: * for (ClosableIterable<Triple> triples : graph.iterate()) { * for (Triple t : triples) { * return t; // OK to terminate for-loop early * } * } * The above will ensure that underlying resources are closed even if * the iteration does not exhaust all triples. * * @param * type of elements returned by the iterator */ public interface ClosableIterable extends Iterable, AutoCloseable { } apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4J.java0000644000175000017500000006630313175733174031710 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import java.util.Arrays; import java.util.EnumSet; import java.util.Objects; import java.util.Set; import java.util.UUID; // To avoid confusion, avoid importing // classes that are in both // commons.rdf and openrdf.model (e.g. IRI, Literal) import org.apache.commons.rdf.api.BlankNode; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.Graph; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.RDF; import org.apache.commons.rdf.api.Triple; import org.apache.commons.rdf.api.TripleLike; import org.apache.commons.rdf.rdf4j.impl.InternalRDF4JFactory; import org.eclipse.rdf4j.model.BNode; import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Literal; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.Value; import org.eclipse.rdf4j.model.ValueFactory; import org.eclipse.rdf4j.model.impl.LinkedHashModel; import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.sail.Sail; import org.eclipse.rdf4j.sail.memory.MemoryStore; /** * RDF4J implementation of RDF. *

* The {@link #RDF4J()} constructor uses a {@link SimpleValueFactory} to create * corresponding RDF4J {@link Value} instances. Alternatively, this factory can * be constructed with a different {@link ValueFactory} using * {@link #RDF4J(ValueFactory)}. *

* {@link #asRDFTerm(Value)} can be used to convert any RDF4J {@link Value} to * an RDFTerm. Note that adapted {@link BNode}s are considered equal if they are * converted with the same {@link RDF4J} instance and have the same * {@link BNode#getID()}. *

* {@link #createGraph()} creates a new Graph backed by {@link LinkedHashModel}. * To use other models, see {@link #asGraph(Model)}. *

* To adapt a RDF4J {@link Repository} as a {@link Dataset} or {@link Graph}, * use {@link #asDataset(Repository, Option...)} or * {@link #asGraph(Repository, Option...)}. *

* {@link #asTriple(Statement)} can be used to convert a RDF4J {@link Statement} * to a Commons RDF {@link Triple}, and equivalent {@link #asQuad(Statement)} to * convert a {@link Quad}. *

* To convert any {@link Triple} or {@link Quad} to to RDF4J {@link Statement}, * use {@link #asStatement(TripleLike)}. This recognises previously converted * {@link RDF4JTriple}s and {@link RDF4JQuad}s without re-converting their * {@link RDF4JTripleLike#asStatement()}. *

* Likewise, {@link #asValue(RDFTerm)} can be used to convert any Commons RDF * {@link RDFTerm} to a corresponding RDF4J {@link Value}. This recognises * previously converted {@link RDF4JTerm}s without re-converting their * {@link RDF4JTerm#asValue()}. *

* For the purpose of {@link BlankNode} equivalence, this factory contains an * internal {@link UUID} salt that is used by adapter methods like * {@link #asQuad(Statement)}, {@link #asTriple(Statement)}, * {@link #asRDFTerm(Value)} as well as {@link #createBlankNode(String)}. As * RDF4J {@link BNode} instances from multiple repositories or models may have * the same {@link BNode#getID()}, converting them with the above methods might * cause accidental {@link BlankNode} equivalence. Note that the {@link Graph} * and {@link Dataset} adapter methods like * {@link #asDataset(Repository, Option...)} and * {@link #asGraph(Repository, Option...)} therefore uses a unique {@link RDF4J} * internally. * * @see RDF * */ public final class RDF4J implements RDF { /** * InternalRDF4JFactory is deliberately abstract */ private static InternalRDF4JFactory rdf4j = new InternalRDF4JFactory() { }; public enum Option { /** * The Graph/Dataset should include any inferred statements */ includeInferred, /** * The graph/dataset should handle {@link Repository#initialize()} (if * needed) and {@link Repository#shutDown()} on {@link Graph#close()} / * {@link Dataset#close()}. */ handleInitAndShutdown } private final UUID salt; private final ValueFactory valueFactory; /** * Construct an {@link RDF4J}. * */ public RDF4J() { this(SimpleValueFactory.getInstance(), UUID.randomUUID()); } /** * Construct an {@link RDF4J}. *

* This constructor is intended for use with the value factory from * {@link Repository#getValueFactory()} when using Repository-based graphs * and datasets. * * @param valueFactory * The RDF4J {@link ValueFactory} to use */ public RDF4J(final ValueFactory valueFactory) { this(valueFactory, UUID.randomUUID()); } /** * Construct an {@link RDF4J}. *

* This constructor may be used if reproducible * {@link BlankNode#uniqueReference()} in {@link BlankNode} is desirable. * * @param salt * An {@link UUID} salt to be used by any created * {@link BlankNode}s for the purpose of * {@link BlankNode#uniqueReference()} */ public RDF4J(final UUID salt) { this(SimpleValueFactory.getInstance(), salt); } /** * Construct an {@link RDF4J}. *

* This constructor may be used if reproducible * {@link BlankNode#uniqueReference()} in {@link BlankNode} is desirable. * * @param valueFactory * The RDF4J {@link ValueFactory} to use * @param salt * An {@link UUID} salt to be used by any created * {@link BlankNode}s for the purpose of * {@link BlankNode#uniqueReference()} */ public RDF4J(final ValueFactory valueFactory, final UUID salt) { this.valueFactory = valueFactory; this.salt = salt; } /** * Adapt a RDF4J {@link Statement} as a Commons RDF {@link Quad}. *

* For the purpose of {@link BlankNode} equivalence, this method will use an * internal salt UUID that is unique per instance of {@link RDF4J}. *

* NOTE: If combining RDF4J {@link Statement}s multiple * repositories or models, then their {@link BNode}s may have the same * {@link BNode#getID()}, which with this method would become equivalent * according to {@link BlankNode#equals(Object)} and * {@link BlankNode#uniqueReference()}, unless a separate {@link RDF4J} * instance is used per RDF4J repository/model. * * @param statement * The statement to convert * @return A {@link RDF4JQuad} that is equivalent to the statement */ public RDF4JQuad asQuad(final Statement statement) { return rdf4j.createQuadImpl(statement, salt); } /** * * Adapt a RDF4J {@link Value} as a Commons RDF {@link RDFTerm}. *

* The value will be of the same kind as the term, e.g. a * {@link org.eclipse.rdf4j.model.BNode} is converted to a * {@link org.apache.commons.rdf.api.BlankNode}, a * {@link org.eclipse.rdf4j.model.IRI} is converted to a * {@link org.apache.commons.rdf.api.IRI} and a * {@link org.eclipse.rdf4j.model.Literal}. is converted to a * {@link org.apache.commons.rdf.api.Literal} *

* For the purpose of {@link BlankNode} equivalence, this method will use an * internal salt UUID that is unique per instance of {@link RDF4J}. *

* NOTE: If combining RDF4J values from multiple * repositories or models, then their {@link BNode}s may have the same * {@link BNode#getID()}, which with this method would become equivalent * according to {@link BlankNode#equals(Object)} and * {@link BlankNode#uniqueReference()}, unless a separate {@link RDF4J} * instance is used per RDF4J repository/model. * * @param value * The RDF4J {@link Value} to convert. * @return A {@link RDFTerm} that corresponds to the RDF4J value * @throws IllegalArgumentException * if the value is not a BNode, Literal or IRI */ public RDF4JTerm asRDFTerm(final Value value) { return asRDFTerm(value, salt); } /** * * Adapt a RDF4J * {@link org.eclipse.rdf4j.model.BNode} as a Commons RDF * {@link org.apache.commons.rdf.api.BlankNode} *

* For the purpose of {@link BlankNode} equivalence, this method will use an * internal salt UUID that is unique per instance of {@link RDF4J}. *

* NOTE: If combining RDF4J values from multiple * repositories or models, then their {@link BNode}s may have the same * {@link BNode#getID()}, which with this method would become equivalent * according to {@link BlankNode#equals(Object)} and * {@link BlankNode#uniqueReference()}, unless a separate {@link RDF4J} * instance is used per RDF4J repository/model. * * @param value * The RDF4J {@link BNode} to convert. * @return A {@link RDF4JBlankNode} that corresponds to the RDF4J BNode */ public RDF4JBlankNode asRDFTerm(final BNode value) { return rdf4j.createBlankNodeImpl(value, salt); } /** * * Adapt a RDF4J * {@link org.eclipse.rdf4j.model.Literal} as a Commons RDF * {@link org.apache.commons.rdf.api.Literal} *

* @param value * The RDF4J {@link Literal} to convert. * @return A {@link RDF4JLiteral} that corresponds to the RDF4J literal */ public RDF4JLiteral asRDFTerm(final Literal value) { return rdf4j.createLiteralImpl(value); } /** * * Adapt a RDF4J * {@link org.eclipse.rdf4j.model.IRI} as a Commons RDF * {@link org.apache.commons.rdf.api.IRI} *

* @param value * The RDF4J {@link Value} to convert. * @return A {@link RDF4JIRI} that corresponds to the RDF4J IRI */ public RDF4JIRI asRDFTerm(final org.eclipse.rdf4j.model.IRI value) { return rdf4j.createIRIImpl(value); } /** * * Adapt a RDF4J * {@link org.eclipse.rdf4j.model.Resource} as a Commons RDF * {@link org.apache.commons.rdf.api.BlankNodeOrIRI} *

* @param value * The RDF4J {@link Value} to convert. * @return A {@link RDF4JBlankNodeOrIRI} that corresponds to the RDF4J Resource */ public RDF4JBlankNodeOrIRI asRDFTerm(final org.eclipse.rdf4j.model.Resource value) { if(value instanceof IRI){ return asRDFTerm((IRI)value); } else if (value instanceof BNode){ return asRDFTerm((BNode)value); } throw new IllegalArgumentException("Value is not a BNode or IRI: " + value.getClass()); } /** * Adapt a RDF4J {@link Value} as a Commons RDF {@link RDFTerm}. *

* The value will be of the same kind as the term, e.g. a * {@link org.eclipse.rdf4j.model.BNode} is converted to a * {@link org.apache.commons.rdf.api.BlankNode}, a * {@link org.eclipse.rdf4j.model.IRI} is converted to a * {@link org.apache.commons.rdf.api.IRI} and a * {@link org.eclipse.rdf4j.model.Literal}. is converted to a * {@link org.apache.commons.rdf.api.Literal} * * @param value * The RDF4J {@link Value} to convert. * @param salt * A {@link UUID} salt to use for uniquely mapping any * {@link BNode}s. The salt should typically be the same for * multiple statements in the same {@link Repository} or * {@link Model} to ensure {@link BlankNode#equals(Object)} and * {@link BlankNode#uniqueReference()} works as intended. * @return A {@link RDFTerm} that corresponds to the RDF4J value * @throws IllegalArgumentException * if the value is not a BNode, Literal or IRI */ public static RDF4JTerm asRDFTerm(final Value value, final UUID salt) { if (value instanceof BNode) { return rdf4j.createBlankNodeImpl((BNode) value, salt); } if (value instanceof org.eclipse.rdf4j.model.Literal) { return rdf4j.createLiteralImpl((org.eclipse.rdf4j.model.Literal) value); } if (value instanceof org.eclipse.rdf4j.model.IRI) { return rdf4j.createIRIImpl((org.eclipse.rdf4j.model.IRI) value); } throw new IllegalArgumentException("Value is not a BNode, Literal or IRI: " + value.getClass()); } /** * Adapt an RDF4J {@link Repository} as a Commons RDF {@link Dataset}. *

* Changes to the dataset are reflected in the repository, and vice versa. *

* Note: Some operations on the {@link RDF4JDataset} * requires the use of try-with-resources to close underlying * {@link RepositoryConnection}s, including {@link RDF4JDataset#iterate()}, * {@link RDF4JDataset#stream()} and {@link RDF4JDataset#getGraphNames()}. * * @param repository * RDF4J {@link Repository} to connect to. * @param options * Zero or more {@link Option} * @return A {@link Dataset} backed by the RDF4J repository. */ public RDF4JDataset asDataset(final Repository repository, final Option... options) { final EnumSet

* Changes to the graph are reflected in the model, and vice versa. * * @param model * RDF4J {@link Model} to adapt. * @return Adapted {@link Graph}. */ public RDF4JGraph asGraph(final Model model) { return rdf4j.createModelGraphImpl(model, this); } /** * Adapt an RDF4J {@link Repository} as a Commons RDF {@link Graph}. *

* The graph will only include triples in the default graph (equivalent to * context new Resource[0]{null}) in RDF4J). *

* Changes to the graph are reflected in the repository, and vice versa. *

* Note: Some operations on the {@link RDF4JGraph} requires * the use of try-with-resources to close underlying * {@link RepositoryConnection}s, including {@link RDF4JGraph#iterate()} and * {@link RDF4JGraph#stream()}. * * @param repository * RDF4J {@link Repository} to connect to. * @param options * Zero or more {@link Option} * @return A {@link Graph} backed by the RDF4J repository. */ public RDF4JGraph asGraph(final Repository repository, final Option... options) { final EnumSet

* The graph will include triples in any contexts (e.g. the union graph). *

* Changes to the graph are reflected in the repository, and vice versa. * * @param repository * RDF4J {@link Repository} to connect to. * @param options * Zero or more {@link Option} * @return A union {@link Graph} backed by the RDF4J repository. */ public RDF4JGraph asGraphUnion(final Repository repository, final Option... options) { final EnumSet

* The graph will include triples in the specified contexts. *

* Changes to the graph are reflected in the repository, and vice versa. * Triples added/removed to the graph are reflected in all the specified * contexts. *

* Note: Some operations on the {@link RDF4JGraph} requires * the use of try-with-resources to close underlying * {@link RepositoryConnection}s, including {@link RDF4JGraph#iterate()} and * {@link RDF4JGraph#stream()}. * * @param repository * RDF4J {@link Repository} to connect to. * @param contexts * A {@link Set} of {@link BlankNodeOrIRI} specifying the graph * names to use as a context. The set may include the value * null to indicate the default graph. The empty set * indicates any context, e.g. the union graph. * @param option * Zero or more {@link Option}s * @return A {@link Graph} backed by the RDF4J repository. */ public RDF4JGraph asGraph(final Repository repository, final Set contexts, final Option... option) { final EnumSet

* If the tripleLike argument is an {@link RDF4JTriple} or a * {@link RDF4JQuad}, then its {@link RDF4JTripleLike#asStatement()} is * returned as-is. Note that this means that a {@link RDF4JTriple} would * preserve its {@link Statement#getContext()}, and that any * {@link BlankNode}s would be deemed equivalent in RDF4J if they have the * same {@link BNode#getID()}. * * @param tripleLike * A {@link Triple} or {@link Quad} to adapt * @return A corresponding {@link Statement} */ public Statement asStatement(final TripleLike tripleLike) { if (tripleLike instanceof RDF4JTripleLike) { // Return original statement - this covers both RDF4JQuad and // RDF4JTriple return ((RDF4JTripleLike) tripleLike).asStatement(); } final org.eclipse.rdf4j.model.Resource subject = (org.eclipse.rdf4j.model.Resource) asValue(tripleLike.getSubject()); final org.eclipse.rdf4j.model.IRI predicate = (org.eclipse.rdf4j.model.IRI) asValue(tripleLike.getPredicate()); final Value object = asValue(tripleLike.getObject()); org.eclipse.rdf4j.model.Resource context = null; if (tripleLike instanceof Quad) { final Quad quad = (Quad) tripleLike; context = (org.eclipse.rdf4j.model.Resource) asValue(quad.getGraphName().orElse(null)); } return getValueFactory().createStatement(subject, predicate, object, context); } /** * Adapt a RDF4J {@link Statement} as a Commons RDF {@link Triple}. *

* For the purpose of {@link BlankNode} equivalence, this method will use an * internal salt UUID that is unique per instance of {@link RDF4J}. *

* NOTE: If combining RDF4J statements from multiple * repositories or models, then their {@link BNode}s may have the same * {@link BNode#getID()}, which with this method would become equivalent * according to {@link BlankNode#equals(Object)} and * {@link BlankNode#uniqueReference()}, unless a separate {@link RDF4J} * instance is used per RDF4J repository/model. * * @param statement * The RDF4J {@link Statement} to adapt. * @return A {@link RDF4JTriple} that is equivalent to the statement */ public RDF4JTriple asTriple(final Statement statement) { return rdf4j.createTripleImpl(statement, salt); } /** * Adapt a Commons RDF {@link RDFTerm} as a RDF4J {@link Value}. *

* The value will be of the same kind as the term, e.g. a * {@link org.apache.commons.rdf.api.BlankNode} is converted to a * {@link org.eclipse.rdf4j.model.BNode}, a * {@link org.apache.commons.rdf.api.IRI} is converted to a * {@link org.eclipse.rdf4j.model.IRI} and a * {@link org.apache.commons.rdf.api.Literal} is converted to a * {@link org.eclipse.rdf4j.model.Literal}. *

* If the provided {@link RDFTerm} is null, then the returned * value is null. *

* If the provided term is an instance of {@link RDF4JTerm}, then the * {@link RDF4JTerm#asValue()} is returned without any conversion. Note that * this could mean that a {@link Value} from a different kind of * {@link ValueFactory} could be returned. * * @param term * RDFTerm to adapt to RDF4J Value * @return Adapted RDF4J {@link Value} */ public Value asValue(final RDFTerm term) { if (term == null) { return null; } if (term instanceof RDF4JTerm) { // One of our own - avoid converting again. // (This is crucial to avoid double-escaping in BlankNode) return ((RDF4JTerm) term).asValue(); } if (term instanceof org.apache.commons.rdf.api.IRI) { final org.apache.commons.rdf.api.IRI iri = (org.apache.commons.rdf.api.IRI) term; return getValueFactory().createIRI(iri.getIRIString()); } if (term instanceof org.apache.commons.rdf.api.Literal) { final org.apache.commons.rdf.api.Literal literal = (org.apache.commons.rdf.api.Literal) term; final String label = literal.getLexicalForm(); if (literal.getLanguageTag().isPresent()) { final String lang = literal.getLanguageTag().get(); return getValueFactory().createLiteral(label, lang); } final org.eclipse.rdf4j.model.IRI dataType = (org.eclipse.rdf4j.model.IRI) asValue(literal.getDatatype()); return getValueFactory().createLiteral(label, dataType); } if (term instanceof BlankNode) { // This is where it gets tricky to support round trips! final BlankNode blankNode = (BlankNode) term; // FIXME: The uniqueReference might not be a valid BlankNode // identifier.. // does it have to be in RDF4J? return getValueFactory().createBNode(blankNode.uniqueReference()); } throw new IllegalArgumentException("RDFTerm was not an IRI, Literal or BlankNode: " + term.getClass()); } @Override public RDF4JBlankNode createBlankNode() { final BNode bnode = getValueFactory().createBNode(); return asRDFTerm(bnode); } @Override public RDF4JBlankNode createBlankNode(final String name) { final BNode bnode = getValueFactory().createBNode(name); return asRDFTerm(bnode); } /** * {@inheritDoc} *

* Note: Some operations on the {@link RDF4JDataset} * requires the use of try-with-resources to close underlying * {@link RepositoryConnection}s, including {@link RDF4JDataset#iterate()}, * {@link RDF4JDataset#stream()} and {@link RDF4JDataset#getGraphNames()}. * */ @Override public RDF4JDataset createDataset() { final Sail sail = new MemoryStore(); final Repository repository = new SailRepository(sail); return rdf4j.createRepositoryDatasetImpl(repository, true, false); } @Override public RDF4JGraph createGraph() { return asGraph(new LinkedHashModel()); } @Override public RDF4JIRI createIRI(final String iri) throws IllegalArgumentException { return asRDFTerm(getValueFactory().createIRI(iri)); } @Override public RDF4JLiteral createLiteral(final String lexicalForm) throws IllegalArgumentException { final org.eclipse.rdf4j.model.Literal lit = getValueFactory().createLiteral(lexicalForm); return asRDFTerm(lit); } @Override public org.apache.commons.rdf.api.Literal createLiteral(final String lexicalForm, final org.apache.commons.rdf.api.IRI dataType) throws IllegalArgumentException { final org.eclipse.rdf4j.model.IRI iri = getValueFactory().createIRI(dataType.getIRIString()); final org.eclipse.rdf4j.model.Literal lit = getValueFactory().createLiteral(lexicalForm, iri); return asRDFTerm(lit); } @Override public org.apache.commons.rdf.api.Literal createLiteral(final String lexicalForm, final String languageTag) throws IllegalArgumentException { final org.eclipse.rdf4j.model.Literal lit = getValueFactory().createLiteral(lexicalForm, languageTag); return asRDFTerm(lit); } @Override public RDF4JTriple createTriple(final BlankNodeOrIRI subject, final org.apache.commons.rdf.api.IRI predicate, final RDFTerm object) throws IllegalArgumentException { final Statement statement = getValueFactory().createStatement( (org.eclipse.rdf4j.model.Resource) asValue(subject), (org.eclipse.rdf4j.model.IRI) asValue(predicate), asValue(object)); return asTriple(statement); } @Override public Quad createQuad(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final org.apache.commons.rdf.api.IRI predicate, final RDFTerm object) throws IllegalArgumentException { final Statement statement = getValueFactory().createStatement( (org.eclipse.rdf4j.model.Resource) asValue(subject), (org.eclipse.rdf4j.model.IRI) asValue(predicate), asValue(object), (org.eclipse.rdf4j.model.Resource) asValue(graphName)); return asQuad(statement); } public ValueFactory getValueFactory() { return valueFactory; } private EnumSet

* This interface is in common with the more specific {@link RDF4JTriple} or * {@link RDF4JQuad}. *

* This is backed by a {@link Statement} retrievable with * {@link #asStatement()}. * * @see RDF4JTriple * @see RDF4JQuad */ public interface RDF4JTripleLike extends TripleLike { /** * Return the corresponding RDF4J {@link Statement}. * * @return The corresponding RDF4J Statement. */ public Statement asStatement(); } ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNodeOrIRI.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNode0000644000175000017500000000252413175733174032541 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Triple; import org.eclipse.rdf4j.model.Resource; /** * Marker interface for RDF4J implementations of Commons RDF * {@link BlankNodeOrIRI} (e.g. the subject of a {@link Triple}). *

* The underlying RDF4J {@link org.eclipse.rdf4j.model.Resource} instance can be * retrieved with {@link #asValue()}. * */ public interface RDF4JBlankNodeOrIRI extends RDF4JTerm, BlankNodeOrIRI { @Override public Resource asValue(); } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNode.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNode0000644000175000017500000000242313175733174032537 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.BlankNode; import org.eclipse.rdf4j.model.BNode; /** * Marker interface for RDF4J implementations of Commons RDF * {@link org.apache.commons.rdf.api.BlankNode}. *

* The underlying RDF4J {@link BNode} instance can be retrieved with * {@link #asValue()}. * * @see RDF4J#createBlankNode() */ public interface RDF4JBlankNode extends RDF4JBlankNodeOrIRI, BlankNode { @Override public BNode asValue(); } apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JIRI.java0000644000175000017500000000235513175733174032251 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; /** * Marker interface for RDF4J implementations of Commons RDF * {@link org.apache.commons.rdf.api.IRI}. *

* The underlying RDF4J {@link org.eclipse.rdf4j.model.IRI} instance can be * retrieved with {@link #asValue()}. * * @see RDF4J#createIRI(String) */ public interface RDF4JIRI extends RDF4JBlankNodeOrIRI, org.apache.commons.rdf.api.IRI { @Override org.eclipse.rdf4j.model.IRI asValue(); } apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/resources/0000755000175000017500000000000013175733174024046 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/resources/META-INF/0000755000175000017500000000000013212356336025177 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/resources/META-INF/NOTICE0000644000175000017500000000025413212356336026104 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/resources/META-INF/services/0000755000175000017500000000000013175733174027031 5ustar andriusandrius././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/resources/META-INF/services/org.apache.commons.rdf.api.RDFapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/resources/META-INF/services/org.apache.commons.r0000644000175000017500000000004313175733174032672 0ustar andriusandriusorg.apache.commons.rdf.rdf4j.RDF4J apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/main/resources/META-INF/LICENSE0000644000175000017500000002613613212356336026214 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/site/0000755000175000017500000000000013175733174022054 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/site/resources/0000755000175000017500000000000013175733174024066 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/site/resources/profile.jacoco0000644000175000017500000000000013175733174026674 0ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/0000755000175000017500000000000014132221255022051 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/0000755000175000017500000000000013175733174023010 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/0000755000175000017500000000000014132221255023561 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/0000755000175000017500000000000014132221255025002 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/0000755000175000017500000000000013175733174026473 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/0000755000175000017500000000000014132221255027230 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/0000755000175000017500000000000014132221255030241 5ustar andriusandrius././@LongLink0000644000000000000000000000016400000000000011604 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/RDF4JMethodOverloadsTest.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/RDF4JMethodOve0000644000175000017500000000373613175733174032637 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.eclipse.rdf4j.model.BNode; import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Literal; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.Value; import org.eclipse.rdf4j.model.ValueFactory; import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.junit.Test; import static org.junit.Assert.assertEquals; public class RDF4JMethodOverloadsTest { @Test public void testAsRDFTermOverloads() { final RDF4J rdf4J = new RDF4J(); final ValueFactory valueFactory = SimpleValueFactory.getInstance(); final Value bNode = valueFactory.createBNode("b1"); final Value iri = valueFactory.createIRI("http://ex.org"); final Value literal = valueFactory.createLiteral("b1"); assertEquals(rdf4J.asRDFTerm(bNode), rdf4J.asRDFTerm((BNode) bNode)); assertEquals(rdf4J.asRDFTerm(iri), rdf4J.asRDFTerm((IRI) iri)); assertEquals(rdf4J.asRDFTerm(literal), rdf4J.asRDFTerm((Literal) literal)); assertEquals(rdf4J.asRDFTerm(bNode), rdf4J.asRDFTerm((Resource) bNode)); assertEquals(rdf4J.asRDFTerm(iri), rdf4J.asRDFTerm((Resource) iri)); } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/BlankNodeTest.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/BlankNodeTest.0000644000175000017500000000240413175733174032755 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.AbstractBlankNodeTest; import org.apache.commons.rdf.api.BlankNode; public class BlankNodeTest extends AbstractBlankNodeTest { RDF4J factory = new RDF4J(); @Override protected BlankNode getBlankNode() { return factory.createBlankNode(); } @Override protected BlankNode getBlankNode(final String identifier) { return factory.createBlankNode(identifier); } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/MemoryStoreRDFTest.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/MemoryStoreRDF0000644000175000017500000000244713175733174033032 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.AbstractRDFTest; import org.apache.commons.rdf.api.RDF; import org.junit.Assume; public class MemoryStoreRDFTest extends AbstractRDFTest { @Override public RDF createFactory() { return new MemoryGraphTest.MemoryStoreRDF(); } @Override public void testInvalidLiteralLang() throws Exception { Assume.assumeTrue("RDF4J doesn't check Lang strings", false); super.testInvalidLiteralLang(); } } apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/RDF4JTest.java0000644000175000017500000000240513175733174032574 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.AbstractRDFTest; import org.apache.commons.rdf.api.RDF; import org.junit.Assume; public class RDF4JTest extends AbstractRDFTest { @Override public RDF createFactory() { return new RDF4J(); } @Override public void testInvalidLiteralLang() throws Exception { Assume.assumeTrue("RDF4J doesn't check Lang strings", false); super.testInvalidLiteralLang(); } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/DatasetTest.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/DatasetTest.ja0000644000175000017500000000206713175733174033025 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.AbstractDatasetTest; import org.apache.commons.rdf.api.RDF; public class DatasetTest extends AbstractDatasetTest { @Override public RDF createFactory() { return new RDF4J(); } } apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/GraphTest.java0000644000175000017500000000206113175733174033022 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.AbstractGraphTest; import org.apache.commons.rdf.api.RDF; public class GraphTest extends AbstractGraphTest { @Override public RDF createFactory() { return new RDF4J(); } } ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGra0000644000175000017500000001435313175733174033105 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import java.io.IOException; import java.io.UncheckedIOException; import java.util.Collections; import java.util.Set; import org.apache.commons.rdf.api.AbstractGraphTest; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.RDF; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryResult; import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.sail.Sail; import org.eclipse.rdf4j.sail.nativerdf.NativeStore; import org.junit.After; import org.junit.Rule; import org.junit.rules.TemporaryFolder; import org.junit.rules.Timeout; /** * Test a graph within a file-based RDF4J {@link SailRepository}. *

* TIP: If the {@link #shutdownAndDelete()} take about 20 seconds this is a hint * that a {@link RepositoryConnection} or {@link RepositoryResult} was not * closed correctly. * */ public class NativeStoreGraphTest extends AbstractGraphTest { public final class NativeStoreRDF implements RDF { RDF4J rdf4jFactory = new RDF4J(getRepository().getValueFactory()); @Override public RDF4JGraph createGraph() { // We re-use the repository connection, but use a different context // every time final Set context = Collections.singleton(rdf4jFactory.createBlankNode()); return rdf4jFactory.asGraph(getRepository(), context); } @Override public Dataset createDataset() { throw new UnsupportedOperationException("Can't create more than one Dataset in this test"); // ...as the below would re-use the same repository: // return rdf4jFactory.asRDFTermDataset(getRepository()); } // Delegate methods @Override public RDF4JBlankNode createBlankNode() { return rdf4jFactory.createBlankNode(); } @Override public RDF4JBlankNode createBlankNode(final String name) { return rdf4jFactory.createBlankNode(name); } @Override public RDF4JIRI createIRI(final String iri) throws IllegalArgumentException, UnsupportedOperationException { return rdf4jFactory.createIRI(iri); } @Override public RDF4JLiteral createLiteral(final String lexicalForm) { return rdf4jFactory.createLiteral(lexicalForm); } @Override public Literal createLiteral(final String lexicalForm, final IRI dataType) { return rdf4jFactory.createLiteral(lexicalForm, dataType); } @Override public Literal createLiteral(final String lexicalForm, final String languageTag) { return rdf4jFactory.createLiteral(lexicalForm, languageTag); } @Override public RDF4JTriple createTriple(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return rdf4jFactory.createTriple(subject, predicate, object); } @Override public Quad createQuad(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) throws IllegalArgumentException { return rdf4jFactory.createQuad(graphName, subject, predicate, object); } } @Rule public TemporaryFolder tempDir = new TemporaryFolder(); private SailRepository repository; public void createRepository() throws IOException { final Sail sail = new NativeStore(tempDir.newFolder()); repository = new SailRepository(sail); repository.initialize(); } public synchronized SailRepository getRepository() { if (repository == null) { try { createRepository(); } catch (final IOException e) { throw new UncheckedIOException(e); } } return repository; } @Rule /** * A timeout of more than 15 seconds pr test indicates typically that * shutdownAndDelete failed. */ public Timeout globalTimeout = Timeout.seconds(15); @After public void shutdownAndDelete() { // must shutdown before we delete if (repository != null) { System.out.print("Shutting down rdf4j repository " + repository + "..."); // NOTE: // If this takes about 20 seconds it means the code forgot to close // a // RepositoryConnection or RespositoryResult // e.g. missing a try-with-resources block repository.shutDown(); System.out.println("OK"); } } // private static void deleteAll(Path dir) throws IOException { // Files.walkFileTree(dir, new SimpleFileVisitor(){ // @Override // public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) // throws IOException { // Files.delete(file); // return FileVisitResult.CONTINUE; // } // @Override // public FileVisitResult postVisitDirectory(Path dir, IOException exc) // throws IOException { // FileVisitResult r = super.postVisitDirectory(dir, exc); // Files.delete(dir); // return r; // } // }); // } @Override public RDF createFactory() { return new NativeStoreRDF(); } } ././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/RDF4JServiceLoaderTest.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/RDF4JServiceLo0000644000175000017500000000247313175733174032635 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import static org.junit.Assert.fail; import java.util.ServiceLoader; import org.apache.commons.rdf.api.RDF; import org.junit.Test; public class RDF4JServiceLoaderTest { @Test public void testServiceLoaderLookup() { final ServiceLoader loader = ServiceLoader.load(RDF.class); for (final RDF impl : loader) { if (impl instanceof RDF4J) { return; // yay } } fail("RDF4J not found in ServiceLoader"); } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/MemoryGraphTest.javaapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/MemoryGraphTes0000644000175000017500000000702613175733174033115 0ustar andriusandrius/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.rdf.rdf4j; import org.apache.commons.rdf.api.AbstractGraphTest; import org.apache.commons.rdf.api.BlankNodeOrIRI; import org.apache.commons.rdf.api.Dataset; import org.apache.commons.rdf.api.IRI; import org.apache.commons.rdf.api.Literal; import org.apache.commons.rdf.api.Quad; import org.apache.commons.rdf.api.RDFTerm; import org.apache.commons.rdf.api.RDF; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.sail.Sail; import org.eclipse.rdf4j.sail.memory.MemoryStore; import org.eclipse.rdf4j.sail.memory.model.MemValueFactory; public class MemoryGraphTest extends AbstractGraphTest { public static final class MemoryStoreRDF implements RDF { RDF4J rdf4jFactory = new RDF4J(new MemValueFactory()); @Override public RDF4JBlankNode createBlankNode() { return rdf4jFactory.createBlankNode(); } @Override public RDF4JBlankNode createBlankNode(final String name) { return rdf4jFactory.createBlankNode(name); } @Override public Dataset createDataset() { return rdf4jFactory.createDataset(); } @Override public RDF4JIRI createIRI(final String iri) throws IllegalArgumentException, UnsupportedOperationException { return rdf4jFactory.createIRI(iri); } @Override public RDF4JLiteral createLiteral(final String lexicalForm) { return rdf4jFactory.createLiteral(lexicalForm); } @Override public Literal createLiteral(final String lexicalForm, final IRI dataType) { return rdf4jFactory.createLiteral(lexicalForm, dataType); } @Override public Literal createLiteral(final String lexicalForm, final String languageTag) { return rdf4jFactory.createLiteral(lexicalForm, languageTag); } @Override public RDF4JTriple createTriple(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return rdf4jFactory.createTriple(subject, predicate, object); } @Override public Quad createQuad(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) { return rdf4jFactory.createQuad(graphName, subject, predicate, object); } @Override public RDF4JGraph createGraph() { final Sail sail = new MemoryStore(); final Repository repository = new SailRepository(sail); repository.initialize(); return rdf4jFactory.asGraph(repository); } } @Override public RDF createFactory() { return new MemoryStoreRDF(); } } apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/resources/0000755000175000017500000000000014132221255024063 5ustar andriusandriusapache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/resources/NOTICE0000644000175000017500000000025413212356336024777 0ustar andriusandriusApache Commons RDF Copyright 2015-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-commons-rdf-0.5.0/commons-rdf-rdf4j/src/test/resources/LICENSE0000644000175000017500000002613613212356336025107 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/commons-rdf-rdf4j/pom.xml0000644000175000017500000001267713212356730021642 0ustar andriusandrius 4.0.0 org.apache.commons commons-rdf-parent 0.5.0 commons-rdf-rdf4j jar Commons RDF impl: RDF4j Eclipse RDF4j implementation of Commons RDF API org.apache.felix maven-bundle-plugin org.apache.commons.rdf.rdf4j org.apache.commons.rdf.rdf4j.impl org.apache.commons.rdf.rdf4j org.apache.commons.rdf.rdf4j osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional osgi.serviceloader; osgi.serviceloader=org.apache.commons.rdf.api.RDF commonsrdf-api-site scm:svn:${commons.scmPubUrl}/rdf4j/ ${project.parent.groupId} commons-rdf-api ${project.version} ${project.parent.groupId} commons-rdf-simple ${project.version} org.eclipse.rdf4j rdf4j-model org.eclipse.rdf4j rdf4j-repository-api org.eclipse.rdf4j rdf4j-rio-turtle org.eclipse.rdf4j rdf4j-rio-ntriples org.eclipse.rdf4j rdf4j-rio-nquads org.eclipse.rdf4j rdf4j-rio-rdfxml org.eclipse.rdf4j rdf4j-rio-trig org.eclipse.rdf4j rdf4j-rio-jsonld org.eclipse.rdf4j rdf4j-sail-memory org.eclipse.rdf4j rdf4j-repository-sail org.eclipse.rdf4j rdf4j-sail-nativerdf test ${project.parent.groupId} commons-rdf-api ${project.version} tests test org.eclipse.rdf4j rdf4j-bom ${rdf4j.version} pom import apache-commons-rdf-0.5.0/commons-rdf-rdf4j/README.md0000644000175000017500000000164213175733174021603 0ustar andriusandrius # Sesame/rdf4j integration This is a prototype showing integration of [RDF4j](http://rdf4j.org/) aka Sesame. apache-commons-rdf-0.5.0/.travis.yml0000644000175000017500000000074213175455642017203 0ustar andriusandrius# Attempt to get a newer oraclejdk8.. # See https://docs.travis-ci.com/user/ci-environment/ sudo: required dist: trusty language: java # If newer Oracle JDK is needed, uncomment: #addons: # apt: # packages: # - oracle-java8-installer # .. and comment out: jdk: - oraclejdk8 cache: directories: - '$HOME/.m2/repository' install: /bin/true notifications: email: - notifications@commons.apache.org after_success: - mvn clean test coveralls:report apache-commons-rdf-0.5.0/LICENSE-header.txt0000644000175000017500000000144313175455642020142 0ustar andriusandrius/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ apache-commons-rdf-0.5.0/MATURITY.md0000644000175000017500000004253213175455642016675 0ustar andriusandrius # Commons RDF Project Maturity Report This is a report of Commons RDF following the [Maturity Model for Apache Projects](https://community.apache.org/apache-way/apache-project-maturity-model.html) (2016-10). **NOTE**: Commons RDF [graduated on 2016-11-28](https://lists.apache.org/thread.html/a2e4081e53bde4d1ce2f98c13d1f3c9a783aaf2c5f1acec9c7b22e1b@%3Cgeneral.incubator.apache.org%3E) from the [Apache Incubator](http://incubator.apache.org/) to become a sub-project (component) of [Apache Commons](https://commons.apache.org/). The links below may not have been updated following graduation. ## Code ### CD10 _The project produces Open Source software, for distribution to the public at no charge._ All outputs of Apache Commons RDF is open source, covered by [Apache License 2.0](https://github.com/apache/incubator-commonsrdf/blob/master/LICENSE) and [distributed](https://commonsrdf.incubator.apache.org/download.html) at no charge. ### CD20 _The project's code is easily discoverable and publicly accessible._ Menu on https://commonsrdf.incubator.apache.org/ links to [Source (git)](https://git-wip-us.apache.org/repos/asf/incubator-commonsrdf.git), [Source (GitHub mirror)](https://github.com/apache/incubator-commonsrdf/), as well as source releases under [Download](https://commonsrdf.incubator.apache.org/download.html) ### CD30 _The code can be built in a reproducible way using widely available standard tools._ See [build instructions](https://github.com/apache/incubator-commonsrdf#building), requires only Apache Maven 3.2 and Java JDK 8. Build independently verified by [Jenkins](https://builds.apache.org/search/?q=incubator-commonsrdf) and [Travis CI](https://travis-ci.org/apache/incubator-commonsrdf). [![Build Status](https://travis-ci.org/apache/incubator-commonsrdf.svg?branch=master)](https://travis-ci.org/apache/incubator-commonsrdf) ### CD40 _The full history of the project's code is available via a source code control system, in a way that allows any released version to be recreated._ Full history in [git.apache.org](https://git-wip-us.apache.org/repos/asf?p=incubator-commonsrdf.git). Each release has a corresponding [tag](https://git-wip-us.apache.org/repos/asf?p=incubator-commonsrdf.git;a=tags) The git commits includes pre-Apache history imported from https://github.com/commons-rdf/commons-rdf through software grant. ### CD50 _The provenance of each line of code is established via the source code control system, in a reliable way based on strong authentication of the committer. When third-party contributions are committed, commit messages provide reliable information about the code provenance._ Only `@apache.org` users have commit access. [Pull requests](https://github.com/apache/incubator-commonsrdf/pulls?q=is%3Apr%20) are acknowledged in [pom.xml](https://github.com/apache/incubator-commonsrdf/blob/0.3.0-incubating/pom.xml#L116). No contributions have been received so far from developers who have not signed an ICLA with ASF. ## Licenses and Copyright ### LC10 _The code is released under the Apache License, version 2.0._ [Apache License 2.0](https://github.com/apache/incubator-commonsrdf/blob/master/LICENSE) only. ### LC20 _Libraries that are mandatory dependencies of the project's code do not create more restrictions than the Apache License does._ Dependencies are [ASF-compatible](https://www.apache.org/legal/resolved) open source licenses like Apache License 2.0, BSD, MIT, Eclipse Distribution License. For details see each module: * [Parent dependencies](https://commonsrdf.incubator.apache.org/dependencies.html) * [API dependencies](https://commonsrdf.incubator.apache.org/commons-rdf-api/dependencies.html) * [Simple dependencies](https://commonsrdf.incubator.apache.org/commons-rdf-simple/dependencies.html) * [RDF4J dependencies](https://commonsrdf.incubator.apache.org/commons-rdf-rdf4j/dependencies.html) * [Jena dependencies](https://commonsrdf.incubator.apache.org/commons-rdf-jena/dependencies.html) * [JSONLD-Java dependencies](https://commonsrdf.incubator.apache.org/commons-rdf-jsonld-java/dependencies.html) * [Integration test dependencies](https://commonsrdf.incubator.apache.org/commons-rdf-integration-tests/dependencies.html) ### LC30 _The libraries mentioned in LC20 are available as Open Source software._ Yes, see [LC20](#LC20). ### LC40 _Committers are bound by an Individual Contributor Agreement (the "Apache iCLA") that defines which code they are allowed to commit and how they need to identify code that is not their own._ All [Commons RDF committers](http://people.apache.org/phonebook.html?podling=commonsrdf) have ASF ICLAs on file and are Apache committers. ### LC50 _The copyright ownership of everything that the project produces is clearly defined and documented._ ASF copyright asserted in [NOTICE](https://github.com/apache/incubator-commonsrdf/blob/master/NOTICE) and in ASF file headers. For details, see RAT report for each module: * [Parent RAT report](https://commonsrdf.incubator.apache.org/rat-report.html) * [API RAT report](https://commonsrdf.incubator.apache.org/commons-rdf-api/rat-report.html) * [Simple RAT report](https://commonsrdf.incubator.apache.org/commons-rdf-simple/rat-report.html) * [RDF4J RAT report](https://commonsrdf.incubator.apache.org/commons-rdf-rdf4j/rat-report.html) * [Jena RAT report](https://commonsrdf.incubator.apache.org/commons-rdf-jena/rat-report.html) * [JSONLD-Java RAT report](https://commonsrdf.incubator.apache.org/commons-rdf-jsonld-java/rat-report.html) * [Integration test RAT report](https://commonsrdf.incubator.apache.org/commons-rdf-integration-tests/rat-report.html) ## Releases ### RE10 _Releases consist of source code, distributed using standard and open archive formats that are expected to stay readable in the long term._ [Releases](https://archive.apache.org/dist/incubator/commonsrdf/) archives are in `.tar.gz` and `.zip` formats. All releases are made to [dist.apache.org](https://www.apache.org/dist/incubator/commonsrdf/) and archived on [archive.apache.org](https://archive.apache.org/dist/incubator/commonsrdf/). ### RE20 _Releases are approved by the project's PMC (see CS10), in order to make them an act of the Foundation._ All ASF releases of Commons RDF are subject to a [vote on dev@](https://lists.apache.org/list.html?dev@commonsrdf.incubator.apache.org:lte=100M:%5BVOTE%5D) following the [ASF voting policy](https://www.apache.org/foundation/voting.html). * [0.3.0-incubating VOTE](https://lists.apache.org/thread.html/d7e8d9b2276fed6b688b64d9096f02631a66eb01aaa9dde35d31bdf1@%3Cdev.commonsrdf.incubator.apache.org%3E) and [RESULT](https://lists.apache.org/thread.html/b3589f5fe64edb0b7cdb5d99750ff586d429df404e044d5664eb2068@%3Cgeneral.incubator.apache.org%3E) * [0.2.0-incubating VOTE](https://lists.apache.org/thread.html/39066964fc8cbc3a634b7a847e23920a49d207ac8336d33b578e91a2@1463093135@%3Cdev.commonsrdf.incubator.apache.org%3E) and [RESULT](https://lists.apache.org/thread.html/c34a91b8d326badbd56ede16a7d4bbb9f5f69d5687991a63270b6981@1463641004@%3Cdev.commonsrdf.incubator.apache.org%3E) * [0.1.0-incubating VOTE](https://lists.apache.org/thread.html/d7e8d9b2276fed6b688b64d9096f02631a66eb01aaa9dde35d31bdf1@%3Cdev.commonsrdf.incubator.apache.org%3E) and [RESULT](https://lists.apache.org/thread.html/0a5238f066d913cfb1b9e05f00ccfad27ade4939e20c67d8fd11ead0@1431673779@%3Cdev.commonsrdf.incubator.apache.org%3E) ### RE30 _Releases are signed and/or distributed along with digests that can be reliably used to validate the downloaded archives._ All releases have corresponding [PGP asc files](https://www.apache.org/dist/incubator/commonsrdf/0.3.0-incubating/apache-commons-rdf-0.3.0-incubating-src.zip.asc) with a corresponding key listed in [KEYS](https://www.apache.org/dist/incubator/commonsrdf/KEYS). Releases also have [.md5](https://www.apache.org/dist/incubator/commonsrdf/0.3.0-incubating/apache-commons-rdf-0.3.0-incubating-src.zip.md5) and [.sha1](https://www.apache.org/dist/incubator/commonsrdf/0.3.0-incubating/apache-commons-rdf-0.3.0-incubating-src.zip.sha1) hashes, which corresponds to the hashes in the vote emails and in Maven Central. ### RE40 _Convenience binaries can be distributed alongside source code but they are not Apache Releases -- they are just a convenience provided with no guarantee._ Convenience binaries are deployed to [Maven Central](https://repo1.maven.org/maven2/org/apache/commons/) under the `org.apache.commons` group ID, which include the [source release](https://repo1.maven.org/maven2/org/apache/commons/commons-rdf-parent/0.3.0-incubating/) corresponding to the the dist files. (see [RE30](#RE30) ) ### RE50 _The release process is documented and repeatable to the extent that someone new to the project is able to independently generate the complete set of artifacts required for a release._ Documented as [RELEASE-PROCESS.md](https://github.com/apache/incubator-commonsrdf/blob/master/RELEASE-PROCESS.md) however this must be updated to align with [Apache Commons release process](https://commons.apache.org/releases/index.html) with regards to site publication. ## Quality ### QU10 _The project is open and honest about the quality of its code. Various levels of quality and maturity for various modules are natural and acceptable as long as they are clearly communicated._ Commons RDF [use semantic versioning](https://commonsrdf.incubator.apache.org/#Modules). [Experimental features](https://commonsrdf.incubator.apache.org/apidocs/org/apache/commons/rdf/experimental/RDFParser.html) are clearly documented as such. ### QU20 _The project puts a very high priority on producing secure software._ Following Apache Commons procedures, Commons RDF uses reports like [Findbugs](https://commonsrdf.incubator.apache.org/commons-rdf-simple/findbugs.html), [PMD](https://commonsrdf.incubator.apache.org/commons-rdf-simple/pmd.html), [JDepend](https://commonsrdf.incubator.apache.org/commons-rdf-simple/jdepend-report.html) and [JaCoCo](https://commonsrdf.incubator.apache.org/commons-rdf-simple/jacoco/index.html). ### QU30 _The project provides a well-documented channel to report security issues, along with a documented way of responding to them._ Menu links to [Commons Security](https://commons.apache.org/security.html) - security reports are reported to `private@commons` [Commons PMC](https://people.apache.org/phonebook.html?ctte=commons) which include several of the Commons RDF committers. ### QU40 _The project puts a high priority on backwards compatibility and aims to document any incompatible changes and provide tools and documentation to help users transition to new features._ Even during `0.x` development the project has strived for backwards compatibility between releases, see for instance this [japicmp report](https://commonsrdf.incubator.apache.org/commons-rdf-api/japicmp.html) and the use of [@Deprecated](https://commonsrdf.incubator.apache.org/apidocs/org/apache/commons/rdf/api/RDFTermFactory.html). (Note that the first 1.0 release is likely to remove those deprecated methods/classes from the 0.x series) ### QU50 _The project strives to respond to documented bug reports in a timely manner._ [Jira](https://issues.apache.org/jira/browse/COMMONSRDF) is used both for feature suggestions and bug reports. ## Community ### CO10 _The project has a well-known homepage that points to all the information required to operate according to this maturity model._ Home page is https://commonsrdf.incubator.apache.org/ The pre-ASF website http://commons-rdf.github.io/ redirects to the above. NOTE: As the project is proposing to graduate to [Apache Commons](https://commons.apache.org/) PMC, the URL will change (with HTTP redirection) to https://commons.apache.org/proper/commons-rdf/ ### CO20 _The community welcomes contributions from anyone who acts in good faith and in a respectful manner and adds value to the project._ Commons RDF [welcome contributions](https://commonsrdf.incubator.apache.org/contributing.html) through mailing list and [pull requests](https://github.com/apache/incubator-commonsrdf/pulls). ### CO30 _Contributions include not only source code, but also documentation, constructive bug reports, constructive discussions, marketing and generally anything that adds value to the project._ Commons RDF recognize all contributions, in particular new features from committers are [raised as pull requests](https://github.com/apache/incubator-commonsrdf/pulls?q=is%3Apr+is%3Aclosed) and discussed on `dev@commonsrdf`. NOTE: As the project is proposing to graduate to Apache Commons, the mailing list will change to `dev@commons` using the subject tag `[RDF]`. Commons RDF also recognize non-code contributions, for instance [this review](https://github.com/apache/incubator-commonsrdf/pull/23) meant Adam Soraka was [listed as a reviewer](https://commonsrdf.incubator.apache.org/team-list.html) ### CO40 _The community is meritocratic and over time aims to give more rights and responsibilities to contributors who add value to the project._ Commons RDF recognizes contributors, but has not elected any new committers during incubation. Most of the people involved with Apache Commons are already ASF committers; note that [any ASF committer have write-access to Apache Commons code](https://commons.apache.org/index.html) which Commons RDF will honour after graduation. ### CO50 _The way in which contributors can be granted more rights such as commit access or decision power is clearly documented and is the same for all contributors._ `TODO`: This documentation should be covered by Apache Commons PMC, but don't currently have a good page for it beyond [Volunteering](https://commons.apache.org/volunteering.html) and [Contributing patches](https://commons.apache.org/patches.html). ### CO60 _The community operates based on consensus of its members (see CS10) who have decision power. Dictators, benevolent or not, are not welcome in Apache projects._ As this project was to form an API across existing RDF frameworks, the quest for consensus has actually been a bit too strong in this project, which caused several committers to retire from the project. It has been agreed to aim for Apache Commons PMC as home, which already operates on strong consensus model. ### CO70 _The project strives to answer user questions in a timely manner._ User engagement is currently done via [dev@commonsrdf](https://lists.apache.org/list.html?dev@commonsrdf.incubator.apache.org) but will transition to [user@commons](https://lists.apache.org/list.html?user@commons.apache.org). ## Consensus Building ### CS10 _The project maintains a public list of its contributors who have decision power -- the project's PMC (Project Management Committee) consists of those contributors._ All contributors listed on [Team page](https://commonsrdf.incubator.apache.org/team-list.html) with their role indicated (e.g. PPMC Member). ## CS20 _Decisions are made by consensus among PMC members and are documented on the project's main communications channel. Community opinions are taken into account but the PMC has the final word if needed._ All decisions are made on [dev@commonsrdf](https://lists.apache.org/list.html?dev@commonsrdf.incubator.apache.org) without much consideration about who is in PMC or not. Note that some discussions happen in GitHub pull requests or Jira issues, which are mirrored to the mailing list. ## CS30 _Documented voting rules are used to build consensus when discussion is not sufficient._ This only happened [once](https://lists.apache.org/thread.html/faba667bf0073c65ca75333733cabb5fc6a7bc0e6c9342b0edec6fad@1427234823@%3Cdev.commonsrdf.incubator.apache.org%3E) which [caused disagreements](https://lists.apache.org/thread.html/9210348a357827f31389f2f8f841cfcf8a7751791c6e677629bea566@1427276263@%3Cdev.commonsrdf.incubator.apache.org%3E). ## CS40 _In Apache projects, vetoes are only valid for code commits and are justified by a technical explanation, as per the Apache voting rules defined in CS30._ No vetoes so far, except soft vetoes during pull request reviews. ## CS50 _All "important" discussions happen asynchronously in written form on the project's main communications channel. Offline, face-to-face or private discussions 11 that affect the project are also documented on that channel._ All discussions are on list, see [CS20](#CS20). ## Independence ## IN10 _The project is independent from any corporate or organizational influence._ No particular influence has been noted from the corporations who employ the committers, however the project communities Commons RDF is integrating with have obviously had an influence on its development. ## IN20 _Contributors act as themselves as opposed to representatives of a corporation or organization._ Commons RDF contributors have very much acted as themselves. apache-commons-rdf-0.5.0/LICENSE0000644000175000017500000002613613175455642016104 0ustar andriusandrius Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-commons-rdf-0.5.0/RELEASE-PROCESS.md0000644000175000017500000000332713176455470017612 0ustar andriusandrius # Commons RDF release process 1. Update documentation (`RELEASE-NOTES.md`, `README.md`, version numbers in `src/site/`) 2. Clean build: `mvn clean install` 3. RAT checking: `mvn apache-rat:check` 4. Prepare the release: `mvn release:prepare -DreleaseVersion=0.4.0 -DdevelopmentVersion=0.5.0-SNAPSHOT -DautoVersionSubmodules=true` 5. Perform the release: `mvn release:perform -Prelease` 6. Close the staging repository at https://repository.apache.org/#stagingRepositories 7. Push the code: `git push` and tag `git push --tags` 8. Cast the `[VOTE]` mail to dev@commons Notice that the `maven-release-plugin` is configured to use the local git repository as well as not push changes to `origin`. Therefore the process can be reverted (e.g., `git reset HEAD~1`) at any time before the sixth step. Acknowledgements to the [Marmotta's release process](https://wiki.apache.org/marmotta/ReleaseProcess) that heavily inspired this one.