Building Ontologies from Multiple Information Sources
Ontology-based Cooperation of Information Systems
1. Ontology-based Cooperation of Information Systems Contributions to Database-to-Ontology Mapping and XML-to-Ontology Mapping Raji GHAWI 15/03/2010
2.
3.
4. Introduction Heterogeneity structural syntactic system semantic scaling & units naming language model schema representation hardware operating system synonymy homonymy
5.
6.
7.
8.
9.
10. OWSCIS Architecture Global Ontology Mapping Directory Knowledge Base Module End User Querying Web Service Results Recomposition Query Decomposition Visualization Web Service sub-queries partial results Relational database XML data source Data Providers DB2OWL X2OWL Local ontology Data Source to Local Ontology Mappings Local Ontology to Global Ontology Mappings Mapping Web Service
24. Example DB Schema Case 1 (m-m relationship) Case 2 (1-1 relationship) Case 3 (others) studentId diplomaId studentNumber Student diplomaId diplomaName Diploma moduleId diplomaId moduleName Module studentId sessionId Presence sessionId moduleId lecturerId Session time hallId lecturerId room Lecturer hallId building hallName Hall personId lastName firstName Person Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation Primary key Foreign key Integrity Constraint
25. Rules for Ontology Generation Primary key Foreign key Integrity Constraint Database component Ontology component ... ... T C case 3 PFK1 ... T PK1 ... T1 C C1 case 2 PK1 ... T1 PFK1 PFK2 T PK2 ... T2 op2 op1 C1 C2 ... NK T dp C ... FK T PK1 ... T1 op C C1 Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation Object property subClassOf Class Datatype property
26. presence-session presence-student module-diploma session-lecturer Person Hall Student Lecturer Diploma Module Session firstName lastName room hallName moduleName diplomaName studentNumber time student-diploma session-module session-hall building Primary key Foreign key Integrity Constraint Database Schema Generated Ontology Object property subClassOf Class Datatype property Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation personId lastName firstName Person sessionId moduleId lecturerId Session time hallId hallId building hallName Hall diplomaId studentNumber Student studentId lecturerId room Lecturer moduleId diplomaId moduleName Module diplomaId diplomaName Diploma studentId sessionId Presence
27. Generated Mappings using Associations with SQL Statements Concept Associations Datatype Property Associations Object Property Associations SELECT person.personId AS DOM FROM person Person SELECT lecturer.lecturerId AS DOM FROM lecturer, person WHERE lecturer.lecturerId = person.personId Student SELECT student.studentId AS DOM FROM student, person WHERE student.studentId = person.personId Lecturer SELECT person.personId AS DOM, person.FirstName AS RNG FROM person firstName SELECT student.studentId AS DOM, student.studentNumber AS RNG FROM student studentNumber student.diploma session.lecturer SELECT student.studentId AS DOM, diploma.diplomaId AS RNG FROM student, diploma WHERE student.diplomaID = diploma.diplomaId SELECT session.sessionId AS DOM, lecturer.lecturerId AS RNG FROM session, lecturer WHERE session.lecturerId = lecturer.lecturerId Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
30. Query Processing sub-query local query Local Ontology Data Provider rewrite translate SQL results SPARQL results reformulate solve SQL query Data Source to Local Ontology Mappings Local Ontology to Global Ontology Mappings Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation Querying Web Service
31. SPARQL-to-SQL Query Translation SPARQL query SQL query Ontology Database Mapping Document Translation Associations with SQL Statements DOML Language Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
32.
33. SPARQL-to-SQL Translation using Associations with SQL Statements Mapping document SELECT variables SPARQL query SELECT FROM WHERE SQL statements SQL query SQL results SPARQL query results XML format Basic Graph Pattern FILTERs simplified SQL query 1 2 3 Concept Associations Property Associations Build Simplification Formulation Mapping Parsing Query Parsing Translation Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
34. SPARQL-to-SQL Translation using Associations with SQL Statements presence-session presence-student module-diploma session-lecturer Person Hall Student Lecturer Diploma Module Session firstName lastName room hallName moduleName diplomaName studentNumber time student-diploma session-module session-hall building SELECT ?modName WHERE { ?mod ont:moduleName ?modName. ont:module-diploma ?dip. ?dip ont:diplomaName ?dipName. FILTER (?dipName = "BDIA") } SPARQL query Example Ontology Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
35. SPARQL-to-SQL Translation using Associations with SQL Statements SELECT S1.RNG AS modName FROM ( SELECT Module.moduleId AS DOM, Module.moduleName AS RNG FROM Module ) AS S1, ( SELECT Module.moduleId AS DOM, Diploma.diplomaId AS RNG FROM Module, Diploma WHERE Module.diplomaId = Diploma.diplomaId ) AS S2, ( SELECT Diploma.diplomaId AS DOM, Diploma.diplomaName AS RNG FROM Diploma ) AS S3 WHERE S1.DOM = S2.DOM AND S2.RNG = S3.DOM AND S3.RNG = "BDIA" S1.RNG AS modName S3.RNG = "BDIA" S1.DOM = S2.DOM S2.RNG = S3.DOM SQL AS S1 AS S2 AS S3 SELECT Module.moduleId AS DOM, Module.moduleName AS RNG FROM Module SELECT Module.moduleId AS DOM, Diploma.diplomaId AS RNG FROM Module, Diploma WHERE Module.diplomaId = Diploma.diplomaId SELECT Diploma.diplomaId AS DOM, Diploma.diplomaName AS RNG FROM Diploma Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation SELECT FROM WHERE
36. SPARQL-to-SQL Translation using Associations with SQL Statements Generated SQL query Simplified SQL query SELECT S1.RNG AS modName FROM ( SELECT Module.moduleId AS DOM, Module.moduleName AS RNG FROM Module ) AS S1, ( SELECT Module.moduleId AS DOM, Diploma.diplomaId AS RNG FROM Module, Diploma WHERE Module.diplomaId = Diploma.diplomaId ) AS S2, ( SELECT Diploma.diplomaId AS DOM, Diploma.diplomaName AS RNG FROM Diploma ) AS S3 WHERE S1.DOM = S2.DOM AND S2.RNG = S3.DOM AND S3.RNG = "BDIA" SELECT Module.moduleName AS modName FROM Module, Diploma WHERE Module.diplomaId = Diploma.diplomaId AND Diploma.diplomaName = "BDIA" Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
39. SPARQL-to-SQL Translation using DOML Language SELECT ?name WHERE { ?stud a ont:Student; ont:name ?name; ont:studies-in ?dept. ?dept ont:dept-name ?deptName. FILTER (?deptName = "IEM"). } SPARQL query Example name email year dept-name works-for studies-in salary Person Ontology Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation Department Employee Student
40.
41.
42.
43. SPARQL-to-SQL Translation using DOML Language 4. Query Translation – Analysis of Mapping Bridges SELECT ?name WHERE { ?stud a ont:Student; ont:name ?name; ont:studies-in ?dept. ?dept ont:dept-name ?deptName. FILTER (?deptName = "IEM"). } Mapping Bridges conditions tables join ?name CONCAT(firstName,lastName) variable to column auxiliary mapping ?deptname dept.deptName Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation WHERE FROM
44. SPARQL-to-SQL Translation using DOML Language 4. Query Translation – SELECT Construction SELECT ?name WHERE { ?stud a ont:Student; ont:name ?name; ont:studies-in ?dept. ?dept ont:dept-name ?deptName. FILTER (?deptName = "IEM"). } ?name CONCAT(firstName,lastName) variable-to-column auxiliary mapping SELECT CONCAT( firstName,lastName ) AS name Replace variables by their corresponding columns or transformations … … Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation SELECT
45. SPARQL-to-SQL Translation using DOML Language 4. Query Translation – FILTER Translation SELECT ?name WHERE { ?stud a ont:Student; ont:name ?name; ont:studies-in ?dept. ?dept ont:dept-name ?deptName. FILTER (?deptName = "IEM"). } dept.deptName = "IEM" Replace variables by their corresponding columns or transformations ?deptName dept.deptName variable-to-column auxiliary mapping … … Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation WHERE
46. SPARQL-to-SQL Translation using DOML Language 4. Query Translation person.status="student" person dept.deptName = "IEM" SELECT CONCAT( firstName,lastName ) AS name dept person.deptId = dept.deptId SELECT CONCAT(person.firstName, person.lastName) AS name FROM person, dept WHERE (person.status = 'Student') AND (person.deptId = department.deptId) AND (dept.deptName = 'IEM') SQL query Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation WHERE SELECT FROM
54. XML-to-Ontology Mapping Process Ontology XML Schema Mapping Document XSG Rules Types Elements Attributes ... Concepts Datatype Properties Object Properties ... XML Schema Graph Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
55. XML Schema Graph (XSG) PurchaseOrderType @ orderDate (anonymous) Address USAddress @ country @weightKg @shipBy purchaseOrder item billTo shipTo state zip street city name price productName shipAndBill ItemDelivery Nodes Edges Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation Attribute Group Element Group Attribute Complex Type Element Type Derivation Containment
56. Rules for Ontology Generation object property MIXED restriction extention complex type element group attribute group containment relationship simple element attribute text of mixed complex type subClassOf Class datatype property XML schema component result ontology component Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
57. hasItem hasItemDelivery hasShipTo hasBillTo Item PurchaseOrderType ItemDelivery USAddress ShipAndBill orderDate name street city country productName price weightKg shipBy zip USstate object property subClassOf OWL class datatype property PurchaseOrderType @ orderDate (anonymous) Address USAddress @ country @weightKg @shipBy purchaseOrder item billTo shipTo state zip street city name price productName shipAndBill ItemDelivery Example hasShipAndBill XML Schema Graph Ontology Address Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
58.
59. Refinement – Use of Different Representations (anonymous) @orderid orderperson (anonymous) (anonymous) (anonymous) (anonymous) @title shipmentorder items shipments shipment date price title quantity item Example XSG XML Document Ontology Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation <shipmentorder orderid="889923"> <orderperson>John Smith</orderperson> <items> <item> <title>Empire Burlesque</title> <quantity>1</quantity> <price>10.90</price> </item> <item> <title>Hide your heart</title> <quantity>1</quantity> <price>9.90</price> </item> <item> <title>Hearts of Fire</title> <quantity>1</quantity> <price>10.50</price> </item> </items> <shipments> <shipment> <date>12-01-2009</date> <item title="Empire Burlesque" /> <item title="Hide your heart" /> </shipment> </shipments> </shipmentorder> hasItem Shipments Item Items orderId orderPerson date title quantity price hasShipments hasItems hasShipment Shipment ShipmentOrder
60.
61.
62. SPARQL-to-XQuery Translation SPARQL query XQuery query Ontology XML Data Source Mapping Document (XOML) Translation Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
63. SPARQL-to-XQuery Translation XOML mapping document SPARQL query XQuery query SPARQL query results XML format FILTERs SELECT variables Concept Bridges Datatype Property Bridges Object Property Bridges 1 2 3 4 Basic Graph Pattern XML Data Source Suitable Mapping Graph Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation Mapping Parsing Query Parsing Building XQuery Preprocessing
64. SPARQL-to-XQuery Translation SELECT ?date ?title WHERE { ?ship ont:date ?date; ont:hasItem ?item. ?item ont:title ?title. } SPARQL query Example hasItem Shipments Item Items orderId orderPerson date title quantity price hasShipments hasItems hasShipment Ontology Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation Shipment ShipmentOrder
68. SPARQL-to-XQuery Translation <sparql> <head> <variable name="..." /> ... </head> <results> { for ... let ... where ... return <result> <binding name="...">{ ... }</binding> ... </result> } </results> </sparql> 4. Building Target XQuery XQuery Template Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
69. SPARQL-to-XQuery Translation 4. Building Target XQuery ?ship ~ /shipmentorder/shipments/shipment ?date ~ /shipmentorder/shipments/shipment/date/text() ?item ~ /shipmentorder/shipments/shipment/item ?title ~ /shipmentorder/shipments/shipment/item/@title for $ship in /shipmentorder/shipments/shipment let $date := /shipmentorder/shipments/shipment/date/text() for $item in /shipmentorder/shipments/shipment/item let $title := /shipmentorder/shipments/shipment/item/@title Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation non-leaf vertex for statement leaf vertex let statement
70. SPARQL-to-XQuery Translation 4. Building Target XQuery Abbreviation of absolute XPath expressions into relative expressions Replace common parts of XPaths by corresponding variables for $ship in /shipmentorder/shipments/shipment let $date := /shipmentorder/shipments/shipment/date/text() for $item in /shipmentorder/shipments/shipment/item let $title := /shipmentorder/shipments/shipment/item/@title for $ship in /shipmentorder/shipments/shipment let $date := $ship/date/text() for $item in $ship/item let $title := $item/@title Absolute XPaths Relative XPaths Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation
71. SPARQL-to-XQuery Translation 4. Building Target XQuery <sparql> <head> <variable name="date" /> <variable name="title" /> </head> <results> { for $ship in /shiporder/ships/ship let $date := $ship/date/text() for $item in $ship/item let $title := $item/@title return <result> <binding name="date">{$date}</binding> <binding name="title">{fn:data($title)}</binding> </result> } </results> </sparql> XQuery Database-to-Ontology Mapping XML-to-Ontology Mapping Mapping Specification Mapping Process Query Translation