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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top