Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] Tutorial for using SPARQL with OWL.

Rich Giuli richard.giuli at sri.com
Wed Sep 6 11:39:07 PDT 2006


Although this isn't possible in Protege, JENA comes with a 
TransitiveReasoner which can be used to infer rdfs:subClassOf and 
rdfs:subPropertyOf:.

The following query behaves differently depending on whether or not the 
TransitiveReasoner is installed:

        SELECT DISTINCT ?uri ?objType
        WHERE {
            ?subClass rdfs:subClassOf <http://myns:MyType> .
            ?uri rdf:type ?subClass .
            ?uri rdf:type ?objType .
        }

This query returns all instances of "http://myns:MyType" as well as all 
instances of subclasses, and for each instance binds the actual rdf:type 
for that instance. If the TransitiveReasoner is not installed, then the 
rdfs:subClassOf statement is interpreted literally with no inference, 
resulting in only direct descendants

FYI, when the TransitiveReasoner is installed, you can still query 
direct descendants only with the following SPARQL statement:

        SELECT DISTINCT ?uri ?objType
        WHERE {
            ?subClass 
<urn:x-hp-direct-predicate:http_//www.w3.org/2000/01/rdf-schema#subClassOf> 
<http://myns:MyType> .
            ?uri rdf:type ?subClass .
            ?uri rdf:type ?objType .
        }

This still doesn't help you if you are only using Protege. You will have 
to create your own app using JENA and install the TransitiveReasoner to 
get this working. I'm posting this to give a little more background. 
Also note that the JENA mailing lists are extremely useful so if you 
decide to use JENA and write your own app, look there for guidance 
(http://groups.yahoo.com/group/jena-dev/).

Hope this is helpful,
Rich

Olivier Dameron wrote:
> On Wed, 06 Sep 2006 10:53:04 -0700, Holger Knublauch
> <holger at knublauch.com> wrote:
>
>   
>> Massimo Coletti wrote:
>>     
>>> Gerhard Austaller ha scritto:
>>>       
>>>>  
>>>> problems that i can't figure aout how to solve. E.g. I try to get
>>>> all individuals that are instances of a particular class including 
>>>> individuals of subclasses of that class... Any hint?
>>>>
>>>>   
>>>>         
>>> this is not possible in SPARQL, as the language have only notion
>>> about asserted triples.
>>>       
>> This is not exactly correct.  The SPARQL language itself doesn't care 
>> whether a triple is inferred or asserted as long as the query graph 
>> provides it.  For example, you can easily do SPARQL queries on top of
>> a Jena inference graph.  But this is not possible in Protege.
>>     
>
> Gerhard's question does not mention asserted vs. inferred.
> I took it as a question about retrieving the "indirect" instances of a
> class, i.e. the instances of some subclass of a class, no matter if the
> subclass is asserted or infered.
>
> Again, I don't think that this is possible because sparql is not aware
> of the rdfs semantics (hence sparql is not aware of owl's semantics).
> sparql doesn't understand the subclass assertions (which are processed
> as any assertion) and it doesn't understand that rdfs:subClassOf is
> transitive, which is also a problem in the case proposed by Gerhard. 
>
> Other rdf query languages are aware of the rdfs semantics (e.g. SeRQL).
> Therefore, the fact that Gerhard's wish is impossible is not a
> limitation of Protege but only of sparql. Holger's remark is
> perfectly correct, but gives the impression that the problem is Protege
> whereas it is sparql (I think).
>
> Olivier
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20060906/b77f807e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5199 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20060906/b77f807e/attachment.p7s>


More information about the protege-owl mailing list