190 likes | 309 Views
OWL-QL. Joshua Scotton jscotton@dcs.warwick.ac.uk. OWL-QL. OWL Query Language) Based on DQL (DAML Query Lang.) Simple Request-Response Model http://www-ksl.stanford.edu/projects/owl-ql/. Basic Queries. a query pattern (required) a must-bind variables list a may-bind variables list
E N D
OWL-QL Joshua Scotton jscotton@dcs.warwick.ac.uk
OWL-QL • OWLQuery Language) • Based on DQL (DAML Query Lang.) • Simple Request-Response Model • http://www-ksl.stanford.edu/projects/owl-ql/
Basic Queries • a query pattern (required) • a must-bind variables list • a may-bind variables list • a don’t bind variables list • an answer pattern • a query premise • an answer KB pattern • an answer bundle size bound
A simple OWL-QL query If C1 is a Seafood Course and W1 is a drink of C1, what color is W1? P: (type C1 Seafood-Course) (drink C1 W1) Q: (has-color W1 ?x) V: must-bind ?x AP: drink ?x Wine with Seafoood KB: http://somewhere.com/wine.owl A: drink White Wine with Seafood
A Simple OWL-QL Query The following is the actual query: <owl-ql:queryxmlns:owl-ql="http://www.w3.org/2003/10/owl-ql-syntax#" xmlns:var="http://www.w3.org/2003/10/owl-ql-variables#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#"> <owl-ql:premise> <rdf:RDF> <rdf:Descriptionrdf:about="#C1"> <rdf:typerdf:resource="#Seafood-Course"/> <drink rdf:resource="#W1"/> </rdf:Description> </rdf:RDF></owl-ql:premise> <owl-ql:queryPattern> <rdf:RDF> <rdf:Descriptionrdf:about="#W1"> <has-color rdf:resource="http://www.w3.org/2003/10/owl-ql-variables#x"/> </rdf:Description> </rdf:RDF> </owl-ql:queryPattern> <owl-ql:mustBindVars> <var:x/> </owl-ql:mustBindVars> <owl-ql:answerKBPattern> <owl-ql:kbRefrdf:resource="http://ontolingua.stanford.edu/wines.owl"/> </owl-ql:answerKBPattern> <owl-ql:answerSizeBound>5</owl-ql:answerSizeBound> </owl-ql:query> This would normally be included inside a SOAP message
Response to Simple Query <rdfs:Class rdf:ID="SEAFOOD-COURSE"> <owl:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#DRINK"/> <owl:toClass> <owl:Restriction> <owl:onProperty rdf:resource="#COLOR"/> <owl:hasValue rdf:resource="#WHITE"/> </owl:Restriction> </owl:toClass> </owl:Restriction> </owl:subClassOf> </rdfs:Class>
Query patterns • specifies a collection of OWL sentences in which some URI refs are considered to be variables • Query Pattern: (owns ?p ?c) (type ?c Car) (has-color ?c Red)
OWL-QL bindings Three types of OWL-QL bindings • must-bind variables lists Answers must provide bindings for all the must-bind variables • may-bind variables lists Answers may provide bindings for any of the may-bind variables • don’t-bind variables lists Answers are not to provide bindings for any of the don’t-bind variables
OWL-QL bindings • A KB may entail the existence of a query answer, but not entail a binding for every variable in the query • A KB says -every person has exactly one father and - Joe is a person • The KB -entails that Joe has a father -but may not entail a value of property “hasFather” for Joe (i.e., the KB may not identify the father)
Another Query Who owns a red car? Query Pattern: (owns ?p ?c) (type ?c Car) (has-color ?c Red) Must-Bind Variable: ?p Don’t-Bind Variable: ?c Answer Pattern: owns ?p a red car
Answer patterns • specify the format in which answer bindings are returned • Answer Pattern: owns ?p a red car
Query Premises • “if-then” queries cannot be stated using only a query pattern • When a premise is included in a query it is considered to be included in the answer KB Query: “If C1 is a Seafood Course and W1 is a drink of C1, then what color is W1? Premise: (type C1 Seafood-Course) (has-drink W1 C1) Query Pattern: has-color W1 ?x Must-Bind Variables: ?x
Answer KB patterns • The Answer KB is a set of OWL sentences that are used by the server in answering the query • If a query’s answer KB pattern is a variable then the server is free to select or to generate an answer KB from which to answer the query. • If a query’s answer KB pattern is a list of KBs then answer sentences must be entailed by conjunction of the KBs in that list
Answer bundle size bounds • specify the maximum number of answers in each “bundle” • answers are delivered by the server in bundles <owl-ql:answerSizeBound>5</owl-ql:answerSizeBound> • contain at most the number of query answers given by the answer bundle size bound
The Car Query <owl-ql:queryxmlns:owl-ql="http://www.w3.org/2003/10/owl-ql-syntax#" xmlns:var="http://www.w3.org/2003/10/owl-ql-variables#"> <owl-ql:queryPattern><rdf:RDF> <rdf:Descriptionrdf:about="http://www.w3.org/2003/10/owl-ql-variables#p"> <owns rdf:resource="http://www.w3.org/2003/10/owl-ql-variables#c"/> </rdf:Description> <Car rdf:ID="http://www.w3.org/2003/10/owl-ql-variables#c"> <has-color rdf:resource="#Red"/> </Car> </rdf:RDF></owl-ql:queryPattern> <owl-ql:mustBindVars><var:p/></owl-ql:mustBindVars> <owl-ql:answerKBPattern><owl-ql:kbRefrdf:resource="http://joedata/joe.owl"/></owl-ql:answerKBPattern> <owl-ql:answerSizeBound>5</owl-ql:answerSizeBound> </owl-ql:query>
An OWL-QL answer Contains: • answer pattern instances • an answer bundle
The Car Query Answer <owl-ql:answerBundlexmlns:owl-ql="http://www.w3.org/2003/10/owl-ql-syntax#" xmlns:var="http://www.w3.org/2003/10/owl-ql-variables#"> <owl-ql:queryPattern><rdf:RDF> <rdf:Descriptionrdf:about="http://www.w3.org/2003/10/owl-ql-variables#p"> <owns rdf:resource="http://www.w3.org/2003/10/owl-ql-variables#c"/> </rdf:Description> <Car rdf:ID="http://www.w3.org/2003/10/owl-ql-variables#c"> <has-color rdf:resource="#Red"/> </Car> </rdf:RDF></owl-ql:queryPattern> <owl-ql:answer> <owl-ql:binding-set> <var:prdf:resource="#Joe"/> </owl-ql:binding-set> <owl-ql:answerPatternInstance> <rdf:RDF> <rdf:Descriptionrdf:about="#Joe"> <owns rdf:resource="http://www.w3.org/2003/10/owl-ql-variables#c"/> </rdf:Description> <Car rdf:ID="http://www.w3.org/2003/10/owl-ql-variables#c"><has-color rdf:resource="#Red"/></Car> </rdf:RDF> </owl-ql:answer> <owl-ql:continuation> <owl-ql:none/> </owl-ql:continuation> </owl-ql:answerBundle>
Online Demonstrations • Try OWL-QL Query Service at http://onto.stanford.edu:8080/owql/FrontEnd