commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [1/2] incubator-commonsrdf git commit: No need for Simple just for Types.XSD_STRING
Date Tue, 03 May 2016 22:34:41 GMT
Repository: incubator-commonsrdf
Updated Branches:
  refs/heads/rdf4j c3ee194a4 -> 38126b3b0


No need for Simple just for Types.XSD_STRING


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

Branch: refs/heads/rdf4j
Commit: 78310991d4a13869e456a73250f306b22a424b72
Parents: c3ee194
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Tue May 3 23:33:02 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Tue May 3 23:33:02 2016 +0100

----------------------------------------------------------------------
 rdf4j/pom.xml                                   |  5 --
 .../commons/rdf/rdf4j/Rdf4JRDFTermFactory.java  | 48 ++++++++++----------
 2 files changed, 24 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/78310991/rdf4j/pom.xml
----------------------------------------------------------------------
diff --git a/rdf4j/pom.xml b/rdf4j/pom.xml
index 6e192ea..3134702 100644
--- a/rdf4j/pom.xml
+++ b/rdf4j/pom.xml
@@ -43,11 +43,6 @@
             <version>${project.version}</version>
         </dependency>
 	<dependency>
-            <groupId>${project.parent.groupId}</groupId>
-            <artifactId>commons-rdf-simple</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-	<dependency>
 		<groupId>org.openrdf.sesame</groupId>
 		<artifactId>sesame-runtime</artifactId>
 		<version>${sesame.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/78310991/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/Rdf4JRDFTermFactory.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/Rdf4JRDFTermFactory.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/Rdf4JRDFTermFactory.java
index 9619299..ac739f5 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/Rdf4JRDFTermFactory.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/Rdf4JRDFTermFactory.java
@@ -32,7 +32,6 @@ import org.apache.commons.rdf.api.BlankNodeOrIRI;
 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.simple.Types;
 import org.openrdf.model.BNode;
 import org.openrdf.model.Model;
 import org.openrdf.model.Resource;
@@ -41,23 +40,24 @@ import org.openrdf.model.Value;
 import org.openrdf.model.ValueFactory;
 import org.openrdf.model.impl.LinkedHashModel;
 import org.openrdf.model.impl.SimpleValueFactory;
+import org.openrdf.model.vocabulary.XMLSchema;
 import org.openrdf.rio.turtle.TurtleUtil;
 
 public class Rdf4JRDFTermFactory implements RDFTermFactory {
 	
-	private abstract class RDFTermImplementation<T extends Value> implements RDFTerm {
+	public abstract class RDFTermImpl<T extends Value> implements RDFTerm {
 		T value;
 
 		public T asValue() { 
 			return value;
 		}
 		
-		RDFTermImplementation(T value) {
+		RDFTermImpl(T value) {
 			this.value = value;			
 		}
 	}
 	
-	private final class GraphImplementation implements org.apache.commons.rdf.api.Graph {
+	private final class GraphImpl implements org.apache.commons.rdf.api.Graph {
 		
 		private Model model;
 
@@ -65,7 +65,7 @@ public class Rdf4JRDFTermFactory implements RDFTermFactory {
 			return model;
 		}
 		
-		public GraphImplementation(Model model) {
+		public GraphImpl(Model model) {
 			this.model = model;		
 		}
 		
@@ -143,10 +143,10 @@ public class Rdf4JRDFTermFactory implements RDFTermFactory {
 		}
 	}
 
-	private final class TripleImplementation implements Triple {
+	private final class TripleImpl implements Triple {
 		private final Statement statement;
 
-		private TripleImplementation(Statement statement) {
+		private TripleImpl(Statement statement) {
 			this.statement = statement;
 		}
 
@@ -191,10 +191,10 @@ public class Rdf4JRDFTermFactory implements RDFTermFactory {
 		}
 	}
 
-	private final class IRIImplementation extends RDFTermImplementation<org.openrdf.model.IRI>

+	private final class IRIImpl extends RDFTermImpl<org.openrdf.model.IRI> 
 		implements org.apache.commons.rdf.api.IRI {
 
-		public IRIImplementation(org.openrdf.model.IRI iri) {
+		public IRIImpl(org.openrdf.model.IRI iri) {
 			super(iri);			
 		}
 		@Override
@@ -219,8 +219,8 @@ public class Rdf4JRDFTermFactory implements RDFTermFactory {
 		@Override
 		public boolean equals(Object obj) {
 			if (obj == this) { return true; }
-			if (obj instanceof IRIImplementation) {
-				IRIImplementation impl = (IRIImplementation) obj; 
+			if (obj instanceof IRIImpl) {
+				IRIImpl impl = (IRIImpl) obj; 
 				return asValue().equals(impl.asValue());
 			}
 			if (obj instanceof org.apache.commons.rdf.api.IRI) {
@@ -232,11 +232,11 @@ public class Rdf4JRDFTermFactory implements RDFTermFactory {
 		
 	}
 
-	private final class LiteralImplementation 
-		extends RDFTermImplementation<org.openrdf.model.Literal>
+	private final class LiteralImpl 
+		extends RDFTermImpl<org.openrdf.model.Literal>
 		implements org.apache.commons.rdf.api.Literal {
 
-		public LiteralImplementation(org.openrdf.model.Literal literal) {
+		public LiteralImpl(org.openrdf.model.Literal literal) {
 			super(literal);			
 		}
 		@Override
@@ -246,7 +246,7 @@ public class Rdf4JRDFTermFactory implements RDFTermFactory {
 			if (value.getLanguage().isPresent()) {
 				return escaped + "@" + value.getLanguage().get();
 			}
-			if (getDatatype().equals(Types.XSD_STRING)) { 
+			if (value.getDatatype().equals(XMLSchema.STRING)) { 
 				return escaped;
 			}
 			return escaped + "^^<" + TurtleUtil.encodeURIString(value.getDatatype().toString())
+ ">";
@@ -290,10 +290,10 @@ public class Rdf4JRDFTermFactory implements RDFTermFactory {
 		}
 	}
 
-	private final class BlankNodeImplementation extends RDFTermImplementation<BNode>
+	private final class BlankNodeImpl extends RDFTermImpl<BNode>
 		implements BlankNode {
 		
-		public BlankNodeImplementation(BNode bNode) {
+		public BlankNodeImpl(BNode bNode) {
 			super(bNode);			
 		}
 		
@@ -424,10 +424,10 @@ public class Rdf4JRDFTermFactory implements RDFTermFactory {
 		if (object == null) { 
 			return null;
 		}
-		if (object instanceof RDFTermImplementation) {
+		if (object instanceof RDFTermImpl) {
 			// One of our own - avoid converting again.
 			// (This is crucial to avoid double-escaping in BlankNode)
-			return ((RDFTermImplementation<?>)object).asValue();
+			return ((RDFTermImpl<?>)object).asValue();
 		}
 		if (object instanceof org.apache.commons.rdf.api.IRI) {
 			org.apache.commons.rdf.api.IRI iri = (org.apache.commons.rdf.api.IRI) object;
@@ -454,22 +454,22 @@ public class Rdf4JRDFTermFactory implements RDFTermFactory {
 	}
 
 	public org.apache.commons.rdf.api.Graph asRDFTermGraph(Model model) {
-		return new GraphImplementation(model);
+		return new GraphImpl(model);
 	}
 
 	public Triple asTriple(final Statement statement) {
-		return new TripleImplementation(statement);
+		return new TripleImpl(statement);
 	}
 
 	public RDFTerm asRDFTerm(final org.openrdf.model.Value value) {		
 		if (value instanceof BNode) {
-			return new BlankNodeImplementation((BNode) value);
+			return new BlankNodeImpl((BNode) value);
 		}
 		if (value instanceof org.openrdf.model.Literal) {
-			return new LiteralImplementation((org.openrdf.model.Literal) value);
+			return new LiteralImpl((org.openrdf.model.Literal) value);
 		}
 		if (value instanceof org.openrdf.model.IRI) {
-			return new IRIImplementation((org.openrdf.model.IRI) value);
+			return new IRIImpl((org.openrdf.model.IRI) value);
 		}
 		throw new IllegalArgumentException("Value is not a BNode, Literal or IRI: " + value.getClass());
	
 	}


Mime
View raw message