SlideShare a Scribd company logo
1 of 14
Download to read offline
A Source-to-Target Constraint rewriting for Direct Mapping
The 20th International Semantic Web Conference 2021
Ratan Bahadur Thapa
ratanbt@ifi.uio.no
W3C Direct Mapping M
M is a fixed set of mapping rules
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 1 / 13
Relational
Database
RDF Graph
W3C Direct Mapping
Input:
Database schema and Instance
Primary Key
Foreign Key
Output:
RDF Graph
Completely Automatic
M is data mapping
M directly translates database instances into RDF triples
M is monotone
If database instances D ⊆ D0
then M(D) ⊆ M(D0
)
Direct Mapping M Engine
IRI identifiers for table, columns and foreign keys
Identifiers for tuples: IRI (if PK exists), otherwise Blank nodes
Triples: Table (tuples), Literal (attributes), Reference (FKs)
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 2 / 13
Table triples: for every tuples of tables
<baseIRI/User#U_ID=E01 > rdf:type <baseIRI/User> .
Literal triples: for every attributes of table
<baseIRI/User#U_ID=E01> <baseIRI/User#Name> "Ida" .
Reference triples: for every FK attributes of table (if exists)
U_ID Name Position
E01 Ida Post Doc
User
<baseIRI/User>
IRI for table
<baseIRI/User#Name>
<baseIRI/User#U_ID=E01>
IRI for tuples
IRI for columns
Sequeda et. al. Direct Mapping DM
Integrates W3C Direct Mapping M and SQL Schemas to OWL mapping1
Ms
rules identify (RDFS) vocabularies V
Mi
rules translate database instance into RDF
OWL rules translate vocabularies V into OWL axioms
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 3 / 13
Key constraints
Σ
Schema R
Instance D
Ms
V Mi
OWL rules
Graph G
OWL axioms
1 Tirmizi et. al., Translating SQL applications to the Semantic Web, DEXA 2008
DM
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 4 / 13
P_ID Name Proj
P02 Semantic Integration B01
Emp Prog
E01 P02
B_ID Name
B01 PeTWIN
E_ID Name Position
E01 Ida Post Doc
FK
FK
FK
Employee Program
EmpProg (Emp,Prog)
Project
Class
Object Property
binary table foreign key of non-binary table
non-binary table
Data type Property
attributes of non-binary table
<baseIRI/Program#P_ID=P02> <rdf:type> <baseIRI/Program> .
Reference triples: via binary tables
<baseIRI/Employee#E_ID=E01> <baseIRI/EmpProg#Emp,Proj,E_ID,B_ID> <baseIRI/Program#P_ID=P02> .
ClassIRI
Where,
<baseIRI/Employee#E_ID=E01> <rdf:type> <baseIRI/Employee> .
Properties of DM
Information Preserving
Query Preserving
Monotone
not Semantics Preserving
i.e., for every R and σ set of PKs and FKs on R, it is not the case that
D  σ ⇐⇒ G  OWL axioms.
Counter Example: D 2 σ, but G  OWL axioms.
No monotone DMextended is semantics preserving, Sequeda et. al.[Them. 3].
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 5 / 13
E_ID Name Position
E01 Ida Post Doc
E01 Cathrine PhD
Employee
:E01
Ida
Cathrine
Post Doc
PhD
:baseIRI/Employee#Name
:baseIRI/Employee#Position
rdf:type
:baseIRI/Employee
Our Goal
Constraints Rewriting T for monotone direct mapping
Relational
Database
RDF Graph
Direct Mapping
Integrity Constraints?
INPUT
Database Schema and Instance
Key Constraints: PKs and FKs
Data Constraints: Nullability, Uniqueness and Data types
OUTPUT
RDF Graph
SHACL Description
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 6 / 13
The rewriting Γ
Γ is a set of Datalog rules.
σ contains a PK for each R ∈ R
for every PK ∈ σ, UNQ ∈ δ and NN ∈ δ
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 7 / 13
Data constraints δ
Key constraints σ
Σ
Schema R
Instance D
Ms
V
Γ
Mi
Shapes S
Graph G
Properties of Γ
Γ is constraint preserving,
i.e., there exist mapping N s.t. N(Γ(V, δ)) = (V, δ).
Γ is not semantics preserving,
i.e., D  Σ ⇐⇒ G  S does not hold.
Counter Example:
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 8 / 13
Properties of Γ
Γ is constraint preserving.
Γ is not semantics preserving,
i.e., D  Σ ⇐⇒ G  S does not hold.
Counter Example:
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 9 / 13
U_ID
U01
U01
Null
User
:User/U_ID=U01 rdf:type :User .
:User/U_ID=U01 :User/U_ID U01 .
RDF Triples:
:User a sh:NodeShape, rdfs:Class;
sh:property [ sh:path :User/U_ID;
sh:nodeKind. sh:Literal;
sh:maxCount 1; sh:minCount 1;
sh:datatype xsd:integer ];
un:uniqueValuesForClass [un:unqProp :User/U_ID;
un:unqForClass :User ].
Class
Datatype Property
Properties of Γ
Γ is constraint preserving,
i.e., there exist mapping N s.t. N(Γ(V, δ)) = (V, δ).
Γ is not semantics preserving,
i.e., D  Σ ⇐⇒ G  S does not hold.
Γ is weakly semantics preserving, i.e.,
D  Σ ⇐⇒ G  S,
for all DB instances D that satisfy their key constraints σ.
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 10 / 13
Discussion
Rewriting Γ extends direct mapping with the SHACL constraints.
Limitations:
Γ is not semantics preserving if:
relation schemas without PKs, and
databases violating the key constraints are considered
Open question:
Maximal semantics preserving rewriting Γ
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 11 / 13
Conclusion
We have extended direct mapping M with the constraint rewriting Γ :
M is monotone, information and query preserving.
Γ is constraint and weakly semantics preserving.
Future Goal :
Constraint rewriting for R2RML
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 12 / 13
References
Sequeda, Juan F. and Arenas, Marcelo and Miranker, Daniel P.
On directly mapping relational databases to RDF and OWL.
Proc. 21st Intl. Conf. on World Wide Web, 649-658, 2012, ACM.
Arenas, Marcelo and Bertails, Alexandre and Prud’hommeaux, Eric
and Sequeda, Juan
A Direct Mapping of Relational Data to RDF.
W3C Recommendation, 2012
Holger Knublauch and Dimitris Kontokostas
Shapes Constraint Language (SHACL).
W3C Recommendation, 2017
Ratan Bahadur Thapa ratanbt@ifi.uio.no
A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 13 / 13

More Related Content

Similar to A Source-to-Target Constraint rewriting for Direct Mapping.pdf

Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-NormalisationAjit Nayak
 
Ch3_Rel_Model-95.ppt
Ch3_Rel_Model-95.pptCh3_Rel_Model-95.ppt
Ch3_Rel_Model-95.pptAtharvaBagul2
 
Robust Real-Time Synchronization between Textual and Graphical Editors
Robust Real-Time Synchronization between Textual and Graphical EditorsRobust Real-Time Synchronization between Textual and Graphical Editors
Robust Real-Time Synchronization between Textual and Graphical EditorsOskar van Rest
 
Database Management System(UNIT 1)
Database Management System(UNIT 1)Database Management System(UNIT 1)
Database Management System(UNIT 1)SURBHI SAROHA
 
Database Management System(UNIT 1)
Database Management System(UNIT 1)Database Management System(UNIT 1)
Database Management System(UNIT 1)SURBHI SAROHA
 
Module 2 - part i
Module   2 - part iModule   2 - part i
Module 2 - part iParthNavale
 
Data-Structure-original-QuantumSupply.pdf
Data-Structure-original-QuantumSupply.pdfData-Structure-original-QuantumSupply.pdf
Data-Structure-original-QuantumSupply.pdflehal93146
 

Similar to A Source-to-Target Constraint rewriting for Direct Mapping.pdf (20)

SWT Lecture Session 11 - R2RML part 2
SWT Lecture Session 11 - R2RML part 2SWT Lecture Session 11 - R2RML part 2
SWT Lecture Session 11 - R2RML part 2
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
 
Db Concepts2
Db Concepts2Db Concepts2
Db Concepts2
 
Compact Representation of Large RDF Data Sets for Publishing and Exchange
Compact Representation of Large RDF Data Sets for Publishing and ExchangeCompact Representation of Large RDF Data Sets for Publishing and Exchange
Compact Representation of Large RDF Data Sets for Publishing and Exchange
 
Ch3_Rel_Model-95.ppt
Ch3_Rel_Model-95.pptCh3_Rel_Model-95.ppt
Ch3_Rel_Model-95.ppt
 
Unit03 dbms
Unit03 dbmsUnit03 dbms
Unit03 dbms
 
The Smartpath Information Systems | BASIC RDBMS CONCEPTS
The Smartpath Information Systems | BASIC RDBMS CONCEPTSThe Smartpath Information Systems | BASIC RDBMS CONCEPTS
The Smartpath Information Systems | BASIC RDBMS CONCEPTS
 
Robust Real-Time Synchronization between Textual and Graphical Editors
Robust Real-Time Synchronization between Textual and Graphical EditorsRobust Real-Time Synchronization between Textual and Graphical Editors
Robust Real-Time Synchronization between Textual and Graphical Editors
 
L9 design2
L9 design2L9 design2
L9 design2
 
Database Management System(UNIT 1)
Database Management System(UNIT 1)Database Management System(UNIT 1)
Database Management System(UNIT 1)
 
Database Management System(UNIT 1)
Database Management System(UNIT 1)Database Management System(UNIT 1)
Database Management System(UNIT 1)
 
Unit 3
Unit  3Unit  3
Unit 3
 
ch2
ch2ch2
ch2
 
Module 2 - part i
Module   2 - part iModule   2 - part i
Module 2 - part i
 
Database Presentation
Database PresentationDatabase Presentation
Database Presentation
 
Graph based data models
Graph based data modelsGraph based data models
Graph based data models
 
DBMS (1).pptx
DBMS (1).pptxDBMS (1).pptx
DBMS (1).pptx
 
Compiler unit 5
Compiler  unit 5Compiler  unit 5
Compiler unit 5
 
Data-Structure-original-QuantumSupply.pdf
Data-Structure-original-QuantumSupply.pdfData-Structure-original-QuantumSupply.pdf
Data-Structure-original-QuantumSupply.pdf
 
Ch4_Algebra.pdf
Ch4_Algebra.pdfCh4_Algebra.pdf
Ch4_Algebra.pdf
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

A Source-to-Target Constraint rewriting for Direct Mapping.pdf

  • 1. A Source-to-Target Constraint rewriting for Direct Mapping The 20th International Semantic Web Conference 2021 Ratan Bahadur Thapa ratanbt@ifi.uio.no
  • 2. W3C Direct Mapping M M is a fixed set of mapping rules Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 1 / 13 Relational Database RDF Graph W3C Direct Mapping Input: Database schema and Instance Primary Key Foreign Key Output: RDF Graph Completely Automatic M is data mapping M directly translates database instances into RDF triples M is monotone If database instances D ⊆ D0 then M(D) ⊆ M(D0 )
  • 3. Direct Mapping M Engine IRI identifiers for table, columns and foreign keys Identifiers for tuples: IRI (if PK exists), otherwise Blank nodes Triples: Table (tuples), Literal (attributes), Reference (FKs) Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 2 / 13 Table triples: for every tuples of tables <baseIRI/User#U_ID=E01 > rdf:type <baseIRI/User> . Literal triples: for every attributes of table <baseIRI/User#U_ID=E01> <baseIRI/User#Name> "Ida" . Reference triples: for every FK attributes of table (if exists) U_ID Name Position E01 Ida Post Doc User <baseIRI/User> IRI for table <baseIRI/User#Name> <baseIRI/User#U_ID=E01> IRI for tuples IRI for columns
  • 4. Sequeda et. al. Direct Mapping DM Integrates W3C Direct Mapping M and SQL Schemas to OWL mapping1 Ms rules identify (RDFS) vocabularies V Mi rules translate database instance into RDF OWL rules translate vocabularies V into OWL axioms Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 3 / 13 Key constraints Σ Schema R Instance D Ms V Mi OWL rules Graph G OWL axioms 1 Tirmizi et. al., Translating SQL applications to the Semantic Web, DEXA 2008
  • 5. DM Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 4 / 13 P_ID Name Proj P02 Semantic Integration B01 Emp Prog E01 P02 B_ID Name B01 PeTWIN E_ID Name Position E01 Ida Post Doc FK FK FK Employee Program EmpProg (Emp,Prog) Project Class Object Property binary table foreign key of non-binary table non-binary table Data type Property attributes of non-binary table <baseIRI/Program#P_ID=P02> <rdf:type> <baseIRI/Program> . Reference triples: via binary tables <baseIRI/Employee#E_ID=E01> <baseIRI/EmpProg#Emp,Proj,E_ID,B_ID> <baseIRI/Program#P_ID=P02> . ClassIRI Where, <baseIRI/Employee#E_ID=E01> <rdf:type> <baseIRI/Employee> .
  • 6. Properties of DM Information Preserving Query Preserving Monotone not Semantics Preserving i.e., for every R and σ set of PKs and FKs on R, it is not the case that D σ ⇐⇒ G OWL axioms. Counter Example: D 2 σ, but G OWL axioms. No monotone DMextended is semantics preserving, Sequeda et. al.[Them. 3]. Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 5 / 13 E_ID Name Position E01 Ida Post Doc E01 Cathrine PhD Employee :E01 Ida Cathrine Post Doc PhD :baseIRI/Employee#Name :baseIRI/Employee#Position rdf:type :baseIRI/Employee
  • 7. Our Goal Constraints Rewriting T for monotone direct mapping Relational Database RDF Graph Direct Mapping Integrity Constraints? INPUT Database Schema and Instance Key Constraints: PKs and FKs Data Constraints: Nullability, Uniqueness and Data types OUTPUT RDF Graph SHACL Description Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 6 / 13
  • 8. The rewriting Γ Γ is a set of Datalog rules. σ contains a PK for each R ∈ R for every PK ∈ σ, UNQ ∈ δ and NN ∈ δ Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 7 / 13 Data constraints δ Key constraints σ Σ Schema R Instance D Ms V Γ Mi Shapes S Graph G
  • 9. Properties of Γ Γ is constraint preserving, i.e., there exist mapping N s.t. N(Γ(V, δ)) = (V, δ). Γ is not semantics preserving, i.e., D Σ ⇐⇒ G S does not hold. Counter Example: Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 8 / 13
  • 10. Properties of Γ Γ is constraint preserving. Γ is not semantics preserving, i.e., D Σ ⇐⇒ G S does not hold. Counter Example: Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 9 / 13 U_ID U01 U01 Null User :User/U_ID=U01 rdf:type :User . :User/U_ID=U01 :User/U_ID U01 . RDF Triples: :User a sh:NodeShape, rdfs:Class; sh:property [ sh:path :User/U_ID; sh:nodeKind. sh:Literal; sh:maxCount 1; sh:minCount 1; sh:datatype xsd:integer ]; un:uniqueValuesForClass [un:unqProp :User/U_ID; un:unqForClass :User ]. Class Datatype Property
  • 11. Properties of Γ Γ is constraint preserving, i.e., there exist mapping N s.t. N(Γ(V, δ)) = (V, δ). Γ is not semantics preserving, i.e., D Σ ⇐⇒ G S does not hold. Γ is weakly semantics preserving, i.e., D Σ ⇐⇒ G S, for all DB instances D that satisfy their key constraints σ. Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 10 / 13
  • 12. Discussion Rewriting Γ extends direct mapping with the SHACL constraints. Limitations: Γ is not semantics preserving if: relation schemas without PKs, and databases violating the key constraints are considered Open question: Maximal semantics preserving rewriting Γ Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 11 / 13
  • 13. Conclusion We have extended direct mapping M with the constraint rewriting Γ : M is monotone, information and query preserving. Γ is constraint and weakly semantics preserving. Future Goal : Constraint rewriting for R2RML Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 12 / 13
  • 14. References Sequeda, Juan F. and Arenas, Marcelo and Miranker, Daniel P. On directly mapping relational databases to RDF and OWL. Proc. 21st Intl. Conf. on World Wide Web, 649-658, 2012, ACM. Arenas, Marcelo and Bertails, Alexandre and Prud’hommeaux, Eric and Sequeda, Juan A Direct Mapping of Relational Data to RDF. W3C Recommendation, 2012 Holger Knublauch and Dimitris Kontokostas Shapes Constraint Language (SHACL). W3C Recommendation, 2017 Ratan Bahadur Thapa ratanbt@ifi.uio.no A Source-to-Target Constraint rewriting for Direct Mapping 2nd April 2023 13 / 13