According to [1] the default RDF accept header in 3.1.0 and 3.1.1 is

text/turtle,application/n-triples;q=0.9,application/rdf+xml;q=0.7,
application/trig,application/n-quads;q=0.9,text/x-nquads;q=0.8,application/x-trig;q=0.7,application/ld+json;q=0.6,
*/*;q=0.5

that means Turtle is always the preferred format for SPARQL CONSTRUCT,
DESCRIBE and also for Linked Data Dereferencing which is the current task.

[1]
https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/riot/WebContent.java#L184-L187



> I trusted so much Jena that I took for granted that no regression would
> happen, but no software is without regression, and testing error catching
> is of course the last thing people do, if ever !
>
> So for my release of semantic_forms , I'll simply revert to 3.1.0 , with
> priority to RDF/XML when reading, as Andy suggested in his code snippet.
>
> Ideally, the Accept: HTTP header should ask for:
>
>    1. N-triples
>    2. RDF/XML
>    3. JSON-LD
>    4. Turtle
>
> or maybe swap 2 and 3 ?
>
> I don't know what Jena does currently.
>
>
> 2017-01-20 9:50 GMT+01:00 Lorenz B. <[email protected]>:
>
>> Ah sorry, right. I tried it with version 3.1.0.
>>
>> I don't know which changes in the code lead to the different behavior.
>> Especially not that you get 0 triples in 3.1.1 which looks more like no
>> triple has to be parsed at all
>>
>>> Haaa, I got it !
>>> jena-3.1.0 brings the exception, jena-3.1.1 does not .
>>>
>>> cd ~/apps/apache-jena-3.1.0 ; JENA= ; 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.
>>> *org.apache.jena.riot.RiotException: [line: 1863, col: 13] Failed to
>> find a
>>> prefix name or keyword: –(8211;0x2013)*
>>>
>>>
>>> 2017-01-20 9:18 GMT+01:00 Jean-Marc Vanel <[email protected]>:
>>>
>>>> 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.1
>>>> 6.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%2F
>>>> jmvanel.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
>>>>
>>>
>> --
>> Lorenz Bühmann
>> AKSW group, University of Leipzig
>> Group: http://aksw.org - semantic web research center
>>
>>
>
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

Reply via email to