Presentation is loading. Please wait.

Presentation is loading. Please wait.

IVOA Registry videocon 2004/05/13-14 Gerard Lemson1 Model based schema.

Similar presentations


Presentation on theme: "IVOA Registry videocon 2004/05/13-14 Gerard Lemson1 Model based schema."— Presentation transcript:

1 IVOA Registry videocon 2004/05/13-14 Gerard Lemson1 Model based schema

2 IVOA Registry videocon 2004/05/13-14 Gerard Lemson2 UML to XSD binding Start with UML model Generate XMI from UML Define UML to XSD binding Implement binding as XSLT script Run script

3 IVOA Registry videocon 2004/05/13-14 Gerard Lemson3 Sample UML

4 IVOA Registry videocon 2004/05/13-14 Gerard Lemson4 Mapping “methodology” Simple: as “1-1” as possible Preserve semantics –Attributes owned by class –Children in parent-child composition relation owned by parent/container Focus on type definitions, complexType-s mainly Valid documents (global elements) defined with respect to, but separate from the type definitions Default document: contains an element definition under the root for each “root-entity-class”. Possibility of reuse of schema type definitions in different special purpose document definitions.

5 IVOA Registry videocon 2004/05/13-14 Gerard Lemson5 Mapping: packages Package -> (target)namespace, in own file Dependency -> import of dependent namespace and file <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn://xml.registry.gavo.org/aas" elementFormDefault="qualified" attributeFormDefault="unqualified" version="0.1" xmlns:aas="urn://xml.domainmodel.gavo.org/aas" xmlns:base="urn://xml.domainmodel.gavo.org/" xmlns:cees="urn://xml.domainmodel.gavo.org/cees">... <xsd:import namespace="urn://xml.registry.gavo.org/cees" schemaLocation="./cees.xsd" />

6 IVOA Registry videocon 2004/05/13-14 Gerard Lemson6 Mapping Classes Every class -> globally defined complexType isAbstract -> abstract=“true” Attribute -> element of simplish-type, either built-in, or also generated

7 IVOA Registry videocon 2004/05/13-14 Gerard Lemson7 Mapping Classes II Inheritance -> extension of base class

8 IVOA Registry videocon 2004/05/13-14 Gerard Lemson8 Mapping Associations I Parent-child relationship Composition -> element of appropriate complexType <xsd:element name="dees" type="cees:D" minOccurs="0" maxOccurs="unbounded" />

9 IVOA Registry videocon 2004/05/13-14 Gerard Lemson9 Mapping associations II “Owned references” -> element of appropriate type

10 IVOA Registry videocon 2004/05/13-14 Gerard Lemson10 Mapping associations III Problem: shared references (also aggregations), many-to-1/many relations Does one want to replicate elements that are shared ? Multiple B-s can reference same C. Solutions: –Don‘t care, map ala composition, with cardinality maxOccurs=“0” –Use ID/IDREF or KEY/KEYREF declarations. Requires the C to exist in same document, possibly completely, i.e. containing all substructure. –Use explicit “proxy ” element, for example using a GUID (IVOA identifier?), which can/must be resolved before the referenced object can be obtained. This is the most tricky thing I think about XML schemas, how to properly embed the semantics of the shared association into a logical schema design.

11 IVOA Registry videocon 2004/05/13-14 Gerard Lemson11 Default Document Root entity classes map also to an element in a document, but in a separate schema doc, depending on the type defining schema documents. <xsd:schema targetNamespace="urn://xml.registry.gavo.org/doc"... xmlns:doc="urn://xml.registry.gavo.org/doc" xmlns:cees="urn://xml.registry.gavo.org/cees" xmlns:aas="urn://xml.registry.gavo.org/aas"> <xsd:import namespace="urn://xml.registry.gavo.org/cees" schemaLocation="./cees.xsd" /> <xsd:import namespace="urn://xml.registry.gavo.org/aas" schemaLocation="./aas.xsd" /> <xsd:element name="c" type="cees:C" minOccurs="0" maxOccurs="unbounded" /> <xsd:element name="a" type="aas:A" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="b" type="aas:B" minOccurs="0" maxOccurs="unbounded"/>

12 IVOA Registry videocon 2004/05/13-14 Gerard Lemson12 Comments Single inheritance mapping, only extension, no substitutionGroup Requires xsi:type construct (next slide) to indicate which precise class is used. No element ref construct. No global elements for attributes and contained classes. Analogy to Java binding : –Complex type class –Typed declarations Fields in class definition –Default document a main method using the classes. –Global elements variable declarations local to main method Can support a more involved special purpose document to/from the “official” default registry document using XSLT scripts for example (view concept). See also: http://www.xml.com/pub/a/2002/08/07/wxs_uml.html and othershttp://www.xml.com/pub/a/2002/08/07/wxs_uml.html Probably more …

13 IVOA Registry videocon 2004/05/13-14 Gerard Lemson13 xsi:type xsi:type=‘’ construct from the xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” in document required to indicate precise class: <doc:sample xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:doc="urn://xml.registry.gavo.org/doc" xmlns:cees="urn://xml.registry.gavo.org/cees"> a C a D1 a D2


Download ppt "IVOA Registry videocon 2004/05/13-14 Gerard Lemson1 Model based schema."

Similar presentations


Ads by Google