conjunctions in sparql query

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

conjunctions in sparql query

Rajverma
Hi,

I'm unable to get the correct syntax to query a conjunction using sparql query... suppose I have the following class axiom:

C1 => some p1 C2

I can query this with the following query, to get the answer C1...

SELECT ?c
WHERE {
        ?c rdfs:subClassOf ?r .
        ?r rdf:type owl:Restriction .
        ?r owl:onProperty :p1 .
        ?r owl:someValuesFrom :C2 .
        }

But when I have the class axiom of the type,

C1 => some p1 (C2 and C3)

I'm not able to formulate the query that takes this conjunction (C2 and C3) into account... I tried many ways but not able to find the right syntax to use this 'Collection' property in the query... could someone help me with some pointers...

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

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
Reply | Threaded
Open this post in threaded view
|

Re: conjunctions in sparql query

Rajverma
I asked this question in this community few weeks ago, but it seems there are not too many sparql experts here... I got a response from pellet community though... just wana share the answer with you...

############################################################################
SELECT ?c
WHERE {
    ?c rdfs:subClassOf ?r .
    ?r rdf:type owl:Restriction .
    ?r owl:onProperty :p1 .
    ?r owl:someValuesFrom ?i .
    ?i rdf:type owl:Class .
    ?i owl:intersectionOf ?l .
    ?l rdf:first :C2 .
    ?l rdf:rest ?m .
    ?m rdf:first :C3 .
    ?m rdf:rest rdf:nil .
    }

or the slightly more compact (using various SPARQL shortcuts):

SELECT ?c
WHERE {
    ?c rdfs:subClassOf [
        a owl:Restriction ;
        owl:onProperty :p1 ;
        owl:someValuesFrom [
            a owl:Class ;
            owl:intersectionOf ( :C2 :C3 )
            ]
        ]
    }

-Brandon :)
############################################################################

Cheers,
Raj


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Mudunuri, Venkata Rajashekar Varma
Sent: Donnerstag, 4. März 2010 13:51
To: 'User support for the Protege-OWL editor'
Subject: [protege-owl] conjunctions in sparql query

Hi,

I'm unable to get the correct syntax to query a conjunction using sparql query... suppose I have the following class axiom:

C1 => some p1 C2

I can query this with the following query, to get the answer C1...

SELECT ?c
WHERE {
        ?c rdfs:subClassOf ?r .
        ?r rdf:type owl:Restriction .
        ?r owl:onProperty :p1 .
        ?r owl:someValuesFrom :C2 .
        }

But when I have the class axiom of the type,

C1 => some p1 (C2 and C3)

I'm not able to formulate the query that takes this conjunction (C2 and C3) into account... I tried many ways but not able to find the right syntax to use this 'Collection' property in the query... could someone help me with some pointers...

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

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
Reply | Threaded
Open this post in threaded view
|

Re: conjunctions in sparql query

Thomas Russ
This is the main reason why SPARQL is not considered an ideal query  
language for OWL.  It doesn't really support the OWL semantics, and  
forces you to deal with fiddly details of the RDF triple  
representation.  That is a representation that isn't even guaranteed  
to remain stable, since there are sometimes different, semantically  
equivalent ways of representing the same OWL construct.

In the example you give below, you work with the description

   C1 => some p1 (C2 and C3)

and have to manually decode the intersection class.  But it is  
certainly possible that in the course of extending your ontology that  
you will at some point name that conjunction by introducing another  
description

   C23 <=> C2 and C3

If you do that, then a semantically equivalent way of representing

   some p1 (C2 and C3)

would be

  C1 => some p1 C23

and then your search for the intersection class would fail because OWL  
had replaced it with a semantically equivalent named class.

On Mar 4, 2010, at 6:57 AM, Mudunuri, Venkata Rajashekar Varma wrote:

> I asked this question in this community few weeks ago, but it seems  
> there are not too many sparql experts here... I got a response from  
> pellet community though... just wana share the answer with you...
>
> ############################################################################
> SELECT ?c
> WHERE {
>    ?c rdfs:subClassOf ?r .
>    ?r rdf:type owl:Restriction .
>    ?r owl:onProperty :p1 .
>    ?r owl:someValuesFrom ?i .
>    ?i rdf:type owl:Class .
>    ?i owl:intersectionOf ?l .
>    ?l rdf:first :C2 .
>    ?l rdf:rest ?m .
>    ?m rdf:first :C3 .
>    ?m rdf:rest rdf:nil .
>    }
>
> or the slightly more compact (using various SPARQL shortcuts):
>
> SELECT ?c
> WHERE {
>    ?c rdfs:subClassOf [
>        a owl:Restriction ;
>        owl:onProperty :p1 ;
>        owl:someValuesFrom [
>            a owl:Class ;
>            owl:intersectionOf ( :C2 :C3 )
>            ]
>        ]
>    }
>
> -Brandon :)
> ############################################################################
>
> Cheers,
> Raj
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]
> ] On Behalf Of Mudunuri, Venkata Rajashekar Varma
> Sent: Donnerstag, 4. März 2010 13:51
> To: 'User support for the Protege-OWL editor'
> Subject: [protege-owl] conjunctions in sparql query
>
> Hi,
>
> I'm unable to get the correct syntax to query a conjunction using  
> sparql query... suppose I have the following class axiom:
>
> C1 => some p1 C2
>
> I can query this with the following query, to get the answer C1...
>
> SELECT ?c
> WHERE {
> ?c rdfs:subClassOf ?r .
> ?r rdf:type owl:Restriction .
> ?r owl:onProperty :p1 .
> ?r owl:someValuesFrom :C2 .
> }
>
> But when I have the class axiom of the type,
>
> C1 => some p1 (C2 and C3)
>
> I'm not able to formulate the query that takes this conjunction (C2  
> and C3) into account... I tried many ways but not able to find the  
> right syntax to use this 'Collection' property in the query... could  
> someone help me with some pointers...
>
> Thanks,
> Raj
> _______________________________________________
> protege-owl mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
> _______________________________________________
> protege-owl mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03

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

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03