Question

I have seen some examples where there is a possibility to convert known serializations in RDF/XML but when the input format (e.g. XML/Turtle/N3) is not known, is there any way of achieving the conversion?

I am writing a tool that receives RDF in different serializations (Turtle/xml/n3) but when I call

 model.read(InputStream in, "", "") 

method of Model Class from Jena, there are exceptions.

Was it helpful?

Solution

It's an input stream - you have to tell it the format. model.read(in, base, "TURTLE"). It does not sniff the stream. You could do a sequence of model.read each inside a try-catch until one does not cause an exception.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top