JSON-LD in Jena RIOT?
Asked Answered
G

2

7

I got Jena 2.12.1 (2014-10-02) from the Apache Jena Releases page. It's supposed to have JSON-LD support, according to Reading and Writing RDF in Apache Jena. But when I try to use riot with an output format of JSON-LD, I get an error (and the same happens for variants in capitalization, hyphenation, etc.):

riot --out=JSON-LD NIF-example2.ttl

   Turtle
   N-Quads
   N-Triples
   TriG
   RDF_THRIFT
Not recognized as an streaming RDF language : 'JSON-LD'

How can I write in JSON-LD?

Guyon answered 9/10, 2014 at 20:30 Comment(0)
B
8

It has correctly identified JSON-LD. JSON-LD is not a streaming output language (the writer needs all the data available before calling the jsonld-java code) and riot is a streaming parser (it can cope with files of any size) and needs to write in a streaming fashion.

The tool to read in the data into memory and write it out is rdfcat.

rdfcat -out JSONLD NIF-example2.ttl
Bosky answered 10/10, 2014 at 9:22 Comment(1)
Just to note that @Bosky has changed the implementation slightly so that riot --output JSON-LD now works. --output means "output, streaming if possible".Horsehair
G
0

More recent RIOT versions (since late 2015) support JSONLD. However, I don't see a way to give it a context

But it's ignored and it makes its own context.

Guyon answered 1/9, 2016 at 13:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.