I have some Triples stored in a string like
String st =
<http://dbpedia.org/resource/53debf646ad3465872522651> <http://dbpedia.org/resource/end> <http://dbpedia.org/resource/1407106906391> .
<http://dbpedia.org/resource/53debf676ad3465872522655> <http://dbpedia.org/resource/foi> <http://dbpedia.org/resource/SpatialThing> .
Now I am using JENA to read the same string as
Model md= ModelFactory.createDefaultModel();
InputStream in = IOUtils.toInputStream(st,"UTF-8");
System.out.println(in.available());
try{
md.read(in, "N-TRIPLES");
}catch(Exception e){
e.printStackTrace();
}
System.out.println("model size:"+md.size());
I know that the string is available to InputStream, but model size is always printed as 0. So md. read
is not working properly. How should I debug it?
Update It throws exception as
org.apache.jena.riot.RiotException: [line: 1, col: 7 ] Element or attribute do not match QName production: QName::=(NCName':')?NCName
I think syntax is fine according to N-TRIPLES. Where is the issue? For debugging purpose I have placed a small program at link