ASF license headers
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/4f243b35
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/4f243b35
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/4f243b35
Branch: refs/heads/master
Commit: 4f243b351d1fd0b3468d2e1b646463e1d6be5ba0
Parents: c0a9b80
Author: Stian Soiland-Reyes
Authored: Wed Oct 26 16:46:29 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Wed Oct 26 16:46:29 2016 +0100
--
.../commons/rdf/jsonldjava/JsonLdTripleLike.java | 17 +
.../rdf/jsonldjava/JsonLdBlankNodeTest.java| 17 +
.../apache/commons/rdf/rdf4j/ClosableIterable.java | 17 +
3 files changed, 51 insertions(+)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4f243b35/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
--
diff --git
a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
index ff06038..8004a02 100644
---
a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
+++
b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
@@ -1,3 +1,20 @@
+/**
+ * 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;
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4f243b35/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.java
--
diff --git
a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.java
b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.java
index 0bf8fb6..1af375a 100644
---
a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.java
+++
b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdBlankNodeTest.java
@@ -1,3 +1,20 @@
+/**
+ * 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;
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4f243b35/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.java
--
diff --git
a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.java
b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.java
index ab4290b..e8c6ad5 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/ClosableIterable.java
@@ -1,3 +1,20 @@
+/**
+ * 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
+ *
COMMONSRDF-46 Javadoc fixed references
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/400d1e72
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/400d1e72
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/400d1e72
Branch: refs/heads/COMMONSRDF-46
Commit: 400d1e72c27024ca7ec9eb17cf04ff346e5e2ee9
Parents: 46e159d
Author: Stian Soiland-Reyes
Authored: Wed Oct 26 13:40:44 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Wed Oct 26 13:40:44 2016 +0100
--
.../org/apache/commons/rdf/jena/JenaRDF.java| 2 +-
.../rdf/rdf4j/impl/InternalRDF4JFactory.java| 3 +-
.../apache/commons/rdf/rdf4j/package-info.java | 36
3 files changed, 24 insertions(+), 17 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/400d1e72/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java
--
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java
b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java
index 22db284..a550b06 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDF.java
@@ -67,7 +67,7 @@ import org.apache.jena.sparql.graph.GraphFactory;
* {@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 JenaFactory#JenaFactory(UUID)}
-
+ * {@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.
*
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/400d1e72/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalRDF4JFactory.java
--
diff --git
a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalRDF4JFactory.java
b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalRDF4JFactory.java
index ca97472..b6d6b29 100644
---
a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalRDF4JFactory.java
+++
b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalRDF4JFactory.java
@@ -28,6 +28,7 @@ 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;
@@ -45,7 +46,7 @@ import org.eclipse.rdf4j.repository.Repository;
* {@link RDF4J} methods like
* {@link RDF4J#createBlankNode()},
* {@link RDF4J#asRDFTerm(org.eclipse.rdf4j.model.Value)} and
- * {@link RDF4J#asGraph(Repository,
org.apache.commons.rdf.rdf4j.RDF4JFactory.Option...)}
+ * {@link RDF4J#asGraph(Repository, Option...)}
*
* This class exists as a public bridge between the packages
* {@link org.apache.commons.rdf.rdf4j} and
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/400d1e72/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/package-info.java
--
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/package-info.java
b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/package-info.java
index dbccdb3..f4bfb7a 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/package-info.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/package-info.java
@@ -18,36 +18,42 @@
/**
* Commons RDF integration with http://rdf4j.org/;>RDF4J.
*
- * Use the {@link org.apache.commons.rdf.rdf4j.RDF4J} to convert
+ * Use the {@link RDF4J} to convert
* between Commons RDF and RDF4J types, for instance
- * {@link
org.apache.commons.rdf.rdf4j.RDF4J#asQuad(org.eclipse.rdf4j.model.Statement)}
+ * {@link 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}
+ * {@link RDF4JTerm} interface, and converted
+ * statements the {@link RDF4JTripleLike}
* interface, which provide convenience access to the underlying RDF4J
* implementations.
*
* RDF4J {@link
Jena*Impl prefixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/6c17d5ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/6c17d5ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/6c17d5ed
Branch: refs/heads/COMMONSRDF-46
Commit: 6c17d5ed10400c840f749ac1f2d252a4010f8cad
Parents: ef6a1af
Author: Stian Soiland-Reyes
Authored: Wed Sep 28 01:18:19 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Wed Sep 28 01:18:19 2016 +0100
--
.../commons/rdf/jena/JenaRDFTermFactory.java| 2 +-
.../rdf/jena/impl/AbstractJenaRDFTerm.java | 47 +
.../commons/rdf/jena/impl/AbstractRDFTerm.java | 47 -
.../apache/commons/rdf/jena/impl/AnyImpl.java | 54 --
.../commons/rdf/jena/impl/BlankNodeImpl.java| 61 --
.../commons/rdf/jena/impl/DatasetImpl.java | 187 ---
.../rdf/jena/impl/GeneralizedQuadImpl.java | 136 --
.../apache/commons/rdf/jena/impl/GraphImpl.java | 154 ---
.../apache/commons/rdf/jena/impl/IRIImpl.java | 61 --
.../commons/rdf/jena/impl/JenaAnyImpl.java | 54 ++
.../rdf/jena/impl/JenaBlankNodeImpl.java| 61 ++
.../commons/rdf/jena/impl/JenaDatasetImpl.java | 187 +++
.../commons/rdf/jena/impl/JenaFactory.java | 52 +++---
.../rdf/jena/impl/JenaGeneralizedQuad.java | 136 ++
.../commons/rdf/jena/impl/JenaGraphImpl.java| 154 +++
.../commons/rdf/jena/impl/JenaIRIImpl.java | 61 ++
.../commons/rdf/jena/impl/JenaLiteralImpl.java | 73
.../commons/rdf/jena/impl/JenaQuadImpl.java | 66 +++
.../commons/rdf/jena/impl/JenaTripleImpl.java | 67 +++
.../commons/rdf/jena/impl/JenaVariableImpl.java | 64 +++
.../commons/rdf/jena/impl/LiteralImpl.java | 73
.../apache/commons/rdf/jena/impl/QuadImpl.java | 66 ---
.../commons/rdf/jena/impl/TripleImpl.java | 67 ---
.../commons/rdf/jena/impl/VariableImpl.java | 64 ---
24 files changed, 997 insertions(+), 997 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6c17d5ed/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
--
diff --git
a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
index ec84c0a..7359acb 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
@@ -681,7 +681,7 @@ public final class JenaRDFTermFactory implements
RDFTermFactory {
return null;
}
if (term instanceof JenaRDFTerm)
- // TODO: What if it's a BlankNodeImpl with
+ // TODO: What if it's a JenaBlankNodeImpl with
// a different salt? Do we need to rewrite the
// jena blanknode identifier?
return ((JenaRDFTerm) term).asJenaNode();
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6c17d5ed/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractJenaRDFTerm.java
--
diff --git
a/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractJenaRDFTerm.java
b/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractJenaRDFTerm.java
new file mode 100644
index 000..9c0d7ec
--- /dev/null
+++
b/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractJenaRDFTerm.java
@@ -0,0 +1,47 @@
+/**
+ * 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.RDFTerm;
+import org.apache.commons.rdf.jena.JenaRDFTerm;
+import
RDFParserBuilder -> RDFParser
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/313fbf75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/313fbf75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/313fbf75
Branch: refs/heads/COMMONSRDF-46
Commit: 313fbf75d349cf194baf83cb2da399bd8ad34bb6
Parents: ed73c6f
Author: Stian Soiland-Reyes
Authored: Tue Sep 27 17:13:16 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Tue Sep 27 17:16:34 2016 +0100
--
.../org/apache/commons/rdf/api/RDFParser.java | 479
.../commons/rdf/api/RDFParserBuilder.java | 479
.../apache/commons/rdf/jena/JenaRDFParser.java | 103
.../commons/rdf/jena/JenaRDFParserBuilder.java | 103
.../commons/rdf/jena/TestRDFParserBuilder.java | 4 +-
.../rdf/jsonldjava/JsonLdParserBuilder.java | 4 +-
.../apache/commons/rdf/rdf4j/RDF4JParser.java | 194 +++
.../commons/rdf/rdf4j/RDF4JParserBuilder.java | 194 ---
.../apache/commons/rdf/rdf4j/package-info.java | 6 +-
.../commons/rdf/simple/AbstractRDFParser.java | 541 +++
.../rdf/simple/AbstractRDFParserBuilder.java| 541 ---
.../commons/rdf/simple/RDFParseException.java | 14 +-
.../simple/AbstractRDFParserBuilderTest.java| 26 +-
.../rdf/simple/DummyRDFParserBuilder.java | 10 +-
14 files changed, 1349 insertions(+), 1349 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/313fbf75/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
--
diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
b/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
new file mode 100644
index 000..72c7e61
--- /dev/null
+++ b/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
@@ -0,0 +1,479 @@
+/**
+ * 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.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;
+
+/**
+ * Parse an RDF source into a target (e.g. a Graph/Dataset).
+ *
+ * This interface follows the
+ * https://en.wikipedia.org/wiki/Builder_pattern;>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
RDFParser is experimental feature for now
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/ef6a1af4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/ef6a1af4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/ef6a1af4
Branch: refs/heads/COMMONSRDF-46
Commit: ef6a1af4819cddacd317952a950bda4ae46c6f18
Parents: 74196bd
Author: Stian Soiland-Reyes
Authored: Tue Sep 27 18:54:06 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Tue Sep 27 18:54:06 2016 +0100
--
.../java/org/apache/commons/rdf/experimental/RDFParser.java| 6 ++
1 file changed, 6 insertions(+)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ef6a1af4/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java
--
diff --git
a/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java
b/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java
index 39b7253..dd6bcf0 100644
--- a/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java
+++ b/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java
@@ -37,6 +37,12 @@ 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
* https://en.wikipedia.org/wiki/Builder_pattern;>Builder pattern,
RDFParser moved to org.apache.commons.rdf.experimental
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/a189f91e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/a189f91e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/a189f91e
Branch: refs/heads/COMMONSRDF-46
Commit: a189f91efba570f0039c6187e612f7d42aeb2f8d
Parents: 313fbf7
Author: Stian Soiland-Reyes
Authored: Tue Sep 27 17:29:28 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Tue Sep 27 18:42:28 2016 +0100
--
.../org/apache/commons/rdf/api/RDFParser.java | 479
.../commons/rdf/experimental/RDFParser.java | 489 +
.../commons/rdf/experimental/package-info.java | 34 ++
.../apache/commons/rdf/jena/JenaRDFParser.java | 103
.../rdf/jena/experimental/JenaRDFParser.java| 105
.../rdf/jena/experimental/package-info.java | 34 ++
.../commons/rdf/jena/TestRDFParserBuilder.java | 3 +-
.../rdf/jsonldjava/JsonLdParserBuilder.java | 157 --
.../jsonldjava/experimental/JsonLdParser.java | 160 ++
.../jsonldjava/experimental/package-info.java | 34 ++
.../rdf/jsonldjava/JsonLdParserBuilderTest.java | 7 +-
.../apache/commons/rdf/rdf4j/RDF4JParser.java | 194 ---
.../rdf/rdf4j/experimental/RDF4JParser.java | 197 +++
.../rdf/rdf4j/experimental/package-info.java| 34 ++
.../apache/commons/rdf/rdf4j/package-info.java | 6 +-
.../commons/rdf/simple/AbstractRDFParser.java | 541 --
.../commons/rdf/simple/RDFParseException.java | 2 +-
.../simple/experimental/AbstractRDFParser.java | 543 +++
.../rdf/simple/experimental/package-info.java | 34 ++
.../simple/AbstractRDFParserBuilderTest.java| 3 +-
.../rdf/simple/DummyRDFParserBuilder.java | 3 +-
21 files changed, 1678 insertions(+), 1484 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/a189f91e/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
--
diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
b/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
deleted file mode 100644
index 72c7e61..000
--- a/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
+++ /dev/null
@@ -1,479 +0,0 @@
-/**
- * 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.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;
-
-/**
- * Parse an RDF source into a target (e.g. a Graph/Dataset).
- *
- * This interface follows the
- * https://en.wikipedia.org/wiki/Builder_pattern;>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 )
- *
jena no longer need log4j.properties
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/b54b5c68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/b54b5c68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/b54b5c68
Branch: refs/heads/COMMONSRDF-46
Commit: b54b5c6862b570a181390f32537310642fb88690
Parents: c34a85e
Author: Stian Soiland-Reyes
Authored: Wed Oct 26 11:45:13 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Wed Oct 26 11:45:13 2016 +0100
--
jena/src/test/resources/log4j.properties | 33 ---
1 file changed, 33 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b54b5c68/jena/src/test/resources/log4j.properties
--
diff --git a/jena/src/test/resources/log4j.properties
b/jena/src/test/resources/log4j.properties
deleted file mode 100644
index 794559f..000
--- a/jena/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,33 +0,0 @@
-## 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.
-log4j.rootLogger=INFO, stdlog
-
-log4j.appender.stdlog=org.apache.log4j.ConsoleAppender
-## log4j.appender.stdlog.target=System.err
-log4j.appender.stdlog.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-25c{1} ::
%m%n
-
-# Execution logging
-log4j.logger.org.apache.jena.arq.info=INFO
-log4j.logger.org.apache.jena.arq.exec=INFO
-
-# Everything else in Jena
-log4j.logger.org.apache.jena=WARN
-log4j.logger.org.apache.jena.riot=INFO
-
-# Apache Commons HTTP
-# May be useful to turn up to DEBUG if debugging HTTP communication issues
-log4j.logger.org.apache.http=WARN
Add integration test
Merge branch 'jena-jsonld-rdf4j-integration'
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/887c9e68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/887c9e68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/887c9e68
Branch: refs/heads/COMMONSRDF-46
Commit: 887c9e68a37106f17b5c609a149af718c3e679c4
Parents: 5f6bcff c991d05
Author: Stian Soiland-Reyes
Authored: Wed Oct 26 11:15:06 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Wed Oct 26 11:17:16 2016 +0100
--
integration-tests/pom.xml | 75
.../rdf/integrationtests/AllToAllTest.java | 178 +++
pom.xml | 1 +
3 files changed, 254 insertions(+)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/887c9e68/integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
--
diff --cc
integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
index 000,09c887c..24d3697
mode 00,100644..100644
---
a/integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
+++
b/integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
@@@ -1,0 -1,161 +1,178 @@@
++/**
++ * 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.RDFTerm;
+ import org.apache.commons.rdf.api.RDFTermFactory;
+ import org.apache.commons.rdf.api.Triple;
+ import org.apache.commons.rdf.jena.JenaRDFTermFactory;
+ import org.apache.commons.rdf.jsonldjava.JsonLdRDFTermFactory;
+ import org.apache.commons.rdf.rdf4j.RDF4JTermFactory;
+ import org.apache.commons.rdf.simple.SimpleRDFTermFactory;
+ 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 RDFTermFactory nodeFactory;
+ private RDFTermFactory graphFactory;
+
+
+ public AllToAllTest(
- Class from,
++ Class from,
+ Class to) throws
InstantiationException, IllegalAccessException {
+ this.nodeFactory = from.newInstance();
- this.graphFactory = to.newInstance();
++ this.graphFactory = to.newInstance();
+ }
-
++
+ @SuppressWarnings("rawtypes")
+ @Parameters(name = "{index}: {0}->{1}")
- public static Collection
fromJena/toJena -> as* / asJena*
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/5c190d21
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/5c190d21
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/5c190d21
Branch: refs/heads/COMMONSRDF-46
Commit: 5c190d2104db3b64bd87b7520f9d45859e5805d9
Parents: 6fdc990
Author: Stian Soiland-Reyes
Authored: Wed Oct 26 12:30:51 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Wed Oct 26 12:30:51 2016 +0100
--
.../apache/commons/rdf/jena/JenaFactory.java| 150 ++-
.../rdf/jena/experimental/JenaRDFParser.java| 4 +-
.../commons/rdf/jena/impl/AbstractQuadLike.java | 28 ++--
.../rdf/jena/impl/InternalJenaFactory.java | 72 -
.../commons/rdf/jena/impl/JenaDatasetImpl.java | 28 ++--
.../commons/rdf/jena/impl/JenaGraphImpl.java| 30 ++--
.../jena/TestJenaGraphToCommonsRDFGraph.java| 2 +-
7 files changed, 164 insertions(+), 150 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c190d21/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
--
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
b/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
index 0d735c7..f2c65df 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
@@ -50,11 +50,25 @@ import org.apache.jena.sparql.graph.GraphFactory;
/**
* RDFTermFactory with Jena-backed objects.
*
- * This factory can also convert existing objects from/to Jena with methods
like
- * {@link #fromJena(org.apache.jena.graph.Graph)} and {@link #toJena(Graph)}.
+ * This factory 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)}.
*
- * For the purpose of {@link BlankNode} identity, this factory will use an
internal
- * {@link UUID} as a salt. See {@link BlankNode#uniqueReference()} for details.
+ * 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 this factory 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 JenaFactory#JenaFactory(UUID)}
-
+ * note that such consistency is only guaranteed within the same minor version
+ * of Commons RDF.
*
* @see RDFTermFactory
*/
@@ -68,7 +82,7 @@ public final class JenaFactory implements RDFTermFactory {
* Create a JenaFactory.
*
* This constructor will use a randomly generated {@link UUID} as a
salt
-* for the purposes of {@link BlankNode} identity, see {@link
#getSalt()}.
+* for the purposes of {@link BlankNode} identity, see {@link #salt()}.
*/
public JenaFactory() {
this.salt = UUID.randomUUID();
@@ -91,22 +105,22 @@ public final class JenaFactory implements RDFTermFactory {
@Override
public JenaBlankNode createBlankNode() {
- return internalJenaFactory.createBlankNode(getSalt());
+ return internalJenaFactory.createBlankNode(salt());
}
@Override
public JenaBlankNode createBlankNode(String name) {
- return internalJenaFactory.createBlankNode(name, getSalt());
+ return internalJenaFactory.createBlankNode(name, salt());
}
@Override
public JenaDataset createDataset() {
- return internalJenaFactory.createDataset(getSalt());
+ return internalJenaFactory.createDataset(salt());
}
@Override
public JenaGraph createGraph() {
- return internalJenaFactory.createGraph(getSalt());
+ return internalJenaFactory.createGraph(salt());
}
@Override
@@ -203,7 +217,7 @@ public final class JenaFactory implements RDFTermFactory {
* {@link Node#getBlankNodeId()}
RDFParser is experimental feature for now
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/ef6a1af4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/ef6a1af4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/ef6a1af4
Branch: refs/heads/master
Commit: ef6a1af4819cddacd317952a950bda4ae46c6f18
Parents: 74196bd
Author: Stian Soiland-Reyes
Authored: Tue Sep 27 18:54:06 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Tue Sep 27 18:54:06 2016 +0100
--
.../java/org/apache/commons/rdf/experimental/RDFParser.java| 6 ++
1 file changed, 6 insertions(+)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ef6a1af4/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java
--
diff --git
a/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java
b/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java
index 39b7253..dd6bcf0 100644
--- a/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java
+++ b/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java
@@ -37,6 +37,12 @@ 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
* https://en.wikipedia.org/wiki/Builder_pattern;>Builder pattern,
RDFParserBuilder -> RDFParser
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/313fbf75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/313fbf75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/313fbf75
Branch: refs/heads/master
Commit: 313fbf75d349cf194baf83cb2da399bd8ad34bb6
Parents: ed73c6f
Author: Stian Soiland-Reyes
Authored: Tue Sep 27 17:13:16 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Tue Sep 27 17:16:34 2016 +0100
--
.../org/apache/commons/rdf/api/RDFParser.java | 479
.../commons/rdf/api/RDFParserBuilder.java | 479
.../apache/commons/rdf/jena/JenaRDFParser.java | 103
.../commons/rdf/jena/JenaRDFParserBuilder.java | 103
.../commons/rdf/jena/TestRDFParserBuilder.java | 4 +-
.../rdf/jsonldjava/JsonLdParserBuilder.java | 4 +-
.../apache/commons/rdf/rdf4j/RDF4JParser.java | 194 +++
.../commons/rdf/rdf4j/RDF4JParserBuilder.java | 194 ---
.../apache/commons/rdf/rdf4j/package-info.java | 6 +-
.../commons/rdf/simple/AbstractRDFParser.java | 541 +++
.../rdf/simple/AbstractRDFParserBuilder.java| 541 ---
.../commons/rdf/simple/RDFParseException.java | 14 +-
.../simple/AbstractRDFParserBuilderTest.java| 26 +-
.../rdf/simple/DummyRDFParserBuilder.java | 10 +-
14 files changed, 1349 insertions(+), 1349 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/313fbf75/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
--
diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
b/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
new file mode 100644
index 000..72c7e61
--- /dev/null
+++ b/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
@@ -0,0 +1,479 @@
+/**
+ * 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.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;
+
+/**
+ * Parse an RDF source into a target (e.g. a Graph/Dataset).
+ *
+ * This interface follows the
+ * https://en.wikipedia.org/wiki/Builder_pattern;>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
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/313fbf75/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParser.java
--
diff --git
a/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParser.java
b/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParser.java
new file mode 100644
index 000..e58fced
--- /dev/null
+++ b/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParser.java
@@ -0,0 +1,541 @@
+/**
+ * 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.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.RDFParser;
+import org.apache.commons.rdf.api.RDFSyntax;
+import org.apache.commons.rdf.api.RDFTermFactory;
+
+/**
+ * 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 RDFTermFactory internalRdfTermFactory = new
SimpleRDFTermFactory();
+
+ /**
+* Get the set {@link RDFTermFactory}, if any.
+*/
+ 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}.
+*/
+ 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()}.
+*/
+ public final Optional getContentType() {
+ return contentType;
+ }
+
+ /**
+* Get the target to consume parsed Quads.
+*
+* From the call to {@link #parseSynchronusly()}, this
+* method is always {@link Optional#isPresent()}.
+*
+*/
+ 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
RDFParser moved to org.apache.commons.rdf.experimental
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/a189f91e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/a189f91e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/a189f91e
Branch: refs/heads/master
Commit: a189f91efba570f0039c6187e612f7d42aeb2f8d
Parents: 313fbf7
Author: Stian Soiland-Reyes
Authored: Tue Sep 27 17:29:28 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Tue Sep 27 18:42:28 2016 +0100
--
.../org/apache/commons/rdf/api/RDFParser.java | 479
.../commons/rdf/experimental/RDFParser.java | 489 +
.../commons/rdf/experimental/package-info.java | 34 ++
.../apache/commons/rdf/jena/JenaRDFParser.java | 103
.../rdf/jena/experimental/JenaRDFParser.java| 105
.../rdf/jena/experimental/package-info.java | 34 ++
.../commons/rdf/jena/TestRDFParserBuilder.java | 3 +-
.../rdf/jsonldjava/JsonLdParserBuilder.java | 157 --
.../jsonldjava/experimental/JsonLdParser.java | 160 ++
.../jsonldjava/experimental/package-info.java | 34 ++
.../rdf/jsonldjava/JsonLdParserBuilderTest.java | 7 +-
.../apache/commons/rdf/rdf4j/RDF4JParser.java | 194 ---
.../rdf/rdf4j/experimental/RDF4JParser.java | 197 +++
.../rdf/rdf4j/experimental/package-info.java| 34 ++
.../apache/commons/rdf/rdf4j/package-info.java | 6 +-
.../commons/rdf/simple/AbstractRDFParser.java | 541 --
.../commons/rdf/simple/RDFParseException.java | 2 +-
.../simple/experimental/AbstractRDFParser.java | 543 +++
.../rdf/simple/experimental/package-info.java | 34 ++
.../simple/AbstractRDFParserBuilderTest.java| 3 +-
.../rdf/simple/DummyRDFParserBuilder.java | 3 +-
21 files changed, 1678 insertions(+), 1484 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/a189f91e/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
--
diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
b/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
deleted file mode 100644
index 72c7e61..000
--- a/api/src/main/java/org/apache/commons/rdf/api/RDFParser.java
+++ /dev/null
@@ -1,479 +0,0 @@
-/**
- * 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.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;
-
-/**
- * Parse an RDF source into a target (e.g. a Graph/Dataset).
- *
- * This interface follows the
- * https://en.wikipedia.org/wiki/Builder_pattern;>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
Jena*Impl prefixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/6c17d5ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/6c17d5ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/6c17d5ed
Branch: refs/heads/master
Commit: 6c17d5ed10400c840f749ac1f2d252a4010f8cad
Parents: ef6a1af
Author: Stian Soiland-Reyes
Authored: Wed Sep 28 01:18:19 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Wed Sep 28 01:18:19 2016 +0100
--
.../commons/rdf/jena/JenaRDFTermFactory.java| 2 +-
.../rdf/jena/impl/AbstractJenaRDFTerm.java | 47 +
.../commons/rdf/jena/impl/AbstractRDFTerm.java | 47 -
.../apache/commons/rdf/jena/impl/AnyImpl.java | 54 --
.../commons/rdf/jena/impl/BlankNodeImpl.java| 61 --
.../commons/rdf/jena/impl/DatasetImpl.java | 187 ---
.../rdf/jena/impl/GeneralizedQuadImpl.java | 136 --
.../apache/commons/rdf/jena/impl/GraphImpl.java | 154 ---
.../apache/commons/rdf/jena/impl/IRIImpl.java | 61 --
.../commons/rdf/jena/impl/JenaAnyImpl.java | 54 ++
.../rdf/jena/impl/JenaBlankNodeImpl.java| 61 ++
.../commons/rdf/jena/impl/JenaDatasetImpl.java | 187 +++
.../commons/rdf/jena/impl/JenaFactory.java | 52 +++---
.../rdf/jena/impl/JenaGeneralizedQuad.java | 136 ++
.../commons/rdf/jena/impl/JenaGraphImpl.java| 154 +++
.../commons/rdf/jena/impl/JenaIRIImpl.java | 61 ++
.../commons/rdf/jena/impl/JenaLiteralImpl.java | 73
.../commons/rdf/jena/impl/JenaQuadImpl.java | 66 +++
.../commons/rdf/jena/impl/JenaTripleImpl.java | 67 +++
.../commons/rdf/jena/impl/JenaVariableImpl.java | 64 +++
.../commons/rdf/jena/impl/LiteralImpl.java | 73
.../apache/commons/rdf/jena/impl/QuadImpl.java | 66 ---
.../commons/rdf/jena/impl/TripleImpl.java | 67 ---
.../commons/rdf/jena/impl/VariableImpl.java | 64 ---
24 files changed, 997 insertions(+), 997 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6c17d5ed/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
--
diff --git
a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
index ec84c0a..7359acb 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
@@ -681,7 +681,7 @@ public final class JenaRDFTermFactory implements
RDFTermFactory {
return null;
}
if (term instanceof JenaRDFTerm)
- // TODO: What if it's a BlankNodeImpl with
+ // TODO: What if it's a JenaBlankNodeImpl with
// a different salt? Do we need to rewrite the
// jena blanknode identifier?
return ((JenaRDFTerm) term).asJenaNode();
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6c17d5ed/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractJenaRDFTerm.java
--
diff --git
a/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractJenaRDFTerm.java
b/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractJenaRDFTerm.java
new file mode 100644
index 000..9c0d7ec
--- /dev/null
+++
b/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractJenaRDFTerm.java
@@ -0,0 +1,47 @@
+/**
+ * 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.RDFTerm;
+import org.apache.commons.rdf.jena.JenaRDFTerm;
+import org.apache.jena.graph.Node;
jena no longer need log4j.properties
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/b54b5c68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/b54b5c68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/b54b5c68
Branch: refs/heads/master
Commit: b54b5c6862b570a181390f32537310642fb88690
Parents: c34a85e
Author: Stian Soiland-Reyes
Authored: Wed Oct 26 11:45:13 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Wed Oct 26 11:45:13 2016 +0100
--
jena/src/test/resources/log4j.properties | 33 ---
1 file changed, 33 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b54b5c68/jena/src/test/resources/log4j.properties
--
diff --git a/jena/src/test/resources/log4j.properties
b/jena/src/test/resources/log4j.properties
deleted file mode 100644
index 794559f..000
--- a/jena/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,33 +0,0 @@
-## 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.
-log4j.rootLogger=INFO, stdlog
-
-log4j.appender.stdlog=org.apache.log4j.ConsoleAppender
-## log4j.appender.stdlog.target=System.err
-log4j.appender.stdlog.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-25c{1} ::
%m%n
-
-# Execution logging
-log4j.logger.org.apache.jena.arq.info=INFO
-log4j.logger.org.apache.jena.arq.exec=INFO
-
-# Everything else in Jena
-log4j.logger.org.apache.jena=WARN
-log4j.logger.org.apache.jena.riot=INFO
-
-# Apache Commons HTTP
-# May be useful to turn up to DEBUG if debugging HTTP communication issues
-log4j.logger.org.apache.http=WARN
Add integration test
Merge branch 'jena-jsonld-rdf4j-integration'
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/887c9e68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/887c9e68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/887c9e68
Branch: refs/heads/master
Commit: 887c9e68a37106f17b5c609a149af718c3e679c4
Parents: 5f6bcff c991d05
Author: Stian Soiland-Reyes
Authored: Wed Oct 26 11:15:06 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Wed Oct 26 11:17:16 2016 +0100
--
integration-tests/pom.xml | 75
.../rdf/integrationtests/AllToAllTest.java | 178 +++
pom.xml | 1 +
3 files changed, 254 insertions(+)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/887c9e68/integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
--
diff --cc
integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
index 000,09c887c..24d3697
mode 00,100644..100644
---
a/integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
+++
b/integration-tests/src/test/java/org/apache/commons/rdf/integrationtests/AllToAllTest.java
@@@ -1,0 -1,161 +1,178 @@@
++/**
++ * 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.RDFTerm;
+ import org.apache.commons.rdf.api.RDFTermFactory;
+ import org.apache.commons.rdf.api.Triple;
+ import org.apache.commons.rdf.jena.JenaRDFTermFactory;
+ import org.apache.commons.rdf.jsonldjava.JsonLdRDFTermFactory;
+ import org.apache.commons.rdf.rdf4j.RDF4JTermFactory;
+ import org.apache.commons.rdf.simple.SimpleRDFTermFactory;
+ 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 RDFTermFactory nodeFactory;
+ private RDFTermFactory graphFactory;
+
+
+ public AllToAllTest(
- Class from,
++ Class from,
+ Class to) throws
InstantiationException, IllegalAccessException {
+ this.nodeFactory = from.newInstance();
- this.graphFactory = to.newInstance();
++ this.graphFactory = to.newInstance();
+ }
-
++
+ @SuppressWarnings("rawtypes")
+ @Parameters(name = "{index}: {0}->{1}")
- public static Collection data() {
++ public static Collection data() {
+ List factories = Arrays.asList(
- SimpleRDFTermFactory.class,
- JenaRDFTermFactory.class,
++ SimpleRDFTermFactory.class,
++ JenaRDFTermFactory.class,
+ RDF4JTermFactory.class,
+ JsonLdRDFTermFactory.class);
+ Collection allToAll = new ArrayList<>();
+ for (Class from : factories) {
+ for (Class to : factories) {
+ // NOTE: we deliberately include self-to-self
here
+
Merge branch 'master' into a
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/44b4b680
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/44b4b680
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/44b4b680
Branch: refs/heads/COMMONSRDF-46
Commit: 44b4b6808d19715006adcc075f749fd57345b965
Parents: 9c191fc 351c296
Author: Stian Soiland-Reyes
Authored: Sun Oct 23 03:16:39 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Sun Oct 23 03:16:39 2016 +0100
--
.../org/apache/commons/rdf/rdf4j/RDF4J.java | 22 ++--
.../apache/commons/rdf/rdf4j/RDF4JDataset.java | 2 +-
.../apache/commons/rdf/rdf4j/RDF4JGraph.java| 8 +++
.../rdf/rdf4j/impl/InternalRDF4JFactory.java| 2 +-
.../apache/commons/rdf/rdf4j/package-info.java | 4 ++--
.../commons/rdf/rdf4j/MemoryGraphTest.java | 2 +-
.../commons/rdf/rdf4j/NativeStoreGraphTest.java | 2 +-
7 files changed, 21 insertions(+), 21 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/44b4b680/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4J.java
--
diff --cc rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4J.java
index fb5743b,000..7f70c75
mode 100644,00..100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4J.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4J.java
@@@ -1,603 -1,0 +1,603 @@@
+/**
+ * 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.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 #asRDFTermGraph(Model)}.
++ * To use other models, see {@link #asGraph(Model)}.
+ *
+ * To adapt a RDF4J {@link Repository} as a {@link Dataset} or {@link Graph},
- * use {@link #asRDFTermDataset(Repository, Option...)}
++ * use {@link #asDataset(Repository, Option...)}
+ * or
- * {@link
Repository: incubator-commonsrdf
Updated Branches:
refs/heads/COMMONSRDF-46 fa27a1789 -> 9c191fc2f
RDFFactory -> RDF in user guide
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/9c191fc2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/9c191fc2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/9c191fc2
Branch: refs/heads/COMMONSRDF-46
Commit: 9c191fc2f4ae00b6537e213d2681821b14104293
Parents: fa27a17
Author: Stian Soiland-Reyes
Authored: Sun Oct 23 02:58:01 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Sun Oct 23 02:58:01 2016 +0100
--
src/site/markdown/userguide.md | 257 +++-
1 file changed, 134 insertions(+), 123 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/9c191fc2/src/site/markdown/userguide.md
--
diff --git a/src/site/markdown/userguide.md b/src/site/markdown/userguide.md
index 8451ab9..6191889 100644
--- a/src/site/markdown/userguide.md
+++ b/src/site/markdown/userguide.md
@@ -28,8 +28,8 @@ Commons RDF [API](apidocs/).
* [RDF concepts](#RDF_concepts)
* [Using Commons RDF from Maven](#Using_Commons_RDF_from_Maven)
* [Creating Commons RDF instances](#Creating_Commons_RDF_instances)
- * [Creating a RDFFactory](#Creating_a_RDFFactory)
- * [Using a RDFFactory](#Using_a_RDFFactory)
+ * [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)
@@ -146,25 +146,26 @@ see the [download page](download.html) for the latest
version._
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
-[RDFFactory](apidocs/org/apache/commons/rdf/api/RDFFactory.html).
+[RDF](apidocs/org/apache/commons/rdf/api/RDF.html) implementation.
-### Creating a RDFFactory
+### Finding an RDF implementation
-How to get an instance of this factory is implementation-specific, for the
-_simple_ implementation, you can construct the
-[SimpleRDFFactory](apidocs/org/apache/commons/rdf/simple/SimpleRDFFactory.html):
+The [implementations](implementations.md) 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.SimpleRDFFactory;
+import org.apache.commons.rdf.simple.SimpleRDF;
// ...
-RDFFactory factory = new SimpleRDFFactory();
+RDF rdf = new SimpleRDF();
```
-If you don't want to depend on instantiating a concrete implementation,
-you can alternatively use the
+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 `RDFFactory` implementations found on the classpath:
+to lookup any `RDF` implementations found on the classpath:
```java
import java.util.Iterator;
@@ -172,43 +173,47 @@ import java.util.ServiceLoader;
import org.apache.commons.rdf.api.*;
// ...
-ServiceLoader loader = ServiceLoader.load(RDFFactory.class);
-Iterator iterator = loader.iterator();
-RDFFactory factory = iterator.next();
+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 a RDFFactory
-Using the factory you can construct
+### 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 = factory.createBlankNode();
-IRI nameIri = factory.createIRI("http://example.com/name;);
-Literal aliceLiteral = factory.createLiteral("Alice");
+BlankNode aliceBlankNode = rdf.createBlankNode();
+IRI nameIri = rdf.createIRI("http://example.com/name;);
+Literal aliceLiteral =
JenaFactory -> JenaRDF
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/384a8337
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/384a8337
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/384a8337
Branch: refs/heads/COMMONSRDF-46
Commit: 384a83377e8f643d61ffc91d202e84053450fa55
Parents: ff94b9d
Author: Stian Soiland-Reyes
Authored: Sun Oct 23 00:44:43 2016 +0100
Committer: Stian Soiland-Reyes
Committed: Sun Oct 23 00:44:43 2016 +0100
--
.../apache/commons/rdf/jena/JenaFactory.java| 727 ---
.../org/apache/commons/rdf/jena/JenaRDF.java| 727 +++
.../rdf/jena/experimental/JenaRDFParser.java| 20 +-
.../commons/rdf/jena/impl/AbstractQuadLike.java | 6 +-
.../rdf/jena/impl/InternalJenaFactory.java | 4 +-
.../commons/rdf/jena/impl/JenaDatasetImpl.java | 14 +-
.../commons/rdf/jena/impl/JenaGraphImpl.java| 12 +-
.../org.apache.commons.rdf.api.RDFFactory | 2 +-
.../commons/rdf/jena/JenaServiceLoaderTest.java | 4 +-
.../apache/commons/rdf/jena/TestGraphJena.java | 2 +-
.../jena/TestJenaGraphToCommonsRDFGraph.java| 4 +-
.../commons/rdf/jena/TestRDFParserBuilder.java | 2 +-
.../rdf/jena/TestRDFTermFactoryJena.java| 2 +-
13 files changed, 763 insertions(+), 763 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/384a8337/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
--
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
b/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
deleted file mode 100644
index 4832e44..000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
+++ /dev/null
@@ -1,727 +0,0 @@
-/**
- * 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;
-
-/**
- * RDF with Jena-backed objects.
- *
- * This factory can also convert existing objects from/to Jena with methods
like
- * {@link #fromJena(org.apache.jena.graph.Graph)} and {@link #toJena(Graph)}.
- *
- * For the purpose of {@link BlankNode} identity, this factory will use an
internal
- * {@link UUID} as a salt. See {@link BlankNode#uniqueReference()} for details.
- *
- * @see RDF
- */
-public final class JenaFactory implements RDF {
-
- private static InternalJenaFactory internalJenaFactory = new
InternalJenaFactory(){};
-
- private final UUID salt;
-
- /**
-* Create a JenaFactory.
-*
-* This constructor will use a randomly generated {@link UUID} as a
salt
-* for the purposes of {@link BlankNode} identity, see