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

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Gerhard Austaller-2
Hi

Is there a good tutorial on how to use SPARQL with OWL. I have some
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?

Thx
Gerhard

_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
Reply | Threaded
Open this post in threaded view
|

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

Schmitz, Jeffrey A
Here's a decent one...

http://www-128.ibm.com/developerworks/library/j-sparql/ 

I no expert by any means, but I think  you'll just have to search for
the instances type properties with the appropriate classes as the
subjects.  I don't think there is any shortcut that will work
automatically as new subclasses are added to the ontology.  You just
have to search for each possible subclass unless you want to build your
query somehow based on the ontology model itself.

-----Original Message-----
From: Gerhard Austaller [mailto:[hidden email]]
Sent: Wednesday, September 06, 2006 11:02 AM
To: [hidden email]
Subject: [protege-owl] Tutorial for using SPARQL with OWL.

Hi

Is there a good tutorial on how to use SPARQL with OWL. I have some
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?

Thx
Gerhard

_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
Reply | Threaded
Open this post in threaded view
|

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

Massimo Coletti
In reply to this post by Gerhard Austaller-2
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.
You can see a previous thread (25-30 aug.) among me, Holger and Olivier

Cheers,

Massimo
> Thx
> Gerhard
>
> _______________________________________________
> protege-owl mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>  



This e-mail and any attachments may contain confidential and
privileged information. If you are not the intended recipient,
please notify the sender immediately by return e-mail, delete this
e-mail and destroy any copies. Any dissemination or use of this
information by a person other than the intended recipient is
unauthorized and may be illegal.
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
Reply | Threaded
Open this post in threaded view
|

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

Holger Knublauch


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.

Holger
TopQuadrant, Inc.
http://www.topbraidcomposer.com
http://composing-the-semantic-web.blogspot.com/
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
Reply | Threaded
Open this post in threaded view
|

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

Gerhard Austaller-2
In reply to this post by Massimo Coletti
Hi

"Massimo Coletti" <[hidden email]> schrieb:

>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.
>You can see a previous thread (25-30 aug.) among me, Holger and Olivier

Thanks! I found the thread. That's a pitty :-(  I thought that the
point in having a query language is that the language is aware of the
semantics. Otherwise we can stick with xpath and work on the XML
documents... Ok, I have to apologize. I know that you can not compare
xpath to SPARQL. Further, without having a query language that is aware
of the semantics of  OWL language constructs there is no point in
having ontologies in OWL.  Because now I am really wondering how to use
the knowledge I modelled in OWL when there is no query language.

Does anybody know projects on OWL-Query languages?

Thx
Gerhard

_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
Reply | Threaded
Open this post in threaded view
|

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

Gerhard Austaller-2
In reply to this post by Holger Knublauch
Hi

"Holger Knublauch" <[hidden email]> schrieb:

>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.

Thx. I'll have a look to that!

Gerhard

_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
Reply | Threaded
Open this post in threaded view
|

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

Olivier Dameron
In reply to this post by Holger Knublauch
On Wed, 06 Sep 2006 10:53:04 -0700, Holger Knublauch
<[hidden email]> 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
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
Reply | Threaded
Open this post in threaded view
|

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

Holger Knublauch
> 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.

But indirect instances have an inferred rdf:type triple.  If you have
reasoning turned on on a Jena graph and then ask for the types of a
resource, then it will return all types (up to rdfs:Resource if you
want) as extra, inferred triples.


> 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.

But these inferences can be handled further down on the Graph level.  If
you have a Graph implementation that does the inferencing on the fly
then you can execute SPARQL on top of it.  You can get complete OWL DL
semantics by taking a Jena Pellet Graph as the query base.


> 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).

Nope, it's a Protege problem only.

Holger
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
Reply | Threaded
Open this post in threaded view
|

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

Holger Knublauch
In reply to this post by Gerhard Austaller-2
>> 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.
>
> Thx. I'll have a look to that!

If you are not a programmer and don't want to get into the details of
Jena, you can try it out with TopBraid Composer (use the option to run
SPARQL on top of Pellet).  This tool uses Jena under the hood but comes
with a convenient query interface.

By the way I have just written about using SPARQL for ontology mapping,
and how to visualize SPARQL queries in class diagrams in my blog (linked
below) - if someone is interested.

Holger

TopQuadrant, Inc.
http://www.topbraidcomposer.com
http://composing-the-semantic-web.blogspot.com/
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
Reply | Threaded
Open this post in threaded view
|

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

Rich Giuli
In reply to this post by Olivier Dameron
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 <a class="moz-txt-link-rfc2396E" href="http://myns:MyType"><http://myns:MyType> .
            ?uri rdf:type ?subClass .
            ?uri rdf:type ?objType .
        }


This query returns all instances of <a class="moz-txt-link-rfc2396E" href="http://myns:MyType">"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>
<a class="moz-txt-link-rfc2396E" href="http://myns:MyType"><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
[hidden email] 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
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
  


_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Olivier Dameron
On Wed, 06 Sep 2006 11:39:07 -0700, Rich Giuli <[hidden email]>
wrote:

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

I didn't know about the TransitiveReasoner.
My bad. Thanks for pointing this out.

Olivier
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl
Reply | Threaded
Open this post in threaded view
|

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

Michael Wessel-2
In reply to this post by Gerhard Austaller-2
Am Wednesday 06 September 2006 20:04 schrieb Gerhard Austaller:

> Does anybody know projects on OWL-Query languages?

Yes, for example nRQL, the query language of the RacerPro system. nRQL is

- an ABox query language,
- an RDF query language (that is aware of the semantics of the RDFS
predicates, thus it works on the "inferred triples"),
- an OWL query language.

A tutorial is available (see RacerPro Users Guide).

> Thx
> Gerhard

Regards,

Michael


_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl