I have a related question. You see uses like the following:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
Some end in /, others end in #. What is the functional difference?
Or is one an older convention?
-----Original Message-----
From: Paolo Castagna [mailto:[email protected]]
Sent: Monday, October 10, 2011 2:57 PM
To: [email protected]
Subject: Re: Is this 'legal' Turtle?
Hi Vadim,
thanks.
But, is '#' a valid character in a qname?
http://www.w3.org/TeamSubmission/turtle/#qname
Paolo
Vadim Eisenberg wrote:
> Hi Paolo,
>
> The hash sign '#' starts a comment in Turtle - so the content after it
> is ignored by Turtle parsers.
> BTW, you can validate Turtle here - http://www.rdfabout.com/demo/validator/.
>
> Regards,
> Vadim
>
> On Mon, Oct 10, 2011 at 7:25 PM, Paolo Castagna <
> [email protected]> wrote:
>
>> Hi,
>> I am not sure whether this is legal Turtle or not:
>>
>> ------
>> @prefix : <http://example.org/> .
>> @prefix foaf: <http://xmlns.com/foaf/0.1/> .
>>
>> :alice#me
>> a foaf:Person ;
>> foaf:name "Alice" ;
>> foaf:mbox <mailto:[email protected]> ;
>> foaf:knows :bob#me ;
>> foaf:knows :charlie#me ;
>> foaf:knows :snoopy#me ;
>> .
>> ------
>>
>> When I try to parse it using Jena:
>>
>> Model model = ModelFactory.createDefaultModel();
>> model.read(in, null, "TURTLE");
>>
>> I get this exception:
>>
>> Exception in thread "main" com.hp.hpl.jena.n3.turtle.TurtleParseException:
>> Encountered " <PNAME_LN> "foaf:knows "" at line 9, column 5.
>> Was expecting one of:
>> ";" ...
>> "," ...
>> "." ...
>>
>> at
>> com.hp.hpl.jena.n3.turtle.ParserTurtle.parse(ParserTurtle.java:41)
>> at
>> com.hp.hpl.jena.n3.turtle.TurtleReader.readWorker(TurtleReader.java:21)
>> at
>> com.hp.hpl.jena.n3.JenaReaderBase.readImpl(JenaReaderBase.java:101)
>> at com.hp.hpl.jena.n3.JenaReaderBase.read(JenaReaderBase.java:68)
>> at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:226)
>> [...]
>>
>> If I try to parse it using RIOT:
>>
>> RIOT.init() ;
>> Model model = ModelFactory.createDefaultModel();
>> model.read(in, null, "TURTLE");
>>
>> I get this exception:
>>
>> ERROR [main] (ErrorHandlerFactory.java:62) - [line: 9, col: 5 ]
>> Triples not terminated by DOT Exception in thread "main"
>> com.hp.hpl.jena.shared.JenaException:
>> org.openjena.riot.RiotException: [line: 9, col: 5 ] Triples not
>> terminated by DOT
>> at
>> org.openjena.riot.system.JenaReaderRIOT.readImpl(JenaReaderRIOT.java:132)
>> at
>> org.openjena.riot.system.JenaReaderRIOT.read(JenaReaderRIOT.java:79)
>> at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:226)
>> [...]
>> Caused by: org.openjena.riot.RiotException: [line: 9, col: 5 ]
>> Triples not terminated by DOT
>> at
>> org.openjena.riot.ErrorHandlerFactory$ErrorHandlerStd.fatal(ErrorHandlerFactory.java:110)
>> at org.openjena.riot.lang.LangBase.raiseException(LangBase.java:201)
>> at
>> org.openjena.riot.lang.LangBase.exceptionDirect(LangBase.java:194)
>> at org.openjena.riot.lang.LangBase.exception(LangBase.java:187)
>> at org.openjena.riot.lang.LangBase.expect(LangBase.java:179)
>> at org.openjena.riot.lang.LangBase.expectOrEOF(LangBase.java:170)
>> at
>> org.openjena.riot.lang.LangTurtle.expectEndOfTriples(LangTurtle.java:45)
>> at
>> org.openjena.riot.lang.LangTurtleBase.triples(LangTurtleBase.java:246)
>> at
>> org.openjena.riot.lang.LangTurtleBase.triplesSameSubject(LangTurtleBase.java:206)
>> at
>> org.openjena.riot.lang.LangTurtle.oneTopLevelElement(LangTurtle.java:34)
>> at
>> org.openjena.riot.lang.LangTurtleBase.runParser(LangTurtleBase.java:132)
>> at org.openjena.riot.lang.LangBase.parse(LangBase.java:71)
>> at
>> org.openjena.riot.system.JenaReaderTurtle2.readWorker(JenaReaderTurtle2.java:34)
>> at
>> org.openjena.riot.system.JenaReaderRIOT.readImpl(JenaReaderRIOT.java:120)
>> ... 3 more
>>
>> I would be tempted to say that it should be treated as legal Turtle:
>> http://www.w3.org/TeamSubmission/turtle/#qname
>>
>> But it seems that '#' in the qname is treated a comment:
>> http://www.w3.org/TeamSubmission/turtle/#comment
>>
>> I tried to use the directive @base instead of @prefix : <
>> http://example.org/> .
>> I have the same exceptions in both cases.
>>
>> Perhaps the Turtle above is 'unusual' and I do not necessarily need
>> to use that.
>> But, since it occurred, I would like to understand if it's legal (and
>> we have a small bug) or not.
>>
>> Thanks in advance,
>> Paolo
>>
>