Search code examples
xmlrdfsemantic-webfoaf

Why am I geting an error while trying to use relation on FOAF?


I am trying to validate a foaf code on W3C RDF and the from following block it is causing problem. Here I am trying to show relation between Randy and Adil, please currect me why I can't use "rel" tag here or why is it causing problem?

<foaf:knows>
        <foaf:Person>

        <foaf:name>Randy</foaf:name>

        <foaf:mbox_sha1sum>0525a7bfaf263d404e751bb12b89e4acc1ce68a7</foaf:mbox_sha1sum>
        <rdfs:workplaceHomepage rdf:resource="randy.html" />
    <rel:friendOf rdf:resource="adil.html"/>        
  </foaf:Person>
    </foaf:knows>

Error:

FatalError: The prefix "rel" for element "rel:friendOf" is not bound.[Line = 39, Column = 46]

Solution

  • You should wrap the FOAF content in an RDF element that declares the appropriate namespaces:

    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:foaf="http://xmlns.com/foaf/0.1/"
         xmlns:rel="http://www.perceive.net/schemas/relationship/">