[rdfweb-dev] Grading the foaf:knows relationship

Morten Frederiksen mof-rdf at mfd-consult.dk
Mon Feb 23 19:35:55 UTC 2004


Hi all,

I'm going to jump in here and spoil the fun...

On Monday 23 February 2004 10:02, Julian Bond wrote:
> [1]Is it possible in RDF to add a qualifier to <foaf:knows> without
> sub-classing? Or am I just being stupid and it's
> <foaf:knows qualifier="value">
The short answer is no.

The long answer is:
RDF only knows (sorry) about binary relationships, that is, relationships 
between exactly two resources. A well-known counter-example is trying to 
state that a city B is between two other cities A and C. This is not possible 
to state using a single property in RDF. A possible solution to this 
"problem" is to define a "between" resource, as a type/class:

_:A rdf:type :City.
_:A :betweenCities _:X.
_:X rdf:type :Between.
_:X :city _:B.
_:X :city _:C.
_:B rdf:type :City.
_:C rdf:type :City.

Note that I didn't write this as RDF/XML. There are so many possible ways the 
above could have been written, but the essense is in the statements.

It could be seen as a weakness of RDF that it is only possible to state 
binary relationships, but as the above hopefully shows, that's really all 
that's necessary.

Now, for "qualifying foaf:knows", the answer is basically the same: Turn the 
relationship into a resource in itself:

_:me :hasRelationship _:R.
_:R rdf:type :Relationship.
_:R :with _:you.
_:R :strength "17".
_:R :scale :myScaleDefinition.

As for the relationship between the above and foaf:knows, it's not possible 
to use the usual subproperty definitions to have a relationship like this 
imply foaf:knows (since the latter is a property and the former is a class). 
I'm not even sure it's possible with OWL, but I hope someone can correct me 
there.

The other approach, making subproperties of foaf:knows, like Jen Golbeck has 
done with her trust schema and pixel has done with his relationship schema, 
is also quite a valid way to do it, even if it doesn't offer the same 
possibilities, e.g. simple sorting by strength and multiple scales.

To close the loop, here's what the exact above relationship statements could 
look like in RDF/XML:

<rdf:Description rdf:nodeID="me">
  <ns:hasRelationship>
    <ns:Relationship>
      <ns:with rdf:nodeID="you"/>
      <ns:strength>17</ns:strength>
      <ns:scale rdf:resource="#myScaleDefinition"/>
    </ns:Relationship>
  </ns:hasRelationship>
</rdf:Description>

As always, there are multiple ways to say the same, and if e.g. the range of 
ns:hasRelationship would be defined as ns:Relationship, it could be even more 
compact:

<rdf:Description rdf:nodeID="me">
  <ns:hasRelationship rdf:parseType="Resource">
    <ns:with rdf:nodeID="you"/>
    <ns:strength>17</ns:strength>
    <ns:scale rdf:resource="#myScaleDefinition"/>
  </ns:hasRelationship>
</rdf:Description>


Regards,
Morten



More information about the foaf-dev mailing list