sqwrl a query language for owl n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
SQWRL: a Query Language for OWL PowerPoint Presentation
Download Presentation
SQWRL: a Query Language for OWL

Loading in 2 Seconds...

play fullscreen
1 / 18

SQWRL: a Query Language for OWL - PowerPoint PPT Presentation


  • 483 Views
  • Uploaded on

SQWRL: a Query Language for OWL . Martin O’Connor, Amar Das Stanford Center for Biomedical Informatics Research, Stanford University. SWRL and Querying. SWRL is a rule language, not a query language However, a rule antecedent can be viewed as a pattern matching specification, i.e., a query

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'SQWRL: a Query Language for OWL' - rico


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
sqwrl a query language for owl

SQWRL: a Query Language for OWL

Martin O’Connor, Amar Das

Stanford Center for Biomedical Informatics Research,

Stanford University

swrl and querying
SWRL and Querying

SWRL is a rule language, not a query language

However, a rule antecedent can be viewed as a pattern matching specification, i.e., a query

With built-ins, language compliant query extensions are possible

Hence: SQWRL (Semantic Query-Enhanced Web Rule Language; pronounced squirrel)

example swrl rule is adult
Example SWRL Rule: is adult?

Person(?p) ^ hasAge(?p,?age) ^ swrlb:greaterThan(?age,17)

→ Adult(?p)

Classify all persons in an ontology with an age greater than 17 as adults.

example sqwrl query
Example SQWRL Query

Person(?p) ^ hasAge(?p,?age) ^ swrlb:greaterThan(?age,17)

→ sqwrl:select(?p, ?age)

List all persons in an ontology with an age greater than 17.

slide5
Person(?p) ^ hasAge(?p,?age) ^ swrlb:greaterThan(?age,17)

→ sqwrl:select(?p, ?age) ^ sqwrl:orderBy(?age)

Example SQWRL Query:Ordering Results

List all persons in an ontology with an age greater than 17 and order

the result by age in ascending order.

Also: orderByDecending

slide6

Example SQWRL Query:Counting Results

Count all cars in ontology.

Car(?c) → sqwrl:count(?c)

Important: no way of asserting count in ontology!

slide7
Person(?p) ^ hasAge(?p, ?age) →sqwrl:avg(?age)

Example SQWRL Query:Aggregating Results

Average age of persons in ontology.

Also: sqwrl:max, sqwrl:min, sqwrl:sum

example sqwrl query arbitrary owl class expressions
Example SQWRL Query: Arbitrary OWL Class Expressions

(hasChild >= 1)(?x) → sqwrl:select(?x)

Individuals with cardinality restrictions.

SQWRL can act as a DL query language

semantics briefly
Semantics (Briefly)

Any SWRL body is valid query specification

Does not violate OWA

Does assume UNA

useful but relatively inexpressive
Useful but Relatively Inexpressive

Useful but relatively inexpressive. Needs:

Negation As Failure

Disjunction

Complex Counting

Complex Aggregation

We have recently added sets to the language to tackle these problems

sqwrl basic set operator
SQWRL: Basic Set Operator

Count all persons in ontology.

Person(?p) °

sqwrl:makeSet(?s, ?p) ^ sqwrl:size(?size, ?s)

→ sqwrl:select(?size)

Ser operators: sqwrl:isEmpty, sqwrl:union, sqwrl:difference

sqwrl negation as failure
SQWRL: Negation as Failure

List the number of non beta blocker drugs in ontology.

Drug(?d) ^ BetaBlocker(?b) °

sqwrl:makeSet(?s1, ?d) ^ sqwrl:makeSet(?s2, ?b) ^

sqwrl:difference(?s3, ?s1, ?s2) ^ sqwrl:size(?size, ?s3)

→ sqwrl:select(?size)

sqwrl disjunction
SQWRL: Disjunction

List the number of beta blocker or anti-hypertensive drugs in ontology.

AntiHypertensive(?d1) ^ BetaBlocker(?d2) °

sqwrl:makeSet(?s1, ?d1) ^ sqwrl:makeSet(?s2, ?d2) ^

sqwrl:union(?s3, ?s1, ?s2) ^ sqwrl:size(?size, ?s3)

→ sqwrl:select(?size)

sqwrl complex counting
SQWRL: Complex Counting

List all patients on more than two drugs.

Patient(?p) ^ hasDrug(?p,?d) °

sqwrl:makeSet(?s, ?d) ^ sqwrl:groupBy(?s, ?p) ^

sqwrl:size(?n, ?s) ^ swrlb:greaterThan(?n, 2)

→ sqwrl:select(?p)

sqwrl complex aggregation
SQWRL: Complex Aggregation

List the average dose of each drug taken by each patient.

Patient(?p) ^ hasDrug(?p,?d) ^ hasDose(?d, ?dose) °

sqwrl:makeSet(?s, ?dose) ^ sqwrl:groupBy(?s, ?p, ?d) ^

sqwrl:avg(?avg, ?s)

→ sqwrl:select(?p, ?d, ?avg)

sqwrl naf disjunction complex counting and aggregation
SQWRL: NAF, Disjunction, Complex Counting and Aggregation

List the average dose of patients that are on more than two drugs and where

none of those drugs is a beta blocker or anti-hypertensive.

Patient(?p) ^ hasDrug(?p,?d) ^ hasDose(?d, ?dose) ^

BetaBlocker(?d1) ^ AntiHypertensive(?d2) °

sqwrl:makeSet(?s1, ?dose) ^ sqwrl:groupBy(?s1, ?p, ?d) ^

sqwrl:makeSet(?s2, ?drug) ^ sqwrl:groupBy(?s2, ?p) ^

sqwrl:makeSet(?s3, ?d1, ?d2) ^

sqwrl:avg(?avg, ?s1) ^

sqwrl:size(?n, ?s2) ^ swrlb:greaterThan(?n, 2) ^

sqwrl:intersection(?s4, ?s2, ?s3) ^ sqwrl:isEmpty(?s4)

→ sqwrl:select(?p, ?d, ?avg)

advantages of swrl based query language
Advantages of SWRL-Based Query Language
  • No need to invent a new semantics
  • Standard(ish) presentation syntax (° is syntactic sugar)
  • Standard serialization
  • Can use existing reasoning infrastructure
  • Can use existing editors
  • On-the-fly query checking in editors
  • For SWRL users, easy to learn
  • Extensible with built-ins (TBox, RDF,XML…)
  • Useful for debugging SWRL rules
  • Queries can interoperate with rules
  • Not SPARQL!
summary
Summary
  • Core language features available for 1+ years in Protege-OWL
  • Set operators will be available in month or so
  • Plans for Protege4 port