[protege-owl] Selecting all asserted individuals in a SPARQL Query

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

[protege-owl] Selecting all asserted individuals in a SPARQL Query

Massimo Coletti
Hi,

I have an OWL ontology, with a Class Person and a subclass YoungPerson.
If I execute a SPARQL query

SELECT ?geek WHERE { ?geek a :Person }

I get only the individuals asserted to belong to the PErson class, while
the individuals belonging to YoungPerson class are excluded.

The only workaround is to create a UNION, with an additional clause {
?geek a ?sub . ?sub rdfs:subClassOf :Person .  }

Clearly, if my subclass tree has many levels, this is unpartical. I
wasn't able to figure out if this is the expected behaviour of SPARQL or
is typical of te Jena interface of Protege.

Anyone can help? I found a similar topic about subproperties among Rinke
and Holger in December, but I don't know it is connected.

Thanks,

Massimo


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.
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Selecting all asserted individuals in a SPARQL Query

Holger Knublauch
Massimo Coletti wrote:

> Hi,
>
> I have an OWL ontology, with a Class Person and a subclass YoungPerson.
> If I execute a SPARQL query
>
> SELECT ?geek WHERE { ?geek a :Person }
>
> I get only the individuals asserted to belong to the PErson class, while
> the individuals belonging to YoungPerson class are excluded.
>
> The only workaround is to create a UNION, with an additional clause {
> ?geek a ?sub . ?sub rdfs:subClassOf :Person .  }
>
> Clearly, if my subclass tree has many levels, this is unpartical. I
> wasn't able to figure out if this is the expected behaviour of SPARQL or
> is typical of te Jena interface of Protege.
>
> Anyone can help? I found a similar topic about subproperties among Rinke
> and Holger in December, but I don't know it is connected.

Massimo,

I don't think this would work with Protege, because it would require
reasoning while the query is executed.  The Protege-OWL bridge to Jena
only operates on the asserted triples, i.e. direct neighbors.

You could use Jena directly, and execute the queries on top of an
InfModel.  Or you can use other tools that have more SPARQL options.

Holger
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Selecting all asserted individuals in a SPARQL Query

Massimo Coletti
Holger Knublauch ha scritto:
>
> Massimo,
>
> I don't think this would work with Protege, because it would require
> reasoning while the query is executed.  The Protege-OWL bridge to Jena
> only operates on the asserted triples, i.e. direct neighbors.
Holger, I wasn't thinking about an inferred model, but only about the
asserted model. Protege is already aware (without using a reasoner) that
an individual asserted of YoungPerson class is also an individual of
Person class. This "awareness" seems lost in the SPARQL module. I can't
figure out if this behaviour is dictated by the SPARQL specifications or
is an implementation decision.

Thanks anyhow,

Massimo


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.
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Selecting all asserted individuals in a SPARQL Query

Holger Knublauch
> Holger, I wasn't thinking about an inferred model, but only about the
> asserted model. Protege is already aware (without using a reasoner) that
> an individual asserted of YoungPerson class is also an individual of
> Person class. This "awareness" seems lost in the SPARQL module. I can't
> figure out if this behaviour is dictated by the SPARQL specifications or
> is an implementation decision.

The "awareness" that you refer to is a kind of inference that the
Protege API does on the fly (in some cases):  Some API methods have
convenience services to also return transitive values, such as indirect
superclasses or indirect instances.

SPARQL operates on triples only, and you would need an implementation
that can wrap the above services behind a triple store.  As I said you
can't do this with Protege, but you can do it with Jena.  Are you
looking for a programmer's solution, or for an end-user's UI solution?

Holger
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: Selecting all asserted individuals in a SPARQL Query

Olivier Dameron
In reply to this post by Massimo Coletti
On Fri, 25 Aug 2006 13:13:13 +0200, Massimo Coletti
<[hidden email]> wrote:

> I have an OWL ontology, with a Class Person and a subclass
> YoungPerson. If I execute a SPARQL query
>
> SELECT ?geek WHERE { ?geek a :Person }
>
> I get only the individuals asserted to belong to the PErson class,
> while the individuals belonging to YoungPerson class are excluded.

I don't think that sparql is aware of the rdfs semantics. Hence, the
fact that YoungPerson is a subclass of Person is meaningless to the
sparql engine and there is no reason why the instances of YoungPerson
should also be instances of Person (from the query engine point of
view).

You might be interested in:
http://www.aifb.uni-karlsruhe.de/WBS/pha/rdf-query/

> The only workaround is to create a UNION, with an additional clause {
> ?geek a ?sub . ?sub rdfs:subClassOf :Person .  }

Likewise, your workaround will only work for the *direct* subclasses of
Person.

Olivier
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html