Hi Phil,

Jena has an RDF reader that wraps up the use of jsonld-java so you don't have to use jsonld-java code directly.

        InputStream in = ...
        Dataset dataset = ...
        RDFDataMgr.read(dataset, in, Lang.JSONLD);

If you want to see the source code to see how it uses JsonLdProcessor.toRDF, the Jena code is

        org.apache.jena.riot.lang.JsonLDReader

If you have the data in a file with a jsonld file extension, you can just read the file directly e.g. if you want to run Fuseki separately from the production of the WoT descriptions.

    Andy

On 25/07/2021 09:18, Philipp Leeb wrote:
Hey guys,

I'm trying to store a WoT-TD (JSON-LD format) in Dataset of embedded fuseki.
When using:

InputStream inputStream = new
ByteArrayInputStream(exposedThing.toJson().getBytes(StandardCharsets.UTF_8))
;
Object jsonObject = JsonUtils.fromInputStream(inputStream);
Object compact = JsonLdProcessor.toRDF(jsonObject);

The compact-Object is a list of triples, so i assume it's correct. But
somehow i don't get it how to read this into a dataset. Can anyone help me?

Best regards

Phil


Reply via email to