[Pellet-users] A simple OWL-DL query

Evren Sirin evren at clarkparsia.com
Wed Feb 13 19:21:49 UTC 2008


On 2/12/08 2:00 PM, Wolfgang May wrote:
> Hi,
>
> On Tue, 12 Feb 2008, João Paulo Sousa wrote:
>
>   
>> Hi,
>>
>> I have the above ontology, basically it's define a person and a  
>> location, and the person can have a location.
>>
>> In this sample steve is in the bar and bill is in theater, and the bar  
>> isPartOf (Transitive property) theater.
>>
>> It's possible to make a query to know if steve is in the theater? But  
>> using the Transitive property, of course ;-) . How to make this  
>> query? :-)
>>     
>
> Not really:
>
> for what you want to do, you would need role-chains (OWL 1.1, but 
> already supported by Pellet), e.g.
>   is-in SubpropertyOf (is-in concat is-part-of).
>   

The subproperty axiom should be other way around (using the names from 
the OWL file below and in Turtle syntax):

(hasLocation isPartOf) rdfs:subPropertyOf hasLocation .

> For demonstrating transitivity of is-part-of, you would
> at least need e.g.
>   bar is-part-of theaterFirstFloor.
>   theater-First-Floor is-part-of theater.
> AFAIR, role chains are only allowed with atomic roles, i.e. not with a
> transitive one as above. Transitivity alone cannot combine edges
> along different roles.
>   

No, this is not true. The restriction says cardinality restrictions 
cannot be used on transitive properties or properties that has complex 
subproperties. This would mean that in this example hasLocation cannot 
be used in any cardinality restrictions (e.g. it cannot be defined 
functional).

The other alternatives:

1) Similar inference can be obtained by the following SWRL rule:

 hasLocation(person, x) ^ isPartOf(x, loc) -> hasLocation(person, loc)

Pellet supports only DL-safe rules so this rule would only be applied to 
the individuals mentioned in the query which should be ok in this case.

2) You can also use a union query in SPARQL like:

SELECT *
WHERE {
    { ?person :locatedAt ?loc }
    UNION
    { ?person locatedAt ?x .
       ?x :isPartOf ?loc }
}

The query approach does not require OWL 1.1 support or SWRL support but 
it is not very elegant either.

Hope this helps,
Evren
> You can probably hack something by defining 
>   is-in subPropertyOf myrole.
>   is-part-of subPropertyOf myrole.
>   myrole a transitiveProperty.
>   [I am even not sure that this is allowed]
> and ask for
>   ?X myrole ?B . ?X a person . ?B a partofbuilding
> to select those  x myrole y  that you are interested in.
> But that's dirty ;)
>
> Wolfgang
>
>
>   
>> Cheers,
>>
>> João Paulo.
>>
>>
>> <?xml version="1.0"?>
>> <!DOCTYPE rdf:RDF [
>>      <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
>>      <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
>>      <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
>>      <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
>> ]>
>> <rdf:RDF xmlns="http://example.org#"
>>       xml:base="http://example.org"
>>       xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>>       xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
>>       xmlns:owl="http://www.w3.org/2002/07/owl#"
>>       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
>>      <owl:Ontology rdf:about=""/>
>>      <Room rdf:ID="bar">
>>          <isPartOf rdf:resource="#theater"/>
>>      </Room>
>>      <Person rdf:ID="bill">
>>          <hasLocation rdf:resource="#theater"/>
>>      </Person>
>>      <owl:Class rdf:ID="Building">
>>          <rdfs:subClassOf rdf:resource="#Spac"/>
>>      </owl:Class>
>>      <owl:ObjectProperty rdf:ID="contains">
>>          <rdf:type rdf:resource="&owl;TransitiveProperty"/>
>>          <rdfs:domain rdf:resource="#Spac"/>
>>          <rdfs:range rdf:resource="#Spac"/>
>>          <owl:inverseOf rdf:resource="#isPartOf"/>
>>      </owl:ObjectProperty>
>>      <owl:ObjectProperty rdf:ID="hasLocation">
>>          <rdfs:domain rdf:resource="#Person"/>
>>          <rdfs:range rdf:resource="#Spac"/>
>>      </owl:ObjectProperty>
>>      <owl:ObjectProperty rdf:ID="isPartOf">
>>          <rdfs:domain rdf:resource="#Spac"/>
>>          <rdfs:range rdf:resource="#Spac"/>
>>          <owl:inverseOf rdf:resource="#contains"/>
>>      </owl:ObjectProperty>
>>      <owl:Class rdf:ID="Person"/>
>>      <owl:Class rdf:ID="Room">
>>          <rdfs:subClassOf rdf:resource="#Spac"/>
>>      </owl:Class>
>>      <owl:Class rdf:ID="Spac"/>
>>      <Person rdf:ID="steve">
>>          <hasLocation rdf:resource="#bar"/>
>>      </Person>
>>      <Building rdf:ID="theater">
>>          <contains rdf:resource="#bar"/>
>>      </Building>
>> </rdf:RDF>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Pellet-users mailing list
>> Pellet-users at lists.owldl.com
>> http://lists.owldl.com/mailman/listinfo/pellet-users
>> _______________________________________________
>>
>> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/
>>     
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Pellet-users mailing list
>> Pellet-users at lists.owldl.com
>> http://lists.owldl.com/mailman/listinfo/pellet-users
>> _______________________________________________
>>
>> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/



More information about the Pellet-users mailing list