views:

63

answers:

3

in RDF a statement is represented with S,P and O; In OWL the owl:ObjectProperty represents the predicate logic.

 (S) (P) (O)   
  I like dog

<owl:Class rdf:about="Person" />
<owl:NamedIndividual rdf:about="I">
    <rdf:type rdf:resource="Person"/>
    <like rdf:resource="Dog"/>
</owl:NamedIndividual>

<owl:Class rdf:about="Pet" />
<owl:NamedIndividual rdf:about="Dog">
    <rdf:type rdf:resource="Pet"/>
</owl:NamedIndividual>

<owl:ObjectProperty rdf:about="like">
    <rdfs:domain>
        <owl:Restriction>
            <owl:onProperty rdf:resource="like"/>
            <owl:someValuesFrom rdf:resource="Person"/>
        </owl:Restriction>
    </rdfs:domain>
    <rdfs:range>
        <owl:Restriction>
            <owl:onProperty rdf:resource="like"/>
            <owl:someValuesFrom rdf:resource="Pet"/>
        </owl:Restriction>
    </rdfs:range>
</owl:ObjectProperty>

But how about to describe "the degree" I like dogs? How can I give a property or value to a predicate? One solution I got is to extend one (S,P,O) statement to 3 statements. For example,

(S)             (P)        (O) 
 Person       isSrcOf    LikeRelation
 Pet          isTargetOf LikeRelation
 LikeRelation hasValue   [0~100]

It should work but obviously it will let ontology 3 times bigger :(

I appreciate any suggestion!

+1  A: 

Your suggestion is a valid one; it is called reification and is the standard way of representing properties inherent to a relationship between two items in an ontology or RDF graph, where statements are made in a pairwise manner between items - it is a limitation of the data model itself that makes reification necessary sometimes.

If you're worried that reification will inflate your ontology, you could try the following instead, but are generally less desirable and come with their own problems:

  1. Create specific properties, such as somewhatLikes, doesntLike, loves; this may be suitable if you have a limited set of alternatives, and don't mind creating the extra properties. This becomes tedious and cumbersome (and I'd go so far as to suggest incorrect) if you intend to encode the 'degree of likeness' with an integer (or any wide range of alternatives) - following this approach, you'd have properties like likes0, likes1, ..., likes99, likes100. This method would also preclude querying, for example, all dogs that a person likes within a range of degree values, which is possible in SPARQL with the reification approach you've specified, but not with this approach.
  2. Attach the likesDogs property to the Person instance, if the assertion can be made against the person onto all types/instances of Dog, and not individual instances. This will, of course, be dependent of what you're trying to capture here; if it's the latter, then this also won't be appropriate.

Good luck!

sharky
+1  A: 

I wouldn't use RDF reification, not in this case and almost not in any case. RDF reification just makes the things always more complicated. As you commented it will inflate your ontology, but not just that, it'll also make your ontology very difficult for applying OWL reasoning.

I've dealt with the same scenario that you've presented and most of times I've ended up with the following design.

(S) (P) [ (P) (O) (P) (O)]
I like [ 'what I like' Dog , 'how much I like it' 'a lot']

Class: LikeLevel //it represents class of things a person likes with a degree factor.

ObjectProperty: likeObject
    Domain: LikeLevel
    Range: Pet //(or Thing)

ObjectProperty: likeScale
    Domain: LikeLevel
    Range: xsd:int //(or an enumeration class i.e: 'nothing', 'a bit', 'very much',...)

ObjectProperty: like
    Domain: Person
    Range: LikeLevel

If you want to represent some instance data with this model (in RDF/Turtle syntax):

:I :like [ a :LikeLevel; 
   :likeObject :dogs;
   :likeScale 5.7] . 

In this case I'm creating a blank node for the object LikeLevel but you could create a ground object as well, sometimes you might want/need to avoid bNodes. In that case:

:I :like :a0001 .
:a0001 a :LikeLevel; 
   :likeObject :dogs;
   :likeScale 5.7.

This design can be consider a light case of reification, the main difference with RDF reification is that keeps the ontology design in the user's model.

msalvadores
Despite what you claim, your answer still effectively uses reification by *reifying* the `like` relationship to a first-order entity called `LikeLevel` (a _concept_), allowing you to attach attributes to the relationship itself, like the object (`Pet`) and 'scale' (integer value). This is generally the correct approach, and is called _reification_.
sharky
Also, your claim that reification (in this case) makes it difficult to perform OWL reasoning is _incorrect_. Note that reification doesn't only apply to the transformation of RDF triples s-p-o to the three triples r-s, r-p, r-o, which does in fact makes OWL reasoning difficult, but *not* in this circumstance where the only reification is of a single property in the model.
sharky
@rati you might be right what I have done could be considered reification as in the general term reification for computer science. But is not pure RDF reification, where rdf:subject, rdf:predicate and rdf:object are used (see http://www.w3.org/TR/rdf-mt/#ReifAndCont). I meant that reasoning is difficult to perform when using RDF reification, mostly because one should always consider a level of indirection/abstraction that is out of the user's data model. As opposite my solution keeps the design in the user's data model.
msalvadores
@rati @elgcom answer edited to explicitly state RDF reification.
msalvadores
@msalvadores; I agree that _RDF reification_ is completely inappropriate in this case, and that your solution here applies _property reification in the OWL TBox_ to correctly address the problem. (+1)
sharky
@sharky @elgcom @rati just to follow up on this question I think is worth looking at these two recent discussions from the semantic web email list. http://lists.w3.org/Archives/Public/semantic-web/2010Sep/0202.html http://lists.w3.org/Archives/Public/semantic-web/2010Sep/0155.html
msalvadores
A: 

A sentence from Jena's document just catch my eye.

...OWL Full allows ... state the following .... construction:

<owl:Class rdf:ID="DigitalCamera">
  <rdf:type owl:ObjectProperty />
</owl:Class>
..

does OWL Full really allow an ObjectProperty be a Class as well? If an ObjectProperty could be a Class, and could have individuals then I could describe a statement with

S_individual P_individual O_individual

and I could have further properties on P_individual. Is it right? or am I missing some points?

since the following RDF is valid, a corresponding OWL should be achievable.

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:j.0="http://somewhere/" > 

  <rdf:Description rdf:about="http://somewhere/Dog_my_dog"&gt;
    <j.0:name>Lucky</j.0:name>
  </rdf:Description>
  <rdf:Description rdf:about="http://somewhere/like_dog"&gt;
    <j.0:degree>80</j.0:degree>
  </rdf:Description>

  <rdf:Description rdf:about="http://somewhere/Cat_my_cat"&gt;
    <j.0:name>Catty</j.0:name>
  </rdf:Description>
  <rdf:Description rdf:about="http://somewhere/like_cat"&gt;
    <j.0:degree>86</j.0:degree>
  </rdf:Description>

  <rdf:Description rdf:about="http://somewhere/Person_I"&gt;
    <j.0:name>Bob</j.0:name>
    <j.0:like_dog rdf:resource="http://somewhere/Dog_my_dog"/&gt;
    <j.0:like_cat rdf:resource="http://somewhere/Cat_my_cat"/&gt;
  </rdf:Description>

</rdf:RDF>
elgcom
@elgcom RDF/XML syntax is very difficult to read I recommend you to write your posts and comments using RDF/Turtle or Manchester Syntax. They are much easier to understand/.
msalvadores
@elgcom what happens if catty likes dogs with a different degree than bob ? Your degree of confidence is attached to the property therefore you would not be able to have different degrees. Apart from that you'd need to have multiple properties for everything that a person might like.
msalvadores
@msalvadores: so the idea is letting predicate "Like" as a Class, and declaring its individual for every "Like"-relation. Can I have a Bnode for a "predicate" in RDF?
elgcom
@msalvadores: of course I am not sure the idea is a good practice. In my application the "relation" (e.g. like) is much important than subject or object. Therefore I would like to model them so that I can easily traverse or query those relations.
elgcom
@elgcom bNodes as predicates ? I don't think so. You wouldn't be able to reference them.
msalvadores