JSON-LD Tree

Developer-friendly serialisation of RDF into a structurally-stable JSON-LD representation.

License

License

Categories

Categories

JSON-LD Data Data Formats Hypermedia Types JSON
GroupId

GroupId

org.daverog
ArtifactId

ArtifactId

json-ld-tree
Last Version

Last Version

1.0.15
Release Date

Release Date

Type

Type

jar
Description

Description

JSON-LD Tree
Developer-friendly serialisation of RDF into a structurally-stable JSON-LD representation.
Project URL

Project URL

https://github.com/daverog/json-ld-tree
Source Code Management

Source Code Management

http://github.com/daverog/json-ld-tree

Download json-ld-tree

How to add to project

<!-- https://jarcasting.com/artifacts/org.daverog/json-ld-tree/ -->
<dependency>
    <groupId>org.daverog</groupId>
    <artifactId>json-ld-tree</artifactId>
    <version>1.0.15</version>
</dependency>
// https://jarcasting.com/artifacts/org.daverog/json-ld-tree/
implementation 'org.daverog:json-ld-tree:1.0.15'
// https://jarcasting.com/artifacts/org.daverog/json-ld-tree/
implementation ("org.daverog:json-ld-tree:1.0.15")
'org.daverog:json-ld-tree:jar:1.0.15'
<dependency org="org.daverog" name="json-ld-tree" rev="1.0.15">
  <artifact name="json-ld-tree" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.daverog', module='json-ld-tree', version='1.0.15')
)
libraryDependencies += "org.daverog" % "json-ld-tree" % "1.0.15"
[org.daverog/json-ld-tree "1.0.15"]

Dependencies

compile (8)

Group / Artifact Type Version
com.hp.hpl.jena : jena jar 2.6.3
com.hp.hpl.jena : arq jar 2.8.8
com.google.code.gson : gson jar 2.2.2
dom4j : dom4j jar 1.6.1
commons-io : commons-io jar 1.4
commons-lang : commons-lang jar 2.5
joda-time : joda-time jar 2.0
com.google.guava : guava jar 11.0-rc1

test (3)

Group / Artifact Type Version
junit : junit jar 4.10
org.hamcrest : hamcrest-all jar 1.1
org.mockito : mockito-all jar 1.9.0

Project Modules

There are no modules declared in this project.

JSON-LD Tree

This library will allow the generation of stable, predictable JSON-LD based on RDF using the RDF Result ontology.

Getting started

To generate the JSON String, do the following:

//Create JSON-LD
new RdfTreeGenerator().generateRdfTree(jenaModel).asJson()

//Create HTML structured in a similar way to JSON-LD
new RdfTreeGenerator().generateRdfTree(jenaModel).asHtml()

The RDF model must contain RDF Result ontology statements to indicate how the graph should be interpretted. This can come in three different forms.

Lists to be ordered by a predicate value:

@prefix result: <http://purl.org/ontology/rdf-result/> .

result:this result:listItem <urn:a> .
result:this result:listItem <urn:b> .
result:this result:listItem <urn:c> .
result:this result:orderByPredicate <urn:p> .

<urn:a> <urn:p> "a" . 
<urn:b> <urn:p> "b" . 
<urn:c> <urn:p> "c" .

Linked Lists:

@prefix result: <http://purl.org/ontology/rdf-result/> .

result:this result:next <urn:a> .
<urn:a> result:next <urn:b> .
<urn:b> result:next <urn:c> .

<urn:a> <urn:p> "a" . 
<urn:b> <urn:p> "b" . 
<urn:c> <urn:p> "c" .

Single items:

@prefix result: <http://purl.org/ontology/rdf-result/> . s

result:this result:item <urn:a> .

<urn:a> <urn:p> "a" . 

Versions

Version
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4