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] Sparql and subclasses

Chema . at
Sun Apr 1 09:57:18 PDT 2007

Hi Marisa,

Probably, sparql engine in protege works with the open model of the
ontologies (only classes and instances declared by the user, not inferred by
the reasoner), therefore the query do not retrieve the expected result.

A simple solution could be ask, explicitily, for the instances in the query,
something as:

1-Obtain all classes we want to retrieve their instances.
2-Union with these classes to  look up their instances
3-It is a bad solution, not scale and the union operation in sparql has a
high cost

select ?in
{ {?cl   rdfs:subClassOf    :B0 } union {?cl rdfs:subClassOf  :B1}  union
{?cl rdfs:subClassOf  :Bi}}.
?in rdf:type ?cl

Another solution ant the good way is close the model, after we can run the
query over declared and inferred classes/instances.
I don't know how to close the model in protege, i usually use a simple
program created with Java, Jena and Arq to run  this kind of queries.

Bye, Chema

On 4/1/07, Marisa Santos Amaro <marisa.osantos at> wrote:
> Hi, dear friends from OWL list !!
> I have some doubts about SPARQL and RACER running to query a Protege
> ontology.
> In the ontology below, SPARQL shows me only asserted instances of first
> level classes (like I3)and instances of subclasses located  at the second
> level of hierarchical model,  like I1 and  I2.
> - Class A
>     > Class A1
>     > Class A2  >> I1
> - Class B >>  I3
>     > Class B1
>     > Class B2 >> I2
>         > Class B21    >> I4
>                               >> I5
> I´d like to get all instances of Class B and of its subclasses, in all
> levels down, but the following query returns just I2 and I3. The instances
> I4 and I5 of Class B21 (a second level subclass) are not selected.
>   SELECT   ?z
>   WHERE  {?x    rdfs:subClasOf    :ClassB  .
>                  {?z    a   ?x}    UNION
>                  {?z    a   :ClassB}  }
> 2) RACER
> Running this reasoner, why it do not put asserted instances of ClassB21 as
> inferred ones of classes ClassB1 and ClassB ?
> Thanks for any help.
> Marisa.
> _______________________________________________
> protege-owl mailing list
> protege-owl at
> Instructions for unsubscribing:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the protege-owl mailing list