commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [2/2] incubator-commonsrdf git commit: add asRDFTermDataset
Date Tue, 14 Jun 2016 17:02:29 GMT
add asRDFTermDataset


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/ea6b992b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/ea6b992b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/ea6b992b

Branch: refs/heads/rdf4j
Commit: ea6b992b02aa3b19d374de33922365572632838a
Parents: ccb5c5f
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Tue Jun 14 18:01:01 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Tue Jun 14 18:01:01 2016 +0100

----------------------------------------------------------------------
 .../commons/rdf/rdf4j/RDF4JTermFactory.java     | 32 +++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ea6b992b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java
index 9326807..04b0030 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java
@@ -24,6 +24,7 @@ import java.util.UUID;
 // commons.rdf and openrdf.model (e.g. IRI)
 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;
@@ -35,6 +36,7 @@ import org.apache.commons.rdf.rdf4j.impl.IRIImpl;
 import org.apache.commons.rdf.rdf4j.impl.LiteralImpl;
 import org.apache.commons.rdf.rdf4j.impl.ModelGraphImpl;
 import org.apache.commons.rdf.rdf4j.impl.QuadImpl;
+import org.apache.commons.rdf.rdf4j.impl.RepositoryDatasetImpl;
 import org.apache.commons.rdf.rdf4j.impl.RepositoryGraphImpl;
 import org.apache.commons.rdf.rdf4j.impl.TripleImpl;
 import org.eclipse.rdf4j.model.BNode;
@@ -155,6 +157,34 @@ public class RDF4JTermFactory implements RDFTermFactory {
 	}
 
 	/**
+	 * Adapt an RDF4J {@link Repository} as a Commons RDF {@link Dataset}.
+	 * <p>
+	 * Changes to the dataset are reflected in the repository, and vice versa.
+	 * 
+	 * @param repository
+	 *            RDF4J {@link Repository} to connect to.
+	 * @return A {@link Dataset} backed by the RDF4J repository.
+	 */
+	public RDF4JDataset asRDFTermDataset(Repository repository) {
+		return new RepositoryDatasetImpl(repository);
+	}
+
+	/**
+	 * Adapt an RDF4J {@link Repository} as a Commons RDF {@link Dataset}.
+	 * <p>
+	 * Changes to the dataset are reflected in the repository, and vice versa.
+	 * 
+	 * @param repository
+	 *            RDF4J {@link Repository} to connect to.
+	 * @param includeInferred
+	 *            If true, any inferred quads are included in the dataset
+	 * @return A {@link Dataset} backed by the RDF4J repository.
+	 */
+	public RDF4JDataset asRDFTermDataset(Repository repository, boolean includeInferred) {
+		return new RepositoryDatasetImpl(repository, includeInferred);
+	}
+	
+	/**
 	 * Adapt an RDF4J {@link Model} as a Commons RDF {@link Graph}.
 	 * <p>
 	 * Changes to the graph are reflected in the model, and vice versa.
@@ -174,7 +204,7 @@ public class RDF4JTermFactory implements RDFTermFactory {
 	 * <p>
 	 * Changes to the graph are reflected in the repository, and vice versa.
 	 * 
-	 * @param model
+	 * @param repository
 	 *            RDF4J {@link Repository} to connect to.
 	 * @return A {@link Graph} backed by the RDF4J repository.
 	 */


Mime
View raw message