Apache Commons RDF (Incubating)

Build Status Coverage Status

Commons RDF aims to provide a common library for RDF 1.1 that could be implemented by Jena as well as for other libraries such as OWLAPI, Clerezza and other JVM languages.

The main motivation behind this simple library is to revise an historical incompatibility issue between these toolkits. This library does not pretend to be a generic API wrapping those libraries, but is a set of common Java interfaces for the RDF 1.1 concepts, e.g. IRI, BlankNode, Graph, accompanied with unit test cases for their expected behaviour, and a simple implementation, which main purpose is to clarify the tests and interfaces.

In particular, Commons RDF aims to provide a type-safe, non-general API that covers RDF 1.1. In a future phase we may define interfaces for Datasets and Quads.

A draft diagram of the interfaces which may be included in Commons RDF are:

This library is still work in progress. Therefore everybody is welcomed to join the project and contribute!

See the Commons RDF homepage for more details.

Contributing

Feel free to subscribe to the dev@commonsrdf mailing list to follow the ongoing development of Commons RDF, ask questions about its usage, or help shape Commons RDF by contributing your ideas, code and use cases.

Disclaimer

Apache Commons RDF is an effort undergoing incubation at The Apache Software Foundation (ASF) sponsored by the Apache Incubator PMC. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

Building

Building has been tested with Apache Maven 3.2 and Java JDK 8.

$ mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Commons RDF
[INFO] Commons RDF: API
[INFO] Commons RDF: Simple impl
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Commons RDF 0.0.3-SNAPSHOT
    ....
[INFO] Installing /home/johndoe/src/commons-rdf/commons-rdf-api/target/commons-rdf-api-0.0.3-SNAPSHOT-javadoc.jar to /home/johndoe/.m2/repository/org/apache/commons/commons-rdf/commons-rdf-api/0.0.3-SNAPSHOT/commons-rdf-api-0.0.3-SNAPSHOT-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Commons RDF ....................................... SUCCESS [  1.792 s]
[INFO] Commons RDF: API .................................. SUCCESS [  2.676 s]
[INFO] Commons RDF: Simple impl .......................... SUCCESS [  3.142 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.718 s
[INFO] Finished at: 2015-01-26T02:09:10+00:00
[INFO] Final Memory: 22M/309M
[INFO] ------------------------------------------------------------------------

To then use from your project, add to Maven (update <version> to match the Maven output):

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-rdf-api</artifactId>
    <version>0.0.3-SNAPSHOT</version>
</dependency>

Snapshot repository

The Apache Commons RDF project is aiming to regularly release early previews releases (0.x.y versions) and publish these to Maven Central.

However, if you are following the ongoing development on dev@commonsrdf, you may want to try the snapshot builds, which are automatically deployed to the Apache snapshot repository.

To use these snapshots from your Maven project, depend on the latest *-SNAPSHOT version as found in the current pom.xml, and add to your own pom.xml:

<repositories>
  <repository>
    <id>apache.snapshots</id>
    <name>Apache Snapshot Repository</name>
    <url>http://repository.apache.org/snapshots</url>
    <releases>
      <enabled>false</enabled>
    </releases>
  </repository>
</repositories>

Simple implementation

The commons-rdf-simple module contains a simple (if not naive) implementation of the Commons RDF API using in-memory POJO objects.

Note that although this module fully implements the commons-rdf API, it should not be considered a reference implementation. It is not thread-safe nor scalable, but may be useful for testing and simple usage (e.g. output from an independent RDF parser).

Testing

The abstract classes AbstractGraphTest and AbstractRDFTermFactoryTest can be realised as JUnit tests by implementations in order to verify that they pass the minimal requirements of this API.

In order for this to work, your project will need to depend on the tests classifier for the commons-rdf-api module, for example (for Maven):

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-rdf-api</artifactId>
    <version>0.0.3-SNAPSHOT</version>
    <classifier>tests</classifier>
    <scope>test</scope>
</dependency>

The extensions of each Test class need to provide a RDFTermFactory that can create the corresponding implementations of a Graph, IRI, etc.

For an example, see SimpleGraphTest.

License

Apache License, Version 2.0