CARVIEW |
Defining N-ary Relations on the Semantic Web: Use With Individuals
W3C Working Draft 21 July 2004
- This version:
- https://www.w3.org/TR/2004/WD-swbp-n-aryRelations-20040721
- Latest version:
- https://www.w3.org/TR/swbp-n-aryRelations
- Previous versions
- This is the first public Working Draft
- Editors:
- Natasha Noy, Stanford University
- Alan Rector, University of Manchester
Copyright ©2004 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
Abstract
In Semantic Web languages, such as RDF and OWL, a property is a binary relation; that is, it links two individuals or an individual and a value. How do we represent relations among more than two individuals? How do we represent properties of a relation, such as our certainty about it, severity or strength of a relation, relevance of a relation, and so on? The document presents ontology patterns for representing n-ary relations and discusses what users must consider when choosing these patterns.
Status of this Document
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.
This document is intended to be a part of a future W3C Working Group Note that will provide an introduction and overview of all ontology design patterns produced by the Semantic Web Best Practices and Deployment Working Group, part of the W3C Semantic Web Activity.
This document is a W3C Working Draft and is expected to change. The SWBPD WG does not expect this document to become a Recommendation. Rather, after further development, review and refinement, it will be published and maintained as a WG Note.
This document is the First Public Working Draft. We encourage public comments. Please send comments to public-swbp-wg@w3.org [archive] and start the subject line of the message with "comment:"
Open issues, todo items:- The addition of an argument-list pattern [1]
- The addition of an Appendix showing a Topics Map solution [2]
- Use of skolemization instead of blank nodes [3]
- Different namespaces for A-Box and T-Box [3]
Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
General issue
In Semantic Web languages, such as RDF and OWL, a property is a binary relation: it links two individuals or an individual and a value. How do we represent relations among more than two individuals? How do we represent properties of a relation, such as our certainty about it, severity or strength of a relation, relevance of a relation, and so on?
Use case examples
Several common use cases fall under the category of n-ary relations. Here are some examples:
- Christine has breast tumor with high probability. There is a binary
relation between the person
Christine
and diagnosisbreast_tumor
and there is a qualitative probability value describing this relation (high
). - Steve has temperature, which is high, but falling. The individual
Steve
has two values for two different aspects of ahas_temperature
relation: itsmagnitude
ishigh
and itstrend
isfalling
. - John buys a "Lenny the Lion" book from books.example.com for
$15 as a birthday gift. There is a relation, in which individual
John
, entitybooks.example.com
and the bookLenny_the_Lion
participate. This relation has other values such as the purpose (birthday_gift
) and the amount ($15
).
Representation pattern
In Semantic Web languages, such as RDF and OWL, we have only binary relations
(properties) between individuals, such as a property P
between
an individual A
and individual B
(more precisely,
P
is the property of A
with the value B
):
We would like to have another individual or simple value C
to
be part of this relation:
In other words, P
is now a relation among A
, B
,
and C
.
A common solution to representing n-ary relations such as these is to create an individual which stands for an instance of the relation and relates the things that are involved in that instance of the relation. We can think of the original relation then as a class of all these relation instances.
Depending on the relation between A
, B
, and C
,
we distinguish two patterns to represent n-ary relations in RDF and OWL:
In the first case (pattern 1), one of the individuals
in the relation (say, A
) is distinguished from others in that
it is the originator of the relation. Just like in the case of
binary relation, where P
was a property of A
with
value B
, here the instance of the relation itself is a property
of A
, with the value that is a complex object in itself, relating
several values and individuals. Examples 1 and 2 from the list above fall under
this category: Christine
and Steve
in these examples
are individuals that the properties are describing.
In the second case (pattern 2), the n-ary relation
represents a network of participants that all play different roles in the relation,
but two or more of the participants have equal "importance" in the
relation. Example 3 above would usually fall into this category: At least John
,
books.example.com
, and the Lenny_The_Lion
book seem
to be equally important in this purchasing relation.
An interested reader may also want to look at the discussion of reification
[3] and rdf:value
[4]
in RDF.
Pattern 1:
If we need to represent a value describing a relation (example 1, Christine has breast tumor with high probability) or represent an object of a relation that has different aspects (example 2, Steve has temperature, which is high, but falling), we can create an individual that includes the relation object itself, as well as the additional information about the object:
For the example 1 above (Christine has breast tumor with high probability),
the individual Christine
has a property has_diagnosis
that has another object (Diagnosis_Relation_1
, an instance of the
relation Diagnosis_Relation
) as its value:
The individual Diagnosis_Relation_1
here represents a single object
both the diagnosis (breast_tumor
) and the probability of the diagnosis
(HIGH
)1:
:Christine
a :Person ;
:has_diagnosis :Diagnosis_Relation_1 . :Diagnosis_Relation_1
a :Diagnosis_Relation ;
:diagnosis_probability :HIGH;
:diagnosis_value :Breast_Tumor .
The corresponding class definitions look as follows:
The additional labels on the links indicate the OWL restrictions on the properties.
We define both diagnosis_value
and diagnosis_probability
as functional properties. We also require that each individual Diagnosis_Relation
has exactly one value for Disease
.
In RDFS, the links represent rdfs:range
constraints on the properties.
For example, the class Diagnosis_Relation
is the range of the property
has_diagnosis
.
Here is a definition of the class Diagnosis_Relation
in OWL, assuming that both properties--diagnosis_value
and diagnosis_probability
--are
defined as functional (we provide full code for the example in OWL and RDFS
below):
:Diagnosis_Relation
a owl:Class ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:someValuesFrom :Disease ;
owl:onProperty :diagnosis_value
] ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:allValuesFrom :Probability_values ;
owl:onProperty :diagnosis_probability
] .
In the definition of the Person
class (of which the individual
Christine
is an instance) we specify a property has_diagnosis with
the range restriction going to the Diagnosis_Relation
class (of
which Diagnosis_Relation_1
is an instance):
:Person
a owl:Class ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:allValuesFrom :Diagnosis_Relation ;
owl:onProperty :has_diagnosis
] .
RDFS code for this example
[RDFS]
OWL code for this example
[N3] [RDF/XML] [Abstract syntax]We have a different use case in the example 2 above (Steve has temperature,
which is high, but falling): In the example with the diagnosis, many will
view the relationship we were representing as in a fact still a binary
relation between the individual Christine
and the diagnosis breast_tumor
that has a probability associated with it. The relation in this example
is between the individual Steve
and the object representing different
aspects of the temperature he has. In most intended interpretations, this relation
cannot be viewed as a binary relation with additional attributes attached to
it. Rather it is a relation between the individual Steve
and the
complex object representing different facts about his temperature.
The RDFS and OWL patterns that implement this intuition are however the same
as in the previous example. A class Person
(of which the individual
Steve
is an instance) has a property has_temperature
which has as a range the relation class Temperature_Relation.
Instances
of the class Temperature_Relation
(such as Temperature_Relation_1
in the figure) in turn have properties for temperature_value
and
temperature_trend
.
RDFS code for this example
[RDFS]
OWL code for this example
[N3] [RDF/XML] [Abstract syntax]
Pattern 2:
In some cases, the n-ary relationship represents a network of individuals that
play different roles in a structure without any single individual standing out
as the originator or the owner of the relation, such as Purchase
in the example 3 above (John buys a "Lenny the Lion" book from
books.example.com for $15 as a birthday gift). Here, the relation explicitly
has more than one participant, and, in many contexts, none of them can be considered
a primary one. In this case, we create an individual to represent the relation
with links to all participants:
In our specific example, the representation will look as follows:
Purchase_1
is an individual instance of the Purchase
class representing a relation:2
:Purchase_1
a :Purchase ;
:buyer :John ;
:object :Lenny_The_Lion ;
:purpose :Birthday_Gift ;
:seller :books.example.com .
The following diagram shows the corresponding classes and properties. For the sake of the example, we specify that each purchase has exactly one buyer (a Person), exactly one seller (a Company) and at least one object (an Object).
The diagram refers to OWL restrictions. In RDFS the arrows can be treated as
rdfs:range
links.
The class Purchase
is defined as follows in OWL (see the RDFS
file below for the definition in RDFS):
:Purchase
a owl:Class ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:allValuesFrom :Purpose ;
owl:onProperty :purpose
] ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:cardinality 1 ;
owl:onProperty :buyer
] ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:onProperty :buyer ;
owl:someValuesFrom :Person
] ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:cardinality 1 ;
owl:onProperty :seller
] ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:onProperty :seller ;
owl:someValuesFrom :Company
] ; rdfs:subClassOf
[ a owl:Restriction ;
owl:onProperty :object ;
owl:someValuesFrom :Object
] .
RDFS code for this example
[RDFS]
OWL code for this example
[N3] [RDF/XML] [Abstract syntax]Considerations when representing n-ary relations
- In many cases, the choice between the two patterns above is subjective.
We have described the difference in terms of the relative importance of various
participants in the relation. In many cases, making this judgment will be
difficult, and both pattern will be appropriate. For instance, if we want
to represent the fact that, in human anatomy, head and neck are adjacent along
the vertical axis, we can look at this relation in two ways.
(1) We want to specify ais_adjacent_to
property for thehead
, and the value of that property is a relation linking it to theneck
and specifying theaxis
as an additional attribute in the relation (pattern 1)
(2) We want to specify an individualadjacency_relation
that hashead
andneck
as its two values for the propertyobject
andvertical
as the value for the propertyaxis
. - In our example, we did not give meaningful names to the individuals representing relations (We do give meaningful names to the corresponding classes though). These individuals usually play auxiliary purpose of grouping together several objects and do not stand on their own. As a result, it is common not to have meaningful names for them (in particular if following pattern 1) and refer to them only in the context of individuals and properties for which they are the values. Note that a similar approach is taken when reifying statements in RDF.
- OWL allows definition of inverse
properties. Defining inverse properties with n-ary relations, using
any of the two patterns above, requires more work than with binary relations.
Each of the properties participating in the n-ary relation should have its
own inverse property (with the proper constraints). Consider the example of
John
buying theLenny_The_Lion
book. We may want to have an inverse relation pointing from theLenny_The_Lion
book to the person who bought it. If we had a simple binary relationJohn
buys
Lenny_The_Lion
, defining an inverse is simple: we simply define a propertyis_bought_by
as an inverse ofbuys
:
:is_bought_by
With the purchase relation represented as an instance, however, we need to add inverse relations between participants in the relation and the instance relation itself:
a owl:ObjectProperty ;
owl:inverseOf :buys .
For example, the definitions of the inverse relations for foragent
andobject
of a purchase, look as follows:
:is_buyer_for
And the definition of the
a owl:ObjectProperty ;
owl:inverseOf :buyer . :is_object_for
a owl:ObjectProperty ;
owl:inverseOf :has_object .Person
class (taking into account the inverse for therecipient
property) is:
:Person
Note that the value of the inverse property
a owl:Class ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:onProperty :is_buyer_for ;
owl:allValuesFrom :Purchase
] .is_buyer_for
for the individualJohn
, for example, is the individualPurchase_1
rather than theobject
orrecipient
of the purchase.
Notes
-
For simplicity, we represent each disease as an individual. This decision may not always be appropriate, and we refer the reader to a different note (ref to be added). Similarly, for simplicity, in OWL we represent probability values as a class that is an enumeration of three individuals (
HIGH
,MEDIUM
, andLOW
)::Probability_values
a owl:Class ;
owl:equivalentClass
[ a owl:Class ;
owl:oneOf (:HIGH :MEDIUM :LOW)
] .There are other ways to represent partitions of values. Please refer to a different note (ref to be added). In RDF Schema version, we represent them simply as strings, also for simplicity reasons.
- For simplicity, we will ignore the fact that the amount is expressed in $ and will use a simply number as the value for the property. For a discussion on how to represent units and quantities in OWL, please refer to a different note (ref to be added)
References
[1] https://lists.w3.org/Archives/Public/public-swbp-wg/2004May/0091.html
[2] https://lists.w3.org/Archives/Public/public-swbp-wg/2004May/0016.html
[3] https://lists.w3.org/Archives/Public/public-swbp-wg/2004Jul/0009.html
[4] https://www.w3.org/TR/2004/REC-rdf-primer-20040210/#reification
[5] https://www.w3.org/TR/2004/REC-rdf-primer-20040210/#rdfvalue