joshua scotton [email protected] owl-ql

19
Joshua Scotton [email protected] OWL-QL

Upload: alfred-vause

Post on 01-Apr-2015

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

Joshua Scotton

[email protected]

OWL-QL

Page 2: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

2

OWL-QL

• OWL Query Language)

• Based on DQL (DAML Query Lang.)

• Simple Request-Response Model• http://www-ksl.stanford.edu/projects/owl-ql/

Page 3: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

3

Basic Queries

1. a query pattern (required)

2. a must-bind variables list

3. a may-bind variables list

4. a don’t bind variables list

5. an answer pattern

6. a query premise

7. an answer KB pattern

8. an answer bundle size bound

Page 4: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

4

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

Page 5: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

5

A Simple OWL-QL QueryThe following is the actual query:<owl-ql:query xmlns: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:Description rdf:about="#C1">

<rdf:type rdf:resource="#Seafood-Course"/>

<drink rdf:resource="#W1"/>

</rdf:Description> </rdf:RDF></owl-ql:premise>

<owl-ql:queryPattern> <rdf:RDF> <rdf:Description rdf: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:kbRef rdf: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

Page 6: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

6

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>

Page 7: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

7

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)

Page 8: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

8

OWL-QL bindingsThree types of OWL-QL bindings

1. must-bind variables listsAnswers must provide bindings for all the must-bind variables

2. may-bind variables listsAnswers may provide bindings for any of the may-bind variables

3. don’t-bind variables listsAnswers are not to provide bindings for any of the don’t-bind variables

Page 9: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

9

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)

Page 10: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

10

Another Query

Who owns a red car?

Query Pattern: (owns ?p ?c) (type ?c Car) (has-color ?c Red)

Must-Bind Variable: ?pDon’t-Bind Variable: ?cAnswer Pattern: owns ?p a red car

Page 11: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

11

Answer patterns

• specify the format in which answer bindings are returned

• Answer Pattern: owns ?p a red car

Page 12: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

12

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 ?xMust-Bind Variables: ?x

Page 13: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

131

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

Page 14: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

14

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

Page 15: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

15

The Car Query<owl-ql:query xmlns: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:Description rdf: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:kbRef

rdf:resource="http://joedata/joe.owl"/></owl-ql:answerKBPattern><owl-ql:answerSizeBound>5</owl-ql:answerSizeBound>

</owl-ql:query>

Page 16: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

16

An OWL-QL answer

Contains:

• answer pattern instances

• an answer bundle

Page 17: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

17

The Car Query Answer<owl-ql:answerBundle xmlns: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:Description rdf: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:p rdf:resource="#Joe"/> </owl-ql:binding-set> <owl-ql:answerPatternInstance> <rdf:RDF> <rdf:Description rdf: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>

Page 18: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

18

Online Demonstrations

• Try OWL-QL Query Service at http://onto.stanford.edu:8080/owql/FrontEnd

Page 19: Joshua Scotton jscotton@dcs.warwick.ac.uk OWL-QL

Questions?

19