commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [8/8] incubator-commonsrdf git commit: JCR_* -> *Impl
Date Mon, 04 Jul 2016 11:24:05 GMT
JCR_* -> *Impl

e.g. TripleImpl instead of JCR_Triple


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

Branch: refs/heads/jena
Commit: 4675e77f1206287c8cb646d929d22322bd838067
Parents: c4311b3
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Mon Jul 4 12:23:30 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Mon Jul 4 12:23:30 2016 +0100

----------------------------------------------------------------------
 .../apache/commons/rdf/jena/JenaCommonsRDF.java |  10 +-
 .../commons/rdf/jena/RDFTermFactoryJena.java    |  18 +--
 .../commons/rdf/jena/impl/AbstractRDFTerm.java  |  50 ++++++++
 .../commons/rdf/jena/impl/BlankNodeImpl.java    |  48 ++++++++
 .../apache/commons/rdf/jena/impl/GraphImpl.java | 117 ++++++++++++++++++
 .../apache/commons/rdf/jena/impl/IRIImpl.java   |  56 +++++++++
 .../commons/rdf/jena/impl/JCR_BlankNode.java    |  48 --------
 .../commons/rdf/jena/impl/JCR_Factory.java      |  90 --------------
 .../apache/commons/rdf/jena/impl/JCR_Graph.java | 117 ------------------
 .../apache/commons/rdf/jena/impl/JCR_IRI.java   |  56 ---------
 .../commons/rdf/jena/impl/JCR_Literal.java      |  68 -----------
 .../apache/commons/rdf/jena/impl/JCR_Quad.java  | 118 -------------------
 .../apache/commons/rdf/jena/impl/JCR_Term.java  |  49 --------
 .../commons/rdf/jena/impl/JCR_Triple.java       |  89 --------------
 .../commons/rdf/jena/impl/JenaFactory.java      |  90 ++++++++++++++
 .../commons/rdf/jena/impl/LiteralImpl.java      |  68 +++++++++++
 .../apache/commons/rdf/jena/impl/QuadImpl.java  | 118 +++++++++++++++++++
 .../commons/rdf/jena/impl/TripleImpl.java       |  89 ++++++++++++++
 .../commons/rdf/jena/TestBlankNodeJena.java     |   6 +-
 19 files changed, 653 insertions(+), 652 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/JenaCommonsRDF.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaCommonsRDF.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaCommonsRDF.java
index 1423a78..80941b0 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaCommonsRDF.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaCommonsRDF.java
@@ -31,7 +31,7 @@ import org.apache.commons.rdf.api.RDFSyntax;
 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.impl.JCR_Factory;
+import org.apache.commons.rdf.jena.impl.JenaFactory;
 import org.apache.jena.datatypes.RDFDatatype ;
 import org.apache.jena.datatypes.xsd.XSDDatatype ;
 import org.apache.jena.graph.Node ;
@@ -103,12 +103,12 @@ public class JenaCommonsRDF {
 
     /** Adapt an existing Jena Node to CommonsRDF {@link RDFTerm}. */
     public static RDFTerm fromJena( Node node) {
-        return JCR_Factory.fromJena(node) ;
+        return JenaFactory.fromJena(node) ;
     }
 
     /** Adapt an existing Jena Triple to CommonsRDF {@link Triple}. */
     public static Triple fromJena(org.apache.jena.graph.Triple triple) {
-        return JCR_Factory.fromJena(triple) ;
+        return JenaFactory.fromJena(triple) ;
     }
 
     /** Adapt an existring Jena Graph to CommonsRDF {@link Graph}.
@@ -116,7 +116,7 @@ public class JenaCommonsRDF {
      * Changes to the CommonsRDF Graph are reflected in the jena graph.
      */    
     public static Graph fromJena(org.apache.jena.graph.Graph graph) {
-        return JCR_Factory.fromJena(graph) ;
+        return JenaFactory.fromJena(graph) ;
     }
 
     /** Convert from Jena {@link Node} to any RDFCommons implementation */
@@ -198,7 +198,7 @@ public static Quad fromJena(RDFTermFactory factory, org.apache.jena.sparql.core.
 }
 
 public static Quad fromJena(org.apache.jena.sparql.core.Quad quad) {	// 
-	return JCR_Factory.fromJena(quad) ;
+	return JenaFactory.fromJena(quad) ;
 }
 
 public static void conversionError(String msg) {

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/RDFTermFactoryJena.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/RDFTermFactoryJena.java b/jena/src/main/java/org/apache/commons/rdf/jena/RDFTermFactoryJena.java
index 3d73459..727ee1e 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/RDFTermFactoryJena.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/RDFTermFactoryJena.java
@@ -19,7 +19,7 @@
 package org.apache.commons.rdf.jena;
 
 import org.apache.commons.rdf.api.* ;
-import org.apache.commons.rdf.jena.impl.JCR_Factory;
+import org.apache.commons.rdf.jena.impl.JenaFactory;
 
 /** RDFTermFactory with Jena-backed objects.
  *  See {@link JenaCommonsRDF} for other conversions of existing objects. 
@@ -30,23 +30,23 @@ public final class RDFTermFactoryJena implements RDFTermFactory {
     
     @Override
     public BlankNode createBlankNode() {
-        return JCR_Factory.createBlankNode() ;
+        return JenaFactory.createBlankNode() ;
     }
 
     @Override
     public BlankNode createBlankNode(String name) {
-        return JCR_Factory.createBlankNode(name) ;
+        return JenaFactory.createBlankNode(name) ;
     }
 
     @Override
     public Graph createGraph() {
-        return JCR_Factory.createGraph() ;
+        return JenaFactory.createGraph() ;
     }
 
     @Override
     public IRI createIRI(String iri) {
         validateIRI(iri) ;
-        return JCR_Factory.createIRI(iri) ;
+        return JenaFactory.createIRI(iri) ;
     }
 
     // Some simple validations - full IRI parsing is not cheap. 
@@ -58,18 +58,18 @@ public final class RDFTermFactoryJena implements RDFTermFactory {
 
     @Override
     public Literal createLiteral(String lexicalForm) {
-        return JCR_Factory.createLiteral(lexicalForm) ;
+        return JenaFactory.createLiteral(lexicalForm) ;
     }
 
     @Override
     public Literal createLiteral(String lexicalForm, IRI dataType) {
-        return JCR_Factory.createLiteralDT(lexicalForm, dataType.getIRIString()) ;
+        return JenaFactory.createLiteralDT(lexicalForm, dataType.getIRIString()) ;
     }
 
     @Override
     public Literal createLiteral(String lexicalForm, String languageTag) {
         validateLang(languageTag) ;
-        return JCR_Factory.createLiteralLang(lexicalForm, languageTag) ;
+        return JenaFactory.createLiteralLang(lexicalForm, languageTag) ;
     }
 
     private static void validateLang(String languageTag) {
@@ -78,7 +78,7 @@ public final class RDFTermFactoryJena implements RDFTermFactory {
 
     @Override
     public Triple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        return JCR_Factory.createTriple(subject, predicate, object) ;
+        return JenaFactory.createTriple(subject, predicate, object) ;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractRDFTerm.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractRDFTerm.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractRDFTerm.java
new file mode 100644
index 0000000..4df9e6d
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractRDFTerm.java
@@ -0,0 +1,50 @@
+/**
+ * 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.JenaNode;
+import org.apache.jena.graph.Node ;
+import org.apache.jena.riot.out.NodeFmtLib ;
+import org.apache.jena.shared.PrefixMapping ;
+import org.apache.jena.shared.impl.PrefixMappingImpl ;
+
+class AbstractRDFTerm implements JenaNode, RDFTerm {
+    private Node node;
+    static private PrefixMapping empty = new PrefixMappingImpl() ; 
+    
+    protected AbstractRDFTerm(Node node) {
+        this.node = node ;
+    }
+    
+    @Override
+    public Node getNode() {
+        return node ;
+    }
+
+    public String ntriplesString() {
+        return NodeFmtLib.str(node) ;
+    }
+    
+    @Override
+    public String toString() {
+        return ntriplesString() ; 
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/BlankNodeImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/BlankNodeImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/BlankNodeImpl.java
new file mode 100644
index 0000000..195e99c
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/BlankNodeImpl.java
@@ -0,0 +1,48 @@
+/**
+ * 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.BlankNode ;
+import org.apache.commons.rdf.jena.JenaNode;
+import org.apache.jena.graph.Node ;
+
+public class BlankNodeImpl extends AbstractRDFTerm implements BlankNode, JenaNode {
+
+    /*package*/ BlankNodeImpl(Node node) { super(node) ; }
+
+    @Override
+    public String uniqueReference() {
+        return getNode().getBlankNodeLabel() ;
+    }
+
+    @Override
+    public int hashCode() {
+        return uniqueReference().hashCode() ;
+    }
+    
+    @Override
+    public boolean equals(Object other) {
+        if ( other == this ) return true ;
+        if ( other == null ) return false ;
+        if ( ! ( other instanceof BlankNode ) ) return false ;
+        BlankNode bNode = (BlankNode)other ;
+        return  uniqueReference().equals(bNode.uniqueReference()) ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/GraphImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/GraphImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/GraphImpl.java
new file mode 100644
index 0000000..282e93d
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/GraphImpl.java
@@ -0,0 +1,117 @@
+/**
+ * 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.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.apache.commons.rdf.jena.JenaCommonsRDF;
+import org.apache.commons.rdf.jena.JenaGraph;
+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 ;
+
+public class GraphImpl implements Graph, JenaGraph {
+
+    private org.apache.jena.graph.Graph graph;
+
+    /*package*/ GraphImpl(org.apache.jena.graph.Graph graph) {
+        this.graph = graph ;
+    }
+    
+    @Override
+    public org.apache.jena.graph.Graph getGraph() {
+        return graph ;
+    }
+
+    @Override
+    public void add(Triple triple) { graph.add(JenaCommonsRDF.toJena(triple)); }
+
+    @Override
+    public void add(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) { 
+        graph.add(org.apache.jena.graph.Triple.create(JenaCommonsRDF.toJena(subject),
+                                                      JenaCommonsRDF.toJena(predicate),
+                                                      JenaCommonsRDF.toJena(object)));
+    }
+
+    @Override
+    public boolean contains(Triple triple) {
+        return graph.contains(JenaCommonsRDF.toJena(triple)) ; 
+    }
+
+    @Override
+    public boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        return graph.contains(JenaCommonsRDF.toJena(subject),
+                              JenaCommonsRDF.toJena(predicate),
+                              JenaCommonsRDF.toJena(object) );
+    }
+
+    @Override
+    public void remove(Triple triple) { graph.delete(JenaCommonsRDF.toJena(triple)); }
+
+    @Override
+    public void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        graph.delete(org.apache.jena.graph.Triple.create(JenaCommonsRDF.toJena(subject),
+                                                         JenaCommonsRDF.toJena(predicate),
+                                                         JenaCommonsRDF.toJena(object)));
+    }
+
+    @Override
+    public void clear() { graph.clear(); }
+
+    @Override
+    public long size() {
+        return graph.size() ;
+    }
+
+    @Override
+    public Stream<? extends Triple> stream() {
+    	return Iter.asStream(graph.find(null, null, null), true).map(JenaCommonsRDF::fromJena);
+    }
+
+    @Override
+    public Stream<? extends Triple> stream(BlankNodeOrIRI s, IRI p, RDFTerm o) {
+        return Iter.asStream(graph.find(toJenaAny(s),toJenaAny(p),toJenaAny(o)), true).
+        		map(JenaCommonsRDF::fromJena);
+    }
+
+    private Node toJenaAny(RDFTerm term) {
+        if ( term == null )
+            return Node.ANY ;
+        return JenaCommonsRDF.toJena(term) ;
+    }
+
+    @Override
+    public void close() { graph.close(); }
+    
+    @Override
+    public String toString() {
+        StringWriter sw = new StringWriter() ;
+        RDFDataMgr.write(sw, graph, Lang.NT) ;
+        return sw.toString() ;
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/IRIImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/IRIImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/IRIImpl.java
new file mode 100644
index 0000000..5f073a6
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/IRIImpl.java
@@ -0,0 +1,56 @@
+/**
+ * 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.jena.graph.Node ;
+import org.apache.jena.graph.NodeFactory ;
+
+import org.apache.commons.rdf.api.* ;
+import org.apache.commons.rdf.jena.JenaNode;
+
+public class IRIImpl extends AbstractRDFTerm implements IRI, JenaNode {
+
+    /*package*/ IRIImpl(String iriStr) {
+        super(NodeFactory.createURI(iriStr)) ;
+    }
+    
+    /*package*/ IRIImpl(Node node) {
+        super(node) ;
+    }
+
+    @Override
+    public String getIRIString() {
+        return getNode().getURI() ;
+    }
+    
+    @Override
+    public int hashCode() {
+        return getIRIString().hashCode() ;
+    }
+    
+    @Override
+    public boolean equals(Object other) {
+        if ( other == this ) return true ;
+        if ( other == null ) return false ;
+        if ( ! ( other instanceof IRI ) ) return false ;
+        IRI iri = (IRI)other ;
+        return getIRIString().equals(iri.getIRIString()) ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_BlankNode.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_BlankNode.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_BlankNode.java
deleted file mode 100644
index dad854b..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_BlankNode.java
+++ /dev/null
@@ -1,48 +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.impl;
-
-import org.apache.commons.rdf.api.BlankNode ;
-import org.apache.commons.rdf.jena.JenaNode;
-import org.apache.jena.graph.Node ;
-
-public class JCR_BlankNode extends JCR_Term implements BlankNode, JenaNode {
-
-    /*package*/ JCR_BlankNode(Node node) { super(node) ; }
-
-    @Override
-    public String uniqueReference() {
-        return getNode().getBlankNodeLabel() ;
-    }
-
-    @Override
-    public int hashCode() {
-        return uniqueReference().hashCode() ;
-    }
-    
-    @Override
-    public boolean equals(Object other) {
-        if ( other == this ) return true ;
-        if ( other == null ) return false ;
-        if ( ! ( other instanceof BlankNode ) ) return false ;
-        BlankNode bNode = (BlankNode)other ;
-        return  uniqueReference().equals(bNode.uniqueReference()) ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Factory.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Factory.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Factory.java
deleted file mode 100644
index 09c085a..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Factory.java
+++ /dev/null
@@ -1,90 +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.impl;
-import static org.apache.commons.rdf.jena.JenaCommonsRDF.conversionError;
-
-import org.apache.commons.rdf.api.* ;
-import org.apache.commons.rdf.jena.JenaCommonsRDF;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.NodeFactory ;
-import org.apache.jena.sparql.graph.GraphFactory ;
-
-public class JCR_Factory {
-    // basic components to commonsrdf backed by Jena. 
-    public static IRI createIRI(String iriStr) {
-        return (IRI)JenaCommonsRDF.fromJena(NodeFactory.createURI(iriStr));
-    }
-
-    public static Literal createLiteral(String lexStr) {
-        return new JCR_Literal(NodeFactory.createLiteral(lexStr));
-    }
-
-    public static Literal createLiteralDT(String lexStr, String datatypeIRI) {
-        return new JCR_Literal(NodeFactory.createLiteral(lexStr, NodeFactory.getType(datatypeIRI))) ;
-    }
-
-    public static Literal createLiteralLang(String lexStr, String langTag) {
-        return new JCR_Literal(NodeFactory.createLiteral(lexStr, langTag));
-    }
-
-    public static BlankNode createBlankNode() {
-        return new JCR_BlankNode(NodeFactory.createBlankNode());
-    }
-
-    public static BlankNode createBlankNode(String id) {
-        return new JCR_BlankNode(NodeFactory.createBlankNode(id));
-    }
-    
-    public static Graph createGraph() { return new JCR_Graph(GraphFactory.createDefaultGraph()) ; }
-    
-    public static Triple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) { 
-        return new JCR_Triple(subject, predicate, object) ;
-    }
-    
-    public static Triple fromJena(org.apache.jena.graph.Triple triple) {
-        return new JCR_Triple(triple) ;
-    }
-
-    public static Graph fromJena(org.apache.jena.graph.Graph graph) {
-        return new JCR_Graph(graph) ;
-    }
-
-    public static RDFTerm fromJena(Node node) {
-        if ( node.isURI() )
-            return new JCR_IRI(node) ; 
-        if ( node.isLiteral() ) {
-            return new JCR_Literal(node) ; 
-//            String lang = node.getLiteralLanguage() ;
-//            if ( lang != null && lang.isEmpty() )
-//                return createLiteralLang(node.getLiteralLexicalForm(), lang) ;
-//            if ( node.getLiteralDatatype().equals(XSDDatatype.XSDstring) )
-//                return createLiteral(node.getLiteralLexicalForm()) ;
-//            return createLiteralDT(node.getLiteralLexicalForm(), node.getLiteralDatatype().getURI());
-        }
-        if ( node.isBlank() )
-            return new JCR_BlankNode(node) ; 
-        conversionError("Node is not a concrete RDF Term: "+node) ;
-        return null ;
-    }
-
-	public static Quad fromJena(org.apache.jena.sparql.core.Quad quad) {
-		 return new JCR_Quad(quad) ;
-	}
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Graph.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Graph.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Graph.java
deleted file mode 100644
index e8d241e..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Graph.java
+++ /dev/null
@@ -1,117 +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.impl;
-
-import java.io.StringWriter ;
-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.apache.commons.rdf.jena.JenaCommonsRDF;
-import org.apache.commons.rdf.jena.JenaGraph;
-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 ;
-
-public class JCR_Graph implements Graph, JenaGraph {
-
-    private org.apache.jena.graph.Graph graph;
-
-    /*package*/ JCR_Graph(org.apache.jena.graph.Graph graph) {
-        this.graph = graph ;
-    }
-    
-    @Override
-    public org.apache.jena.graph.Graph getGraph() {
-        return graph ;
-    }
-
-    @Override
-    public void add(Triple triple) { graph.add(JenaCommonsRDF.toJena(triple)); }
-
-    @Override
-    public void add(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) { 
-        graph.add(org.apache.jena.graph.Triple.create(JenaCommonsRDF.toJena(subject),
-                                                      JenaCommonsRDF.toJena(predicate),
-                                                      JenaCommonsRDF.toJena(object)));
-    }
-
-    @Override
-    public boolean contains(Triple triple) {
-        return graph.contains(JenaCommonsRDF.toJena(triple)) ; 
-    }
-
-    @Override
-    public boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        return graph.contains(JenaCommonsRDF.toJena(subject),
-                              JenaCommonsRDF.toJena(predicate),
-                              JenaCommonsRDF.toJena(object) );
-    }
-
-    @Override
-    public void remove(Triple triple) { graph.delete(JenaCommonsRDF.toJena(triple)); }
-
-    @Override
-    public void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        graph.delete(org.apache.jena.graph.Triple.create(JenaCommonsRDF.toJena(subject),
-                                                         JenaCommonsRDF.toJena(predicate),
-                                                         JenaCommonsRDF.toJena(object)));
-    }
-
-    @Override
-    public void clear() { graph.clear(); }
-
-    @Override
-    public long size() {
-        return graph.size() ;
-    }
-
-    @Override
-    public Stream<? extends Triple> stream() {
-    	return Iter.asStream(graph.find(null, null, null), true).map(JenaCommonsRDF::fromJena);
-    }
-
-    @Override
-    public Stream<? extends Triple> stream(BlankNodeOrIRI s, IRI p, RDFTerm o) {
-        return Iter.asStream(graph.find(toJenaAny(s),toJenaAny(p),toJenaAny(o)), true).
-        		map(JenaCommonsRDF::fromJena);
-    }
-
-    private Node toJenaAny(RDFTerm term) {
-        if ( term == null )
-            return Node.ANY ;
-        return JenaCommonsRDF.toJena(term) ;
-    }
-
-    @Override
-    public void close() { graph.close(); }
-    
-    @Override
-    public String toString() {
-        StringWriter sw = new StringWriter() ;
-        RDFDataMgr.write(sw, graph, Lang.NT) ;
-        return sw.toString() ;
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_IRI.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_IRI.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_IRI.java
deleted file mode 100644
index b63d6a6..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_IRI.java
+++ /dev/null
@@ -1,56 +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.impl;
-
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.NodeFactory ;
-
-import org.apache.commons.rdf.api.* ;
-import org.apache.commons.rdf.jena.JenaNode;
-
-public class JCR_IRI extends JCR_Term implements IRI, JenaNode {
-
-    /*package*/ JCR_IRI(String iriStr) {
-        super(NodeFactory.createURI(iriStr)) ;
-    }
-    
-    /*package*/ JCR_IRI(Node node) {
-        super(node) ;
-    }
-
-    @Override
-    public String getIRIString() {
-        return getNode().getURI() ;
-    }
-    
-    @Override
-    public int hashCode() {
-        return getIRIString().hashCode() ;
-    }
-    
-    @Override
-    public boolean equals(Object other) {
-        if ( other == this ) return true ;
-        if ( other == null ) return false ;
-        if ( ! ( other instanceof IRI ) ) return false ;
-        IRI iri = (IRI)other ;
-        return getIRIString().equals(iri.getIRIString()) ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Literal.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Literal.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Literal.java
deleted file mode 100644
index 08153cd..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Literal.java
+++ /dev/null
@@ -1,68 +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.impl;
-
-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.jena.graph.Node ;
-
-public class JCR_Literal extends JCR_Term implements Literal {
-
-    /* package */ JCR_Literal(Node node) {
-        super(node) ;
-    }
-
-    @Override
-    public String getLexicalForm() {
-        return getNode().getLiteralLexicalForm() ;
-    }
-
-    @Override
-    public IRI getDatatype() {
-        return JCR_Factory.createIRI(getNode().getLiteralDatatype().getURI()) ;
-    }
-
-    @Override
-    public Optional<String> getLanguageTag() {
-        String x = getNode().getLiteralLanguage() ;
-        if ( x == null || x.isEmpty() )
-            return Optional.empty() ; 
-        return Optional.of(x) ;
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hash(getLexicalForm(), getDatatype(), getLanguageTag()) ;
-    }
-    
-    @Override
-    public boolean equals(Object other) {
-        if ( other == this ) return true ;
-        if ( other == null ) return false ;
-        if ( ! ( other instanceof Literal ) ) return false ;
-        Literal literal = (Literal)other ;
-        return  getLexicalForm().equals(literal.getLexicalForm()) &&
-                getLanguageTag().equals(literal.getLanguageTag()) &&
-                getDatatype().equals(literal.getDatatype()) ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Quad.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Quad.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Quad.java
deleted file mode 100644
index a299a85..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Quad.java
+++ /dev/null
@@ -1,118 +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.impl;
-
-import java.util.Objects;
-import java.util.Optional;
-
-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 org.apache.commons.rdf.jena.JenaCommonsRDF;
-import org.apache.commons.rdf.jena.JenaQuad;
-
-public class JCR_Quad implements Quad, JenaQuad {
-
-	private final Optional<BlankNodeOrIRI> graphName;	
-    private final BlankNodeOrIRI subject ;
-    private final IRI predicate ;
-    private final RDFTerm object ;
-    private org.apache.jena.sparql.core.Quad quad = null ;
-
-    /* package */ JCR_Quad(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        this.graphName = Objects.requireNonNull(graphName);
-		this.subject = Objects.requireNonNull(subject) ;
-        this.predicate = Objects.requireNonNull(predicate) ;
-        this.object = Objects.requireNonNull(object) ;
-    }
-    
-    /* package */ JCR_Quad(org.apache.jena.sparql.core.Quad quad) {
-        this.quad = Objects.requireNonNull(quad) ;
-    	this.graphName = Optional.of((BlankNodeOrIRI)JCR_Factory.fromJena(quad.getGraph())) ;
-        this.subject = (BlankNodeOrIRI)JCR_Factory.fromJena(quad.getSubject()) ;
-        this.predicate = (IRI)JCR_Factory.fromJena(quad.getPredicate()) ;
-        this.object = JCR_Factory.fromJena(quad.getObject()) ;
-    }
-
-    @Override
-    public org.apache.jena.sparql.core.Quad getQuad() {
-        if ( quad == null ) {
-            quad = org.apache.jena.sparql.core.Quad.create(
-            		JenaCommonsRDF.toJena(graphName.orElse(null)), 
-            		JenaCommonsRDF.toJena(subject), 
-            		JenaCommonsRDF.toJena(predicate), 
-            		JenaCommonsRDF.toJena(object)) ;
-        }
-        return quad ;
-    }
-
-    @Override
-    public BlankNodeOrIRI getSubject() {
-        return subject ;
-    }
-
-    @Override
-    public IRI getPredicate() {
-        return predicate ;
-    }
-
-    @Override
-    public RDFTerm getObject() {
-        return object ;
-    }
-
-    @Override
-	public Optional<BlankNodeOrIRI> getGraphName() {
-		return graphName;
-	}
-    
-    @Override
-    public int hashCode() {
-        return Objects.hash(getSubject(), getPredicate(), getObject(), getGraphName()) ;
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if ( other == this ) return true ;
-        if ( other == null ) return false ;
-        if ( ! ( other instanceof Quad ) ) return false ;
-        Quad quad = (Quad)other ;
-        return getGraphName().equals(quad.getGraphName()) &&
-        		getSubject().equals(quad.getSubject()) &&
-        		getPredicate().equals(quad.getPredicate()) &&
-        		getObject().equals(quad.getObject()) ;
-    }
-    
-    @Override 
-    public String toString() {
-    	// kind of nquad syntax
-		return getSubject().ntriplesString() + " " + 
-    			getPredicate().ntriplesString() + " " + 
-    			getObject().ntriplesString() + " " + 
-    			getGraphName().map(RDFTerm::ntriplesString).orElse("") +  ".";
-    }
-
-    @Override
-    public Triple asTriple() {
-    	return new JCR_Triple(getSubject(), getPredicate(), getObject());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Term.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Term.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Term.java
deleted file mode 100644
index b52f5ac..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Term.java
+++ /dev/null
@@ -1,49 +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.impl;
-
-import org.apache.commons.rdf.jena.JenaNode;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.riot.out.NodeFmtLib ;
-import org.apache.jena.shared.PrefixMapping ;
-import org.apache.jena.shared.impl.PrefixMappingImpl ;
-
-class JCR_Term implements JenaNode {
-    private Node node;
-    static private PrefixMapping empty = new PrefixMappingImpl() ; 
-    
-    protected JCR_Term(Node node) {
-        this.node = node ;
-    }
-    
-    @Override
-    public Node getNode() {
-        return node ;
-    }
-
-    public String ntriplesString() {
-        return NodeFmtLib.str(node) ;
-    }
-    
-    @Override
-    public String toString() {
-        return ntriplesString() ; 
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Triple.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Triple.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Triple.java
deleted file mode 100644
index 3956771..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JCR_Triple.java
+++ /dev/null
@@ -1,89 +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.impl;
-
-import java.util.Objects ;
-
-import org.apache.commons.rdf.api.* ;
-import org.apache.commons.rdf.jena.JenaCommonsRDF;
-import org.apache.commons.rdf.jena.JenaTriple;
-
-public class JCR_Triple implements Triple, JenaTriple {
-    private final BlankNodeOrIRI subject ;
-    private final IRI predicate ;
-    private final RDFTerm object ;
-    private org.apache.jena.graph.Triple triple = null ;
-
-    /* package */ JCR_Triple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        this.subject = subject ;
-        this.predicate = predicate ;
-        this.object = object ;
-    }
-    
-    /* package */ JCR_Triple(org.apache.jena.graph.Triple triple) {
-        this.subject = (BlankNodeOrIRI)JCR_Factory.fromJena(triple.getSubject()) ;
-        this.predicate = (IRI)JCR_Factory.fromJena(triple.getPredicate()) ;
-        this.object = JCR_Factory.fromJena(triple.getObject()) ;
-        this.triple = triple ;
-    }
-
-    @Override
-    public org.apache.jena.graph.Triple getTriple() {
-        if ( triple == null )
-            triple = org.apache.jena.graph.Triple.create(JenaCommonsRDF.toJena(subject), JenaCommonsRDF.toJena(predicate), JenaCommonsRDF.toJena(object)) ;
-        return triple ;
-    }
-
-    @Override
-    public BlankNodeOrIRI getSubject() {
-        return subject ;
-    }
-
-    @Override
-    public IRI getPredicate() {
-        return predicate ;
-    }
-
-    @Override
-    public RDFTerm getObject() {
-        return object ;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(getSubject(), getPredicate(), getObject()) ;
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if ( other == this ) return true ;
-        if ( other == null ) return false ;
-        if ( ! ( other instanceof Triple ) ) return false ;
-        Triple triple = (Triple)other ;
-        return  getSubject().equals(triple.getSubject()) &&
-            getPredicate().equals(triple.getPredicate()) &&
-            getObject().equals(triple.getObject()) ;
-    }
-    
-    @Override 
-    public String toString() {
-        return getSubject()+" "+getPredicate()+" "+getObject()+" ." ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
new file mode 100644
index 0000000..fbd89cc
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
@@ -0,0 +1,90 @@
+/**
+ * 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.commons.rdf.jena.JenaCommonsRDF.conversionError;
+
+import org.apache.commons.rdf.api.* ;
+import org.apache.commons.rdf.jena.JenaCommonsRDF;
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.NodeFactory ;
+import org.apache.jena.sparql.graph.GraphFactory ;
+
+public class JenaFactory {
+    // basic components to commonsrdf backed by Jena. 
+    public static IRI createIRI(String iriStr) {
+        return (IRI)JenaCommonsRDF.fromJena(NodeFactory.createURI(iriStr));
+    }
+
+    public static Literal createLiteral(String lexStr) {
+        return new LiteralImpl(NodeFactory.createLiteral(lexStr));
+    }
+
+    public static Literal createLiteralDT(String lexStr, String datatypeIRI) {
+        return new LiteralImpl(NodeFactory.createLiteral(lexStr, NodeFactory.getType(datatypeIRI))) ;
+    }
+
+    public static Literal createLiteralLang(String lexStr, String langTag) {
+        return new LiteralImpl(NodeFactory.createLiteral(lexStr, langTag));
+    }
+
+    public static BlankNode createBlankNode() {
+        return new BlankNodeImpl(NodeFactory.createBlankNode());
+    }
+
+    public static BlankNode createBlankNode(String id) {
+        return new BlankNodeImpl(NodeFactory.createBlankNode(id));
+    }
+    
+    public static Graph createGraph() { return new GraphImpl(GraphFactory.createDefaultGraph()) ; }
+    
+    public static Triple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) { 
+        return new TripleImpl(subject, predicate, object) ;
+    }
+    
+    public static Triple fromJena(org.apache.jena.graph.Triple triple) {
+        return new TripleImpl(triple) ;
+    }
+
+    public static Graph fromJena(org.apache.jena.graph.Graph graph) {
+        return new GraphImpl(graph) ;
+    }
+
+    public static RDFTerm fromJena(Node node) {
+        if ( node.isURI() )
+            return new IRIImpl(node) ; 
+        if ( node.isLiteral() ) {
+            return new LiteralImpl(node) ; 
+//            String lang = node.getLiteralLanguage() ;
+//            if ( lang != null && lang.isEmpty() )
+//                return createLiteralLang(node.getLiteralLexicalForm(), lang) ;
+//            if ( node.getLiteralDatatype().equals(XSDDatatype.XSDstring) )
+//                return createLiteral(node.getLiteralLexicalForm()) ;
+//            return createLiteralDT(node.getLiteralLexicalForm(), node.getLiteralDatatype().getURI());
+        }
+        if ( node.isBlank() )
+            return new BlankNodeImpl(node) ; 
+        conversionError("Node is not a concrete RDF Term: "+node) ;
+        return null ;
+    }
+
+	public static Quad fromJena(org.apache.jena.sparql.core.Quad quad) {
+		 return new QuadImpl(quad) ;
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/LiteralImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/LiteralImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/LiteralImpl.java
new file mode 100644
index 0000000..91584c4
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/LiteralImpl.java
@@ -0,0 +1,68 @@
+/**
+ * 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 org.apache.commons.rdf.api.IRI ;
+import org.apache.commons.rdf.api.Literal ;
+import org.apache.jena.graph.Node ;
+
+public class LiteralImpl extends AbstractRDFTerm implements Literal {
+
+    /* package */ LiteralImpl(Node node) {
+        super(node) ;
+    }
+
+    @Override
+    public String getLexicalForm() {
+        return getNode().getLiteralLexicalForm() ;
+    }
+
+    @Override
+    public IRI getDatatype() {
+        return JenaFactory.createIRI(getNode().getLiteralDatatype().getURI()) ;
+    }
+
+    @Override
+    public Optional<String> getLanguageTag() {
+        String x = getNode().getLiteralLanguage() ;
+        if ( x == null || x.isEmpty() )
+            return Optional.empty() ; 
+        return Optional.of(x) ;
+    }
+    
+    @Override
+    public int hashCode() {
+        return Objects.hash(getLexicalForm(), getDatatype(), getLanguageTag()) ;
+    }
+    
+    @Override
+    public boolean equals(Object other) {
+        if ( other == this ) return true ;
+        if ( other == null ) return false ;
+        if ( ! ( other instanceof Literal ) ) return false ;
+        Literal literal = (Literal)other ;
+        return  getLexicalForm().equals(literal.getLexicalForm()) &&
+                getLanguageTag().equals(literal.getLanguageTag()) &&
+                getDatatype().equals(literal.getDatatype()) ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/QuadImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/QuadImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/QuadImpl.java
new file mode 100644
index 0000000..a3546ce
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/QuadImpl.java
@@ -0,0 +1,118 @@
+/**
+ * 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 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 org.apache.commons.rdf.jena.JenaCommonsRDF;
+import org.apache.commons.rdf.jena.JenaQuad;
+
+public class QuadImpl implements Quad, JenaQuad {
+
+	private final Optional<BlankNodeOrIRI> graphName;	
+    private final BlankNodeOrIRI subject ;
+    private final IRI predicate ;
+    private final RDFTerm object ;
+    private org.apache.jena.sparql.core.Quad quad = null ;
+
+    /* package */ QuadImpl(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        this.graphName = Objects.requireNonNull(graphName);
+		this.subject = Objects.requireNonNull(subject) ;
+        this.predicate = Objects.requireNonNull(predicate) ;
+        this.object = Objects.requireNonNull(object) ;
+    }
+    
+    /* package */ QuadImpl(org.apache.jena.sparql.core.Quad quad) {
+        this.quad = Objects.requireNonNull(quad) ;
+    	this.graphName = Optional.of((BlankNodeOrIRI)JenaFactory.fromJena(quad.getGraph())) ;
+        this.subject = (BlankNodeOrIRI)JenaFactory.fromJena(quad.getSubject()) ;
+        this.predicate = (IRI)JenaFactory.fromJena(quad.getPredicate()) ;
+        this.object = JenaFactory.fromJena(quad.getObject()) ;
+    }
+
+    @Override
+    public org.apache.jena.sparql.core.Quad getQuad() {
+        if ( quad == null ) {
+            quad = org.apache.jena.sparql.core.Quad.create(
+            		JenaCommonsRDF.toJena(graphName.orElse(null)), 
+            		JenaCommonsRDF.toJena(subject), 
+            		JenaCommonsRDF.toJena(predicate), 
+            		JenaCommonsRDF.toJena(object)) ;
+        }
+        return quad ;
+    }
+
+    @Override
+    public BlankNodeOrIRI getSubject() {
+        return subject ;
+    }
+
+    @Override
+    public IRI getPredicate() {
+        return predicate ;
+    }
+
+    @Override
+    public RDFTerm getObject() {
+        return object ;
+    }
+
+    @Override
+	public Optional<BlankNodeOrIRI> getGraphName() {
+		return graphName;
+	}
+    
+    @Override
+    public int hashCode() {
+        return Objects.hash(getSubject(), getPredicate(), getObject(), getGraphName()) ;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if ( other == this ) return true ;
+        if ( other == null ) return false ;
+        if ( ! ( other instanceof Quad ) ) return false ;
+        Quad quad = (Quad)other ;
+        return getGraphName().equals(quad.getGraphName()) &&
+        		getSubject().equals(quad.getSubject()) &&
+        		getPredicate().equals(quad.getPredicate()) &&
+        		getObject().equals(quad.getObject()) ;
+    }
+    
+    @Override 
+    public String toString() {
+    	// kind of nquad syntax
+		return getSubject().ntriplesString() + " " + 
+    			getPredicate().ntriplesString() + " " + 
+    			getObject().ntriplesString() + " " + 
+    			getGraphName().map(RDFTerm::ntriplesString).orElse("") +  ".";
+    }
+
+    @Override
+    public Triple asTriple() {
+    	return new TripleImpl(getSubject(), getPredicate(), getObject());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/main/java/org/apache/commons/rdf/jena/impl/TripleImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/TripleImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/TripleImpl.java
new file mode 100644
index 0000000..c77e594
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/TripleImpl.java
@@ -0,0 +1,89 @@
+/**
+ * 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 org.apache.commons.rdf.api.* ;
+import org.apache.commons.rdf.jena.JenaCommonsRDF;
+import org.apache.commons.rdf.jena.JenaTriple;
+
+public class TripleImpl implements Triple, JenaTriple {
+    private final BlankNodeOrIRI subject ;
+    private final IRI predicate ;
+    private final RDFTerm object ;
+    private org.apache.jena.graph.Triple triple = null ;
+
+    /* package */ TripleImpl(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        this.subject = subject ;
+        this.predicate = predicate ;
+        this.object = object ;
+    }
+    
+    /* package */ TripleImpl(org.apache.jena.graph.Triple triple) {
+        this.subject = (BlankNodeOrIRI)JenaFactory.fromJena(triple.getSubject()) ;
+        this.predicate = (IRI)JenaFactory.fromJena(triple.getPredicate()) ;
+        this.object = JenaFactory.fromJena(triple.getObject()) ;
+        this.triple = triple ;
+    }
+
+    @Override
+    public org.apache.jena.graph.Triple getTriple() {
+        if ( triple == null )
+            triple = org.apache.jena.graph.Triple.create(JenaCommonsRDF.toJena(subject), JenaCommonsRDF.toJena(predicate), JenaCommonsRDF.toJena(object)) ;
+        return triple ;
+    }
+
+    @Override
+    public BlankNodeOrIRI getSubject() {
+        return subject ;
+    }
+
+    @Override
+    public IRI getPredicate() {
+        return predicate ;
+    }
+
+    @Override
+    public RDFTerm getObject() {
+        return object ;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(getSubject(), getPredicate(), getObject()) ;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if ( other == this ) return true ;
+        if ( other == null ) return false ;
+        if ( ! ( other instanceof Triple ) ) return false ;
+        Triple triple = (Triple)other ;
+        return  getSubject().equals(triple.getSubject()) &&
+            getPredicate().equals(triple.getPredicate()) &&
+            getObject().equals(triple.getObject()) ;
+    }
+    
+    @Override 
+    public String toString() {
+        return getSubject()+" "+getPredicate()+" "+getObject()+" ." ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/4675e77f/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java b/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
index 07e9ce7..cd5d264 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
@@ -20,17 +20,17 @@ package org.apache.commons.rdf.jena;
 
 import org.apache.commons.rdf.api.AbstractBlankNodeTest ;
 import org.apache.commons.rdf.api.BlankNode ;
-import org.apache.commons.rdf.jena.impl.JCR_Factory;
+import org.apache.commons.rdf.jena.impl.JenaFactory;
 
 public class TestBlankNodeJena extends AbstractBlankNodeTest {
     @Override
     protected BlankNode getBlankNode() {
-        return JCR_Factory.createBlankNode() ;
+        return JenaFactory.createBlankNode() ;
     }
     
     @Override
     protected BlankNode getBlankNode(String identifier) {
-        return JCR_Factory.createBlankNode(identifier) ;
+        return JenaFactory.createBlankNode(identifier) ;
     }
 }
 


Mime
View raw message