NEDA ALIPANAH, MARIA ADELA GRANDO DBMI [email protected] [email protected] 11/19/2012.

34
Querying- Reasoning with Ontologies NEDA ALIPANAH, MARIA ADELA GRANDO DBMI [email protected] [email protected] 11/19/2012

Transcript of NEDA ALIPANAH, MARIA ADELA GRANDO DBMI [email protected] [email protected] 11/19/2012.

Page 1: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Querying-Reasoning with

OntologiesNEDA ALIPANAH, MARIA ADELA GRANDO

[email protected]@ucsd.edu

11/19/2012

Page 2: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Outline of the talkUse case scenario: Informed Consent

Examples of Querying and Reasoning on Ontologies :Semantic Web Rule Language (SWRL)SPARQL

Criteria to choose a reasoning language

Conclusions

Page 3: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Use Case: Informed ConsentCommunication process between a patient and

investigator that ultimately results in the patient’s agreement to participate in a research study.

The process includes documents that the patient must sign to acknowledge the discussion on the reason for the research study, risks, benefits, alternatives, options to withdraw, etc.

It constitutes a critical decision-making process: It is crucial that patients are engage in the decision of

participating in the study, and understand

the consequences.

Page 4: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Research Involving Specimens

Because of the developments in genetics and genomics biological specimens (biospecimens) and clinical data for research are currently in high demand, they can be very limited in availability.

This concern has boosted the creation of clinical data warehouses and biobanks.

Subject’s will to share his biospecimens and clinical data to biobanks and warehouses is expressed through informed consent

Page 5: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Informed Consent Management Vision

Clinical Data Warehouse

QueryUser U requests data D and sample S to perform operation O on subjects like I under constraints C

User U

Research Institutio

n

HealthcareInstitution

ResultsUser U receives data D and sample S in compliance with subject’s permission

Permission Repository

Resou

rce M

ed

iato

r

BioSample Repository

PermissionI authorize U to perform operation O over my data D or sample S under certain constraints C

Patient I

Can I access blood samples from patients with breast cancer for

cancer research?

I consent to share my blood

samples for future cancer

research

Page 6: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Permission OntologyA <subject> has <permission> or <obligation> to perform an <operation> over <biological specimens> or <medical records> under constraints

Page 7: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Permission Ontology- Data Repository

Page 8: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Resource Mediator for Cancer Center Biorepository

Clinical Data Warehouse

QueryUser U requests data D and sample S to perform operation O on subjects like I under constraints C

User U

Research Institutio

n

HealthcareInstitution

ResultsUser U receives data D and sample S in compliance with subject’s permission

Permission Repository

Resou

rce M

ed

iato

r In

terf

ace

MCCBioSample Repository

I am a Stanford researcher, can I access laboratory

tests and frozen blood samples from patients with ovarian cancer?

Reasoning Engine

Page 9: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Resource Mediator Interface

QueryUser U requests data D and sample S to perform operation O on subjects like I under constraints C

I am a Stanford researcher, can I access laboratory

tests and frozen blood samples from patients with ovarian cancer?

Page 10: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Resource Mediator Reasoning Engine

1. Look for the patients with breast cancer diagnosis who have signed IC documents authorizing sharing his/her blood samples and laboratory tests

2. Check if that the requested resources can be shared in compliance with the patient’s signed consent.

I am a Stanford researcher, can I access laboratory tests and frozen blood samples from

patients with ovarian cancer?

PermissionI authorize U to perform operation O over my data D or sample S under certain constraints C

Page 11: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Resource Mediator Reasoning Engine

Check that the MCC biorepository and clinical data warehouse has available the requested clinical record entries and biosamples in the requested preservation state.

I am a Stanford researcher, can I access laboratory

tests and frozen blood samples from patients with ovarian cancer?

Page 12: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Where in the Layered Architecture?

XML/XML Schemas

RDF/OWL Ontologies

Rules/Query

Resource Mediator

OtherServices

URI/UNICODE

SPARQL SWRL

Page 13: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SWRL Resource Mediator

Clinical Data Warehouse

QueryUser U requests data D and sample S to perform operation O on subjects like I under constraints C

User U

Research Institutio

n

HealthcareInstitution

ResultsUser U receives data D and sample S in compliance with subject’s permission

Permission Repository

Resou

rce M

ed

iato

r In

terf

ace

MCCBioSample Repository

I am a Stanford researcher, can I access laboratory

tests and frozen blood samples from patients with ovarian cancer?

SWRLReasoning

Engine

Page 14: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SWRL: Inference in OWLSemantic Web Rule Language (SWRL)

Intended for rule-based reasoning in the Semantic Web

SWRL is based on OWL: all rules are expressed in terms of OWL concepts (classes, properties, individuals,…)

Provides intuitive, easy-to-read specifications

Supported by Protégé

Requires a reasoner, for instance Jess reasoner

Page 15: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SWRL: Inference in OWLSWRL rules have the form antecedent ->

consequent where:both antecedent and consequent are conjunctions of

atoms written a1 ∧ ... ∧ an,

variables are indicated using the standard convention of prefixing them with a question mark (e.g., ?x).

Example:

Person(?p) ^ hasSibling(?p,?s) ^ Man(?s) -> hasBrother(?p,?s)

How would you define hasUncle(?x,?y)?

Page 16: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SWRL Query Example

Which informed consents grant me

access to de-identified blood samples?

User U

Research Institutio

n

Page 17: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SWRL Query Example

Which informed consents grant me

access to de-identified blood samples?

Page 18: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SWRL Query ExamplehasPolicy(?InfConsent, ?ppolicy) ^ Permission(?ppolicy) ^ canPerformOperation(?ppolicy, ?operation) ^ Share(?operation) ^ BloodSample(?sample) ^ operatesOn(?operation, ?sample) ^ isDeintifiedData(?sample, 1) -> sqwrl:selectDistinct(?InfConsent)

Page 19: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SPARQL: Inference on RDF/RDFSSPARQL

Query on Linked Data Directly (Graph)Use Triple Patterns in the Graph

SPARQL SyntaxSelect Command CONSTRUCT Command (for reasoning

)OPTIONAL Command

Page 20: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SPARQL Query• Ontology Triple Pattern

<http://www.owl-ontologies.com/Ontology1331852106.owl#PatientName_6><http://www.w3.org/1999/02/22-rdf-syntax-ns#type><http://www.owl-ontologies.com/Ontology1331852106.owl#PatientName>

Page 21: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Simple SPARQL Query• Single Triple Matching (Use the Select

Structure of SQL) Select Variable name (?a)Where{Subject Predicate ?a}

• Multiple Triple MatchingSelect Variable name (?a),(?b)Where{Subject1 Predicate1 ?a . Subject2 Predicate2 ?b }

Page 22: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SPARQL Query• SPARQL Triple PatternDifferent parts of triple patterns can be variables.

SELECT DISTINCT ?a WHERE{ ?a rdf:type <http://www.owl-ontologies.com/Ontology1331852106.owl#PatientName> . }LIMIT 32

Page 23: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SPARQL for Inferencing What is inferencing (Reasoning)?

An inference is the creation of a fact from existing facts.

In RDF, this means adding a triple.:Patient6 rdf:type :Patient

: Patient rdfs:subClassOf :Person

Example of Inferencing in SPARQL Subclass (Subsumption) Inference Transitive Inference

Page 24: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Subclass Inferencing Subclass Inference (Subsumption)

: Patient6 rdf:type :Person I.e. all members of the subclass are also members of the superclass.

Command SPARQL CONSTRUCT for adding triples:

Returns a graph (set of triples) that is the result of applying the CONSTRUCT graph pattern to each match in the WHERE clause.

CONSTRUCT {?rsc rdf:type :Person}

WHERE

{ ?rsc rdf:type :Patient .

.Patient rdfs:subClassOf :Person .

}

Page 25: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Subclass Inferencing CONSTRUCT {?rsc rdf:type :Person}

WHERE

{ ?rsc rdf:type :Patient .

.Patient rdfs:subClassOf :Person .

}

Check the Triples with Where clause Condition.?rsc rdf:type :Patient

Patient rdfs:subClassOf :Person

…then the CONSTRUCT query will return the relevant triple for them and add to the graph.

{?rsc rdf:type :Person}

Page 26: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Transitive InferencingExample

PREFIX o:http://www.owl-ontologies.com/Ontology1331852106.owl

SELECT ?policy WHERE{ ?policy rdf:type o:Permission; OPTIONAL {?policy o:haspolicy ?n} Filter(?n="MCCInfConsent")}

Permission(?ppolicy) ^

hasPolicy(?ppolicy,“MCCInfConsent”)

Page 27: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Inference ResultThe results are returned in RDF graph form.

It can be directly inserted into an existing graph.

Following inference protocol, Add this to the inferred graph, Saved to the asserted graph.

Page 28: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

Inference ResultSPARQL 1.1:

Data directly asserted into your data through the INSERT/INSERT INTO syntax INSERT INTO <graph-name>

{?x rdf:type ?c2}

WHERE

{ ?c1 rdfs:subClassf ?c2 .

?x rdf:type ?c1 .

}

Page 29: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SPARQL for Inferencing VSPARQL 1.1:

INSERT is part of the general SPARQL update syntax that includes DELETE/DELETE FROM. This means that one can do updates on existing triples. An example: MODIFY GRAPH <graph-name>

INSERT – DELETE SyntaxINSERT {?rsc ?someprop ?newvalue}

DELETE {?rsc ?someprop ?value}

WHERE { ?rsc ?someprop ?value . ... ?newvalue . }

Page 30: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SPARQL vs. SQL SPARQL is to RDF is like SQL to relational

models.

Relational Model RDF Model (Linked data)

Many of SQL commands have equivalent in SPARQL (e.g. OPTIONAL can be seen as a left-outer join).

Page 31: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

SPARQL OPTIONAL COMMANDSPARQL has a the ability to query for

data but not to fail query when that data does not exist.

SELECT ?Patient-name ?Patient-ageWHERE{ ?person hasFirstName ? Patient-name . OPTIONAL { ?person age ? Patient-age}

| name | age |=======================| "Becky Smith" | 23 || "Sarah Jones" | || "John Smith" | 25 || "Matt Jones" | |

Page 32: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

How to choose a reasoning language?

What is happening in the Back-End?

RDF vs. OWL Querying

RDF/RDFS Ontologies

Application Level

OWL Ontologies

Rules/Queries

SPARQL SWRL

Page 33: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

How to choose a reasoning language?

Criteria Protégé SWRL SPARQL

Ontology Type OWL RDF/RDFS

Ease of Use/ Intuitiveness

Easy Difficult

User level Non-programmer Programmer

Performance NP CompleteNot good

Good

Flexibility to improve Performance

Less Flexible More Flexible

Page 34: NEDA ALIPANAH, MARIA ADELA GRANDO DBMI nalipanah@ucsd.edu mgrando@ucsd.edu 11/19/2012.

ConclusionNeed inference to get more information from

ontologies.

SWRL is upper level reasoning language on OWL Ontologies.

SPARQL is lower level language for querying/reasoning RDF Ontologies.

SWRL is more intuitive and SPARQL is more technical (no semantic).