I have this RDF statement (turtle format):
@prefix cd: <http://mai.com/contactwrapper/0.1#> .
<http://mai.com/contactwrapper/0.1#malzaa@m.com>
cd:Belongs_To "1"^^xmls:string ;
cd:Email_Address "malzaa@m.com"^^xmls:string ;
cd:Email_Type "WORK"^^xmls:string .
As you can see, the prefix worked with the properties (Belongs_To, Email_Address, and Email_Type) but didn't work with the name of the resource (malzaa@m.com). Because "http://mai.com/contactwrapper/0.1#" should be replaced by cd.
Could anyone please explain whats wrong with that ??
Thank you
The abbreviated form is often called a QName (which stands for "qualified name"). The reason cd:malazaam@m.com
does not work as a QName are the @
and the .
char in the part behind the :
. Turtle syntax does not allow these characters in a QName, which is why the full URI is used instead.
See the Turtle grammar for an overview of what characters are allowed in a QName.
As an aside: your Turtle fragment does not declare the xmls:
namespace either (which you use for your literal datatypes), so it will fail to parse.
As Jeen says "@" is not allowed in a prefixed name in Turtle, despite prefixed name being broader than QNames.
In RDF 1.1, the Turtle language is being formally standardized. "@" is not legal in the local part of prefixed names, but "\\@" is.
The latest grammar is: http://www.w3.org/TR/turtle/#sec-grammar-grammar
There are many parers that accept the traditional Turtle. Jena writers are conservative - they output legal RDF in a way to maximise the chances of being readable by another parser. Writing in full <..> form or using a prefixed name does not change the URI being written, only it's surface appearance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.