Why am I getting an error when trying to use relationships on FOAF?

I am trying to check foaf code on W3C RDF , and from the next block this causes a problem. Here I am trying to show the connection between Randy and Adil, please correct me, why can not I use the "rel" tag here or why does this cause problems?

<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] 
+4
source share
2 answers

You must wrap the contents of the FOAF in an RDF element that will declare 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/"> 
+3
source

You need to declare the rel namespace in the same way that you should specify foaf at the top of your RDF / XML document.

This example should work for you ...

 <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://some.namespace.for.rel.com/ns/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > <foaf:Person> <foaf:name>Peter Parker</foaf:name> <foaf:mbox rdf:resource="mailto: peter.parker@dailybugle.com "/> <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> </foaf:Person> </rdf:RDF> 

In any case, your use of rdfs:workplaceHomepage is wrong, you should use foaf:workplaceHomepage , and rel:friendOf does not make much sense. You can also use foaf:knows .

+3
source

All Articles