commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [06/33] incubator-commonsrdf git commit: Refactor to API and implementation packaging.
Date Mon, 28 Mar 2016 04:55:02 GMT
Refactor to API and implementation packaging.


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

Branch: refs/heads/jena
Commit: 5c084f62617f1d52523ee34bd658788133506afc
Parents: d6c2356
Author: Andy Seaborne <andy@seaborne.org>
Authored: Thu Aug 27 15:41:46 2015 +0100
Committer: Andy Seaborne <andy@seaborne.org>
Committed: Thu Aug 27 15:42:44 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/jena/commons/Example1.java  |  50 ------
 .../org/apache/jena/commons/JCR_BlankNode.java  |  47 ------
 .../org/apache/jena/commons/JCR_Factory.java    | 117 --------------
 .../java/org/apache/jena/commons/JCR_Graph.java | 112 --------------
 .../java/org/apache/jena/commons/JCR_IRI.java   |  55 -------
 .../org/apache/jena/commons/JCR_Literal.java    |  68 --------
 .../java/org/apache/jena/commons/JCR_Term.java  |  50 ------
 .../org/apache/jena/commons/JCR_Triple.java     |  72 ---------
 .../org/apache/jena/commons/JenaCommonsRDF.java |  26 ----
 .../apache/jena/commons/RDFTermFactoryJena.java |  80 ----------
 .../java/org/apache/jena/commons/ToGraph.java   |  95 ------------
 .../jena/commonsrdf/ConversionException.java    |  29 ++++
 .../apache/jena/commonsrdf/JenaCommonsRDF.java  | 154 +++++++++++++++++++
 .../jena/commonsrdf/RDFTermFactoryJena.java     |  83 ++++++++++
 .../jena/commonsrdf/examples/Example1.java      |  61 ++++++++
 .../jena/commonsrdf/impl/JCR_BlankNode.java     |  47 ++++++
 .../jena/commonsrdf/impl/JCR_Factory.java       |  86 +++++++++++
 .../apache/jena/commonsrdf/impl/JCR_Graph.java  | 115 ++++++++++++++
 .../apache/jena/commonsrdf/impl/JCR_IRI.java    |  55 +++++++
 .../jena/commonsrdf/impl/JCR_Literal.java       |  68 ++++++++
 .../apache/jena/commonsrdf/impl/JCR_Term.java   |  51 ++++++
 .../apache/jena/commonsrdf/impl/JCR_Triple.java |  88 +++++++++++
 .../apache/jena/commonsrdf/impl/JenaGraph.java  |  26 ++++
 .../apache/jena/commonsrdf/impl/JenaNode.java   |  26 ++++
 .../apache/jena/commonsrdf/impl/JenaTriple.java |  26 ++++
 .../apache/jena/commonsrdf/impl/ToGraph.java    |  68 ++++++++
 .../apache/jena/commons/TestBlankNodeJena.java  |  35 -----
 .../org/apache/jena/commons/TestGraphJena.java  |  32 ----
 .../jena/commons/TestRDFTermFactoryJena.java    |  32 ----
 .../jena/commonsrdf/TestBlankNodeJena.java      |  35 +++++
 .../apache/jena/commonsrdf/TestGraphJena.java   |  32 ++++
 .../jena/commonsrdf/TestRDFTermFactoryJena.java |  32 ++++
 32 files changed, 1082 insertions(+), 871 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commons/Example1.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/Example1.java b/src/main/java/org/apache/jena/commons/Example1.java
deleted file mode 100644
index 8c66fc3..0000000
--- a/src/main/java/org/apache/jena/commons/Example1.java
+++ /dev/null
@@ -1,50 +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.jena.commons;
-
-import org.apache.commons.rdf.api.Graph ;
-import org.apache.commons.rdf.api.RDFTermFactory ;
-import org.apache.jena.atlas.logging.LogCtl ;
-import org.apache.jena.riot.RDFDataMgr ;
-
-public class Example1 {
-    static { LogCtl.setCmdLogging();}
-    
-    public static void main(String... args) {
-        main_ex2() ;
-    }
-    
-    public static void main_ex1(String... args) {
-        RDFTermFactory rft = new RDFTermFactoryJena() ;
-        ToGraph dest = new ToGraph(rft) ;
-        RDFDataMgr.parse(dest, "D.ttl") ;
-        dest.getGraph().getTriples().forEach(System.out::println) ;
-    }
-
-    public static void main_ex2(String... args) {
-        RDFTermFactory rft = new RDFTermFactoryJena() ;
-        Graph graph = rft.createGraph() ;
-        ToGraph dest = new ToGraph(graph, rft) ;
-        RDFDataMgr.parse(dest, "D.ttl") ;
-        graph.getTriples().forEach(System.out::println) ;
-    }
-
-    
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commons/JCR_BlankNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/JCR_BlankNode.java b/src/main/java/org/apache/jena/commons/JCR_BlankNode.java
deleted file mode 100644
index f01049d..0000000
--- a/src/main/java/org/apache/jena/commons/JCR_BlankNode.java
+++ /dev/null
@@ -1,47 +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.jena.commons;
-
-import org.apache.commons.rdf.api.BlankNode ;
-import org.apache.jena.graph.Node ;
-
-public class JCR_BlankNode extends JCR_Term implements BlankNode, JenaCommonsRDF {
-
-    /*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/5c084f62/src/main/java/org/apache/jena/commons/JCR_Factory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/JCR_Factory.java b/src/main/java/org/apache/jena/commons/JCR_Factory.java
deleted file mode 100644
index e914267..0000000
--- a/src/main/java/org/apache/jena/commons/JCR_Factory.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.jena.commons;
-
-import org.apache.commons.rdf.api.* ;
-import org.apache.jena.datatypes.RDFDatatype ;
-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)fromJena(NodeFactory.createURI(iriStr));
-    }
-
-    public static Literal createLiteral(String lexStr) {
-        return (Literal)fromJena(NodeFactory.createLiteral(lexStr));
-    }
-
-    public static Literal createLiteralDT(String lexStr, String datatypeIRI) {
-        return (Literal)fromJena(NodeFactory.createLiteral(lexStr, NodeFactory.getType(datatypeIRI))) ;
-    }
-
-    public static Literal createLiteralLang(String lexStr, String langTag) {
-        return (Literal)fromJena(NodeFactory.createLiteral(lexStr, langTag));
-    }
-
-    public static BlankNode createBlankNode() {
-        return (BlankNode)fromJena(NodeFactory.createBlankNode());
-    }
-
-    public static BlankNode createBlankNode(String id) {
-        return (BlankNode)fromJena(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) ;
-    }
-    
-//    // Nodes to commonsrdf. 
-//    public static IRI createIRI(Node iri) { return ()
-//    public static Literal createLiteral(Node lexStr) { return null ; }
-//    public static BlankNode createBlankNode(Node bNode) { return null ; }
-
-    
-    // commonsrdf to jena
-    public static org.apache.jena.graph.Triple toJena(Triple triple) {
-        return new org.apache.jena.graph.Triple(toJena(triple.getSubject()), toJena(triple.getPredicate()), toJena(triple.getObject()) ) ;   
-    }
-    
-    public static Node toJena(RDFTerm term) {
-        if ( term instanceof JenaCommonsRDF )
-            return ((JenaCommonsRDF)term).getNode() ;
-        
-        if ( term instanceof IRI ) 
-            return NodeFactory.createURI(((IRI)term).getIRIString()) ;
-        
-        if ( term instanceof Literal ) {
-            Literal lit = (Literal)term ; 
-            RDFDatatype dt = NodeFactory.getType(lit.getDatatype().getIRIString()) ;
-            String lang = lit.getLanguageTag().orElse("") ;
-            return NodeFactory.createLiteral(lit.getLexicalForm(), lang, dt) ; 
-        }
-        
-        if ( term instanceof BlankNode ) {
-            String id = ((BlankNode)term).uniqueReference() ;
-            // XXX ???
-            // preserve skolemization vs gen new id?
-            return NodeFactory.createBlankNode(id) ;
-        }
-        
-        error("Not a concrete RDF Term: "+term) ;
-        return null ;
-    }
-    // jena to commonsrdf
-    public static RDFTerm fromJena(Node node) {
-        if ( node.isURI() )
-            return new JCR_IRI(node) ; 
-        if ( node.isLiteral() )
-            return new JCR_Literal(node) ;
-        if ( node.isBlank() ) {
-            return new JCR_BlankNode(node) ;
-        }
-        error("Node is not a concrete RDF Term: "+node) ;
-        return null ;
-    }
- 
-    public static Triple fromJena(org.apache.jena.graph.Triple triple) {
-        return createTriple((BlankNodeOrIRI)fromJena(triple.getSubject()),
-                            (IRI)fromJena(triple.getPredicate()),
-                            fromJena(triple.getObject())) ;
-    }
-    private static void error(String msg) {
-        System.err.println("Error: "+msg) ;
-        throw new RuntimeException(msg) ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commons/JCR_Graph.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/JCR_Graph.java b/src/main/java/org/apache/jena/commons/JCR_Graph.java
deleted file mode 100644
index 788aae7..0000000
--- a/src/main/java/org/apache/jena/commons/JCR_Graph.java
+++ /dev/null
@@ -1,112 +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.jena.commons;
-
-import static org.apache.jena.commons.JCR_Factory.toJena ;
-import static org.apache.jena.commons.JCR_Factory.fromJena ;
-
-import java.io.StringWriter ;
-import java.util.Iterator ;
-import java.util.stream.Stream ;
-
-import org.apache.commons.rdf.api.* ;
-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 {
-
-    private org.apache.jena.graph.Graph graph;
-
-    /*package*/ JCR_Graph(org.apache.jena.graph.Graph graph) {
-        this.graph = graph ;
-    }
-    
-    @Override
-    public void add(Triple triple) { graph.add(JCR_Factory.toJena(triple)); }
-
-    @Override
-    public void add(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) { 
-        graph.add(org.apache.jena.graph.Triple.create(toJena(subject),
-                                                      toJena(predicate),
-                                                      toJena(object)));
-    }
-
-    @Override
-    public boolean contains(Triple triple) {
-        return graph.contains(toJena(triple)) ; 
-    }
-
-    @Override
-    public boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        return graph.contains(toJena(subject),
-                              toJena(predicate),
-                              toJena(object) );
-    }
-
-    @Override
-    public void remove(Triple triple) { graph.delete(JCR_Factory.toJena(triple)); }
-
-    @Override
-    public void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        graph.delete(org.apache.jena.graph.Triple.create(toJena(subject),
-                                                         toJena(predicate),
-                                                         toJena(object)));
-    }
-
-    @Override
-    public void clear() { graph.clear(); }
-
-    @Override
-    public long size() {
-        return graph.size() ;
-    }
-
-    @Override
-    public Stream<? extends Triple> getTriples() {
-        return getTriples(null, null, null) ;
-    }
-
-    @Override
-    public Stream<? extends Triple> getTriples(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        Iterator<org.apache.jena.graph.Triple> iter = graph.find(toJenaAny(subject),toJenaAny(predicate),toJenaAny(object)) ;
-        Iterator<Triple> iter2 = Iter.map(iter, t-> fromJena(t)) ;
-        return Iter.asStream(iter2) ;
-                        
-    }
-
-    private Node toJenaAny(RDFTerm term) {
-        if ( term == null )
-            return Node.ANY ;
-        return 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/5c084f62/src/main/java/org/apache/jena/commons/JCR_IRI.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/JCR_IRI.java b/src/main/java/org/apache/jena/commons/JCR_IRI.java
deleted file mode 100644
index d8566a7..0000000
--- a/src/main/java/org/apache/jena/commons/JCR_IRI.java
+++ /dev/null
@@ -1,55 +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.jena.commons;
-
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.NodeFactory ;
-
-import org.apache.commons.rdf.api.* ;
-
-public class JCR_IRI extends JCR_Term implements IRI, JenaCommonsRDF {
-
-    /*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/5c084f62/src/main/java/org/apache/jena/commons/JCR_Literal.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/JCR_Literal.java b/src/main/java/org/apache/jena/commons/JCR_Literal.java
deleted file mode 100644
index 970ffe9..0000000
--- a/src/main/java/org/apache/jena/commons/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.jena.commons;
-
-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/5c084f62/src/main/java/org/apache/jena/commons/JCR_Term.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/JCR_Term.java b/src/main/java/org/apache/jena/commons/JCR_Term.java
deleted file mode 100644
index f475d3e..0000000
--- a/src/main/java/org/apache/jena/commons/JCR_Term.java
+++ /dev/null
@@ -1,50 +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.jena.commons;
-
-import org.apache.jena.graph.Node ;
-import org.apache.jena.shared.PrefixMapping ;
-import org.apache.jena.shared.impl.PrefixMappingImpl ;
-import org.apache.jena.sparql.util.FmtUtils ;
-
-class JCR_Term implements JenaCommonsRDF {
-    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() {
-        if ( node.isBlank() )
-            return "_:C"+node.getBlankNodeLabel() ;
-        return FmtUtils.stringForNode(node, empty) ;
-    }
-    
-    @Override
-    public String toString() {
-        return ntriplesString() ; 
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commons/JCR_Triple.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/JCR_Triple.java b/src/main/java/org/apache/jena/commons/JCR_Triple.java
deleted file mode 100644
index 78463d0..0000000
--- a/src/main/java/org/apache/jena/commons/JCR_Triple.java
+++ /dev/null
@@ -1,72 +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.jena.commons;
-
-import java.util.Objects ;
-
-import org.apache.commons.rdf.api.* ;
-
-public class JCR_Triple implements Triple {
-    private final BlankNodeOrIRI subject ;
-    private final IRI predicate ;
-    private final RDFTerm object ;
-
-    /* package */ JCR_Triple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-        this.subject = subject ;
-        this.predicate = predicate ;
-        this.object = object ;
-    }
-    
-    @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/5c084f62/src/main/java/org/apache/jena/commons/JenaCommonsRDF.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/JenaCommonsRDF.java b/src/main/java/org/apache/jena/commons/JenaCommonsRDF.java
deleted file mode 100644
index d8f22f4..0000000
--- a/src/main/java/org/apache/jena/commons/JenaCommonsRDF.java
+++ /dev/null
@@ -1,26 +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.jena.commons;
-
-import org.apache.jena.graph.Node ;
-
-public interface JenaCommonsRDF {
-    public Node getNode() ;
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commons/RDFTermFactoryJena.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/RDFTermFactoryJena.java b/src/main/java/org/apache/jena/commons/RDFTermFactoryJena.java
deleted file mode 100644
index e4f8ed3..0000000
--- a/src/main/java/org/apache/jena/commons/RDFTermFactoryJena.java
+++ /dev/null
@@ -1,80 +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.jena.commons;
-
-import org.apache.commons.rdf.api.* ;
-
-public class RDFTermFactoryJena implements RDFTermFactory {
-    
-    @Override
-    public BlankNode createBlankNode() {
-        return JCR_Factory.createBlankNode() ;
-    }
-
-    @Override
-    public BlankNode createBlankNode(String name) {
-        return JCR_Factory.createBlankNode(name) ;
-    }
-
-    @Override
-    public Graph createGraph() {
-        return JCR_Factory.createGraph() ;
-    }
-
-    @Override
-    public IRI createIRI(String iri) {
-        validateIRI(iri) ;
-        return JCR_Factory.createIRI(iri) ;
-    }
-
-    // Some simple validations - full IRI parsing is not cheap. 
-    private static void validateIRI(String iri) {
-        if ( iri.contains(" ") ) throw new IllegalArgumentException() ;
-        if ( iri.contains("<") ) throw new IllegalArgumentException() ;
-        if ( iri.contains(">") ) throw new IllegalArgumentException() ;
-    }
-
-    @Override
-    public Literal createLiteral(String lexicalForm) {
-        return JCR_Factory.createLiteral(lexicalForm) ;
-    }
-
-    @Override
-    public Literal createLiteral(String lexicalForm, IRI dataType) {
-        return JCR_Factory.createLiteralDT(lexicalForm, dataType.getIRIString()) ;
-    }
-
-    @Override
-    public Literal createLiteral(String lexicalForm, String languageTag) {
-        validateLang(languageTag) ;
-        return JCR_Factory.createLiteralLang(lexicalForm, languageTag) ;
-    }
-
-    private static void validateLang(String languageTag) {
-        if ( languageTag.contains(" ") ) throw new IllegalArgumentException() ;
-    }
-
-    @Override
-    public Triple createTriple(BlankNodeOrIRI subject, IRI predicate, 
-                                RDFTerm object) {
-        return JCR_Factory.createTriple(subject, predicate, object) ;
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commons/ToGraph.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commons/ToGraph.java b/src/main/java/org/apache/jena/commons/ToGraph.java
deleted file mode 100644
index 604b4f2..0000000
--- a/src/main/java/org/apache/jena/commons/ToGraph.java
+++ /dev/null
@@ -1,95 +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.jena.commons;
-
-import org.apache.commons.rdf.api.* ;
-import org.apache.jena.datatypes.xsd.XSDDatatype ;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.riot.system.StreamRDF ;
-
-public class ToGraph implements StreamRDF {
-
-    private Graph graph;
-    private RDFTermFactory factory;
-
-    public ToGraph(RDFTermFactory factory) {
-        this(factory.createGraph(), factory) ;
-    }
-
-    public ToGraph(Graph graph, RDFTermFactory factory) {
-        this.factory = factory ; 
-        this.graph = graph ;
-    }
-
-    @Override
-    public void start() {}
-
-    @Override
-    public void triple(org.apache.jena.graph.Triple triple) {
-        graph.add((BlankNodeOrIRI)fromJena(triple.getSubject()), 
-                  (IRI)fromJena(triple.getPredicate()),
-                  fromJena(triple.getObject())) ;
-    }
-
-    // jena to commonsrdf
-    public RDFTerm fromJena(Node node) {
-        if ( node.isURI() )
-            return factory.createIRI(node.getURI()) ;
-        if ( node.isLiteral() ) {
-            String lang = node.getLiteralLanguage() ;
-            if ( lang != null && lang.isEmpty() )
-                return factory.createLiteral(node.getLiteralLexicalForm(), lang) ;
-            if ( node.getLiteralDatatype().equals(XSDDatatype.XSDstring) )
-                return factory.createLiteral(node.getLiteralLexicalForm()) ;
-            IRI dt = factory.createIRI(node.getLiteralDatatype().getURI()) ;
-            return factory.createLiteral(node.getLiteralLexicalForm(), dt);
-        }
-        if ( node.isBlank() )
-            return factory.createBlankNode(node.getBlankNodeLabel()) ;
-        error("Node is not a concrete RDF Term: "+node) ;
-        return null ;
-    }
-
-    private static void error(String msg) {
-        System.err.println("Error: "+msg) ;
-        throw new RuntimeException(msg) ;
-    }
-    
-    @Override
-    public void quad(org.apache.jena.sparql.core.Quad quad) {
-        throw new UnsupportedOperationException() ;
-    }
-
-    @Override
-    public void base(String base) {}
-
-    @Override
-    public void prefix(String prefix, String iri) {}
-
-    @Override
-    public void finish() {}
-
-
-
-    public Graph getGraph() {
-        return graph;
-    }
-    
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commonsrdf/ConversionException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/ConversionException.java b/src/main/java/org/apache/jena/commonsrdf/ConversionException.java
new file mode 100644
index 0000000..8cee6b0
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/ConversionException.java
@@ -0,0 +1,29 @@
+/**
+ * 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.jena.commonsrdf;
+
+import org.apache.jena.shared.JenaException ;
+
+public class ConversionException extends JenaException {
+    public ConversionException()                                  { super(); }
+    public ConversionException(String message)                    { super(message); }
+    public ConversionException(Throwable cause)                   { super(cause) ; }
+    public ConversionException(String message, Throwable cause)   { super(message, cause) ; }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commonsrdf/JenaCommonsRDF.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/JenaCommonsRDF.java b/src/main/java/org/apache/jena/commonsrdf/JenaCommonsRDF.java
new file mode 100644
index 0000000..7578505
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/JenaCommonsRDF.java
@@ -0,0 +1,154 @@
+/**
+ * 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.jena.commonsrdf;
+
+import org.apache.commons.rdf.api.* ;
+import org.apache.jena.atlas.lib.NotImplemented ;
+import org.apache.jena.commonsrdf.impl.* ;
+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.system.StreamRDF ;
+import org.apache.jena.sparql.graph.GraphFactory ;
+
+/** A set of utilities for moving between CommonsRDF and Jena
+ * The {@code RDFTermFactory} is {@link RDFTermFactoryJena} for
+ * creating CommonsRDF objects backed by Jena.   
+
+ * This class encapsulates moving between existing object (RDFTerms, Triples, Graphs)
+ * if necessary.   
+ * 
+ *  @see RDFTermFactoryJena
+ */
+public class JenaCommonsRDF {
+
+    /** Convert a CommonsRDF RDFTerm to a Jena Node.
+     * If the RDFTerm was from Jena originally, return that original object else
+     * create a copy using Jena objects. 
+     */
+    public static Node toJena(RDFTerm term) {
+        if ( term instanceof JenaNode )
+            return ((JenaNode)term).getNode() ;
+        
+        if ( term instanceof IRI ) 
+            return NodeFactory.createURI(((IRI)term).getIRIString()) ;
+        
+        if ( term instanceof Literal ) {
+            Literal lit = (Literal)term ; 
+            RDFDatatype dt = NodeFactory.getType(lit.getDatatype().getIRIString()) ;
+            String lang = lit.getLanguageTag().orElse("") ;
+            return NodeFactory.createLiteral(lit.getLexicalForm(), lang, dt) ; 
+        }
+        
+        if ( term instanceof BlankNode ) {
+            String id = ((BlankNode)term).uniqueReference() ;
+            return NodeFactory.createBlankNode(id) ;
+        }
+        conversionError("Not a concrete RDF Term: "+term) ;
+        return null ;
+    }
+
+    /** Convert a CommonsRDF Triple to a Jena Triple.
+     * If the Triple was from Jena originally, return that original object else
+     * create a copy using Jena objects. 
+     */
+    public static org.apache.jena.graph.Triple toJena(Triple triple) {
+        if ( triple instanceof JenaTriple )
+            return ((JenaTriple)triple).getTriple() ;
+        return new org.apache.jena.graph.Triple(toJena(triple.getSubject()), toJena(triple.getPredicate()), toJena(triple.getObject()) ) ;   
+    }
+
+    /** Convert a CommonsRDF Graph to a Jena Graph.
+     * If the Graph was from Jena originally, return that original object else
+     * create a copy using Jena objects. 
+     */
+    public static org.apache.jena.graph.Graph toJena(Graph graph) {
+        if ( graph instanceof JenaGraph )
+            return ((JenaGraph)graph).getGraph() ;
+        org.apache.jena.graph.Graph g = GraphFactory.createGraphMem() ;
+        graph.getTriples().forEach(t->g.add(toJena(t))) ; 
+        return g ;   
+    }
+
+    /** Adapt an existing Jena Node to CommonsRDF. */
+    public static RDFTerm fromJena( Node node) {
+        return JCR_Factory.fromJena(node) ;
+    }
+
+    /** Adapt an existing Jena Triple to CommonsRDF. */
+    public static Triple fromJena(org.apache.jena.graph.Triple triple) {
+        return JCR_Factory.fromJena(triple) ;
+    }
+
+    /** Adapt an existring Jena Graph to CommonsRDF.  This does not take a copy. */  
+    public static Graph fromJena(org.apache.jena.graph.Graph graph) {
+        return JCR_Factory.fromJena(graph) ;
+    }
+
+    /** Convert from Jena to any RDFCommons implementation */
+    public static RDFTerm fromJena(RDFTermFactory factory, Node node) {
+        if ( node.isURI() )
+            return factory.createIRI(node.getURI()) ;
+        if ( node.isLiteral() ) {
+            String lang = node.getLiteralLanguage() ;
+            if ( lang != null && lang.isEmpty() )
+                return factory.createLiteral(node.getLiteralLexicalForm(), lang) ;
+            if ( node.getLiteralDatatype().equals(XSDDatatype.XSDstring) )
+                return factory.createLiteral(node.getLiteralLexicalForm()) ;
+            IRI dt = factory.createIRI(node.getLiteralDatatype().getURI()) ;
+            return factory.createLiteral(node.getLiteralLexicalForm(), dt);
+        }
+        if ( node.isBlank() )
+            return factory.createBlankNode(node.getBlankNodeLabel()) ;
+        //error("Node is not a concrete RDF Term: "+node) ;
+        return null ;
+    }
+
+    /** Convert from Jena to any RDFCommons implementation */
+   public static Triple fromJena(RDFTermFactory factory, org.apache.jena.graph.Triple triple) {
+        BlankNodeOrIRI subject = (BlankNodeOrIRI)(fromJena(factory, triple.getSubject())) ;
+        IRI predicate = (IRI)(fromJena(factory, triple.getSubject())) ;
+        RDFTerm object = fromJena(factory, triple.getSubject()) ;
+        return factory.createTriple(subject, predicate, object) ;
+    }
+
+   /** Convert from Jena to any RDFCommons implementation */
+   public static Graph fromJena(RDFTermFactory factory, org.apache.jena.graph.Graph graph) {
+       if ( factory instanceof RDFTermFactoryJena ) 
+           return JCR_Factory.fromJena(graph) ;
+       throw new NotImplemented() ;
+    //        /return JCR_Factory.fromJena(factory, graph) ;
+   }
+
+   /** Convert from Jena to any RDFCommons implementation */
+   public static StreamRDF streamJenaToCommonsRDF(RDFTermFactory factory, Graph graph) {
+       return new ToGraph(factory, graph) ;
+   }
+
+   /** Convert from Jena to any RDFCommons implementation */
+   public static StreamRDF steramJenaToCommonsRDF(Graph graph) {
+       return streamJenaToCommonsRDF(new RDFTermFactoryJena(), graph) ;
+   }
+
+   public static void conversionError(String msg) {
+        throw new ConversionException(msg) ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commonsrdf/RDFTermFactoryJena.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/RDFTermFactoryJena.java b/src/main/java/org/apache/jena/commonsrdf/RDFTermFactoryJena.java
new file mode 100644
index 0000000..d5afca6
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/RDFTermFactoryJena.java
@@ -0,0 +1,83 @@
+/**
+ * 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.jena.commonsrdf;
+
+import org.apache.commons.rdf.api.* ;
+import org.apache.jena.commonsrdf.impl.JCR_Factory ;
+
+/** RDFTermFactory with Jena-backed objects.
+ *  See {@link JenaCommonsRDF} for other conversions of existing objects. 
+ */
+public class RDFTermFactoryJena implements RDFTermFactory {
+    
+    @Override
+    public BlankNode createBlankNode() {
+        return JCR_Factory.createBlankNode() ;
+    }
+
+    @Override
+    public BlankNode createBlankNode(String name) {
+        return JCR_Factory.createBlankNode(name) ;
+    }
+
+    @Override
+    public Graph createGraph() {
+        return JCR_Factory.createGraph() ;
+    }
+
+    @Override
+    public IRI createIRI(String iri) {
+        validateIRI(iri) ;
+        return JCR_Factory.createIRI(iri) ;
+    }
+
+    // Some simple validations - full IRI parsing is not cheap. 
+    private static void validateIRI(String iri) {
+        if ( iri.contains(" ") ) throw new IllegalArgumentException() ;
+        if ( iri.contains("<") ) throw new IllegalArgumentException() ;
+        if ( iri.contains(">") ) throw new IllegalArgumentException() ;
+    }
+
+    @Override
+    public Literal createLiteral(String lexicalForm) {
+        return JCR_Factory.createLiteral(lexicalForm) ;
+    }
+
+    @Override
+    public Literal createLiteral(String lexicalForm, IRI dataType) {
+        return JCR_Factory.createLiteralDT(lexicalForm, dataType.getIRIString()) ;
+    }
+
+    @Override
+    public Literal createLiteral(String lexicalForm, String languageTag) {
+        validateLang(languageTag) ;
+        return JCR_Factory.createLiteralLang(lexicalForm, languageTag) ;
+    }
+
+    private static void validateLang(String languageTag) {
+        if ( languageTag.contains(" ") ) throw new IllegalArgumentException() ;
+    }
+
+    @Override
+    public Triple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        return JCR_Factory.createTriple(subject, predicate, object) ;
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commonsrdf/examples/Example1.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/examples/Example1.java b/src/main/java/org/apache/jena/commonsrdf/examples/Example1.java
new file mode 100644
index 0000000..b55313d
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/examples/Example1.java
@@ -0,0 +1,61 @@
+/**
+ * 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.jena.commonsrdf;
+
+import org.apache.commons.rdf.api.Graph ;
+import org.apache.commons.rdf.api.RDFTermFactory ;
+import org.apache.jena.atlas.logging.LogCtl ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.riot.system.StreamRDF ;
+import org.apache.jena.sparql.graph.GraphFactory ;
+
+/** Short examples */
+public class Example1 {
+    static { LogCtl.setCmdLogging(); }
+    
+    public static void main(String ...a) {
+        jenaGraphToCommonsRDFGraph() ;
+    }
+    
+    public static void jenaGraphToCommonsRDFGraph() {
+        org.apache.jena.graph.Graph jGraph = GraphFactory.createGraphMem() ;
+        RDFDataMgr.read(jGraph, "D.ttl") ;
+        
+        Graph graph = JenaCommonsRDF.fromJena(jGraph) ;
+        
+        
+        // Add to CommonsRDF Graph
+        RDFTermFactory rft = new RDFTermFactoryJena() ;
+        graph.add(rft.createIRI("http://example/s2"),
+                  rft.createIRI("http://example/p2"),
+                  rft.createLiteral("foo")) ;
+        graph.getTriples().forEach(System.out::println) ;
+    }
+
+    public static void parseIntoCommonsRDFGraph() {
+        RDFTermFactory rft = new RDFTermFactoryJena() ;
+        Graph graph = rft.createGraph() ;
+        StreamRDF dest = JenaCommonsRDF.streamJenaToCommonsRDF(rft, graph) ;
+        RDFDataMgr.parse(dest, "D.ttl") ;
+        graph.getTriples().forEach(System.out::println) ;
+    }
+
+    
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/JCR_BlankNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JCR_BlankNode.java b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_BlankNode.java
new file mode 100644
index 0000000..ef11a0e
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_BlankNode.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.jena.commonsrdf.impl;
+
+import org.apache.commons.rdf.api.BlankNode ;
+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/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Factory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Factory.java b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Factory.java
new file mode 100644
index 0000000..e1c2b52
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Factory.java
@@ -0,0 +1,86 @@
+/**
+ * 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.jena.commonsrdf.impl;
+import static org.apache.jena.commonsrdf.JenaCommonsRDF.conversionError;
+
+import org.apache.commons.rdf.api.* ;
+import org.apache.jena.commonsrdf.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 ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Graph.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Graph.java b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Graph.java
new file mode 100644
index 0000000..ef043e4
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Graph.java
@@ -0,0 +1,115 @@
+/**
+ * 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.jena.commonsrdf.impl;
+
+import java.io.StringWriter ;
+import java.util.Iterator ;
+import java.util.stream.Stream ;
+
+import org.apache.commons.rdf.api.* ;
+import org.apache.jena.atlas.iterator.Iter ;
+import org.apache.jena.commonsrdf.JenaCommonsRDF ;
+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> getTriples() {
+        return getTriples(null, null, null) ;
+    }
+
+    @Override
+    public Stream<? extends Triple> getTriples(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+        Iterator<org.apache.jena.graph.Triple> iter = graph.find(toJenaAny(subject),toJenaAny(predicate),toJenaAny(object)) ;
+        Iterator<Triple> iter2 = Iter.map(iter, t-> JenaCommonsRDF.fromJena(t)) ;
+        return Iter.asStream(iter2) ;
+                        
+    }
+
+    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/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/JCR_IRI.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JCR_IRI.java b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_IRI.java
new file mode 100644
index 0000000..888169e
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_IRI.java
@@ -0,0 +1,55 @@
+/**
+ * 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.jena.commonsrdf.impl;
+
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.NodeFactory ;
+
+import org.apache.commons.rdf.api.* ;
+
+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/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Literal.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Literal.java b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Literal.java
new file mode 100644
index 0000000..97284c9
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Literal.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.jena.commonsrdf.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/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java
new file mode 100644
index 0000000..9b897dd
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java
@@ -0,0 +1,51 @@
+/**
+ * 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.jena.commonsrdf.impl;
+
+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 ;
+import org.apache.jena.sparql.util.FmtUtils ;
+
+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() {
+        if ( node.isBlank() )
+            return "_:C"+NodeFmtLib.encodeBNodeLabel(node.getBlankNodeLabel()) ;
+        return FmtUtils.stringForNode(node, empty) ;
+    }
+    
+    @Override
+    public String toString() {
+        return ntriplesString() ; 
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Triple.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Triple.java b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Triple.java
new file mode 100644
index 0000000..88c36bc
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Triple.java
@@ -0,0 +1,88 @@
+/**
+ * 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.jena.commonsrdf.impl;
+
+import java.util.Objects ;
+
+import org.apache.commons.rdf.api.* ;
+import org.apache.jena.commonsrdf.JenaCommonsRDF ;
+
+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/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/JenaGraph.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JenaGraph.java b/src/main/java/org/apache/jena/commonsrdf/impl/JenaGraph.java
new file mode 100644
index 0000000..fd0ab3b
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JenaGraph.java
@@ -0,0 +1,26 @@
+/**
+ * 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.jena.commonsrdf.impl;
+
+import org.apache.jena.graph.Graph ;
+
+/** Access the Jena graph backing this object */ 
+public interface JenaGraph {
+    public Graph getGraph() ;
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/JenaNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JenaNode.java b/src/main/java/org/apache/jena/commonsrdf/impl/JenaNode.java
new file mode 100644
index 0000000..b1148e1
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JenaNode.java
@@ -0,0 +1,26 @@
+/**
+ * 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.jena.commonsrdf.impl;
+
+import org.apache.jena.graph.Node ;
+
+/** Access the Jena node backing this object */ 
+public interface JenaNode {
+    public Node getNode() ;
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/JenaTriple.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/JenaTriple.java b/src/main/java/org/apache/jena/commonsrdf/impl/JenaTriple.java
new file mode 100644
index 0000000..0b3ef6f
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/JenaTriple.java
@@ -0,0 +1,26 @@
+/**
+ * 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.jena.commonsrdf.impl;
+
+import org.apache.jena.graph.Triple ;
+
+/** Access the Jena triple backing this object */ 
+public interface JenaTriple {
+    public Triple getTriple() ;
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/main/java/org/apache/jena/commonsrdf/impl/ToGraph.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/jena/commonsrdf/impl/ToGraph.java b/src/main/java/org/apache/jena/commonsrdf/impl/ToGraph.java
new file mode 100644
index 0000000..eb16773
--- /dev/null
+++ b/src/main/java/org/apache/jena/commonsrdf/impl/ToGraph.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.jena.commonsrdf.impl;
+
+import org.apache.commons.rdf.api.Graph ;
+import org.apache.commons.rdf.api.RDFTermFactory ;
+import org.apache.jena.commonsrdf.JenaCommonsRDF ;
+import org.apache.jena.riot.system.StreamRDF ;
+
+/** Adapter to go from Jena StreamRDF (e.g. a parser output stream) to a CommonsRDF Graph */
+public class ToGraph implements StreamRDF {
+
+    private Graph graph;
+    private RDFTermFactory factory;
+
+    public ToGraph(RDFTermFactory factory) {
+        this(factory, factory.createGraph()) ;
+    }
+
+    public ToGraph(RDFTermFactory factory, Graph graph) {
+        this.factory = factory ; 
+        this.graph = graph ;
+    }
+
+    @Override
+    public void start() {}
+
+    @Override
+    public void triple(org.apache.jena.graph.Triple triple) {
+        graph.add(JenaCommonsRDF.fromJena(factory, triple)) ;
+    }
+
+    @Override
+    public void quad(org.apache.jena.sparql.core.Quad quad) {
+        throw new UnsupportedOperationException() ;
+    }
+
+    @Override
+    public void base(String base) {}
+
+    @Override
+    public void prefix(String prefix, String iri) {}
+
+    @Override
+    public void finish() {}
+
+    public Graph getGraph() {
+        return graph;
+    }
+    
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/test/java/org/apache/jena/commons/TestBlankNodeJena.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/jena/commons/TestBlankNodeJena.java b/src/test/java/org/apache/jena/commons/TestBlankNodeJena.java
deleted file mode 100644
index 117a352..0000000
--- a/src/test/java/org/apache/jena/commons/TestBlankNodeJena.java
+++ /dev/null
@@ -1,35 +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.jena.commons;
-
-import org.apache.commons.rdf.api.AbstractBlankNodeTest ;
-import org.apache.commons.rdf.api.BlankNode ;
-
-public class TestBlankNodeJena extends AbstractBlankNodeTest {
-    @Override
-    protected BlankNode getBlankNode() {
-        return JCR_Factory.createBlankNode() ;
-    }
-    
-    @Override
-    protected BlankNode getBlankNode(String identifier) {
-        return JCR_Factory.createBlankNode(identifier) ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/test/java/org/apache/jena/commons/TestGraphJena.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/jena/commons/TestGraphJena.java b/src/test/java/org/apache/jena/commons/TestGraphJena.java
deleted file mode 100644
index 66df1d0..0000000
--- a/src/test/java/org/apache/jena/commons/TestGraphJena.java
+++ /dev/null
@@ -1,32 +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.jena.commons;
-
-import org.apache.commons.rdf.api.AbstractGraphTest ;
-import org.apache.commons.rdf.api.RDFTermFactory ;
-
-public class TestGraphJena extends AbstractGraphTest {
-
-    @Override
-    public RDFTermFactory createFactory() {
-        return new RDFTermFactoryJena() ;
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/test/java/org/apache/jena/commons/TestRDFTermFactoryJena.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/jena/commons/TestRDFTermFactoryJena.java b/src/test/java/org/apache/jena/commons/TestRDFTermFactoryJena.java
deleted file mode 100644
index c65bbc9..0000000
--- a/src/test/java/org/apache/jena/commons/TestRDFTermFactoryJena.java
+++ /dev/null
@@ -1,32 +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.jena.commons;
-
-import org.apache.commons.rdf.api.AbstractRDFTermFactoryTest ;
-import org.apache.commons.rdf.api.RDFTermFactory ;
-
-public class TestRDFTermFactoryJena extends AbstractRDFTermFactoryTest {
-
-    @Override
-    public RDFTermFactory createFactory() {
-        return new RDFTermFactoryJena() ;
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/test/java/org/apache/jena/commonsrdf/TestBlankNodeJena.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/jena/commonsrdf/TestBlankNodeJena.java b/src/test/java/org/apache/jena/commonsrdf/TestBlankNodeJena.java
new file mode 100644
index 0000000..117a352
--- /dev/null
+++ b/src/test/java/org/apache/jena/commonsrdf/TestBlankNodeJena.java
@@ -0,0 +1,35 @@
+/**
+ * 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.jena.commons;
+
+import org.apache.commons.rdf.api.AbstractBlankNodeTest ;
+import org.apache.commons.rdf.api.BlankNode ;
+
+public class TestBlankNodeJena extends AbstractBlankNodeTest {
+    @Override
+    protected BlankNode getBlankNode() {
+        return JCR_Factory.createBlankNode() ;
+    }
+    
+    @Override
+    protected BlankNode getBlankNode(String identifier) {
+        return JCR_Factory.createBlankNode(identifier) ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/test/java/org/apache/jena/commonsrdf/TestGraphJena.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/jena/commonsrdf/TestGraphJena.java b/src/test/java/org/apache/jena/commonsrdf/TestGraphJena.java
new file mode 100644
index 0000000..66df1d0
--- /dev/null
+++ b/src/test/java/org/apache/jena/commonsrdf/TestGraphJena.java
@@ -0,0 +1,32 @@
+/**
+ * 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.jena.commons;
+
+import org.apache.commons.rdf.api.AbstractGraphTest ;
+import org.apache.commons.rdf.api.RDFTermFactory ;
+
+public class TestGraphJena extends AbstractGraphTest {
+
+    @Override
+    public RDFTermFactory createFactory() {
+        return new RDFTermFactoryJena() ;
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5c084f62/src/test/java/org/apache/jena/commonsrdf/TestRDFTermFactoryJena.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/jena/commonsrdf/TestRDFTermFactoryJena.java b/src/test/java/org/apache/jena/commonsrdf/TestRDFTermFactoryJena.java
new file mode 100644
index 0000000..c65bbc9
--- /dev/null
+++ b/src/test/java/org/apache/jena/commonsrdf/TestRDFTermFactoryJena.java
@@ -0,0 +1,32 @@
+/**
+ * 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.jena.commons;
+
+import org.apache.commons.rdf.api.AbstractRDFTermFactoryTest ;
+import org.apache.commons.rdf.api.RDFTermFactory ;
+
+public class TestRDFTermFactoryJena extends AbstractRDFTermFactoryTest {
+
+    @Override
+    public RDFTermFactory createFactory() {
+        return new RDFTermFactoryJena() ;
+    }
+
+}
+



Mime
View raw message