Search code examples
resourcesrdfjenaprefix

Prefix namespace in RDF


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


Solution

  • 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.