simple SPARQL query!

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

simple SPARQL query!

Rajverma

Hi,

 

I’m unable to find the syntax of a simple SPARQL query that fetches classes based on the restriction that has a conjunction of two other classes…

 

Ex:

 

A => X ^ Y

B => X ^ Y

C => X ^ Z

 

I want to frame a sparql query that gives me all the classes that are defined by (X ^ Y)… the answer that I want to get is A, B…

 

Above is a simple case… my actual classes are defined as follows…

 

A => p1 some (p2 only X)

B => p1 some (X and (p2 only Y))

 

Now, I’m able to query the first (A) case with the below query…

 

SELECT ?c ?r1 ?r2

WHERE {

    ?c  rdfs:subClassOf ?r1 .

    ?r1 rdf:type owl:Restriction .

    ?r1 owl:onProperty :p1 .

    ?r1 owl:someValuesFrom ?r2 .

    ?r2 rdf:type owl:Restriction .

    ?r2 owl:onProperty :p2 .

    ?r2 owl:allValuesFrom :X .

}

 

The answer I get for this query is:

c – A

r1 – p1 some (p2 only X)

r2 – p2 all X

 

so far so good… but I’m not able to query the second (B) case, b‘cos of the conjunction involved there… I know this is more simple and straight forward with DL Query tab, but my application is already setup with sparql queries embedded in it, so I badly need this one kind of query… I appreciate any pointers in this regard…

 

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: simple SPARQL query!

Rajverma

Hi,

 

What is the syntax for a sparql query that uses a conjunction with <owl:intersectionOf rdf:parseType="Collection"> type? I want to fetch the classes based on the restriction that has conjunction of two other classes…

 

Ex:

 

A => X ^ Y

B => X ^ Y

C => X ^ Z

 

I want to frame a sparql query that gives me all the classes that are defined by (X ^ Y)… the answer that I want to get is A, B…

 

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