commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [3/7] incubator-commonsrdf git commit: GraphImpl also static class
Date Fri, 03 Jun 2016 13:28:37 GMT
GraphImpl also static class


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

Branch: refs/heads/rdf4j
Commit: ed0213ddc6ae5990052a1f0a7f0824dcb66b32b6
Parents: 2cde4c9
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Thu Jun 2 18:09:27 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Thu Jun 2 18:09:27 2016 +0100

----------------------------------------------------------------------
 .../commons/rdf/rdf4j/RDF4JTermFactory.java     | 45 +++++++++++---------
 1 file changed, 26 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ed0213dd/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 d8943db..b60c726 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
@@ -356,25 +356,32 @@ public class RDF4JTermFactory implements RDFTermFactory {
 		}
 	}
 
-	private final class GraphImpl implements RDF4JGraph {
+	private final static class GraphImpl implements RDF4JGraph {
 		
 		private Model model;
+		private RDF4JTermFactory rdf4jTermFactory;
 	
 		GraphImpl(Model model) {
-			this.model = model;		
+			this.model = model;	
+			this.rdf4jTermFactory = new RDF4JTermFactory();
+		}
+
+		GraphImpl(Model model, RDF4JTermFactory rdf4jTermFactory) {
+			this.model = model;	
+			this.rdf4jTermFactory = rdf4jTermFactory;
 		}
 		
 		@Override
 		public void add(BlankNodeOrIRI subject, org.apache.commons.rdf.api.IRI predicate, RDFTerm
object) {
 			model.add(
-					(Resource)asValue(subject), 
-					(org.eclipse.rdf4j.model.IRI)asValue(predicate), 
-					asValue(object));				
+					(Resource)rdf4jTermFactory.asValue(subject), 
+					(org.eclipse.rdf4j.model.IRI)rdf4jTermFactory.asValue(predicate), 
+					rdf4jTermFactory.asValue(object));				
 		}
 		
 		@Override
 		public void add(Triple triple) {
-			model.add(asStatement(triple));
+			model.add(rdf4jTermFactory.asStatement(triple));
 		}
 	
 		public Model asModel() { 
@@ -389,42 +396,42 @@ public class RDF4JTermFactory implements RDFTermFactory {
 		@Override
 		public boolean contains(BlankNodeOrIRI subject, org.apache.commons.rdf.api.IRI predicate,
RDFTerm object) {
 			return model.contains(
-					(Resource)asValue(subject), 
-					(org.eclipse.rdf4j.model.IRI)asValue(predicate), 
-					asValue(object));
+					(Resource)rdf4jTermFactory.asValue(subject), 
+					(org.eclipse.rdf4j.model.IRI)rdf4jTermFactory.asValue(predicate), 
+					rdf4jTermFactory.asValue(object));
 		}
 	
 		@Override
 		public boolean contains(Triple triple) {
-			return model.contains(asStatement(triple));
+			return model.contains(rdf4jTermFactory.asStatement(triple));
 		}
 	
 		@Override
 		public Stream<RDF4JTriple> stream() {
-			return model.parallelStream().map(RDF4JTermFactory.this::asTriple);
+			return model.parallelStream().map(rdf4jTermFactory::asTriple);
 		}
 	
 		@Override
 		public Stream<RDF4JTriple> stream(BlankNodeOrIRI subject, org.apache.commons.rdf.api.IRI
predicate, RDFTerm object) {
 			return model.filter(
-					(Resource)asValue(subject), 
-					(org.eclipse.rdf4j.model.IRI)asValue(predicate), 
-					asValue(object)).parallelStream()
-				.map(RDF4JTermFactory.this::asTriple);
+					(Resource)rdf4jTermFactory.asValue(subject), 
+					(org.eclipse.rdf4j.model.IRI)rdf4jTermFactory.asValue(predicate), 
+					rdf4jTermFactory.asValue(object)).parallelStream()
+				.map(rdf4jTermFactory::asTriple);
 		}
 	
 		@Override
 		public void remove(BlankNodeOrIRI subject, org.apache.commons.rdf.api.IRI predicate, RDFTerm
object) {
 			model.remove(
-					(Resource)asValue(subject), 
-					(org.eclipse.rdf4j.model.IRI)asValue(predicate), 
-					asValue(object));
+					(Resource)rdf4jTermFactory.asValue(subject), 
+					(org.eclipse.rdf4j.model.IRI)rdf4jTermFactory.asValue(predicate), 
+					rdf4jTermFactory.asValue(object));
 			
 		}
 	
 		@Override
 		public void remove(Triple triple) { 
-			model.remove(asStatement(triple));
+			model.remove(rdf4jTermFactory.asStatement(triple));
 		}
 	
 		@Override


Mime
View raw message