© Copyright 2007 STI - INNSBRUCK www.sti- innsbruck.at Applying Reasoning to Instance Transformation Adrian Mocan, Mick Kerrigan, Emilia Cimpian [email protected]
Mar 26, 2015
© Copyright 2007 STI - INNSBRUCK www.sti-innsbruck.at
Applying Reasoning to Instance Transformation
Adrian Mocan, Mick Kerrigan, Emilia Cimpian
2www.sti-innsbruck.at
Overview
• Context• Ontology mappings and mapping rules• Grounding the mappings to WSML• Applying data mediation • Conclusions
3www.sti-innsbruck.at
Ontology-based Data MediationContext
• Mediation ScenarioBusiness Partner 2
Business Partner 1
Information System 2
communicate
Ontology 1
uses
hassource
Ontology 2
has target
usesInformation
System 1
Mediation Component
Target Ontology
Source Ontology
Storage
Mappings
Mappings
Source Instance
Target Instance
Ontology Mapping Tool
Run-time Data Mediator
inTermsOf
inTermsOf
• Mediation SolutionWeb Service Modeling Toolkit
4www.sti-innsbruck.at
Run-time Data Mediator
Abstract Mappings
Repr.
RulesGenerator
Instance
Source
ReasoningEnvironment
Mapping Rules
Mappings
Instance
Target
Ontologies
Abstract Mappings
Repr.
Abstract Mappings
Repr.
RulesGenerator
RulesGenerator
Instance
Source
Instance
Source
ReasoningEnvironmentReasoning
Environment
Mapping Rules
Mappings
Instance
Target
Instance
Target
OntologiesOntologies
• Input– Source Instances + Source/Target Schemas
– Ontology Mappings
• Output– Target Instances
5www.sti-innsbruck.at
Ontology Mappings (1)
• Abstract representation of mappings– Alignment format developed as part of the KW NoE project
Schema elements (e.g. concepts, attributes)
Restriction on the schema elements (e.g. allowed values for an attribute)
Concept2Concept (C2C)Attribute2Attribute (A2A)Concept2Attribute (C2A)Attribute2Concept (A2C)
mapping(sourceEntity; [sourceEntityRestriction]; targetEntity; [targetEntityRestriction];
typeOfMapping)
6www.sti-innsbruck.at
Ontology Mappings (2)
• The Alignment Format – Not committed to any ontology representation language
• It doesn’t have a formal semantics
– It has an XML and an RDF serialization
• Why using such a mapping language?– Easier to manage mappings
• When parts of the alignment need to be updated
• When the mapped ontologies evolve
– Allows the effective usage of the mappings
Mappings needs to be grounded to a concrete formalism
7www.sti-innsbruck.at
Web Service Modeling Language (WSML) (1)
• Family of languages for Web Service Modeling Ontology (WSMO)
• WSML-Flight– Based on Datalog
• WSML-Rule– Extension of WSML-Flight based on Horn fragment of F-logic– Allows functions symbols and unsafe rules
8www.sti-innsbruck.at
Web Service Modeling Language (WSML) (2)
concept person hasChristianName ofType (0 *) _string hasSurname ofType (1 1) _string hasGender ofType (1 1) Gender dateOfBirth ofType (0 1) Date
concept book title ofType (1 1) _string hasAuthor ofType (0 *) author concept author subConceptOf person authorOf inverseOf(hasAuthor) ofType (0 *) book
instance crimeAndPunishment memberOf book title hasValue “Crime and Punishment" hasAuthor hasValue dostoyevsky
axiom authorshipFromAuthor definedBy authorship(?x, ?y):- ?x[authorOf hasValue ?y] memberOf author
F-Logic
person[hasChristianName =>>_string; hasSurname => _string; hasGender => Gender; dateOfBirth => Date].
book[title => _string; hasAuthor => author].
author::person[authorOf =>> book].
crimeAndPunishment:book.book[title -> “Crime and Punishment”; hasAuthor -> dostoyevsky].
FORALL X,Y authorship(X,Y) <- X:author[auhtorOf -> Y]
9www.sti-innsbruck.at
Mapping Rules in WSML
• The ontology mappings are grounded to WSML rules
• The target instances are “constructed” by these rules– Function symbols are used in order to generate new, unique
identifiers for these instances
mediated(source_instance, target_concept)
• WSML rules + source instances + source/target schema fragments are loaded into a reasoner– “pseudo-merged” ontology– The mediated data (i.e. the target instances) are retrieved by
querying this ontology
10www.sti-innsbruck.at
Running Examples
concept Person
hasChristianName ofType _string
hasSurname ofType _string
hasGender ofType Gender
dateOfBirth ofType Date
concept Date
day ofType _integer
month ofType _integer
year ofType _integer
concept Gender
instance _1 memberOf Gender
instance _2 memberOf Gender
instance _ memberOf Gender
concept Citizen
hasName ofType Name
hasSex ofType Sex
hasBirthday ofType Date
concept Name
hasFirstName ofType _string
hasSurname ofType _string
concept Date
day ofType _integer
month ofType _integer
year ofType _integer
concept Sex
instance M memberOf Sex
instance F memberOf Sex
instance N memberOf Sex
Source Ontology Target Ontology
11www.sti-innsbruck.at
Mapping Rules in WSMLClass to Class Mapping
mapping(o1#Person, o2#Citizen, C2C)
mediated(?x, o2#Citizen) memberOf o2#Citizen and mapped(o1#Person, o2#Citizen,?x):-
?x memberOf o1#Person
instance johnS
memberOf o1#Person
mediated(johnS, o2#Citizen)
memberOf o2#Citizen
mapped(o1#Person, o2#Citizen, johnS)
12www.sti-innsbruck.at
Mapping Rules in WSMLClass to Attribute Mappings
mapping( o1#Person, o2#Citizen.hasName , C2A)
mediated(?x,o2#Citizen)[hasName hasValue mediated(?x, o2#Name)] memberOf o2#Citizen:-
?x memberOf o1#Person and
mediated(?x,o2#Name)[?anAttribute hasValue ?aValue] memberOf o2#Name.
instance johnS memberOf o1#Person
mediated(?x,o2#Name)[…] memberOf
o2#Name
mediated(johnS,o2#Citizen)[hasName
hasValue mediated(johnS, o2#Name)]
memberOf o2#Citizen
13www.sti-innsbruck.at
Mapping Rules in WSMLAttribute to Attribute Mappings (1)
mapping(o1#Person.hasSurname, o2#Name.hasSurname, A2A)
mediated(?x,o2#Name)[hasSurname hasValue ?v] memberOf o2#Name:-
?x[hasSurname hasValue ?v] memberOf ?subCs and
?subCs subConceptOf o1#Person and mapped(?subCs,o2#Name,?x).
instance johnS[hasSurname
hasValue “Smith”] memberOf o1#Person
mapped(o1#Person, o2#Name, johnS)
mediated(johnS,o2#Name)[hasSurname
hasValue “Smith”] memberOf o2#Name
mapping(o1#Person, o2#Name, C2C)
14www.sti-innsbruck.at
Mapping Rules in WSMLAttribute to Attribute Mappings (2)
mapping(o1#Person.dateOfBirth, o2#Citizen.hasBirthDay, A2A)
mediated(?x,o2#Citizen)[hasBirthDay hasValue mediated(?i, o2#Date)] memberOf o2#Citizen:-
?x[dateOfBirth hasValue ?i] memberOf ?subCs and?subCs subConceptOf o1#Person and mapped(?subCs, o2#Citizen)mediated(?i,o2#Date)[?anAttribute hasValue ?aValue].
instance johnS[dateOfBirth hasValue
johnS_birthdate] memberOf o1#Person
mapped(o1#Person, o2#Citizen, johnS)
mediated(johnS_birthdate, o2#Date)[...]
mediated(johnS,o2#Citizen)[hasBirthDay
hasValue
mediated(johnS_birthdate, o2#Date)] memberOf o2#Citizen
15www.sti-innsbruck.at
Mapping Rules in WSMLAttribute to Class Mappings
16www.sti-innsbruck.at
Mapping Conditions
• Conditions that have to hold for the mapping to apply
• Three main types– Attribute occurrence conditions
– Attribute type conditions
– Attribute value conditions
Source
Target
17www.sti-innsbruck.at
Querying and Retrieving the Mediated Instances
?- ?x memberOf o2#Citizen Found < 1 > result to the query: (1) -- ?x = mediated(johnS, o2#Citizen)
?- mediated(johnS, o2#Citizen)[?y hasValue ?z] memberOf o2#Citizen and ?z memberOf ?avC. Found < 3 > results to the query: (1) -- ?z = o2#M, ?avC = o2#Sex, ?y=o2#hasSex (2) -- ?z = mediated(johnS,o2#Name), ?avC = o2#Name, ?y= o2#hasName (3) -- ?z = mediated(johnS_birthDate, o2#Date), ?avC = o2#Date, ?y = o2#hasBirthday
?- mediated(johnS, o2#Name)[?y hasValue ?z] memberOf o2#Name and ?z memberOf ?avC. Found < 2 > results to the query : (1) -- ?z = John, ?avC = string, ?y = o2#hasFirstName (2) -- ?z = Smith, ?avC = string, ?y = o2#hasSurname
...
18www.sti-innsbruck.at
Applying the Ontology-based Data Mediation
• SEEMP EU FP6 Project
• SemanticGov EU FP6 Project
• Rules, schemas and data to be mediated cannot be simply loaded in the reasoning space
• A set of optimizations have to be applied for an effective mediation task
• Minimize the size of the knowledge base to be queried (i.e. filtering)
19www.sti-innsbruck.at
Optimizations for the Instance Transformation Scenario
• Source Instance Filtering– Instances of unmapped entities can be directly discarded
• Mapping Filtering– Mappings that cannot applied to any of the source instances
don’t need to be transformed to rules
• Source and Target Ontology Filtering– Schema elements that are not relevant don’t need to be included
in the reasoning space
mapping(sourceEntity; [sourceEntityRestriction]; targetEntity; [targetEntityRestriction];
typeOfMapping)
20www.sti-innsbruck.at
Value Transformation Services
• Very often imply more than “re-arranging” the source values in the structure imposed by the target is needed
• Target values might need to be computed based on source values
• Value transformation services– Service calls embedded in the rules– The reasoner has the role of setting the parameters– Services are resolved after reasoning in a preprocessing phase
mapping(sourceEntity; [sourceEntityRestriction];targetEntity; [targetEntityRestriction];
typeOfMaping)
Transf. Service(serviceId, param)
21www.sti-innsbruck.at
Value Transformation ServicesExample
mediated(?X45,o2#Citizen)[o2#hasName hasValuehttp://example.org/concatService(?Y46,?Y47)] memberOf o2#Citizen :- ?X45[o1#hasChristianName hasValue ?Y46] memberOf o1#Person and ?X45[o1#hasSurname hasValue ?Y47] memberOf ?SC47 and ?SC47 subConceptOf o1#Person and mapped(?SC47,o2#Citizen,?X45) .
instance mediated(johnS, o2#Citizen) memberOf o2#Citizen o2#hasSex hasValue o2#M o2#hasName hasValue http://example.org/concatService("John","Smith") o2#hasBirthday hasValue mediated(johnS_birthDate, o2#Date)
22www.sti-innsbruck.at
Summary and conclusions
• Main principle of an instance transformation engine– Separation between mappings and rules– Grounding of mappings to WSML rules– Usage of a Datalog reasoner with function symbols
• Applying data mediation
• Future work– Extend and refine the optimization algorithms– Further Evaluation