280 likes | 420 Views
Towards Translating between XML and WSML based on mappings between XML Schema and an equivalent WSMO Ontology. WSMO Implementation Workshop Matt Moran, matthew.moran@deri.org 07 June 2005. Overview. Motivation It’s a WSDL and XML Schema world Background
E N D
Towards Translating between XML and WSML based on mappings between XML Schema and an equivalent WSMO Ontology WSMO Implementation WorkshopMatt Moran, matthew.moran@deri.org07 June 2005
Overview • Motivation • It’s a WSDL and XML Schema world • Background • XML, XML Schema, what’s been done before • Approach to Mapping • Three possible approaches, one chosen • Creating the Mappings • Methodology, identifying mappings, next steps • Grounding WSMO Choreography to WSDL • Linking to the standards
Motivation • Web services being created and deployed now and for the next few years will be described using WSDL and XML Schema • Want to define the mechanism for how WSMO service descriptions can be grounded to WSDL • Ground WSMO ontologies to XML Schema (this presentation) • Ground WSMO choreography descriptions to WSDL operations • Lifting XML Schema to a corresponding ontology provides opportunities for data mapping at the conceptual level
Background - XML • XML Pros • Standard language for sharing data across systems especially the Web • Extensible tag set great flexibility, many XML based languages for all kinds of purposes • Strong tool support parsers, editors, storage, querying • XML Con • Semantics must be known by receiver of XML documents in advance; can not be determined from the document itself
Background - XML Schema • Defines constraints on syntax and structure of XML documents • Legal elements and attributes, order of child elements, default and fixed values for elements and attributes • Components of XML Schema • Simple types • Built-in or defining constraints on values of built-in types • Complex types • Define a data type composed of child elements of other data types • Define allowed structure of child elements • Extend or restrict definition of an existing complex type • Elements • An association between a name and a type definition (simple or complex) • Attibutes • An association between a name and a simple type. They can be global or in the scope of a complex type.
Background – Previous Work • Comparing XML schema (DTD, XMLS) to Ontologies Other Related Areas of Work • Embed semantic metadata into XML • Complement structure with semantics • Lifting XML representation to OWL and RDF • We will take a similar approach • Lowering ontologies to XML schema • More expressive to less expressive
Approaches to Mapping • Map between XML and WSML/XML • Map between XML and WSML • Lift XML to ontological representation and create mappings from WSMO to WSMO at conceptual level
Approach to Mapping #1 • Direct transformation between XML as defined in WSDL and the XML syntax for a target WSMO ontology • Use XSLT • Disadvantages • Might be no suitable WSMO ontology • New XSLT must be created for every XML/ WSMO ontology pair • Syntactic mapping based on the structure of the XML document • Low possibility for re-use of WSMO data mediation • The XML syntax of WSMO has less parser support
Approach to Mapping #2 • Map directly between XML and WSML instances • Create a mapping language for this • Maybe XSLT • Disadvantages (mostly same as approach #1) • Might be no suitable WSMO ontology • New mapping needed for every XML Schema/WSMO ont. pair • Low possibility for re-use of WSMO data mediation • Syntactic mapping based on the structure of the XML document
Approach to Mapping #3 (the chosen one) • Define mapping at the conceptual level • Create WSMO Ontology from XML Schema of WSDL • Define mappings from conceptual framework for XML Schema to WSMO Ontology metamodel • Generate ad-hoc ontology • Create set of executable mapping rules for data instances • Benefits • Take advantage of data mediation • Mapping rules generated automatically • No additional ontology required (in simplest case)
Creating the Mappings – Example Scenario • Semantic service description designer with the task of providing a semantic description for the Amazon service • Only consider scenario in terms of grounding the data • Imagine that a tool exists that can automatically create a ad-hoc WSMO ontology from an XML Schema • Two scenario use cases • No mediation required • Mediation required
Creating the Mappings: Use Case 1 • The ad-hoc ontology is sufficient for designer’s needs • Mapping rules to get from instances of WSMO to instances of XML and vice-versa are created automatically during creation of the ad-hoc ontology
Creating the Mappings: Use Case 2 • Designer wishes to use a specific book ontology • Ad-hoc ontology + rules created as before • Additional data mediation needs to be defined (using existing tools)
Creating the Mappings: Methodology • Define a mapping between the XML Schema Conceptual Model to the WSMO Ontology Metamodel. • Create an executable description of these mappings to enable the automatic creation of ad-hoc WSMO ontologies from specific XML Schema. • Create the bidirectional mappings rules to be used for the transformation between XML instances and WSMO instances. • Should be created at the same time as the generation of the ad-hoc WSMO ontology from an XML Schema. • The creation of these mapping rules should be automatic as they should be completely derived from the actions described in the first two bullet points.
Mapping from XML Schema to WSMO 00 <xsd:schema xmlns:xsd="http://www.ws.org/2000/08/XMLSchema"> 01 02 <xsd:element name="resumes" type="resumeTypes"/> 03 04 <xsd:complexType name="resumesTypes"> 05 <xsd:sequence> 06 <xsd:element name="applicantName" type="xsd:string"/> 07 <xsd:element name="jobsAvailable" type="jobListType"/> 08 </xsd:sequence> 09 <xsd:attribute name="applicationDate" type="xsd:date"/> 10 </xsd:complexType> 11 12 <xsd:complexType name="jobListType"> 13 <xsd:sequence> 14 <xsd:complexType name="job" type="jobDesc"> 15 <xsd:attribute name="jobid" type="xsd:string"/> 16 </xsd:complexType name="job" type="jobDesc"> 17 </xsd:sequence> 18 </xsd:complexType> 19 20 <xsd:complexType name="jobDesc"> 21 <xsd:element name="title" type="xsd:string"> 22 <xsd:element name="salary"> 23 <xsd:simpleType> 24 <xsd:restriction base="xsd:positiveInteger"> 25 <xsd:maxExclusive value="55000"> 26 </xsd:restriction> 27 </xsd:simpleType> 28 </xsd:element> 29 </xsd:complexType> 30 31 </xsd:schema>
Mapping from XML Schema to WSMO 00 <xsd:schema xmlns:xsd="http://www.ws.org/2000/08/XMLSchema"> 01 02 <xsd:element name="resumes" type="resumeTypes"/> 03 04 <xsd:complexType name="resumesTypes"> 05 <xsd:sequence> 06 <xsd:element name="applicantName" type="xsd:string"/> 07 <xsd:element name="jobsAvailable" type="jobListType"/> 08 </xsd:sequence> 09 <xsd:attribute name="applicationDate" type="xsd:date"/> 10 </xsd:complexType> 11 12 <xsd:complexType name="jobListType"> 13 <xsd:sequence> 14 <xsd:complexType name="job" type="jobDesc"> 15 <xsd:attribute name="jobid" type="xsd:string"/> 16 </xsd:complexType name="job" type="jobDesc"> 17 </xsd:sequence> 18 </xsd:complexType> 19 20 <xsd:complexType name="jobDesc"> 21 <xsd:element name="title" type="xsd:string"> 22 <xsd:element name="salary"> 23 <xsd:simpleType> 24 <xsd:restriction base="xsd:positiveInteger"> 25 <xsd:maxExclusive value="55000"> 26 </xsd:restriction> 27 </xsd:simpleType> 28 </xsd:element> 29 </xsd:complexType> 30 31 </xsd:schema> Element Complex Type Simple Type
Mapping Simple Types • Built-in simple types • Simple mapping as WSMO supports XML Schema built-in types • Simple Type based on restriction of a built-in type • Create a sub concept and use axiom to express the restriction XML Schema <xsd:element name="salary"> <xsd:simpleType> <xsd:restriction base="xsd:positiveInteger"> <xsd:maxExclusive value="55000"> </xsd:restriction> </xsd:simpleType> </xsd:element> WSML concept salaryType subConceptOf xsd:positiveInteger constraint salaryConstraint definedBy ?X:salaryType and ?X<55000
Mapping Complex Types • Complex types always map to a WSMO concept • Complex type can have sub-components that are a mixture of simple types, attributes, elements and complex types • Sub-components with a built-in simple type are mapped to attributes of the concept with the same type • Sub-components with simple types that are not built-in are mapped to attributes of the concept with the type of the mapped simple type definition • A sub-component that itself is a complex type, leads to the creation of a corresponding concept. The sub-component is then mapped to an attribute with the type of the newly created concept.
Mapping Complex Types • Attributes within the scope of complex types provide an additional complexity • We propose that the attribute acts as an extension to the definition of the concept mapped from the complex type definition • This means: • A concept for the complex type is created • A second concept is defined as a subconcept of 1.It contains an attribute mapped from the XML Schema attribute
Mapping Complex Types XML Schema <xsd:complexType name="jobListType"> <xsd:sequence> <xsd:complexType name="job" type="jobDesc"> <xsd:attribute name="jobid" type="xsd:string"/> </xsd:complexType name="job" type="jobDesc"> </xsd:sequence> </xsd:complexType> WSML concept jobListType job (0 *) ofType jobList_withAttrJobID concept jobList_withAttrJobID subConceptOf jobDesc jobid ofType xsd:integer concept jobDesc title ofType xsd:string salary ofType salaryType
Mapping attributes and elements • Elements are structural components within XML Schema • No mapping • Although they do need to be considered when creating the rules for mapping between instances of XML and instances of WSMO • Why? • They define the element name required in the XML document • Mapping attributes (outside complex types) • No mapping defined yet
Some Discussion Points & Next Steps • XSLT is powerful but does not take account of semantics • Conceptual mapping offers better opportunity for reuse • How to deal with structural info during the mapping? • Does a WSMO attribute maps back to and XML Schema sub element or to an attribute of an element? • How to maintain the element names for the XML Schema – neither an attribute nor a sub element • Need to formalise the mappings • Need to extend the mappings • Need to define how they mappings should be executed
Grounding WSMO Choreography to WSDL • How is choreography represented in WSMO • States (made up of concepts) and transitions • Some concepts represent in or out messages • Mode non functional property • In, out, shared • Grounding non functional property • Specifies a set of URIs relating to that message • URIs point to WSDL in, out or fault messages • URIs for identifying messages in WSDL 2.0 • http://example.com/#wsdl.interfaceMessageReference(PrinterInterface/print/In • WSDL WSMO – manual (with tool support) • WSMO WSDL – auto generation of WSDL
Summary • Motivation is to provide the link to the WSDL and XML Schema world • Grounding is needed for semantic service designers needing to describe an existing WSDL service • Looked at a scenario with and without mediation • Three steps in approach • Define mappings from metamodel of XML Schema to that of WSMO • Use the mappings to create ad-hoc WSMO ontologies and … • During ontology creation, generate mapping rules that can be applied at runtime to lift and lower data instances • Presented some initial work for this first step with some example XML Schema and WSML • Had a quick look at the approach for grounding WSMO chor.
Summary Inaccuracy in WIW paper
Summary Inaccuracy in WIW paper Simplest case would consist of only the mapping rules required to lift and lower between XML and WSMO
Thanks, Q&A Questions?