SlideShare a Scribd company logo
ON THE RELATIONSHIP
BETWEEN OBDA AND
RELATIONAL MAPPING
Diego Calvanese, Marco Montali, Mariano Rodríguez-Muro
KRDB Research Group
Free University of Bozen-Bolzano
Thanks to A. Artale, E. Franconi, D. Lembo, M. Lenzerini, A. Mosca
Dagstuhl, May 2013
Reasoning
Traditional Approach
Data
Store
Conceptual
Schema /
Ontology
ResultQuery
Logical
Schema
Reasoning
Reasoning
Ontology-Based Data Access
Logical
Schema
Data
Store
Conceptual
Schema /
Ontology
ResultQuery
The usual workflow
Reasoner
Source
Application
Communication
Ontology
Inputs
Triples Application Code
Problems
•  Software Complexity
•  Duplication
•  Data refreshing
•  Data structure is lost
(PKEYS, FOREIGN KEYS,
information about the import
procedure)
OBDA: Architecture, Techniques and Systems
Reasoner
Source
Application
Communication
Ontology
Inputs
Triples Application Code
OBDA as an Architecture
OBDA: Architecture, Techniques and Systems
Reasoner
Source
Application
Direct
Communication
Ontology
OBDA
Model
Inputs
OBDA Models: Sources and Mappings
“A formal specification of the relationship
between data in a data source and the
vocabulary of the ontology”
OBDA: Architecture, Techniques and Systems
OBDA
Model
Source
Source Declaration A set of mappings
Mapping
“A tuple of 2 queries, one over the source and
one over the ontology, with the same
signature. Intuitively, a mapping associates the
data specified by qs with the answers for qo ”
qs⊆qo
SELECT id FROM
condition WHERE
c_id = 3333
⊆ CardiacArrestPatient(?id)èq(?id)
id = (23) <23> rdf:type CardiacArrestPatient
Example OBDA
model
SELECT id FROM
condition WHERE
c_id = 3333
⊆CardiacArrestPatient(?id)
è q(?id)
SELECT id,name,age,ssn
FROM patient ⊆Patient(?id) ^ name(?id,?name)
^ age(?id,?age) ^ ssn(?id, ?ssn)
è q(?id,?name,?age,?ssn)
id [PKEY] name age ssn
12345 John 37 xxx-999
… … … …
Table: patient
patient_id [FKEY] c_id [FKEY]
12345 3333
… …
Table: condition
Example OBDA
model
id [PKEY] name age ssn
12345 John 37 xxx-999
… … … …
Table: patient
patient_id [FKEY] c_id [FKEY]
12345 3333
… …
Table: condition
<12345> rdf:type :Patient.
<12345> :name “John”.
<12345> :age “37”.
<12345> :ssn “xxx-999”
<12345> rdf:type :CardiacArrestPatient
…
The Pay-off
•  At least
•  The source is documented
•  Data handling can be done automatically (by the reasoner)
•  Reduced cost of application development and maintenance
•  The reasoner can analyze source and mappings to minimize the cost of
inference
•  The sweet spot
•  On-the-fly data access
•  Reasoning by query rewriting: queries posed directly over the conceptual
schema, taking into account the constraints of the conceptual schema itself
•  Exploitation of efficient engines to provide the answer to the query
Answering Queries: Rewriting
• Given a query Q, a TBox T, an OBDA model <D, M>
to compute a query Q’ such that:
answer(Q,T,mat(D,M)) = answer(Q’,D)
where mat(D,M) is the collection of assertion resulting
from “materializing” the mappings into ABox assertions
(assertional triples)
Example OBDA
model
SELECT id FROM
condition WHERE
c_id = 3333
⤳ CardiacArrestPatient(?id)
è q(?id)
SELECT id,name,age,ssn
FROM patient ⤳ Patient(?id) ^ name(?id,?name)
^ age(?id,?age) ^ ssn(?id, ?ssn)
è q(?id,?name,?age,?ssn)
id [PKEY] name age ssn
12345 John 37 xxx-999
… … … …
Table: patient
patient_id [FKEY] c_id [FKEY]
12345 3333
… …
Table: condition
Query Rewriting:
An example
Ontology (Tbox)
SubClassOf(:CardiacArrest :HearthCondition)
SubClassOf(:CardiacArrestPatient :Patient)
SubClassOf(:CardiacArrestPatient
ObjectSomeValuesFrom(:affectedBy :CardiacArrest))
Query (SPARQL)
SELECT ?p ?name ?ssn WHERE {
?p a :Patient; :name ?name; :ssn ?ssn; :age ?age
:affectedBy [
a :HeartCondition
]. FILTER (?age >= 21 && ?age <= 50)
}
Query Rewriting:
An Example
Rewritten query
SELECT ?p ?name ?ssn WHERE {
{?p a :Patient; :name ?name; :ssn ?ssn; :age ?age
:affectedBy [
a :HeartCondition
]. FILTER (?age >= 21 && ?age <= 50)
}
UNION
{?p a :Patient; :name ?name; :ssn ?ssn; :age ?age
:affectedBy [
a :CardiacArrest
]. FILTER (?age >= 21 && ?age <= 50)
}
UNION
{?p a :Patient; :name ?name; :ssn ?ssn; :age ?age;
a :CardiacArrestPatient.
FILTER (?age >= 21 && ?age <= 50)
}
UNION …
}
Query Rewriting:
An Example
SQL query
SELECT tp.id as p, tp.name as name, tp.age as age
FROM
patient tp JOIN condition tc ON tp.id = tc.patient_id
WHERE
c.c_id = 3333 AND
tp.age >= 21 AND
tp.age <= 50
?p ?name ?ssn
12345 John xxx-999
Answer
“Fast execution even in the presence of millions of
assertions”
OBDA: Key Points
• Mappings to tackle the abstraction gap between the
conceptual model and the underlying data storage
• Main application: query answering (read-only modality)
•  Taking into account the constraints present in the conceptual schema
•  Considering incomplete data at this level
•  Implementation of query answering facilities: two steps
•  Incorporation of the conceptual schema directly into the query
•  Use of mappings to rephrase the query in terms of another query, this time
directly applicable to the underlying data
•  N.B.: this magic can happen only under suitable restrictions on the
expressible constraints (cf. first-order rewritability)
Software Engineering
Redundancies in SW Development
Data logic (transient)
Global conceptual
schema
Application layer
Persistence layer
object-oriented
logical schema
Presentation logic
mapping
meta-data
Application logic
Data logic (persistent)
relational logical
schema
Object-relational mapping
•  No real abstraction gap between the
persistent and transient data logic
(“lossless” connection)
•  However, they look at data from
different perspectives
•  Transient data logic: OO programming
•  Persistent data logic: Relational DBMS
•  In the OO paradigm, we have
•  Hierarchies
•  Different ways for navigating the associations
•  Object identifiers, no explicit keys
Relational Mapping
• Methodology to obtain a database schema (in third-normal
form) out from a conceptual schema
• Requires to suitably annotate the conceptual schema
• To specify how to handle with hierarchies
• To specify how to handle with 1-1 associations
• To bridge the gap between the OO and relational world
•  OO: internal object identifiers (references)
•  Relational DB: primary keys
•  Mandatory vs optional attributes
Relational Mapping: an example
StaffMember
code: String {P}
email: String
phoneNumber: String
Student
id: long {P}
name: String
surname: String
surname
NOT NULL
∗ 0..1
supervisor
PermanentMember
divisionNr: int
FixedTermMember
endTerm: Date
endTerm
NOT NULL
ContractType
is used as a
discriminator for the
subclasses
{complete, disjoint}
Project
projectNr: long {P}
manager1
∗ ∗
∗participant
Relational Mapping: an example
StaffMember
code: String {P}
email: String
phoneNumber: String
Student
id: long {P}
name: String
surname: String
surname
NOT NULL
∗ 0..1
supervisor
PermanentMember
divisionNr: int
FixedTermMember
endTerm: Date
endTerm
NOT NULL
ContractType
is used as a
discriminator for the
subclasses
{complete, disjoint}
Project
projectNr: long {P}
manager1
∗ ∗
∗participant
Table per subclass!
Object-Relational Mapping
Object-Relational Mapping (ORM!)
Data logic (transient)
Global conceptual
schema
Application layer
Persistence layer
object-oriented
logical schema
Presentation logic
mapping
meta-data
Application logic
Data logic (persistent)
relational logical
schema
Object-relational mapping
•  A lot of programming effort
to code the synchronization
between the transient and
persistent data logic
•  Object-relational mapping
•  Annotate the transient data logic
with information about relational
mapping
•  Exploit these annotations to
•  Create the underlying database
schema (if needed)
•  Automatically synchronize the
two layers
Example: Hibernate Mappings
<class name="Student" table="Student" abstract="true”>
<id name="id" column="personId”>
<generator class="assigned"/>
</id>
<property name="name" not-null="true"/>
<property name="surname"/>
<many-to-one name="supervisor" class="StaffMember" column="memberCode"/>
</class>
<class name="StaffMember" abstract="true”>
<id name="code" column="memberCode”><generator class="assigned"/></id>
<property name="email"/>
<property name="phoneNumber"/>
<set name="supervisedStudents" lazy="true" inverse="true">
<key column="supervisor" not-null="true"/>
<one-to-many class="Student"/>
</set>
<union-subclass name="FixedTermMember" table="FTMember">
<property name="endTerm" not-null="true"/>
</union-subclass>
<union-subclass name="PermanentMember" table="PMember">
<property name="divisionNr"/>
</union-subclass>
</class>
…
Update
Student s = new Student();
s.setId(1543);
s.setName("John");
… //SAVE s
…
s.setSupervisor(m);
… //SAVE s
Hibernate:
insert
into
Student
(name, surname, memberCode)
values
(?, ?, ?)
Hibernate:
update
Student
set
name=?,
surname=?,
memberCode=?
where
personId=?
Queries (Over the Java Model)
"from StaffMember" Hibernate:
select
staffmembe0_.memberCode as memberCode5_,
staffmembe0_.email as email5_,
staffmembe0_.phoneNumber as phoneNum3_5_,
staffmembe0_.endTerm as endTerm6_,
staffmembe0_.divisionNr as divisionNr7_,
staffmembe0_.clazz_ as clazz_
from
( select
memberCode, email, phoneNumber, endTerm,
null as divisionNr, 1 as clazz_
from FTMember
union
select
memberCode, email, phoneNumber,
null as endTerm, divisionNr, 2 as clazz_
from PMember
) staffmembe0_
JAVA
objects
Queries (Over the Java Model)
"select m.supervisedStudents from FixedTermMember m"
Hibernate:
select
supervised1_.personId as personId4_,
supervised1_.name as name4_,
supervised1_.surname as surname4_,
supervised1_.memberCode as memberCode4_
from
FTMember fixedtermm0_
inner join
Student supervised1_
on
fixedtermm0_.memberCode=supervised1_.supervisorJAVA
objects
Object Relational Mapping: Key Points
•  Automated synch between the transient data logic (OO) and the
persistent data logic (relational)
•  Assumption of complete data in both layers
•  The transient data logic is a lossless representation of the underlying
persistent data logic
•  Bidirectional mappings implicitly obtained from the annotations
•  Support of many useful architectural patterns (e.g., lazy navigation of
relationships)
•  Constraints enforced by the framework, to maintain the alignment
between the two layers according to the annotations
•  Semantics? Proof of correctness?
Cross-Fertilization!
•  Correctness for object-relational mapping techniques a là Hibernate to
be studied
•  Complexity investigation
•  “It turns out that Hibernate is very fast if used properly” [JBOSS community]
•  Query language: understanding, assessment, extension
•  Exploitation of the object-relational mapping methodologies
•  Principled generation of “well-balanced” relational schemas from a conceptual
model/ontology (no universal tables!)
•  Implicit generation of mappings from annotations
•  New architectural frameworks for mappings: two-layered conceptual
model
•  First layer: lossless representation of the persistence storage
•  Second layer: high-level ontology
•  Mappings between ontologies
THANKS
Queries?

More Related Content

What's hot

Dynamic Symbolic Database Application Testing
Dynamic Symbolic Database Application TestingDynamic Symbolic Database Application Testing
Machine learning for the Web:
Machine learning for the Web: Machine learning for the Web:
Machine learning for the Web:
butest
 
Best Keyword Cover Search
Best Keyword Cover SearchBest Keyword Cover Search
Best Keyword Cover Search
1crore projects
 
Probabilistic retrieval model
Probabilistic retrieval modelProbabilistic retrieval model
Probabilistic retrieval model
baradhimarch81
 

What's hot (20)

Deep Neural Methods for Retrieval
Deep Neural Methods for RetrievalDeep Neural Methods for Retrieval
Deep Neural Methods for Retrieval
 
Neural Models for Information Retrieval
Neural Models for Information RetrievalNeural Models for Information Retrieval
Neural Models for Information Retrieval
 
Adversarial and reinforcement learning-based approaches to information retrieval
Adversarial and reinforcement learning-based approaches to information retrievalAdversarial and reinforcement learning-based approaches to information retrieval
Adversarial and reinforcement learning-based approaches to information retrieval
 
4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patil4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patil
 
Analysis of different similarity measures: Simrank
Analysis of different similarity measures: SimrankAnalysis of different similarity measures: Simrank
Analysis of different similarity measures: Simrank
 
Duet @ TREC 2019 Deep Learning Track
Duet @ TREC 2019 Deep Learning TrackDuet @ TREC 2019 Deep Learning Track
Duet @ TREC 2019 Deep Learning Track
 
Graphical Structure Learning accelerated with POWER9
Graphical Structure Learning accelerated with POWER9Graphical Structure Learning accelerated with POWER9
Graphical Structure Learning accelerated with POWER9
 
EFFICIENT SCHEMA BASED KEYWORD SEARCH IN RELATIONAL DATABASES
EFFICIENT SCHEMA BASED KEYWORD SEARCH IN RELATIONAL DATABASESEFFICIENT SCHEMA BASED KEYWORD SEARCH IN RELATIONAL DATABASES
EFFICIENT SCHEMA BASED KEYWORD SEARCH IN RELATIONAL DATABASES
 
IRE Semantic Annotation of Documents
IRE Semantic Annotation of Documents IRE Semantic Annotation of Documents
IRE Semantic Annotation of Documents
 
Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...
Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...
Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...
 
Document ranking using qprp with concept of multi dimensional subspace
Document ranking using qprp with concept of multi dimensional subspaceDocument ranking using qprp with concept of multi dimensional subspace
Document ranking using qprp with concept of multi dimensional subspace
 
Recommender System with Distributed Representation
Recommender System with Distributed RepresentationRecommender System with Distributed Representation
Recommender System with Distributed Representation
 
Dynamic Symbolic Database Application Testing
Dynamic Symbolic Database Application TestingDynamic Symbolic Database Application Testing
Dynamic Symbolic Database Application Testing
 
Machine learning for the Web:
Machine learning for the Web: Machine learning for the Web:
Machine learning for the Web:
 
Topic Modeling
Topic ModelingTopic Modeling
Topic Modeling
 
Concurrent Inference of Topic Models and Distributed Vector Representations
Concurrent Inference of Topic Models and Distributed Vector RepresentationsConcurrent Inference of Topic Models and Distributed Vector Representations
Concurrent Inference of Topic Models and Distributed Vector Representations
 
Ju3517011704
Ju3517011704Ju3517011704
Ju3517011704
 
Dawak f v.6camera-1
Dawak f v.6camera-1Dawak f v.6camera-1
Dawak f v.6camera-1
 
Best Keyword Cover Search
Best Keyword Cover SearchBest Keyword Cover Search
Best Keyword Cover Search
 
Probabilistic retrieval model
Probabilistic retrieval modelProbabilistic retrieval model
Probabilistic retrieval model
 

Viewers also liked

Oral Presentation (McNair)
Oral Presentation (McNair)Oral Presentation (McNair)
Oral Presentation (McNair)
Robyn Harper
 

Viewers also liked (8)

Brief Report: Theory of Mind, Relational Reasoning, and Social Responsiveness...
Brief Report: Theory of Mind, Relational Reasoning, and Social Responsiveness...Brief Report: Theory of Mind, Relational Reasoning, and Social Responsiveness...
Brief Report: Theory of Mind, Relational Reasoning, and Social Responsiveness...
 
Oral Presentation (McNair)
Oral Presentation (McNair)Oral Presentation (McNair)
Oral Presentation (McNair)
 
UnBBayes-PRM - On Implementing Probabilistic Relational Models
UnBBayes-PRM - On Implementing Probabilistic Relational ModelsUnBBayes-PRM - On Implementing Probabilistic Relational Models
UnBBayes-PRM - On Implementing Probabilistic Relational Models
 
Makalah pendekatan apos dalam pembelajaran matematika
Makalah pendekatan apos dalam pembelajaran matematikaMakalah pendekatan apos dalam pembelajaran matematika
Makalah pendekatan apos dalam pembelajaran matematika
 
Aula 11 a alma após a morte
Aula 11   a alma após a morteAula 11   a alma após a morte
Aula 11 a alma após a morte
 
RuleML2015 : Hybrid Relational and Graph Reasoning
RuleML2015 : Hybrid Relational and Graph Reasoning RuleML2015 : Hybrid Relational and Graph Reasoning
RuleML2015 : Hybrid Relational and Graph Reasoning
 
Semantics at Scale: A Distributional Approach
Semantics at Scale: A Distributional ApproachSemantics at Scale: A Distributional Approach
Semantics at Scale: A Distributional Approach
 
What's Trending in Talent and Learning for 2016?
What's Trending in Talent and Learning for 2016?What's Trending in Talent and Learning for 2016?
What's Trending in Talent and Learning for 2016?
 

Similar to Dagstuhl 2013 - Montali - On the Relationship between OBDA and Relational Mapping

Similar to Dagstuhl 2013 - Montali - On the Relationship between OBDA and Relational Mapping (20)

Azure Databricks for Data Scientists
Azure Databricks for Data ScientistsAzure Databricks for Data Scientists
Azure Databricks for Data Scientists
 
PEARC17:A real-time machine learning and visualization framework for scientif...
PEARC17:A real-time machine learning and visualization framework for scientif...PEARC17:A real-time machine learning and visualization framework for scientif...
PEARC17:A real-time machine learning and visualization framework for scientif...
 
SERENE 2014 School: Incremental Model Queries over the Cloud
SERENE 2014 School: Incremental Model Queries over the CloudSERENE 2014 School: Incremental Model Queries over the Cloud
SERENE 2014 School: Incremental Model Queries over the Cloud
 
SERENE 2014 School: Daniel varro serene2014_school
SERENE 2014 School: Daniel varro serene2014_schoolSERENE 2014 School: Daniel varro serene2014_school
SERENE 2014 School: Daniel varro serene2014_school
 
Wrokflow programming and provenance query model
Wrokflow programming and provenance query model  Wrokflow programming and provenance query model
Wrokflow programming and provenance query model
 
Compressing Graphs and Indexes with Recursive Graph Bisection
Compressing Graphs and Indexes with Recursive Graph Bisection Compressing Graphs and Indexes with Recursive Graph Bisection
Compressing Graphs and Indexes with Recursive Graph Bisection
 
Workflow Provenance: From Modelling to Reporting
Workflow Provenance: From Modelling to ReportingWorkflow Provenance: From Modelling to Reporting
Workflow Provenance: From Modelling to Reporting
 
Software Defect Prediction on Unlabeled Datasets
Software Defect Prediction on Unlabeled DatasetsSoftware Defect Prediction on Unlabeled Datasets
Software Defect Prediction on Unlabeled Datasets
 
RAMSES: Robust Analytic Models for Science at Extreme Scales
RAMSES: Robust Analytic Models for Science at Extreme ScalesRAMSES: Robust Analytic Models for Science at Extreme Scales
RAMSES: Robust Analytic Models for Science at Extreme Scales
 
Transfer defect learning
Transfer defect learningTransfer defect learning
Transfer defect learning
 
[20240513_LabSeminar_Huy]GraphFewShort_Transfer.pptx
[20240513_LabSeminar_Huy]GraphFewShort_Transfer.pptx[20240513_LabSeminar_Huy]GraphFewShort_Transfer.pptx
[20240513_LabSeminar_Huy]GraphFewShort_Transfer.pptx
 
Start From A MapReduce Graph Pattern-recognize Algorithm
Start From A MapReduce Graph Pattern-recognize AlgorithmStart From A MapReduce Graph Pattern-recognize Algorithm
Start From A MapReduce Graph Pattern-recognize Algorithm
 
MUDROD - Ranking
MUDROD - RankingMUDROD - Ranking
MUDROD - Ranking
 
Keynote at IWLS 2017
Keynote at IWLS 2017Keynote at IWLS 2017
Keynote at IWLS 2017
 
Synthesis of analytical methods data driven decision-making
Synthesis of analytical methods data driven decision-makingSynthesis of analytical methods data driven decision-making
Synthesis of analytical methods data driven decision-making
 
Stanford'12 Intro to Ontology Based Data Access for RDBMS through query rewri...
Stanford'12 Intro to Ontology Based Data Access for RDBMS through query rewri...Stanford'12 Intro to Ontology Based Data Access for RDBMS through query rewri...
Stanford'12 Intro to Ontology Based Data Access for RDBMS through query rewri...
 
Ontology-based Cooperation of Information Systems
Ontology-based Cooperation of Information SystemsOntology-based Cooperation of Information Systems
Ontology-based Cooperation of Information Systems
 
Matrix Factorization In Recommender Systems
Matrix Factorization In Recommender SystemsMatrix Factorization In Recommender Systems
Matrix Factorization In Recommender Systems
 
The Analytics Frontier of the Hadoop Eco-System
The Analytics Frontier of the Hadoop Eco-SystemThe Analytics Frontier of the Hadoop Eco-System
The Analytics Frontier of the Hadoop Eco-System
 
Predicting query performance and explaining results to assist Linked Data con...
Predicting query performance and explaining results to assist Linked Data con...Predicting query performance and explaining results to assist Linked Data con...
Predicting query performance and explaining results to assist Linked Data con...
 

More from Faculty of Computer Science - Free University of Bozen-Bolzano

Soundness of Data-Aware Processes with Arithmetic Conditions
Soundness of Data-Aware Processes with Arithmetic ConditionsSoundness of Data-Aware Processes with Arithmetic Conditions
Soundness of Data-Aware Processes with Arithmetic Conditions
Faculty of Computer Science - Free University of Bozen-Bolzano
 
Extending Temporal Business Constraints with Uncertainty
Extending Temporal Business Constraints with UncertaintyExtending Temporal Business Constraints with Uncertainty
Extending Temporal Business Constraints with Uncertainty
Faculty of Computer Science - Free University of Bozen-Bolzano
 
Modeling and Reasoning over Declarative Data-Aware Processes with Object-Cent...
Modeling and Reasoning over Declarative Data-Aware Processes with Object-Cent...Modeling and Reasoning over Declarative Data-Aware Processes with Object-Cent...
Modeling and Reasoning over Declarative Data-Aware Processes with Object-Cent...
Faculty of Computer Science - Free University of Bozen-Bolzano
 
From legacy data to event data
From legacy data to event dataFrom legacy data to event data
Putting Decisions in Perspective(s)
Putting Decisions in Perspective(s)Putting Decisions in Perspective(s)

More from Faculty of Computer Science - Free University of Bozen-Bolzano (20)

From Case-Isolated to Object-Centric Processes - A Tale of two Models
From Case-Isolated to Object-Centric Processes - A Tale of two ModelsFrom Case-Isolated to Object-Centric Processes - A Tale of two Models
From Case-Isolated to Object-Centric Processes - A Tale of two Models
 
Reasoning on Labelled Petri Nets and Their Dynamics in a Stochastic Setting
Reasoning on Labelled Petri Nets and Their Dynamics in a Stochastic SettingReasoning on Labelled Petri Nets and Their Dynamics in a Stochastic Setting
Reasoning on Labelled Petri Nets and Their Dynamics in a Stochastic Setting
 
Constraints for Process Framing in Augmented BPM
Constraints for Process Framing in Augmented BPMConstraints for Process Framing in Augmented BPM
Constraints for Process Framing in Augmented BPM
 
Intelligent Systems for Process Mining
Intelligent Systems for Process MiningIntelligent Systems for Process Mining
Intelligent Systems for Process Mining
 
Declarative process mining
Declarative process miningDeclarative process mining
Declarative process mining
 
Process Reasoning and Mining with Uncertainty
Process Reasoning and Mining with UncertaintyProcess Reasoning and Mining with Uncertainty
Process Reasoning and Mining with Uncertainty
 
From Case-Isolated to Object-Centric Processes
From Case-Isolated to Object-Centric ProcessesFrom Case-Isolated to Object-Centric Processes
From Case-Isolated to Object-Centric Processes
 
Modeling and Reasoning over Declarative Data-Aware Processes
Modeling and Reasoning over Declarative Data-Aware ProcessesModeling and Reasoning over Declarative Data-Aware Processes
Modeling and Reasoning over Declarative Data-Aware Processes
 
Soundness of Data-Aware Processes with Arithmetic Conditions
Soundness of Data-Aware Processes with Arithmetic ConditionsSoundness of Data-Aware Processes with Arithmetic Conditions
Soundness of Data-Aware Processes with Arithmetic Conditions
 
Probabilistic Trace Alignment
Probabilistic Trace AlignmentProbabilistic Trace Alignment
Probabilistic Trace Alignment
 
Strategy Synthesis for Data-Aware Dynamic Systems with Multiple Actors
Strategy Synthesis for Data-Aware Dynamic Systems with Multiple ActorsStrategy Synthesis for Data-Aware Dynamic Systems with Multiple Actors
Strategy Synthesis for Data-Aware Dynamic Systems with Multiple Actors
 
Extending Temporal Business Constraints with Uncertainty
Extending Temporal Business Constraints with UncertaintyExtending Temporal Business Constraints with Uncertainty
Extending Temporal Business Constraints with Uncertainty
 
Extending Temporal Business Constraints with Uncertainty
Extending Temporal Business Constraints with UncertaintyExtending Temporal Business Constraints with Uncertainty
Extending Temporal Business Constraints with Uncertainty
 
Modeling and Reasoning over Declarative Data-Aware Processes with Object-Cent...
Modeling and Reasoning over Declarative Data-Aware Processes with Object-Cent...Modeling and Reasoning over Declarative Data-Aware Processes with Object-Cent...
Modeling and Reasoning over Declarative Data-Aware Processes with Object-Cent...
 
From legacy data to event data
From legacy data to event dataFrom legacy data to event data
From legacy data to event data
 
Putting Decisions in Perspective(s)
Putting Decisions in Perspective(s)Putting Decisions in Perspective(s)
Putting Decisions in Perspective(s)
 
Enriching Data Models with Behavioral Constraints
Enriching Data Models with Behavioral ConstraintsEnriching Data Models with Behavioral Constraints
Enriching Data Models with Behavioral Constraints
 
Representing and querying norm states using temporal ontology-based data access
Representing and querying norm states using temporal ontology-based data accessRepresenting and querying norm states using temporal ontology-based data access
Representing and querying norm states using temporal ontology-based data access
 
Compliance monitoring of multi-perspective declarative process models
Compliance monitoring of multi-perspective declarative process modelsCompliance monitoring of multi-perspective declarative process models
Compliance monitoring of multi-perspective declarative process models
 
Processes and organizations - a look behind the paper wall
Processes and organizations - a look behind the paper wallProcesses and organizations - a look behind the paper wall
Processes and organizations - a look behind the paper wall
 

Recently uploaded

527598851-ppc-due-to-various-govt-policies.pdf
527598851-ppc-due-to-various-govt-policies.pdf527598851-ppc-due-to-various-govt-policies.pdf
527598851-ppc-due-to-various-govt-policies.pdf
rajpreetkaur75080
 

Recently uploaded (15)

Getting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control TowerGetting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control Tower
 
Pollinator Ambassador Earth Steward Day Presentation 2024-05-22
Pollinator Ambassador Earth Steward Day Presentation 2024-05-22Pollinator Ambassador Earth Steward Day Presentation 2024-05-22
Pollinator Ambassador Earth Steward Day Presentation 2024-05-22
 
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
 
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
0x01 - Newton's Third Law:  Static vs. Dynamic Abusers0x01 - Newton's Third Law:  Static vs. Dynamic Abusers
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
 
The Canoga Gardens Development Project. PDF
The Canoga Gardens Development Project. PDFThe Canoga Gardens Development Project. PDF
The Canoga Gardens Development Project. PDF
 
05232024 Joint Meeting - Community Networking
05232024 Joint Meeting - Community Networking05232024 Joint Meeting - Community Networking
05232024 Joint Meeting - Community Networking
 
527598851-ppc-due-to-various-govt-policies.pdf
527598851-ppc-due-to-various-govt-policies.pdf527598851-ppc-due-to-various-govt-policies.pdf
527598851-ppc-due-to-various-govt-policies.pdf
 
Eureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 PresentationEureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 Presentation
 
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
 
Acorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutesAcorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutes
 
123445566544333222333444dxcvbcvcvharsh.pptx
123445566544333222333444dxcvbcvcvharsh.pptx123445566544333222333444dxcvbcvcvharsh.pptx
123445566544333222333444dxcvbcvcvharsh.pptx
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
 
Hi-Tech Industry 2024-25 Prospective.pptx
Hi-Tech Industry 2024-25 Prospective.pptxHi-Tech Industry 2024-25 Prospective.pptx
Hi-Tech Industry 2024-25 Prospective.pptx
 
Oracle Database Administration I (1Z0-082) Exam Dumps 2024.pdf
Oracle Database Administration I (1Z0-082) Exam Dumps 2024.pdfOracle Database Administration I (1Z0-082) Exam Dumps 2024.pdf
Oracle Database Administration I (1Z0-082) Exam Dumps 2024.pdf
 
Writing Sample 2 -Bridging the Divide: Enhancing Public Engagement in Urban D...
Writing Sample 2 -Bridging the Divide: Enhancing Public Engagement in Urban D...Writing Sample 2 -Bridging the Divide: Enhancing Public Engagement in Urban D...
Writing Sample 2 -Bridging the Divide: Enhancing Public Engagement in Urban D...
 

Dagstuhl 2013 - Montali - On the Relationship between OBDA and Relational Mapping

  • 1. ON THE RELATIONSHIP BETWEEN OBDA AND RELATIONAL MAPPING Diego Calvanese, Marco Montali, Mariano Rodríguez-Muro KRDB Research Group Free University of Bozen-Bolzano Thanks to A. Artale, E. Franconi, D. Lembo, M. Lenzerini, A. Mosca Dagstuhl, May 2013
  • 5. Problems •  Software Complexity •  Duplication •  Data refreshing •  Data structure is lost (PKEYS, FOREIGN KEYS, information about the import procedure) OBDA: Architecture, Techniques and Systems Reasoner Source Application Communication Ontology Inputs Triples Application Code
  • 6. OBDA as an Architecture OBDA: Architecture, Techniques and Systems Reasoner Source Application Direct Communication Ontology OBDA Model Inputs
  • 7. OBDA Models: Sources and Mappings “A formal specification of the relationship between data in a data source and the vocabulary of the ontology” OBDA: Architecture, Techniques and Systems OBDA Model Source Source Declaration A set of mappings
  • 8. Mapping “A tuple of 2 queries, one over the source and one over the ontology, with the same signature. Intuitively, a mapping associates the data specified by qs with the answers for qo ” qs⊆qo SELECT id FROM condition WHERE c_id = 3333 ⊆ CardiacArrestPatient(?id)èq(?id) id = (23) <23> rdf:type CardiacArrestPatient
  • 9. Example OBDA model SELECT id FROM condition WHERE c_id = 3333 ⊆CardiacArrestPatient(?id) è q(?id) SELECT id,name,age,ssn FROM patient ⊆Patient(?id) ^ name(?id,?name) ^ age(?id,?age) ^ ssn(?id, ?ssn) è q(?id,?name,?age,?ssn) id [PKEY] name age ssn 12345 John 37 xxx-999 … … … … Table: patient patient_id [FKEY] c_id [FKEY] 12345 3333 … … Table: condition
  • 10. Example OBDA model id [PKEY] name age ssn 12345 John 37 xxx-999 … … … … Table: patient patient_id [FKEY] c_id [FKEY] 12345 3333 … … Table: condition <12345> rdf:type :Patient. <12345> :name “John”. <12345> :age “37”. <12345> :ssn “xxx-999” <12345> rdf:type :CardiacArrestPatient …
  • 11. The Pay-off •  At least •  The source is documented •  Data handling can be done automatically (by the reasoner) •  Reduced cost of application development and maintenance •  The reasoner can analyze source and mappings to minimize the cost of inference •  The sweet spot •  On-the-fly data access •  Reasoning by query rewriting: queries posed directly over the conceptual schema, taking into account the constraints of the conceptual schema itself •  Exploitation of efficient engines to provide the answer to the query
  • 12. Answering Queries: Rewriting • Given a query Q, a TBox T, an OBDA model <D, M> to compute a query Q’ such that: answer(Q,T,mat(D,M)) = answer(Q’,D) where mat(D,M) is the collection of assertion resulting from “materializing” the mappings into ABox assertions (assertional triples)
  • 13. Example OBDA model SELECT id FROM condition WHERE c_id = 3333 ⤳ CardiacArrestPatient(?id) è q(?id) SELECT id,name,age,ssn FROM patient ⤳ Patient(?id) ^ name(?id,?name) ^ age(?id,?age) ^ ssn(?id, ?ssn) è q(?id,?name,?age,?ssn) id [PKEY] name age ssn 12345 John 37 xxx-999 … … … … Table: patient patient_id [FKEY] c_id [FKEY] 12345 3333 … … Table: condition
  • 14. Query Rewriting: An example Ontology (Tbox) SubClassOf(:CardiacArrest :HearthCondition) SubClassOf(:CardiacArrestPatient :Patient) SubClassOf(:CardiacArrestPatient ObjectSomeValuesFrom(:affectedBy :CardiacArrest)) Query (SPARQL) SELECT ?p ?name ?ssn WHERE { ?p a :Patient; :name ?name; :ssn ?ssn; :age ?age :affectedBy [ a :HeartCondition ]. FILTER (?age >= 21 && ?age <= 50) }
  • 15. Query Rewriting: An Example Rewritten query SELECT ?p ?name ?ssn WHERE { {?p a :Patient; :name ?name; :ssn ?ssn; :age ?age :affectedBy [ a :HeartCondition ]. FILTER (?age >= 21 && ?age <= 50) } UNION {?p a :Patient; :name ?name; :ssn ?ssn; :age ?age :affectedBy [ a :CardiacArrest ]. FILTER (?age >= 21 && ?age <= 50) } UNION {?p a :Patient; :name ?name; :ssn ?ssn; :age ?age; a :CardiacArrestPatient. FILTER (?age >= 21 && ?age <= 50) } UNION … }
  • 16. Query Rewriting: An Example SQL query SELECT tp.id as p, tp.name as name, tp.age as age FROM patient tp JOIN condition tc ON tp.id = tc.patient_id WHERE c.c_id = 3333 AND tp.age >= 21 AND tp.age <= 50 ?p ?name ?ssn 12345 John xxx-999 Answer “Fast execution even in the presence of millions of assertions”
  • 17. OBDA: Key Points • Mappings to tackle the abstraction gap between the conceptual model and the underlying data storage • Main application: query answering (read-only modality) •  Taking into account the constraints present in the conceptual schema •  Considering incomplete data at this level •  Implementation of query answering facilities: two steps •  Incorporation of the conceptual schema directly into the query •  Use of mappings to rephrase the query in terms of another query, this time directly applicable to the underlying data •  N.B.: this magic can happen only under suitable restrictions on the expressible constraints (cf. first-order rewritability)
  • 19. Redundancies in SW Development Data logic (transient) Global conceptual schema Application layer Persistence layer object-oriented logical schema Presentation logic mapping meta-data Application logic Data logic (persistent) relational logical schema Object-relational mapping •  No real abstraction gap between the persistent and transient data logic (“lossless” connection) •  However, they look at data from different perspectives •  Transient data logic: OO programming •  Persistent data logic: Relational DBMS •  In the OO paradigm, we have •  Hierarchies •  Different ways for navigating the associations •  Object identifiers, no explicit keys
  • 20. Relational Mapping • Methodology to obtain a database schema (in third-normal form) out from a conceptual schema • Requires to suitably annotate the conceptual schema • To specify how to handle with hierarchies • To specify how to handle with 1-1 associations • To bridge the gap between the OO and relational world •  OO: internal object identifiers (references) •  Relational DB: primary keys •  Mandatory vs optional attributes
  • 21. Relational Mapping: an example StaffMember code: String {P} email: String phoneNumber: String Student id: long {P} name: String surname: String surname NOT NULL ∗ 0..1 supervisor PermanentMember divisionNr: int FixedTermMember endTerm: Date endTerm NOT NULL ContractType is used as a discriminator for the subclasses {complete, disjoint} Project projectNr: long {P} manager1 ∗ ∗ ∗participant
  • 22. Relational Mapping: an example StaffMember code: String {P} email: String phoneNumber: String Student id: long {P} name: String surname: String surname NOT NULL ∗ 0..1 supervisor PermanentMember divisionNr: int FixedTermMember endTerm: Date endTerm NOT NULL ContractType is used as a discriminator for the subclasses {complete, disjoint} Project projectNr: long {P} manager1 ∗ ∗ ∗participant Table per subclass!
  • 23. Object-Relational Mapping Object-Relational Mapping (ORM!) Data logic (transient) Global conceptual schema Application layer Persistence layer object-oriented logical schema Presentation logic mapping meta-data Application logic Data logic (persistent) relational logical schema Object-relational mapping •  A lot of programming effort to code the synchronization between the transient and persistent data logic •  Object-relational mapping •  Annotate the transient data logic with information about relational mapping •  Exploit these annotations to •  Create the underlying database schema (if needed) •  Automatically synchronize the two layers
  • 24. Example: Hibernate Mappings <class name="Student" table="Student" abstract="true”> <id name="id" column="personId”> <generator class="assigned"/> </id> <property name="name" not-null="true"/> <property name="surname"/> <many-to-one name="supervisor" class="StaffMember" column="memberCode"/> </class> <class name="StaffMember" abstract="true”> <id name="code" column="memberCode”><generator class="assigned"/></id> <property name="email"/> <property name="phoneNumber"/> <set name="supervisedStudents" lazy="true" inverse="true"> <key column="supervisor" not-null="true"/> <one-to-many class="Student"/> </set> <union-subclass name="FixedTermMember" table="FTMember"> <property name="endTerm" not-null="true"/> </union-subclass> <union-subclass name="PermanentMember" table="PMember"> <property name="divisionNr"/> </union-subclass> </class> …
  • 25. Update Student s = new Student(); s.setId(1543); s.setName("John"); … //SAVE s … s.setSupervisor(m); … //SAVE s Hibernate: insert into Student (name, surname, memberCode) values (?, ?, ?) Hibernate: update Student set name=?, surname=?, memberCode=? where personId=?
  • 26. Queries (Over the Java Model) "from StaffMember" Hibernate: select staffmembe0_.memberCode as memberCode5_, staffmembe0_.email as email5_, staffmembe0_.phoneNumber as phoneNum3_5_, staffmembe0_.endTerm as endTerm6_, staffmembe0_.divisionNr as divisionNr7_, staffmembe0_.clazz_ as clazz_ from ( select memberCode, email, phoneNumber, endTerm, null as divisionNr, 1 as clazz_ from FTMember union select memberCode, email, phoneNumber, null as endTerm, divisionNr, 2 as clazz_ from PMember ) staffmembe0_ JAVA objects
  • 27. Queries (Over the Java Model) "select m.supervisedStudents from FixedTermMember m" Hibernate: select supervised1_.personId as personId4_, supervised1_.name as name4_, supervised1_.surname as surname4_, supervised1_.memberCode as memberCode4_ from FTMember fixedtermm0_ inner join Student supervised1_ on fixedtermm0_.memberCode=supervised1_.supervisorJAVA objects
  • 28. Object Relational Mapping: Key Points •  Automated synch between the transient data logic (OO) and the persistent data logic (relational) •  Assumption of complete data in both layers •  The transient data logic is a lossless representation of the underlying persistent data logic •  Bidirectional mappings implicitly obtained from the annotations •  Support of many useful architectural patterns (e.g., lazy navigation of relationships) •  Constraints enforced by the framework, to maintain the alignment between the two layers according to the annotations •  Semantics? Proof of correctness?
  • 29. Cross-Fertilization! •  Correctness for object-relational mapping techniques a là Hibernate to be studied •  Complexity investigation •  “It turns out that Hibernate is very fast if used properly” [JBOSS community] •  Query language: understanding, assessment, extension •  Exploitation of the object-relational mapping methodologies •  Principled generation of “well-balanced” relational schemas from a conceptual model/ontology (no universal tables!) •  Implicit generation of mappings from annotations •  New architectural frameworks for mappings: two-layered conceptual model •  First layer: lossless representation of the persistence storage •  Second layer: high-level ontology •  Mappings between ontologies