Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research,...

20
Knowledge Integration with SWRL Martin O’Connor Stanford Center for Biomedical Informatics Research, Stanford University

Transcript of Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research,...

Page 1: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

Knowledge Integration with SWRL

Martin O’ConnorStanford Center for Biomedical Informatics Research,

Stanford University

Page 2: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

2

Talk Outline

• Rules and the Semantic Web: OWL + SWRL

• Knowledge Integration–Querying–XML–Relational (and CSV/Excel)–Ontology integration

Page 3: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

3

What is SWRL?

• SWRL is an acronym for Semantic Web Rule Language.

• SWRL is intended to be the rule language of the Semantic Web.

• SWRL includes a high-level abstract syntax for Horn-like rules.

• All rules are expressed in terms of OWL concepts (classes, properties, individuals).

Page 4: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

4

Example SWRL Rule

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

→ Adult(?p)

Page 5: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

5

SWRL Semantics

• Based on OWL-DL

• Has a formal semantics

• Complements OWL and fully semantically compatible

• More expressive yet at expense of decidability

Page 6: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

6

SWRLTab: http://protege.cim3.net/cgi-bin/wiki.pl?SWRLTab

Page 7: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

7

Uses of SWRL for Knowledge Integration

• Ontology querying• Data integration

– XML– Relational data (and CSV/Excel)

• Ontology mapping

Page 8: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

8

SWRL and Querying: SQWRL

• 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.

• We have developed a SWRL-based query language called SQWRL

Page 9: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

9

Example SQWRL Query

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

→ sqwrl:select(?p, ?age)

Return all adults in an ontology :

Page 10: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

10

Another SQWRL Query

Person(?p) ^ hasAge(?p, ?age) ^ swrlb:greaterThan(?age, 17) -> sqwrl:select(?p)

^ sqwrl:orderBy(?age)

Return all adults in an ontology ordered by age:

Page 11: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

11

Use of SWRL as basis for Query Language is Attractive

• Cleaner semantics than SPARQL

• OWL-based, not RDF-based

• Very extensible via built-ins, e.g., temporal queries using temporal built-ins

Page 12: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

12

XML Mapping

Ontology

XML Document

Application

SWRLMappingRules

Visit_3

Page 13: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

13

<Patients> <Patient> <PID>3454-34</PID> <Age>43</Age> … <ZIP>94402</ZIP> </Patient>…<Patents>

XML Querying

swrlxml:XMLElement(?ep) ^ swrlxml:hasName(?ep,“Patent”) ^ swrlxml:hasSubElement(?ep,?eAge) ^ swrlxml:hasName(?eAge,“Age”) ^ swrlxml:hasContent(?eAge,?cAge) ^ swrlxml:convert(?age, ?cAge, xs:Integer) ^swrlxml:hasSubElement(?ep,?eZIP) ^ swrlxml:hasName(?eZIP,“ZIP”) ^ swrlxml:hasContent(?eZIP, ?ZIP) -> sqwrl:select(?ZIP) ^ sqwrl:avg(?age)

Return the average age of patients per ZIP code:

Page 14: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

14

Relational Mapping

• DataMaster:– Imports schema or content of relational

databases into Protégé-OWL– Uses JDBC/ODBC so supports: MySQL, SQL

Server, Oracle etc.– Also supports Excel files.

• Dynamic DataMaster: supports dynamic SWRL/SQWRL-driven relational importation

Page 15: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

15

Page 16: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

16

Dynamic DataMaster

• Can query data imported by DataMaster

• Dynamic querying also supported via DDM

• One-the-fly querying of relational data

• Mapping ontology specifies link

Page 17: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

17

DynamicDataMaster

OWLKB Bridge

Data

Knowledge

Rule Engine

Page 18: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

18

Ontology Mapping for Integration

• SWRL rules are very good at traversing trees

• Complex mappings between multiple ontologies convenient in SWRL

• Knowledge-level mappings to merge or integrate ontologies

Page 19: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

19

Example Application

Page 20: Knowledge Integration with SWRL Martin OConnor Stanford Center for Biomedical Informatics Research, Stanford University.

20

Software Availability

• Free, open source; download at: protégé.stanford.edu

• SWRLTab, Datamaster: v3.3.1

• SQWRL, XML querying: v3.4 beta

• Dynamic relational querying: 2-3 months

• Extensive documentation: http://protege.cim3.net/cgi-bin/wiki.pl?SWRLTab