On 08/08/2021 15:41, Steve Vestal wrote:
I am reading a file using the following:

myModel.read(myInputStream, "JSON-LD");
Wrong API call. The two arg version takes the base URI, not the language.

Model.read(InputStream, baseURI)


Try:

myModel.read(myInputStream, null, "JSON-LD");

or (better type checking):

RDFDataMgr.read(model, myInputStream, Lang.JSONLD);

or (buildler style arguments - this is what RDFDataMgr is built on):

RDFParser.source(myInputStream).lang(Lang.JSONLD).parse(model);

    Andy

I get an exception:

org.apache.jena.riot.RiotException: [line: 1, col: 1 ] Content is not allowed in prolog.     at org.apache.jena.riot.system.ErrorHandlerFactory$ErrorHandlerStd.fatal(ErrorHandlerFactory.java:153)     at org.apache.jena.riot.lang.ReaderRIOTRDFXML$ErrorHandlerBridge.fatalError(ReaderRIOTRDFXML.java:313)
     ...

The "ReaderRIOTRDFXML" makes me wonder if Jena is trying to input my data in RDF/XML rather than JSON-LD format.

Correct.

  I am still on Jena 3.17. Do I need a later version to read JSON-LD?

No.

    Andy

Reply via email to