Switch branches/tags
Nothing to show
Find file History
Pull request Compare This branch is 521 commits behind jsonld-java:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



This is the base package to provide JSON-LD integration with other Java RDF libraries.


Fork the jsonld-java project

If you're creating a module for a RDF library that isn't already supported by the jsonld-java integration modules you can create your module directly in the jsonld-java project. This will allow other people who may be interested in your module to find it easier and allow it to be released along with the core code and updated by the comunity.

See https://help.github.com/articles/fork-a-repo for details on forking a repository.

Create module in Eclipse

Install m2e

Make sure you have m2e installed.

Import jsonld-java project into Eclipse

  • File -> Import
  • Select Existing Maven Projects
  • Browse to the directory you cloned jsonld-java to
  • Select All
  • Finish

Create new Maven Module

  • Right click on the jsonld-java-integration project and select New -> Project
  • Select Maven Module
  • Enter a Module Name which matches the RDF Library you're integrating (e.g. jena)
  • Next -> Next (you should now be at the Specify Archetype parameters page
  • Change Package to com.github.jsonldjava.impl
  • Finish

Clean up automatically generated pom.xml

Make the generated pom.xml match the one listed below.

Remove generated code

Delete the App.java and AppTest.java files.

Create module manually

Create folder for your module

After cloning your fork of jsonld-java, create a new directory for your module under /jsonld-java/integration/<your module>.

Create pom.xml for your module

Here is the basic outline for what your module's pom.xml should look like

<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/maven-v4_0_0.xsd">

	<artifactId>jsonld-java-{your module}</artifactId>
	<name>JSONLD Java :: {your module name}</name>
	<description>JSON-LD Java integration module for {RDF Library your module integrates}</description>



Make sure you edit the following:

  • project/artifactId : set this to jsonld-java-{module id}, where {module id} usually represents the RDF library you're integrating (e.g. jsonld-java-jena)
  • project/name : set this to JSONLD Java :: {Module Name}, wher {module name} is usually the name of the RDF library you're integrating.
  • project/description
  • project/developers/developer/... : Give youself credit by filling in the developer field. At least put your <name> in (see here for all available options).
  • project/dependencies/... : remember to add any dependencies your project needs

Import into your favorite editor

For Example: Follow the first few steps in the section above to import the whole jsonld-java project or only your new module into eclipse.

Create RDFParser Implementation

The interface com.github.jsonldjava.core.RDFParser is used to parse RDF from the library into the JSONLD-Java internal RDF format. See the documentation in RDFParser.java for details on how to implement this interface.

Create TripleCallback Implementation

The interface com.github.jsonldjava.core.JSONLDTripleCallback is used to generate a representation of the JSON-LD input in the RDF library. See the documentation in JSONLDTripleCallback.java for details on how to implement this interface.

Using your Implementations


There are two ways to use your RDFParser implementation.

Register your parser with the JSONLD class and set options.format when you call fromRDF

JSONLD.registerRDFParser("format/identifier", new YourRDFParser());
Object jsonld = JSONLD.fromRDF(yourInput, new Options("") {{ format = "format/identifier" }});

or pass an instance of your RDFParser into the fromRDF function

Object jsonld = JSONLD.fromRDF(yourInput, new YourRDFParser());


Pass an instance of your TripleCallback to JSONLD.toRDF

Object yourOutput = JSONLD.toRDF(jsonld, new YourTripleCallback());

Write Tests

It's helpful to have a test or two for your implementations to make sure they work and continue to work with future versions.

Write README.md

Write a README.md file under jsonld-java/integration/<your module>/ with instrutions on how to use your module.

Submit your module

Once you've committed your code, and pushed it into your github fork you can issue a Pull Request so that we can pull your new module into the jsonld-java codebase.