You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commonsrdf.apache.org by st...@apache.org on 2016/07/02 16:14:36 UTC
[19/50] [abbrv] incubator-commonsrdf git commit: Move to jena/*
Move to jena/*
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/5838bf5d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/5838bf5d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/5838bf5d
Branch: refs/heads/jena
Commit: 5838bf5d4cbb40e0c01aea2bf795b3aeb7dd9bb3
Parents: 9486009
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Mon Mar 28 02:22:08 2016 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Mon Mar 28 02:22:08 2016 +0100
----------------------------------------------------------------------
.gitignore | 28 ---
CONTRIBUTING.md | 7 -
D.ttl | 4 -
LICENSE | 201 -------------------
README.md | 14 --
jena/.classpath | 36 ++++
jena/.project | 23 +++
jena/.settings/org.eclipse.core.resources.prefs | 6 +
jena/.settings/org.eclipse.jdt.core.prefs | 5 +
jena/.settings/org.eclipse.m2e.core.prefs | 4 +
jena/D.ttl | 4 +
jena/README.md | 14 ++
jena/commit.txt | 10 +
jena/pom-old.xml | 83 ++++++++
.../jena/commonsrdf/ConversionException.java | 37 ++++
.../apache/jena/commonsrdf/JenaCommonsRDF.java | 154 ++++++++++++++
.../jena/commonsrdf/RDFTermFactoryJena.java | 85 ++++++++
.../examples/Ex_JenaGraphToCommonsRDFGraph.java | 54 +++++
.../examples/Ex_ParseIntoCommonsRDFGraph.java | 52 +++++
.../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 | 48 +++++
.../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 +++++++
.../jena/commonsrdf/TS_JenaCommonsRDF.java | 41 ++++
.../jena/commonsrdf/TestBlankNodeJena.java | 36 ++++
.../apache/jena/commonsrdf/TestGraphJena.java | 33 +++
.../jena/commonsrdf/TestRDFTermFactoryJena.java | 33 +++
jena/src/test/resources/log4j.properties | 18 ++
jena/target/classes/META-INF/MANIFEST.MF | 18 ++
.../commons-rdf-jena/pom.properties | 7 +
.../org.apache.commons/commons-rdf-jena/pom.xml | 61 ++++++
pom.xml | 83 --------
.../jena/commonsrdf/ConversionException.java | 37 ----
.../apache/jena/commonsrdf/JenaCommonsRDF.java | 154 --------------
.../jena/commonsrdf/RDFTermFactoryJena.java | 85 --------
.../examples/Ex_JenaGraphToCommonsRDFGraph.java | 54 -----
.../examples/Ex_ParseIntoCommonsRDFGraph.java | 52 -----
.../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 | 48 -----
.../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 -------
.../jena/commonsrdf/TS_JenaCommonsRDF.java | 41 ----
.../jena/commonsrdf/TestBlankNodeJena.java | 36 ----
.../apache/jena/commonsrdf/TestGraphJena.java | 33 ---
.../jena/commonsrdf/TestRDFTermFactoryJena.java | 33 ---
src/test/resources/log4j.properties | 18 --
60 files changed, 1467 insertions(+), 1533 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index fc05569..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,28 +0,0 @@
-# Maven and build files
-target/
-
-# Eclipse
-.classpath
-.project
-.settings
-.recommenders
-.metadata
-
-# Idea IntelliJ
-*.ipr
-*.iws
-*.iml
-.idea/
-
-# Caches
-.scala_dependencies
-
-# Other
-.DS_Store
-*.jar
-
-# Backups
-pom.xml.backup
-*~
-.#*
-\#*
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 4e03fb2..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Contributions to this project will be gratefully received.
-
-The work of this project may be contributed to the Apache Software Foundation.
-
-Contributors may be asked to sign a Apache Software Grant
-
-[http://www.apache.org/licenses/software-grant.txt](http://www.apache.org/licenses/software-grant.txt)
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/D.ttl
----------------------------------------------------------------------
diff --git a/D.ttl b/D.ttl
deleted file mode 100644
index d37081c..0000000
--- a/D.ttl
+++ /dev/null
@@ -1,4 +0,0 @@
-prefix : <http://example/>
-
-:s :p 123 .
-[ :p1 [ :q "r"@en ] ] .
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index ad410e1..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed 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.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
deleted file mode 100644
index f5d6277..0000000
--- a/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# commonsrdf-jena
-
-Code showing using [Apache CommonsRDF](http://commonsrdf.incubator.apache.org/)
-with [Apache Jena](http://jena.apache.org/).
-
-`package org.apache.jena.commonsrdf.examples`
-
-* `Ex_ParseIntoCommonsRDFGraph`
-
-Shows how to use Jena parsers to stream parser output into any CommonsRDF graph.
-
-* `Ex_JenaGraphToCommonsRDFGraph`
-
-Shows wrapping existing Jena data to use with CommonsRDF so you can inject Jena-backed RDF into a general CommonsRDF algorithm and see the results in Jena later.
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/.classpath
----------------------------------------------------------------------
diff --git a/jena/.classpath b/jena/.classpath
new file mode 100644
index 0000000..fae1a2b
--- /dev/null
+++ b/jena/.classpath
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/.project
----------------------------------------------------------------------
diff --git a/jena/.project b/jena/.project
new file mode 100644
index 0000000..3671af8
--- /dev/null
+++ b/jena/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>commons-rdf-jena</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/jena/.settings/org.eclipse.core.resources.prefs b/jena/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..29abf99
--- /dev/null
+++ b/jena/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding/<project>=UTF-8
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/jena/.settings/org.eclipse.jdt.core.prefs b/jena/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..714351a
--- /dev/null
+++ b/jena/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/jena/.settings/org.eclipse.m2e.core.prefs b/jena/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/jena/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/D.ttl
----------------------------------------------------------------------
diff --git a/jena/D.ttl b/jena/D.ttl
new file mode 100644
index 0000000..d37081c
--- /dev/null
+++ b/jena/D.ttl
@@ -0,0 +1,4 @@
+prefix : <http://example/>
+
+:s :p 123 .
+[ :p1 [ :q "r"@en ] ] .
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/README.md
----------------------------------------------------------------------
diff --git a/jena/README.md b/jena/README.md
new file mode 100644
index 0000000..f5d6277
--- /dev/null
+++ b/jena/README.md
@@ -0,0 +1,14 @@
+# commonsrdf-jena
+
+Code showing using [Apache CommonsRDF](http://commonsrdf.incubator.apache.org/)
+with [Apache Jena](http://jena.apache.org/).
+
+`package org.apache.jena.commonsrdf.examples`
+
+* `Ex_ParseIntoCommonsRDFGraph`
+
+Shows how to use Jena parsers to stream parser output into any CommonsRDF graph.
+
+* `Ex_JenaGraphToCommonsRDFGraph`
+
+Shows wrapping existing Jena data to use with CommonsRDF so you can inject Jena-backed RDF into a general CommonsRDF algorithm and see the results in Jena later.
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/commit.txt
----------------------------------------------------------------------
diff --git a/jena/commit.txt b/jena/commit.txt
new file mode 100644
index 0000000..16b0565
--- /dev/null
+++ b/jena/commit.txt
@@ -0,0 +1,10 @@
+ Merge branch 'asf-jena' into jena
+
+ Imported from https://github.com/afs/commonsrdf-jena
+ by Andy Seaborne <as...@apache.org>
+
+ Code already had ASF headers including:
+
+ > Licensed to the Apache Software Foundation (ASF)
+
+ .. but perhaps an IP clearance is needed anyway?
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/pom-old.xml
----------------------------------------------------------------------
diff --git a/jena/pom-old.xml b/jena/pom-old.xml
new file mode 100644
index 0000000..3411597
--- /dev/null
+++ b/jena/pom-old.xml
@@ -0,0 +1,83 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.seaborne</groupId>
+ <artifactId>commonsrdf-jena</artifactId>
+ <version>0.0.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>commonsrdf-jena</name>
+ <description>Commons Java library for RDF 1.1</description>
+
+ <inceptionYear>2014</inceptionYear>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <ver.commonsrdf>0.2.0-incubating-SNAPSHOT</ver.commonsrdf>
+ <ver.jena>3.0.1</ver.jena>
+ </properties>
+
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.jena</groupId>
+ <artifactId>apache-jena-libs</artifactId>
+ <version>${ver.jena}</version>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-rdf-api</artifactId>
+ <version>${ver.commonsrdf}</version>
+ </dependency>
+
+ <!-- Used for testing and examples -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-rdf-simple</artifactId>
+ <version>${ver.commonsrdf}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-rdf-api</artifactId>
+ <version>${ver.commonsrdf}</version>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/ConversionException.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/ConversionException.java b/jena/src/main/java/org/apache/jena/commonsrdf/ConversionException.java
new file mode 100644
index 0000000..65cc04a
--- /dev/null
+++ b/jena/src/main/java/org/apache/jena/commonsrdf/ConversionException.java
@@ -0,0 +1,37 @@
+/**
+ * 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 ;
+
+/**
+ * Exception thrown when a problem arises across the Jena-CommonRDF boundary.
+ * This should not happen in well-formed RDF data but, for example, Jena triples
+ * allow
+ * <a href="http://www.w3.org/TR/rdf11-concepts/#section-generalized-rdf"
+ * >generalized RDF</a>.
+ */
+
+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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/JenaCommonsRDF.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/JenaCommonsRDF.java b/jena/src/main/java/org/apache/jena/commonsrdf/JenaCommonsRDF.java
new file mode 100644
index 0000000..1b24560
--- /dev/null
+++ b/jena/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.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 {@link RDFTermFactory} for is {@link RDFTermFactoryJena} which
+ * creates CommonsRDF objects backed by Jena.
+ * <p>
+ * This class encapsulates moving between existing object (RDFTerms, Triples, Graphs)
+ * which is usually necessary when working with existing data.
+ *
+ * @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 {@link RDFTerm}. */
+ public static RDFTerm fromJena( Node node) {
+ return JCR_Factory.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) ;
+ }
+
+ /** Adapt an existring Jena Graph to CommonsRDF {@link Graph}.
+ * This does not take a copy.
+ * 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) ;
+ }
+
+ /** Convert from Jena {@link Node} 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()) ;
+ throw new ConversionException("Node is not a concrete RDF Term: "+node) ;
+ }
+
+ /** Convert from Jena {@link org.apache.jena.graph.Triple} 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.getPredicate())) ;
+ RDFTerm object = fromJena(factory, triple.getObject()) ;
+ return factory.createTriple(subject, predicate, object) ;
+ }
+
+ /** Convert from Jena to any RDFCommons implementation.
+ * This is a copy, even if the factory is a RDFTermFactoryJena.
+ * Use {@link #fromJena(org.apache.jena.graph.Graph)} for a wrapper.
+ */
+ public static Graph fromJena(RDFTermFactory factory, org.apache.jena.graph.Graph graph) {
+ Graph g = factory.createGraph() ;
+ graph.find(Node.ANY, Node.ANY, Node.ANY).forEachRemaining( t-> {
+ g.add(fromJena(factory, t) );
+ }) ;
+ return g ;
+ }
+
+ /** Create a {@link StreamRDF} that inserts into any RDFCommons implementation of Graph */
+ public static StreamRDF streamJenaToCommonsRDF(RDFTermFactory factory, Graph graph) {
+ return new ToGraph(factory, graph) ;
+ }
+
+ public static void conversionError(String msg) {
+ throw new ConversionException(msg) ;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/RDFTermFactoryJena.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/RDFTermFactoryJena.java b/jena/src/main/java/org/apache/jena/commonsrdf/RDFTermFactoryJena.java
new file mode 100644
index 0000000..d9d577a
--- /dev/null
+++ b/jena/src/main/java/org/apache/jena/commonsrdf/RDFTermFactoryJena.java
@@ -0,0 +1,85 @@
+/**
+ * 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.
+ *
+ * @see RDFTermFactory
+ */
+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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/examples/Ex_JenaGraphToCommonsRDFGraph.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/examples/Ex_JenaGraphToCommonsRDFGraph.java b/jena/src/main/java/org/apache/jena/commonsrdf/examples/Ex_JenaGraphToCommonsRDFGraph.java
new file mode 100644
index 0000000..ceeeb53
--- /dev/null
+++ b/jena/src/main/java/org/apache/jena/commonsrdf/examples/Ex_JenaGraphToCommonsRDFGraph.java
@@ -0,0 +1,54 @@
+/**
+ * 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.examples;
+
+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.commonsrdf.JenaCommonsRDF ;
+import org.apache.jena.commonsrdf.RDFTermFactoryJena ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.sparql.graph.GraphFactory ;
+
+/** Adapt a Jena Graph after parsing data into it */
+public class Ex_JenaGraphToCommonsRDFGraph {
+ static { LogCtl.setCmdLogging(); }
+
+ public static void main(String ...a) {
+ org.apache.jena.graph.Graph jGraph = GraphFactory.createGraphMem() ;
+ RDFDataMgr.read(jGraph, "D.ttl") ;
+
+ // "graph" is a CommonsRDF graph
+ 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")) ;
+ System.out.println("==== Write CommonsRDF graph\n") ;
+ graph.getTriples().forEach(System.out::println) ;
+
+ System.out.println("\n==== Write Jena graph directly\n") ;
+ // And its in the Jena graph
+ RDFDataMgr.write(System.out, jGraph, Lang.TTL) ;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/examples/Ex_ParseIntoCommonsRDFGraph.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/examples/Ex_ParseIntoCommonsRDFGraph.java b/jena/src/main/java/org/apache/jena/commonsrdf/examples/Ex_ParseIntoCommonsRDFGraph.java
new file mode 100644
index 0000000..cb77289
--- /dev/null
+++ b/jena/src/main/java/org/apache/jena/commonsrdf/examples/Ex_ParseIntoCommonsRDFGraph.java
@@ -0,0 +1,52 @@
+/**
+ * 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.examples;
+
+import org.apache.commons.rdf.api.Graph ;
+import org.apache.commons.rdf.api.RDFTermFactory ;
+import org.apache.commons.rdf.simple.SimpleRDFTermFactory ;
+import org.apache.jena.atlas.logging.LogCtl ;
+import org.apache.jena.commonsrdf.JenaCommonsRDF ;
+import org.apache.jena.commonsrdf.RDFTermFactoryJena ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.riot.system.StreamRDF ;
+
+/** Use jena to parse data into an CommonsRDF graph */
+public class Ex_ParseIntoCommonsRDFGraph {
+ static { LogCtl.setCmdLogging(); }
+
+ public static void main(String ...a) {
+ System.out.println("== RDFTermFactoryJena") ;
+ RDFTermFactory rft1 = new RDFTermFactoryJena() ; // This can be a non-Jena backed factory
+ parse(rft1) ;
+ System.out.println() ;
+ System.out.println("== SimpleRDFTermFactory") ;
+ RDFTermFactory rft2 = new SimpleRDFTermFactory() ;
+ parse(rft2) ;
+ }
+
+ public static void parse(RDFTermFactory rft) {
+ 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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_BlankNode.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_BlankNode.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_BlankNode.java
new file mode 100644
index 0000000..ef11a0e
--- /dev/null
+++ b/jena/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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Factory.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Factory.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Factory.java
new file mode 100644
index 0000000..e1c2b52
--- /dev/null
+++ b/jena/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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Graph.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Graph.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Graph.java
new file mode 100644
index 0000000..ef043e4
--- /dev/null
+++ b/jena/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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_IRI.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_IRI.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_IRI.java
new file mode 100644
index 0000000..888169e
--- /dev/null
+++ b/jena/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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Literal.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Literal.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Literal.java
new file mode 100644
index 0000000..97284c9
--- /dev/null
+++ b/jena/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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.java
new file mode 100644
index 0000000..f2f27ec
--- /dev/null
+++ b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Term.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.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 ;
+
+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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Triple.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Triple.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JCR_Triple.java
new file mode 100644
index 0000000..88c36bc
--- /dev/null
+++ b/jena/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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/JenaGraph.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/JenaGraph.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JenaGraph.java
new file mode 100644
index 0000000..fd0ab3b
--- /dev/null
+++ b/jena/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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/JenaNode.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/JenaNode.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JenaNode.java
new file mode 100644
index 0000000..b1148e1
--- /dev/null
+++ b/jena/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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/JenaTriple.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/JenaTriple.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/JenaTriple.java
new file mode 100644
index 0000000..0b3ef6f
--- /dev/null
+++ b/jena/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/5838bf5d/jena/src/main/java/org/apache/jena/commonsrdf/impl/ToGraph.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/jena/commonsrdf/impl/ToGraph.java b/jena/src/main/java/org/apache/jena/commonsrdf/impl/ToGraph.java
new file mode 100644
index 0000000..eb16773
--- /dev/null
+++ b/jena/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/5838bf5d/jena/src/test/java/org/apache/jena/commonsrdf/TS_JenaCommonsRDF.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/jena/commonsrdf/TS_JenaCommonsRDF.java b/jena/src/test/java/org/apache/jena/commonsrdf/TS_JenaCommonsRDF.java
new file mode 100644
index 0000000..b7e98c9
--- /dev/null
+++ b/jena/src/test/java/org/apache/jena/commonsrdf/TS_JenaCommonsRDF.java
@@ -0,0 +1,41 @@
+/**
+ * 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.atlas.logging.LogCtl ;
+import org.junit.BeforeClass ;
+import org.junit.runner.RunWith ;
+import org.junit.runners.Suite ;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {
+ // The tests from commons-rdf
+ TestBlankNodeJena.class
+ , TestGraphJena.class
+ , TestRDFTermFactoryJena.class
+ // Additional tests.
+})
+
+public class TS_JenaCommonsRDF {
+ @BeforeClass public static void beforeClass() {
+ LogCtl.setLog4j();
+ //LogCtl.setWarn("org.apache.jena");
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/src/test/java/org/apache/jena/commonsrdf/TestBlankNodeJena.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/jena/commonsrdf/TestBlankNodeJena.java b/jena/src/test/java/org/apache/jena/commonsrdf/TestBlankNodeJena.java
new file mode 100644
index 0000000..10ca79f
--- /dev/null
+++ b/jena/src/test/java/org/apache/jena/commonsrdf/TestBlankNodeJena.java
@@ -0,0 +1,36 @@
+/**
+ * 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.AbstractBlankNodeTest ;
+import org.apache.commons.rdf.api.BlankNode ;
+import org.apache.jena.commonsrdf.impl.JCR_Factory ;
+
+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/5838bf5d/jena/src/test/java/org/apache/jena/commonsrdf/TestGraphJena.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/jena/commonsrdf/TestGraphJena.java b/jena/src/test/java/org/apache/jena/commonsrdf/TestGraphJena.java
new file mode 100644
index 0000000..2369732
--- /dev/null
+++ b/jena/src/test/java/org/apache/jena/commonsrdf/TestGraphJena.java
@@ -0,0 +1,33 @@
+/**
+ * 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.AbstractGraphTest ;
+import org.apache.commons.rdf.api.RDFTermFactory ;
+import org.apache.jena.commonsrdf.RDFTermFactoryJena ;
+
+public class TestGraphJena extends AbstractGraphTest {
+
+ @Override
+ public RDFTermFactory createFactory() {
+ return new RDFTermFactoryJena() ;
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/src/test/java/org/apache/jena/commonsrdf/TestRDFTermFactoryJena.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/jena/commonsrdf/TestRDFTermFactoryJena.java b/jena/src/test/java/org/apache/jena/commonsrdf/TestRDFTermFactoryJena.java
new file mode 100644
index 0000000..d2e2c9f
--- /dev/null
+++ b/jena/src/test/java/org/apache/jena/commonsrdf/TestRDFTermFactoryJena.java
@@ -0,0 +1,33 @@
+/**
+ * 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.AbstractRDFTermFactoryTest ;
+import org.apache.commons.rdf.api.RDFTermFactory ;
+import org.apache.jena.commonsrdf.RDFTermFactoryJena ;
+
+public class TestRDFTermFactoryJena extends AbstractRDFTermFactoryTest {
+
+ @Override
+ public RDFTermFactory createFactory() {
+ return new RDFTermFactoryJena() ;
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/jena/src/test/resources/log4j.properties b/jena/src/test/resources/log4j.properties
new file mode 100644
index 0000000..5cedb50
--- /dev/null
+++ b/jena/src/test/resources/log4j.properties
@@ -0,0 +1,18 @@
+log4j.rootLogger=INFO, stdlog
+
+log4j.appender.stdlog=org.apache.log4j.ConsoleAppender
+## log4j.appender.stdlog.target=System.err
+log4j.appender.stdlog.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-25c{1} :: %m%n
+
+# Execution logging
+log4j.logger.org.apache.jena.arq.info=INFO
+log4j.logger.org.apache.jena.arq.exec=INFO
+
+# Everything else in Jena
+log4j.logger.org.apache.jena=WARN
+log4j.logger.org.apache.jena.riot=INFO
+
+# Apache Commons HTTP
+# May be useful to turn up to DEBUG if debugging HTTP communication issues
+log4j.logger.org.apache.http=WARN
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/target/classes/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/jena/target/classes/META-INF/MANIFEST.MF b/jena/target/classes/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..dc20081
--- /dev/null
+++ b/jena/target/classes/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Implementation-Title: Commons RDF: Integration: Apache Jena
+Implementation-Version: 0.2.0-incubating-SNAPSHOT
+Built-By: stain
+Specification-Vendor: The Apache Software Foundation
+Implementation-Vendor-Id: org.apache
+Specification-Title: Commons RDF: Integration: Apache Jena
+Implementation-Vendor: The Apache Software Foundation
+X-Compile-Target-JDK: 1.8
+Implementation-Build: ${scmBranch}@r${buildNumber}; 2016-03-28 01:18:5
+ 1+0000
+X-Compile-Source-JDK: 1.8
+Build-Jdk: 1.8.0_72-internal
+Implementation-URL: http://commonsrdf.incubator.apache.org/commons-rdf
+ -jena
+Created-By: Maven Integration for Eclipse
+Specification-Version: 0.2.0-incubating-SNAPSHOT
+
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/target/classes/META-INF/maven/org.apache.commons/commons-rdf-jena/pom.properties
----------------------------------------------------------------------
diff --git a/jena/target/classes/META-INF/maven/org.apache.commons/commons-rdf-jena/pom.properties b/jena/target/classes/META-INF/maven/org.apache.commons/commons-rdf-jena/pom.properties
new file mode 100644
index 0000000..a7aca86
--- /dev/null
+++ b/jena/target/classes/META-INF/maven/org.apache.commons/commons-rdf-jena/pom.properties
@@ -0,0 +1,7 @@
+#Generated by Maven Integration for Eclipse
+#Mon Mar 28 02:18:51 BST 2016
+version=0.2.0-incubating-SNAPSHOT
+groupId=org.apache.commons
+m2e.projectName=commons-rdf-jena
+m2e.projectLocation=/home/stain/src/incubator-commonsrdf/jena
+artifactId=commons-rdf-jena
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5838bf5d/jena/target/classes/META-INF/maven/org.apache.commons/commons-rdf-jena/pom.xml
----------------------------------------------------------------------
diff --git a/jena/target/classes/META-INF/maven/org.apache.commons/commons-rdf-jena/pom.xml b/jena/target/classes/META-INF/maven/org.apache.commons/commons-rdf-jena/pom.xml
new file mode 100644
index 0000000..bcfeaec
--- /dev/null
+++ b/jena/target/classes/META-INF/maven/org.apache.commons/commons-rdf-jena/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-rdf-parent</artifactId>
+ <version>0.2.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>commons-rdf-jena</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Commons RDF: Integration: Apache Jena</name>
+ <description>Apache Jena implementation of Commons RDF API</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>commons-rdf-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>commons-rdf-simple</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>commons-rdf-api</artifactId>
+ <version>${project.version}</version>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>