Code Monkey home page Code Monkey logo

jsonld-java's Introduction

JSONLD-JAVA

This is a Java implementation of the JSON-LD specification (http://json-ld.org/).

USAGE

From Maven

<dependency>
    <groupId>com.github.jsonld-java</groupId>
    <artifactId>jsonld-java</artifactId>
    <version>0.2</version>
</dependency>

Code example

// Open a valid json(-ld) input file
InputStream inputStream = new FileInputStream("input.json");
// Read the file into an Object (The type of this object will be a List, Map, String, Boolean,
// Number or null depending on the root object in the file).
Object jsonObject = JSONUtils.fromInputStream(inputStream);
// Call whichever JSONLD function you want! (e.g. compact)
Object compact = JSONLD.compact(jsonObject);
// Print out the result (or don't, it's your call!)
System.out.println(JSONUtils.toString(normalized));

Processor options

The Options specified by the JSON-LD API Specification are accessible via the com.github.jsonldjava.core.Options class, and each JSONLD.* function has an optional input to take an instance of this class.

RDF implementation specific code

All code specific to various RDF implementations (e.g. jena, sesame, etc) are stored in the integration modules. Readmes for how to use these modules should be present in their respective folders.

PLAYGROUND

This is a simple application which provides command line access to JSON-LD functions

initial setup

chmod +x ./jsonldplayground

usage

run the following to get usage details:

./jsonldplayground

For Developers

Compiling & Packaging

jsonld-java uses maven to compile. From the base jsonld-java module run mvn install -DskipTests=true to install the jar into your local maven repository.

Running tests

mvn test

or

mvn test -pl core

to run only core package tests

Generating Implementation Report

Implementation Reports conforming to the JSON-LD Implementation Report document can be generated using the following command:

mvn test -pl core -Dtest=JSONLDProcessorTest -Dreport.format=<format>

Current possible values for <format> include JSON-LD (application/ld+json or jsonld), NQuads (text/plain, nquads, ntriples, nq or nt) and Turtle (text/turtle, turtle or ttl). * can be used to generate reports in all available formats.

CHANGELOG

2013-11-07

  • Integration packages renamed com.github.jsonldjava.sesame, com.github.jsonldjava.jena etc. (Issue #76)

2013-10-07

  • Matched class names to Spec
  • Renamed JSONLDException to JsonLdError
  • Renamed JSONLDProcessor to JsonLdApi
  • Renamed JSONLD to JsonLdProcessor
  • Renamed ActiveContext to Context
  • Renamed Options to JsonLdOptions
  • All context related utility functions moved to be members of the Context class

2013-09-30

  • Fixed JSON-LD to Jena to handle of BNodes

2013-09-02

  • Add RDF2Go integration
  • Bump Sesame and Clerezza dependency versions

2013-06-18

  • Bump to version 0.2
  • Updated Turtle integration
  • Added Caching of contexts loaded from URI
  • Added source formatting eclipse config
  • Fixed up seasame integration package names
  • Replaced depreciated Jackson code

2013-05-19

  • Added Turtle RDFParser and TripleCallback
  • Changed Maven groupIds to com.github.jsonld-java to match github domain.
  • Released version 0.1

2013-05-16

  • Updated core code to match JSON-LD 1.0 Processing Algorithms and API / W3C Editor's Draft 14 May 2013
  • Deprecated JSONLDSerializer in favor of the RDFParser interface to better represent the purpose of the interface and better fit in with the updated core code.
  • Updated the JSONLDTripleCallback to better fit with the updated code.
  • Updated the Playground tool to support updated core code.

2013-05-07

  • Changed base package names to com.github.jsonldjava
  • Reverted version to 0.1-SNAPSHOT to allow version incrementing pre 1.0 while allowing a 1.0 release when the json-ld spec is finalised.
  • Turned JSONLDTripleCallback into an interface.

2013-04-18

  • Updated to Sesame 2.7.0, Jena 2.10.0, Jackson 2.1.4
  • Fixing a character encoding issue in the JSONLDProcessorTests
  • Bumping to 1.0.1 to reflect dependency changes

2012-10-30

  • Brought the implementation up to date with the reference implementation (minus the normalization stuff)
  • Changed entry point for the functions to the static functions in the JSONLD class
  • Changed the JSONLDSerializer to an abstract class, requiring the implementation of a "parse" function. The JSONLDSerializer is now passed to the JSONLD.fromRDF function.
  • Added JSONLDProcessingError class to handle errors more efficiently

Considerations for 1.0 release / optimisations

  • The Context class is a Map and many of the options are stored as values of the map. These could be made into variables, whice should speed things up a bit (the same with the termDefinitions variable inside the Context).
  • some sort of document loader interface (with a mockup for testing) is required

jsonld-java's People

Contributors

ansell avatar tristan avatar stain avatar stuehmer avatar ismriv avatar ubbo avatar crvidya avatar mhgrove avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.