|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Help in writting Sparql QueriesHi I am having problem writing sparql query from an ontology that I created in Protégé 3.3.1.
Class: Laptops String – name Float – weight
CPU String – name Float – speed Int – cache
name, speed, cache and weight have been defined as datatype properties. has_CPU is defined as object property
Laptops has_CPU CPU
Is it possible to write a query to access or list the datatype property of the CPU instance with the (above) given information?
For example: I am trying to write a sparql query to List all laptops that has cpu speed greater than or equal to 1.5?
_______________________________________________ protege-owl mailing list protege-owl@... https://mailman.stanford.edu/mailman/listinfo/protege-owl Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 |
|
|
Re: Help in writting Sparql QueriesThe fundamental problem with using SPARQL to query an OWL ontology is
that SPARQL works on the serialized structure of the tuples, and there are several structurally different but semantically equivalent ways to serialize an OWL expression. You are better off doing this with an OWL-aware query language like SQWRL. You can search the mail archives for more information. On Jul 23, 2008, at 6:25 PM, R A J E E V Santhirarasa wrote: > Hi > I am having problem writing sparql query from an ontology that I > created in Protégé MailScanner has detected a possible fraud attempt > from "3.3.1." claiming to be 3.3.1. > > Class: > Laptops > String – name > Float – weight > > CPU > String – name > Float – speed > Int – cache > > name, speed, cache and weight have been defined as datatype > properties. > has_CPU is defined as object property > > Laptops has_CPU CPU > > > Is it possible to write a query to access or list the datatype > property of the CPU instance with the (above) given information? > > For example: I am trying to write a sparql query to > List all laptops that has cpu speed greater than or equal to 1.5? > > > Thank You > Rajeev Santhirarasa > _______________________________________________ > protege-owl mailing list > protege-owl@... > https://mailman.stanford.edu/mailman/listinfo/protege-owl > > Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 _______________________________________________ protege-owl mailing list protege-owl@... https://mailman.stanford.edu/mailman/listinfo/protege-owl Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 |
|
|
Re: Help in writting Sparql QueriesOn Jul 23, 2008, at 10:37 PM, Thomas Russ wrote: > The fundamental problem with using SPARQL to query an OWL ontology is > that SPARQL works on the serialized structure of the tuples, and there > are several structurally different but semantically equivalent ways to > serialize an OWL expression. > > You are better off doing this with an OWL-aware query language like > SQWRL. Is there a useful reference for understanding this more? I guess I'm not sure the details of how this plays out once an OWL-aware reasoner, like Pellet, is in the picture. > You can search the mail archives for more information. Rajeev, the best way to get a feel for writing SPARQL queries is to look at your knowledge base in n3/Turtle format. Nonetheless I'll give it a shot: PREFIX yourNS: <http://your.namespace.com/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?laptop_url ?name WHERE { ?laptop_url yourNS:has_CPU ?cpu . ?cpu yourNS:speed ?speed ; yourNS:name ?name . FILTER ( ?speed > "1.5"^^xsd:float ) } Realize, of course, that each of the triples in this query must be 'in the model', which is to say that if they are entailments of OWL statements you must be using (or have used and saved the results of) an adequate reasoner. The FILTER is applied against each set of statements that match the top part of the query, and results where the ?speed field doesn't meet the condition are dropped before the results are returned. --J > > > On Jul 23, 2008, at 6:25 PM, R A J E E V Santhirarasa wrote: > >> Hi >> I am having problem writing sparql query from an ontology that I >> created in Protégé MailScanner has detected a possible fraud attempt >> from "3.3.1." claiming to be 3.3.1. >> >> Class: >> Laptops >> String – name >> Float – weight >> >> CPU >> String – name >> Float – speed >> Int – cache >> >> name, speed, cache and weight have been defined as datatype >> properties. >> has_CPU is defined as object property >> >> Laptops has_CPU CPU >> >> >> Is it possible to write a query to access or list the datatype >> property of the CPU instance with the (above) given information? >> >> For example: I am trying to write a sparql query to >> List all laptops that has cpu speed greater than or equal to 1.5? >> >> >> Thank You >> Rajeev Santhirarasa >> _______________________________________________ >> protege-owl mailing list >> protege-owl@... >> https://mailman.stanford.edu/mailman/listinfo/protege-owl >> >> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 > > _______________________________________________ > protege-owl mailing list > protege-owl@... > https://mailman.stanford.edu/mailman/listinfo/protege-owl > > Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 > _______________________________________________ protege-owl mailing list protege-owl@... https://mailman.stanford.edu/mailman/listinfo/protege-owl Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 |
|
|
Re: Help in writting Sparql QueriesI see that you already have replies, so I
will leave you with a link You need to use “Filter”. http://www.w3.org/TR/rdf-sparql-query/ http://jena.sourceforge.net/ARQ/Tutorial/ http://www.ibm.com/developerworks/xml/library/j-sparql/ From: protege-owl-bounces@...
[mailto:protege-owl-bounces@...] On Behalf Of R A J E E V Santhirarasa Hi I am having problem writing sparql query from an
ontology that I created in Protégé 3.3.1. Class: Laptops
String – name Float
– weight CPU
String – name
Float – speed
Int – cache
name, speed, cache and
weight have been defined as datatype properties. has_CPU is defined as
object property Laptops has_CPU CPU Is it possible to write a query to access or list the
datatype property of the CPU instance with the (above) given information? For example: I am trying to write a sparql query to List all laptops that has
cpu speed greater than or equal to 1.5?
_______________________________________________ protege-owl mailing list protege-owl@... https://mailman.stanford.edu/mailman/listinfo/protege-owl Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 |
|
|
Re: Help in writting Sparql QueriesThank you all for your help.
On Thu, Jul 24, 2008 at 10:00 AM, Pitonyak, Andrew D <PitonyakA@...> wrote:
_______________________________________________ protege-owl mailing list protege-owl@... https://mailman.stanford.edu/mailman/listinfo/protege-owl Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 |
| Free Forum Powered by Nabble | Forum Help |