N-ary relations

From semanticweb.org.edu
Jump to: navigation, search

An n-ary relation is a relation that maps between a subject and two or more values. This is distinct from the most common type of relation, a binary relation, which maps between a single subject and a single value. An n-ary relation cannot be split up into n binary relations, because the relations it defines are all interconnected in some way.

Theoretical basis[edit]

The W3C's paper on the subject, "Defining N-ary Relations on the Semantic Web", lists four types of n-ary relations:

  1. Additional attributes describing a relation - an example is "Christine has breast tumor with high probability". In this case, there is one main relation, and one or more additional relations that modify the main one.
  2. Different aspects of the same relation - an example is "Steve has temperature, which is high, but falling". In this case, all relations are equal in importance, and all describe the subject in some way.
  3. N-ary relation with no distinguished participant - an example is "John buys a 'Lenny the Lion' book from books.example.com for $15 as a birthday gift". In this case, all relations are equal in importance, and they do not describe the subject; they describe some other entity (in this case, a purchase).
  4. Using lists for arguments in a relation - an example is "United Airlines flight 3177 visits the following airports: LAX, DFW, and JFK". In this case, the order of the relations matters as well.

The RDF/OWL approach to n-ary relations is to map them using binary relations, by creating an intermediate entity that serves as the subject for the entire set of relations; this entity is then in turn made the object for a relation in which the main subject is the subject. Since this intermediate entity does not have a real-world name of its own, it is usually given the name of the class to which it belongs, followed by an index number. Here for instance, is a portion of the RDF definition [1] for the second example above:

  <Temperature_Observation rdf:nodeID="Temperature_Observation_1">
    <temperature_trend rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Falling</temperature_trend>
    <temperature_value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Elevated</temperature_value>
  <Person rdf:ID="Steve">
    <has_temperature rdf:resource="#Temperature_Observation_1"/>

This could get represented within a semantic Wiki in a similar way. Here is one approach to representing it, in an article named "Steve":

[[has temperature::
  [[Temperature Observation::
    [[temperature trend:=Falling]]
    [[temperature value:=Elevated]]

while the Datatype is specified in the Articles Attribute:temperature trend and Attribute:temperature value.

Here is another semantic wiki approach, incorporating free text:

Steve is a [[subClassOf::Person]].
[[[has temperature::
  Steve's temperature is [[has trend:=Falling]],
  but still [[has value:=Elevated]].

As before, the data types would be represented in the articles for those attributes.

Semantic wiki support[edit]

Please list here any semantic wikis that support n-ary relations:

  • Semantic MediaWiki 1.0 supports compound, or many-valued, properties, that resemble n-ary relations, though with some limitations; see Many-valued properties.
  • BOWiki supports n-ary relations and reasoning

See also[edit]