2017-01-19 22:26 GMT+01:00 Andy Seaborne <[email protected]>: > I get the parse error message with that code. >
This is strange. I can't think of a reason for this difference in execution. My impression is that the exceptions worked some weeks or a few months ago. And what has changed since is the Ubuntu OS updates. I tried both these Java JDK: $ java -version openjdk version "1.8.0_111" OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.10.2-b14) OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode) java -version java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode) My OS is uname -a Linux jmv-SMBIOSation 4.8.0-34-generic #36-Ubuntu SMP Wed Dec 21 17:24:18 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Instead of working in a Scala eclipse environment, I downloaded a fresh Jena 3.1.1, and tried again: SAME THING ! cd ~/apps/apache-jena-3.1.1 for f in lib/*; do JENA=$JENA:$f; done javac -cp $JENA ReadMgr.java java -cp $JENA ReadMgr log4j:WARN No appenders could be found for logger (Jena). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. *size 0* You can force the use of, say RDF/XML, by opening the connection directly > with HttpOp. You then have to tell the parse the syntax and base URI: > This I will do systematically, because as you explained , Turtle is fragile. But of course, I must understand why the exception does not occur, and the reading also does not occur. > try { > Graph g = GraphFactory.createDefaultGraph(); > String uri = "http://dbpedia.org/resource/Rome"; > try ( TypedInputStream in = HttpOp.execHttpGet(uri, > "application/rdf+xml") ) { > RDFDataMgr.read(g, in, uri, Lang.RDFXML); > } > System.out.println("size " + g.size()); > } catch (Throwable e) { > System.err.println(e); > } > > ==> > > size 8142 > > Andy > > > On 19/01/17 16:52, Jean-Marc Vanel wrote: > >> import org.apache.jena.graph.Graph; >> import org.apache.jena.riot.RDFDataMgr; >> >> public class ReadMgr { >> public static void main(String[] args) { >> try { >> Graph g = RDFDataMgr.loadGraph("http://d >> bpedia.org/resource/Rome >> "); >> System.out.println("size " + g.size()); >> } catch (Throwable e) { >> System.err.println(e); >> } >> } >> } >> > -- Jean-Marc Vanel Profil: http://163.172.179.125:9111/display?displayuri=http%3A%2F% 2Fjmvanel.free.fr%2Fjmv.rdf%23me Déductions SARL - Consulting, services, training, Rule-based programming, Semantic Web +33 (0)6 89 16 29 52 <+33%206%2089%2016%2029%2052> Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
