Contents of /PlatformKit/platformkit-java/transformations/UML2ToPackageAPIOntology.atl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7380 - (show annotations) (download)
Thu Nov 8 09:49:02 2007 UTC (2 years, 3 months ago) by dwagelaa
File size: 4633 byte(s)
Corrected OCL operation syntax: -> is only used for collection operations
1 -- @atlcompiler atl2006
2 -- $Id$
3 -- Transforms a UML2 model to an API OWL ontology containing all the packages
4 module UML2ToPackageAPIOntology; --extends UML2ToAPIOntology
5
6 create OUT : OWL from IN : UML2, PLATFORM : OWL, JAVA : OWL;
7
8 uses UML2ToAPIOntology;
9
10 -- ======================================================================
11 -- helper attributes begin
12 -- ======================================================================
13
14 helper def : UML2ToPackageAPIOntologyVersionString : String =
15 '$Id$';
16
17 -- ======================================================================
18 -- helper attributes end
19 -- ======================================================================
20
21 -- ======================================================================
22 -- transformation rules begin
23 -- ======================================================================
24
25 rule Model {
26 from s : UML2!"uml::Model" (thisModule.inElements->includes(s))
27 using {
28 prevNotEmpty : Boolean = thisModule.prevModels->select(m|m.packagedElement->notEmpty())->notEmpty();
29 superClasses : Sequence(OWL!"owl::OWLClass") = s.compatibleClasses->select(c|s.equivalentClasses->excludes(c));
30 }
31 to n : OWL!"rdfs::Namespace" mapsTo s (
32 URI <- 'http://ssel.vub.ac.be/platformkit/' + s.name + '#',
33 name <- s.name),
34 xsd : OWL!"rdfs::Namespace" (
35 URI <- 'http://www.w3.org/2001/XMLSchema#',
36 name <- 'xsd'),
37 units : OWL!"rdfs::Namespace" (
38 URI <- 'http://localhost/~dennis/Units.owl#',
39 name <- 'units'),
40 platform : OWL!"rdfs::Namespace" (
41 URI <- 'http://localhost/~dennis/Platform.owl#',
42 name <- 'platform'),
43 java : OWL!"rdfs::Namespace" (
44 URI <- 'http://localhost/~dennis/Java.owl#',
45 name <- 'java'),
46 ont : OWL!"owl::OWLOntology" (
47 localName <- '',
48 namespace <- n,
49 RDFSLabel <- Sequence{label},
50 RDFSComment <- Sequence{comment},
51 ownedNamespace <- Set{n, xsd, units, platform, java}->union(
52 if prevNotEmpty then thisModule.importedOntologies->collect(o|thisModule.PrevNamespace(o)) else Set{} endif),
53 -- !!! OWLImports generates bogus namespace !!!
54 OWLImports <- thisModule.platformOntology->union(thisModule.javaOntology)->union(
55 if prevNotEmpty then thisModule.importedOntologies else Set{} endif),
56 contains <- Sequence{apiClass, jreClass}->union(
57 thisModule.includedPackages)),
58 label : OWL!"rdfs::PlainLiteral" (
59 language <- 'en',
60 lexicalForm <- s.name),
61 comment : OWL!"rdfs::PlainLiteral" (
62 language <- 'en',
63 lexicalForm <- 'Generated by ' +
64 thisModule.UML2ToPackageAPIOntologyVersionString + ' and ' +
65 thisModule.UML2ToAPIOntologyVersionString + ' and ' +
66 thisModule.UML2ComparisonVersionString),
67 apiClass : OWL!"owl::OWLClass" (
68 localName <- s.name.firstToUpper() + 'ClassLibrary',
69 RDFSSubClassOf <- thisModule.includedPackages->union(superClasses),
70 OWLEquivalentClass <- if s.equivalentClasses->isEmpty()
71 then Sequence{} else s.equivalentClasses endif,
72 RDFSComment <- Sequence{apiComment},
73 namespace <- s),
74 apiComment : OWL!"rdfs::PlainLiteral" (
75 language <- 'en',
76 lexicalForm <- 'JavaLibrary implementing the entire API for ' + s.name),
77 jreClass : OWL!"owl::OWLClass" (
78 localName <- s.name.firstToUpper(),
79 RDFSSubClassOf <- Sequence{thisModule.javaJRE, builtinJavaLibraryRestriction},
80 RDFSComment <- Sequence{jreComment},
81 namespace <- s),
82 jreComment : OWL!"rdfs::PlainLiteral" (
83 language <- 'en',
84 lexicalForm <- s.name + ' Java Runtime Environment'),
85 builtinJavaLibraryRestriction : OWL!"owl::SomeValuesFromRestriction" (
86 OWLOnProperty <- thisModule.jreProvidesBuiltinJavaLibrary,
87 OWLSomeValuesFrom <- apiClass,
88 namespace <- s)
89 }
90
91 rule Package {
92 from s : UML2!"uml::Package" (thisModule.includedPackages->includes(s))
93 using {
94 superClasses : Sequence(OWL!"owl::OWLClass") = s.compatibleClasses->select(c|s.equivalentClasses->excludes(c));
95 }
96 to t : OWL!"owl::OWLClass" mapsTo s (
97 localName <- (s.ontClassName + 'Library').debug(thisModule.modelName.prefix + 'Package'),
98 RDFSSubClassOf <- if superClasses->isEmpty()
99 then thisModule.javaLibrary else superClasses endif,
100 OWLEquivalentClass <- s.equivalentClasses,
101 RDFSComment <- Sequence{comment},
102 RDFSSeeAlso <- s.references,
103 namespace <- s.getModel()),
104 comment : OWL!"rdfs::PlainLiteral" (
105 language <- 'en',
106 lexicalForm <- 'JavaLibrary implementing the ' + s.javaQualifiedName + ' package for ' + thisModule.modelName)
107 }
108
109 -- ======================================================================
110 -- transformation rules end
111 -- ======================================================================

Properties

Name Value
svn:keywords Id

© 2009 • Software Languages Lab • Submit comments and bugs to our Bugzilla