How can I insert data from json-ld files?

I’ve got some files containing RDF data serialized as json-ld. Is there a simple way to add json-ld data to a stardog database?

Thanks,
Peter

Hi Peter,

Assuming your files have a .jsonld or .json extension, stardog data add should accept them as-is. If that’s not the extension, you might be able to pass in --format jsonld but I’m not 100% sure on that.

Hi Peter,

If you are using the Java API, you can format it while streaming it. I couldn’t make it work through the web API.

aConn.add().io().format(RDFFormat.RDFXML).stream(ontologyInputStream);

Hope that helps,
Charbel

That's exactly what I wanted to do, but my version (4.1.1) complains:
No known format matches the file: C:\Users\pneorr\Desktop\scratch-jsonld\default.json

The online docs don't list jsonld as a supported format. :frowning:
404 | Stardog Documentation Latest

Adding --format JSONLD flag causes a different error:
'JSONLD' is not a valid RDF format identifier. Acceptable format strings are NTRIPLES, RDF/XML, TURTLE, PRETTY_TURTLE, TRIG, TRIX, N3, NQUADS.

Adding --format JSON flag does something similar:
'JSON' is not a valid RDF format identifier. Acceptable format strings are NTRIPLES, RDF/XML, TURTLE, PRETTY_TURTLE, TRIG, TRIX, N3, NQUADS.

My short term fix was to use protege to save as turtle. (gag)

Hmm, if changing the filename to a .jsonld extension doesn’t do the trick then I’m not sure you could have done it any other way in 4.1.1. I can confirm that this bug has been fixed some time between then and 4.2.4. At least the .json part. Apologies for the confusion!