Domain Modelling and Implementation From model to implementation Simon Cox Research Scientist Sydney...

35
Domain Modelling and Implementation From model to implementation Simon Cox Research Scientist Sydney - December, 3 rd 2010

Transcript of Domain Modelling and Implementation From model to implementation Simon Cox Research Scientist Sydney...

Domain Modelling and Implementation From model to implementation

Simon Cox

Research Scientist

Sydney - December, 3rd 2010

Overview

• Serialization rules• Technical finalization of a model• FullMoon

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Serialization rules

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Encoding

• ISO 19118 • Encoding principles

• ISO 19136 (a.k.a. GML 3.2)• Annex D – XML implementation of ISO 19107, 19108, 19111,

19123 (sort-of)• Annex E – UMLGML 3.2 encoding rule

• ISO TS 19139• Variant UMLXML encoding rule - generally follows GML pattern,

except:• All types implemented as elements, even gco:CharacterString!• Sophisticated treatment of codelists

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

UML → XML/GML

• ‘striped’ syntax - • Alternating UpperCamelCase objects, lowerCamelCase properties

<gsml:Borehole gml:id="gcDD0214"> <gml:name codeSpace="urn:cgi:authority:CGI:GSV“ >gcDD0214</gml:name> <sa:length uom="m">48.3</sa:length> <sa:shape> <gml:LineString gml:id="gcDD0214survey“ > ... </gml:LineString> </sa:shape> <gsml:collarLocation> <gsml:BoreholeCollar gml:id="gcDD0214c"> <gsml:location> <gml:Point gml:id="gcDD0214p"> <gml:pos srsName="urn:ogc:crs:EPSG:4326“ >-31.939 115.832</gml:pos> </gml:Point> </gsml:location> </gsml:BoreholeCollar> </gsml:collarLocation> <gsml:indexData> <gsml:BoreholeDetails> ... </gsml:BoreholeDetails> </gsml:indexData> ...</gsml:Borehole>

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Inline or by-reference

<gsml:Borehole gml:id="gcDD0214"> <gml:name codeSpace="urn:cgi:authority:CGI:GSV“>gcDD0214</gml:name> <sa:length uom="m">48.3</sa:length> <sa:shape> <gml:LineString gml:id="gcDD0214survey“> ... </gml:LineString> </sa:shape> <gsml:collarLocation> <gsml:BoreholeCollar gml:id="gcDD0214c"> <gsml:location> <gml:Point gml:id="gcDD0214p"> <gml:pos srsName="urn:ogc:crs:EPSG::4326“ >-31.939 115.832</gml:pos> </gml:Point> </gsml:location> <gsml:elevation srsName=“urn:ogc:crs:EPSG::5711” >34.5</gsml:elevation> </gsml:BoreholeCollar> </gsml:collarLocation> <gsml:indexData> <gsml:BoreholeDetails> ... </gsml:BoreholeDetails> </gsml:indexData> ...</gsml:Borehole>

<gsml:Borehole gml:id="gcDD0214"> <gml:name codeSpace="urn:cgi:authority:CGI:GSV">gcDD0214</gml:name> <sa:length uom="m">48.3</sa:length> <sa:shape xlink:href="#gcDD0214survey“ xlink:role=“gml:LineString"/> <gsml:collarLocation xlink:href="http://wfs.example.org/collars?gcDD0214c“ /> <gsml:indexData> <gsml:BoreholeDetails> ... </gsml:BoreholeDetails> </gsml:indexData> ...</gsml:Borehole>

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

GML rule

• Object = XML element• Attribute & association = sub-element• Association target or attribute value = inline or by reference• Some standard qualifiers → XML attributes

• srsName, codeSpace, uom• xlink for references

• xlink:href – URI of target resource• xlink:role – type of target, xlink:role – name of target, etc• Other xlinks …

<gsml:Borehole gml:id="gcDD0214"> <gml:name codeSpace="urn:cgi:authority:CGI:GSV">gcDD0214</gml:name> <sa:length uom="m">48.3</sa:length> <sa:shape xlink:href="#gcDD0214survey“ xlink:role=“gml:LineString"/> <gsml:collarLocation xlink:href="http://wfs.example.org/collars?gcDD0214c“ /> <gsml:indexData> <gsml:BoreholeDetails> ... </gsml:BoreholeDetails> </gsml:indexData> ...</gsml:Borehole>

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

GML rule

• For more detail:• https://www.seegrid.csiro.au/twiki/bin/view/AppSchemas/GmlImplementation• https://www.seegrid.csiro.au/twiki/bin/view/AppSchemas/UmlGmlTestModels

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Finishing a model

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Finishing the model

• Tagged values: XML implementation details • on each package

• targetNamespace• xmlns• xsdDocument

• on properties (attributes and association-ends)• inlineOrByReference on attributes and association ends• sequenceNumber on each attribute and association end

https://www.seegrid.csiro.au/twiki/bin/view/AppSchemas/UmlGmlStereotypesAndTaggedValues

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Associations

1. Navigable end must carry a roleName• Else can’t be encoded

2. Tagged value: inlineOrByReference• ‘inline’ sub-element only• ‘byReference’ xlink

3. «DataType»• has no (external) identity• composition association

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Package tags

«Application Schema»TestAS08

+ Sample

tagsclassMap = Map_ta08.xmlgmlProfileSchema = owner = Simon CoxtargetNamespace = urn:cgi:xmlns:CSIRO:TestAS08:1.0version = 1.0.0xmlns = ta08xsdDocument = testas08.xsd

«Leaf»Sample

+ Sample

tagsxsdDocument = sample.xsd

Name:Package:Version:Author:

Package Dependencies«Application Schema» TestAS081.0Simon CoxTest model 08

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Property tags

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Finishing the model

• Tagged values: XML implementation details • Record package dependencies

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Link to standard components

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Package dependencies

• HollowWorld ‘add-in’ will build these automagically

«Application Schema»TestAS08

+ Sample

tagsclassMap = Map_ta08.xmlgmlProfileSchema = owner = Simon CoxtargetNamespace = urn:cgi:xmlns:CSIRO:TestAS08:1.0version = 1.0.0xmlns = ta08xsdDocument = testas08.xsd

«Leaf»Sample

+ Sample

tagsxsdDocument = sample.xsd

(from TestApplications)

«import»

«import»

«import»

ISO 19103 Conceptual Schema Language

+ Basic Types

(from ISO 19100)

ISO 19108 Temporal

+ Temporal Objects

+ Temporal Reference System

(from ISO 19100)

ISO 19107 Spatial Schema

+ Geometry

+ Topology

(from ISO 19100)«import»

Name:Package:Version:Author:

Package Dependencies«Application Schema» TestAS081.0Simon CoxTest model 08

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Do you use packages not in HollowWorld?

You must tell the encoded (FullMoon) how to find them1. Register the external package

... and how its classes are implemented in XML2. Publish its ‘classmap’

http://projects.arcs.org.au/trac/fullmoon/wiki/ExternalDependencyConfiguration

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Finishing the model

• Tagged values• Record package dependencies• Documentation

• Add a scope note for every package, class, attribute, association• https://www.seegrid.csiro.au/twiki/bin/view/AppSchemas/ModelDocumentation

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Complete all scope notes

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Finishing the model

• Tagged values• Record package dependencies• Documentation

• Refer to the modelling check-list • https://www.seegrid.csiro.au/twiki/bin/view/AppSchemas/ModelingCheckList

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Create Artefacts for encoder (FullMoon)

• Export model from UML tool• Exported package must be «Application Schema»• XMI 1.1• XMI sample with EAStub elements

• Make sure all external dependencies are recorded• Register of external packages• Standard UMLXML classmaps, published classmaps

http://projects.arcs.org.au/trac/fullmoon/wiki/ExternalDependencyConfiguration

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

FullMoon

Conformance

Documentation

XML Encoder

FullMoon overview

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

<xmi>

FullMoon

eXist XQuery

<html>

<xs:schema>

report

OWL <owl>

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

FullMoon implementation

• Uses XMI representation of UML structure model• Three rulesets (for now):

• Model conformance• GML schema generation• HTML documentation

• Processing rules expressed in XQuery

• Coming soon?• UML OWL• UML ISO 19110 Feature Type Catalogue• UML data bindings (header files)

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

FullMoon setup

• Requirements• Java• Apache Ant• Tomcat• eXist• FullMoon

• See FullMoon Installation • http://projects.arcs.org.au/trac/fullmoon/wiki/FullMoonInstallation

• Run the installation tests!• http://projects.arcs.org.au/svn/fullmoon/trunk/doc/user-manual/quick-start.html

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

FullMoon operation

• Command line• ant -f bin/run.xml add -Di=“myModel” -Dd=“c:/tmp:MyModel.xml” • ant -f bin/run.xml test -Di=“myModel”• ant -f bin/run.xml execute-enc –Di=“myModel” –Dg=“3.2”• ant -f bin/run.xml export -Do=“c:/tmp/xsd”• ant -f bin/run.xml execute-doc –Di=“myModel” –Dl=“better.css” –Dt=“My terrific domain model”

• Bat scripts• run-test.bat • run-encode.bat• run-doc.bat

• For support, see usage guide Trac mailing list• http://projects.arcs.org.au/svn/fullmoon/trunk/doc/user-manual/usage.html • http://projects.arcs.org.au/trac/fullmoon/

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

FullMoon Examples

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Conformance tests

http://projects.arcs.org.au/trac/fullmoon/wiki/ModelConformanceTests

Run FullMoon test on TestAS08***.xml

(in xmi-samples)

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

XML Schema Generation

• See outputs in http://projects.arcs.org.au/trac/fullmoon/wiki/UmlGmlTestModels

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Documentation

• Requires scope notes for every• Package• Class• Attribute• Association

• See outputs in http://projects.arcs.org.au/trac/fullmoon/wiki/UmlGmlTestModels

• Extended example - http://www.geosciml.org/geosciml/2.0/doc/

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

End-to-end checklist

• https://www.seegrid.csiro.au/twiki/bin/view/AppSchemas/EndToEndCheckList

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

FullMoon highlights

1. Conformance tests + diagnostics

2. Management of external dependencies• Register of known models with XML bindings• Map of UML ClassXML for each model

• Separately maintained and published

3. Documentation generator• including XSD fragments

4. Modular architecture• Relatively easy to add a new rule-set

… separation of concerns

Contact UsPhone: 1300 363 400 or +61 3 9545 2176

Email: [email protected] Web: www.csiro.au

Thank you

Earth Science & Resource EngineeringSimon CoxResearch Scientist

Phone: 08 6436 8639Email: [email protected]: www.csiro.au

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

Qualified values

<MappedFeature>    …     <observationMethod> <CGI_TermValue>

            <value codeSpace="urn:cgi:classifierScheme:GA:1MillionGeology_ObservationMethods“ >GSNSW785</value>

        </CGI_TermValue></observationMethod>    <positionalAccuracy> <CGI_NumericValue>

            <principalValue uom="urn:ogc:def:uom:UCUM:m">500</principalValue>        </CGI_NumericValue> </positionalAccuracy>    <samplingFrame

xlink:href="urn:cgi:classsifier:GA:SurfaceGeologyOfEasternAustralia_1MillionScale"/>     <specification>

        <LithologicUnit >            <gml:description>Mafic volcaniclastic sandstone, siltstone, shale, chert; minor limestone, conglomerate</gml:description>             <gml:name codeSpace="urn:cgi:classifierScheme:GA:StratigraphicLexicon:Unitname“

>Kabadah Formation</gml:name>             <gml:name codeSpace="urn:cgi:classifierScheme:GA:StratigraphicLexicon:Map_symbol“

>Ojck</gml:name>             <gml:name codeSpace="urn:ietf:rfc:2141">urn:cgi:feature:GA:Stratno:29570</gml:name>

            <observationMethod> <CGI_TermValue>                    <value codeSpace="urn:cgi:classifierScheme:GA:ObservationMethods“

>published description</value>                </CGI_TermValue> </observationMethod>

            <purpose>typicalNorm</purpose>             <preferredAge> <GeologicEvent>

<eventAge> <CGI_TermValue>                            <value codeSpace="urn:cgi:classifierScheme:ICS:StratChart:2004“

>urn:cgi:classifier:ICS:StratChart:2004:Ordovician</value>                        </CGI_TermValue> </eventAge>

 <eventProcess> <CGI_TermValue>                            <value codeSpace="urn:cgi:classifierScheme:GA:Process">unspecified</value>                        </CGI_TermValue> </eventProcess>

 </GeologicEvent> </preferredAge> …

Most content is taken from controlled sourcesCommon values interoperability

CSIRO. Masterclass: Domain Modelling and Implementation - Sydney 03/12/2010

XMI

• XML Model Interchange • Verbose serialization of the UML• See Test Model 5 (one empty class!)

• Not very standardized• FullMoon is designed around Enterprise Architect XMI 1.1

• Puts some key information in tagged values• XMI 2 is more standard and complete

• May include representation of diagrams• These are not used by FullMoon