ontomde-uml2 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/Manifest.txt +39 -0
- data/README.txt +77 -0
- data/Rakefile +23 -0
- data/lib/ontomde-uml2.rb +31 -0
- data/lib/ontomde-uml2/autoImplement.rb +196 -0
- data/lib/ontomde-uml2/cardinality.rb +130 -0
- data/lib/ontomde-uml2/check.rb +28 -0
- data/lib/ontomde-uml2/createAndAdd.rb +222 -0
- data/lib/ontomde-uml2/depencies.rb +30 -0
- data/lib/ontomde-uml2/dotDiagram.rb +115 -0
- data/lib/ontomde-uml2/enumerated.rb +36 -0
- data/lib/ontomde-uml2/extension.rb +5 -0
- data/lib/ontomde-uml2/helper.rb +14 -0
- data/lib/ontomde-uml2/multipleInheritance.rb +104 -0
- data/lib/ontomde-uml2/nt_old_to_nt_new.sh +28 -0
- data/lib/ontomde-uml2/owner.rb +61 -0
- data/lib/ontomde-uml2/salvageErrors.rb +71 -0
- data/lib/ontomde-uml2/select.rb +85 -0
- data/lib/ontomde-uml2/shortcut.rb +27 -0
- data/lib/ontomde-uml2/uml2.rb +236 -0
- data/lib/ontomde-uml2/uml2.rdfs.nt +2560 -0
- data/lib/ontomde-uml2/umlx.rb +638 -0
- data/lib/ontomde-uml2/version.rb +5 -0
- data/lib/ontomde-uml2/versionSignature.rb +34 -0
- data/test/_test_dot.rb +53 -0
- data/test/_test_perf.rb +44 -0
- data/test/model/.project +11 -0
- data/test/model/SID.emx +25904 -0
- data/test/model/SID.emx.nt +62554 -0
- data/test/model/SID.uml2 +25904 -0
- data/test/model/simple2.emx +891 -0
- data/test/model/simple2.emx.nt +2713 -0
- data/test/model/simple2WithProfile.emx +771 -0
- data/test/test_base.rb +97 -0
- data/test/test_clone.rb +78 -0
- data/test/test_misc.rb +196 -0
- data/test/test_ontomde-uml2.rb +0 -0
- metadata +113 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
lib/ontomde-uml2.rb
|
6
|
+
lib/ontomde-uml2/version.rb
|
7
|
+
lib/ontomde-uml2/cardinality.rb
|
8
|
+
lib/ontomde-uml2/check.rb
|
9
|
+
lib/ontomde-uml2/uml2.rdfs.nt
|
10
|
+
lib/ontomde-uml2/dotDiagram.rb
|
11
|
+
lib/ontomde-uml2/nt_old_to_nt_new.sh
|
12
|
+
lib/ontomde-uml2/createAndAdd.rb
|
13
|
+
lib/ontomde-uml2/enumerated.rb
|
14
|
+
lib/ontomde-uml2/select.rb
|
15
|
+
lib/ontomde-uml2/salvageErrors.rb
|
16
|
+
lib/ontomde-uml2/multipleInheritance.rb
|
17
|
+
lib/ontomde-uml2/uml2.rb
|
18
|
+
lib/ontomde-uml2/owner.rb
|
19
|
+
lib/ontomde-uml2/versionSignature.rb
|
20
|
+
lib/ontomde-uml2/depencies.rb
|
21
|
+
lib/ontomde-uml2/extension.rb
|
22
|
+
lib/ontomde-uml2/umlx.rb
|
23
|
+
lib/ontomde-uml2/autoImplement.rb
|
24
|
+
lib/ontomde-uml2.rb
|
25
|
+
lib/ontomde-uml2/helper.rb
|
26
|
+
lib/ontomde-uml2/shortcut.rb
|
27
|
+
test/_test_perf.rb
|
28
|
+
test/test_misc.rb
|
29
|
+
test/test_base.rb
|
30
|
+
test/test_ontomde-uml2.rb
|
31
|
+
test/model/SID.emx
|
32
|
+
test/model/SID.emx.nt
|
33
|
+
test/model/simple2WithProfile.emx
|
34
|
+
test/model/simple2.emx
|
35
|
+
test/model/SID.uml2
|
36
|
+
test/model/.project
|
37
|
+
test/model/simple2.emx.nt
|
38
|
+
test/test_clone.rb
|
39
|
+
test/_test_dot.rb
|
data/README.txt
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
ontomde-uml2
|
2
|
+
by stephane (Pierre) Carrie
|
3
|
+
http://ontomde.rubyforge.org
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
ontoMDE-uml2 contains UML2 meta-model and helper files to manipulate a UML2 model.
|
8
|
+
ontoMDE-uml2 uses ontoMDA-core which provides core fonctionalities for loading a model in RDF/RDFS format. ontoMDE-UML2 is used by ontoMDE-java which contains rules for generating java Code.
|
9
|
+
|
10
|
+
== FEATURES/PROBLEMS:
|
11
|
+
|
12
|
+
* UML2 meta-model definition in RDFS format
|
13
|
+
* Ruby helper methods for handling a UML2 model.
|
14
|
+
* UML Stereotype handling helpers.
|
15
|
+
* UML predefined enumerations handling helper.
|
16
|
+
* UML model manipulations helpers (add interface implementations, transform multiple inheritance into single inheritance, ...)
|
17
|
+
|
18
|
+
|
19
|
+
== SYNOPSIS:
|
20
|
+
|
21
|
+
require 'ontomde-uml2'
|
22
|
+
|
23
|
+
# create a new empty model.
|
24
|
+
model=Crdf_Model.new
|
25
|
+
|
26
|
+
# loads UML2 meta-model
|
27
|
+
model.loadUML2
|
28
|
+
|
29
|
+
# loads your UML2 model
|
30
|
+
model.loadModelFromFile("YourUML2ModelFile.emx.nt",true)
|
31
|
+
|
32
|
+
# display name of every UML element with a name
|
33
|
+
module Muml_NamedElement
|
34
|
+
def disp
|
35
|
+
puts "Name=#{uml_name}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
# ignore every other model element
|
39
|
+
module Crdf_Ressource
|
40
|
+
def disp
|
41
|
+
#do nothing
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
model.each { |k,c|
|
46
|
+
c.disp
|
47
|
+
}
|
48
|
+
|
49
|
+
== REQUIREMENTS:
|
50
|
+
|
51
|
+
* requires ontomde-core
|
52
|
+
|
53
|
+
== INSTALL:
|
54
|
+
|
55
|
+
* (UNIX) sudo gem install ontomde-uml2
|
56
|
+
* (WIN) gem install ontomde-uml2
|
57
|
+
|
58
|
+
Additional information is available on ontoMDE web site :
|
59
|
+
http://ontomde.rubyforge.org/website/download.html
|
60
|
+
== LICENSE:
|
61
|
+
|
62
|
+
Copyright (C) 2008 Orange-labs
|
63
|
+
38 rue General Leclerc
|
64
|
+
92130 ISSY LES MOULINEAUX, France
|
65
|
+
|
66
|
+
This program is free software: you can redistribute it and/or modify
|
67
|
+
it under the terms of the GNU Affero General Public License as
|
68
|
+
published by the Free Software Foundation, either version 3 of the
|
69
|
+
License, or (at your option) any later version.
|
70
|
+
|
71
|
+
This program is distributed in the hope that it will be useful,
|
72
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
73
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
74
|
+
GNU Affero General Public License for more details.
|
75
|
+
|
76
|
+
You should have received a copy of the GNU Affero General Public License
|
77
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/ontomde-uml2/version.rb'
|
6
|
+
|
7
|
+
Hoe.new('ontomde-uml2', Ontomde::Uml2::VERSION) do |p|
|
8
|
+
p.rubyforge_name = 'ontomde'
|
9
|
+
p.author = 'Stephane (Pierre) Carrie'
|
10
|
+
p.email = 'stephanepierre.carrie -nospam- @orange-ftgroup.com'
|
11
|
+
p.summary = 'OntoMDE UML2 handling cartridge'
|
12
|
+
p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
|
13
|
+
p.url="http://ontomde.rubyforge.org"
|
14
|
+
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
15
|
+
p.spec_extras[:required_ruby_version] = '>= 1.8.4'
|
16
|
+
p.extra_deps=[
|
17
|
+
['ontomde-core',"= #{Ontomde::Uml2::VERSION}"]
|
18
|
+
#,['rubygems-update', "> 0.9.5" ] # .cmd to .bat change
|
19
|
+
]
|
20
|
+
p.spec_extras={ :required_ruby_version => '>=1.8.6',:required_rubygems_version => '>=1.0.0' }
|
21
|
+
end
|
22
|
+
|
23
|
+
# vim: syntax=Ruby
|
data/lib/ontomde-uml2.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# This files includes requires for every ruby files of the ontomde-uml2 package.
|
2
|
+
#
|
3
|
+
# To use ontomde-uml2 just insert the following instruction in your file:
|
4
|
+
# require 'ontomde-uml2'
|
5
|
+
#
|
6
|
+
# Users wishing to write a Java Code generator should rather use ontomde-uml2_java and eventually redefine methods.
|
7
|
+
|
8
|
+
here="#{File.dirname(__FILE__)}/ontomde-uml2"
|
9
|
+
require "#{__FILE__[0..-4]}/version.rb"
|
10
|
+
|
11
|
+
UML2_RDFS_NT_FILE="#{here}/uml2.rdfs.nt"
|
12
|
+
require 'ontomde-core'
|
13
|
+
require "#{here}/extension.rb"
|
14
|
+
require "#{here}/enumerated.rb"
|
15
|
+
require "#{here}/umlx.rb"
|
16
|
+
require "#{here}/cardinality.rb"
|
17
|
+
require "#{here}/uml2.rb"
|
18
|
+
require "#{here}/dotDiagram.rb"
|
19
|
+
require "#{here}/createAndAdd.rb"
|
20
|
+
require "#{here}/autoImplement.rb"
|
21
|
+
require "#{here}/owner.rb"
|
22
|
+
require "#{here}/select.rb"
|
23
|
+
require "#{here}/depencies.rb"
|
24
|
+
require "#{here}/multipleInheritance.rb"
|
25
|
+
require "#{here}/salvageErrors.rb"
|
26
|
+
require "#{here}/check.rb"
|
27
|
+
require "#{here}/versionSignature.rb"
|
28
|
+
require "#{here}/helper.rb"
|
29
|
+
require "#{here}/shortcut.rb"
|
30
|
+
|
31
|
+
|
@@ -0,0 +1,196 @@
|
|
1
|
+
# Provide auto-implement feature
|
2
|
+
#
|
3
|
+
# If a class implements an interface
|
4
|
+
#
|
5
|
+
|
6
|
+
module Mrdf_Model
|
7
|
+
def umlx_autoImplementProperty!
|
8
|
+
uml_Class_all.each {|c|
|
9
|
+
next unless c.kind_of?(Muml_Class)
|
10
|
+
c.umlx_autoImplementProperty!
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
module Muml_Class
|
15
|
+
rdf_safe_attr_reader_many :umlx_autoImplementComplete
|
16
|
+
def umlx_autoImplementProperty!
|
17
|
+
return if umlx_autoImplementComplete?
|
18
|
+
umlx_autoImplementComplete=RDF_TRUE
|
19
|
+
|
20
|
+
#Recurse begining at top of inheritance
|
21
|
+
uml_generalization.each { |gen|
|
22
|
+
gen.uml_general_one.umlx_autoImplementProperty!
|
23
|
+
}
|
24
|
+
|
25
|
+
#OK my ancesters have been processed
|
26
|
+
#Now if I don't implement an attribute, it is my duty.
|
27
|
+
impAttNames=umlx_ImplementedAttributesNames
|
28
|
+
umlx_ImplementedAttributes.each { |ia|
|
29
|
+
#log.debug { "umlx_autoImplementProperty #{ia} for #{self} #{ia.umlx_isAssociation?}" }
|
30
|
+
next if impAttNames.include?(ia.uml_name.to_s)
|
31
|
+
if(ia.umlx_isAttribute?)
|
32
|
+
att=self.umlx_createAndAddProperty(ia.uml_name.to_s)
|
33
|
+
att.uml_name=ia.uml_name
|
34
|
+
att.uml_type=ia.uml_type
|
35
|
+
else
|
36
|
+
#puts "create and add ..."
|
37
|
+
ms=ia.uml_association_one
|
38
|
+
ms1=ia
|
39
|
+
ms2=ia.umlx_otherEnd;
|
40
|
+
#puts "ms=#{ms}"
|
41
|
+
#puts "ms1=#{ms1} #{ms1.uml_type}"
|
42
|
+
#puts "ms2=#{ms2} #{ms2.uml_type}"
|
43
|
+
m,m1,m2=self.umlx_createAndAddAssociation(self.rdf_uri+ia.uml_name.to_s,ia.uml_type)
|
44
|
+
m1.uml_aggregation=ms1.uml_aggregation
|
45
|
+
m2.uml_aggregation=ms2.uml_aggregation
|
46
|
+
m1.uml_name=ms1.uml_name
|
47
|
+
m2.uml_name=ms2.uml_name
|
48
|
+
|
49
|
+
ms1.umlx_copyToAttributeProperty(m1)
|
50
|
+
ms2.umlx_copyToAttributeProperty(m2)
|
51
|
+
|
52
|
+
#puts "m=#{m}"
|
53
|
+
#puts "m1=#{m1} #{m1.uml_type}"
|
54
|
+
#puts "m2=#{m2} #{m2.uml_type}"
|
55
|
+
end
|
56
|
+
}
|
57
|
+
end
|
58
|
+
def umlx_ImplementedAttributesNames(ret=Set.new())
|
59
|
+
uml_generalization.each { |gen|
|
60
|
+
gen.uml_general_one.umlx_ImplementedAttributesNames(ret)
|
61
|
+
}
|
62
|
+
uml_ownedAttribute.each { |oa|
|
63
|
+
ret << oa.uml_name.to_s
|
64
|
+
}
|
65
|
+
return ret
|
66
|
+
end
|
67
|
+
def umlx_ImplementedAttributes(ret=Set.new())
|
68
|
+
uml_implementation.each { |g|
|
69
|
+
g.uml_supplier_one.umlx_ImplementedAttributes(ret)
|
70
|
+
}
|
71
|
+
return ret
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
module Muml_Interface
|
76
|
+
def umlx_ImplementedAttributes(ret)
|
77
|
+
uml_generalization.each{|gen|
|
78
|
+
gen.uml_general_one.umlx_ImplementedAttributes(ret)
|
79
|
+
}
|
80
|
+
uml_ownedAttribute.each { |oa|
|
81
|
+
ret << oa
|
82
|
+
}
|
83
|
+
return ret
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
#----------------
|
89
|
+
#
|
90
|
+
module Mrdf_Model
|
91
|
+
def umlx_autoImplementOperation!
|
92
|
+
uml_Class_all.each { |c|
|
93
|
+
next unless c.kind_of?(Muml_Class)
|
94
|
+
c.umlx_autoImplementOperation!
|
95
|
+
}
|
96
|
+
end
|
97
|
+
end
|
98
|
+
module Muml_Class
|
99
|
+
rdf_safe_attr_reader_many :umlx_autoImplementCompleteOperation
|
100
|
+
def umlx_autoImplementOperation!
|
101
|
+
return if umlx_autoImplementCompleteOperation?
|
102
|
+
return if uml_isAbstract?
|
103
|
+
umlx_autoImplementCompleteOperation=RDF_TRUE
|
104
|
+
|
105
|
+
#Recurse begining at top of inheritance
|
106
|
+
uml_generalization.each { |gen|
|
107
|
+
gen.uml_general_one.umlx_autoImplementOperation!
|
108
|
+
}
|
109
|
+
|
110
|
+
#OK my ancesters have been processed
|
111
|
+
#Now if I don't implement an operation, it is my duty.
|
112
|
+
impOper=umlx_ImplementedOperations
|
113
|
+
umlx_operationIShouldImplement.each { |sig,ia|
|
114
|
+
next if impOper.keys.include?(ia.umlx_signature)
|
115
|
+
|
116
|
+
c=umlx_createAndAddOperation(ia.rdf_uri+"_implem",ia.uml_name);
|
117
|
+
(ia.uml_ownedParameter+ia.uml_returnResult).each { |p|
|
118
|
+
cp=c.umlx_createAndAddParameter(p.rdf_uri+"_implem",p.uml_name_one)
|
119
|
+
p.umlx_copyToAttributeProperty(cp)
|
120
|
+
cp.uml_direction=p.uml_direction
|
121
|
+
}
|
122
|
+
# the new method is considered business Method if the original method is one
|
123
|
+
#NOTE: umlx_businessMethod? changed to umlx_businessMethod
|
124
|
+
c.umlx_businessMethod=ia.umlx_businessMethod
|
125
|
+
c.umlx_redefinesMethod=ia
|
126
|
+
}
|
127
|
+
end
|
128
|
+
|
129
|
+
def umlx_ImplementedOperations(ret=Hash.new())
|
130
|
+
uml_generalization.each { |gen|
|
131
|
+
gen.uml_general_one.umlx_ImplementedOperations(ret)
|
132
|
+
}
|
133
|
+
uml_ownedOperation.each { |oa|
|
134
|
+
next if oa.uml_isAbstract?
|
135
|
+
ret[oa.umlx_signature]=oa
|
136
|
+
}
|
137
|
+
return ret
|
138
|
+
end
|
139
|
+
|
140
|
+
def umlx_operationIShouldImplement(ret=Hash.new())
|
141
|
+
|
142
|
+
#SR16252
|
143
|
+
umlx_classifier_generalization_indirect.each { |i|
|
144
|
+
i.uml_ownedOperation.each { |oo|
|
145
|
+
next unless oo.uml_isAbstract?
|
146
|
+
ret[oo.umlx_signature]=oo
|
147
|
+
}
|
148
|
+
}
|
149
|
+
uml_implementation.each { |g|
|
150
|
+
g.uml_supplier_one.uml_ownedOperation.each { |oo|
|
151
|
+
ret[oo.umlx_signature]=oo
|
152
|
+
}
|
153
|
+
#interface implemented via an interface inheritance
|
154
|
+
g.uml_supplier_one.umlx_classifier_generalization_indirect.each { |i|
|
155
|
+
i.uml_ownedOperation.each { |oo|
|
156
|
+
ret[oo.umlx_signature]=oo
|
157
|
+
}}
|
158
|
+
}
|
159
|
+
return ret
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
module Muml_Interface
|
164
|
+
def umlx_ImplementedOperation(ret=Hash.new())
|
165
|
+
return ret
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
module Muml_Operation
|
170
|
+
#operation this operation redefines.
|
171
|
+
rdf_safe_attr_reader_many :umlx_redefinesMethod
|
172
|
+
|
173
|
+
def umlx_signature
|
174
|
+
#todo: take parameter into account
|
175
|
+
r="#{uml_name}("
|
176
|
+
sep=""
|
177
|
+
uml_ownedParameter.each { |p|
|
178
|
+
next if Cuml_ParameterDirectionKind::Return==p.uml_direction_one
|
179
|
+
r="#{r}#{sep}#{p.umlx_signature}"
|
180
|
+
sep=","
|
181
|
+
}
|
182
|
+
r="#{r})"
|
183
|
+
return r
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
module Muml_Parameter
|
188
|
+
# Returns parameter signature
|
189
|
+
# Examples: String[], int, ...
|
190
|
+
def umlx_signature
|
191
|
+
return self.uml_type
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
|
196
|
+
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# Provides helpers to help map a UML model to a Relationnal database.
|
2
|
+
module ::Muml_Parameter
|
3
|
+
# Is this property such an extremity of an SQL mapping ?
|
4
|
+
# (lowerValue<=1 && upperValue==1)
|
5
|
+
def umlx_oneSide?
|
6
|
+
#assoc = uml_association_one0
|
7
|
+
#return false if assoc.nil?
|
8
|
+
lowerValue = self.uml_lowerValue_one0
|
9
|
+
if !lowerValue.nil?
|
10
|
+
return false if lowerValue.umlx_to_i>1
|
11
|
+
end
|
12
|
+
upperValue = self.uml_upperValue_one0
|
13
|
+
if !upperValue.nil?
|
14
|
+
return false if upperValue.umlx_to_i!=1
|
15
|
+
end
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
module ::Muml_Property
|
20
|
+
|
21
|
+
# Should this SQL mapping used for this association ?
|
22
|
+
def umlx_oneToOne?
|
23
|
+
return false if uml_association_one0.nil?
|
24
|
+
return false if !umlx_oneSide?
|
25
|
+
otherEnd = umlx_otherEnd
|
26
|
+
return false if otherEnd.nil?
|
27
|
+
return otherEnd.umlx_oneSide?
|
28
|
+
end
|
29
|
+
|
30
|
+
# Is this property such an extremity of an SQL mapping ?
|
31
|
+
# (lowerValue==1 && upperValue==1)
|
32
|
+
def umlx_exactlyOneSide?
|
33
|
+
assoc = uml_association_one0
|
34
|
+
return false if assoc.nil?
|
35
|
+
lowerValue = self.uml_lowerValue_one0
|
36
|
+
return false if lowerValue.nil?
|
37
|
+
return false if lowerValue.umlx_to_i != 1
|
38
|
+
upperValue = self.uml_upperValue_one0
|
39
|
+
if !upperValue.nil?
|
40
|
+
return false if upperValue.umlx_to_i!=1
|
41
|
+
end
|
42
|
+
return true
|
43
|
+
end
|
44
|
+
|
45
|
+
# Is this property such an extremity of an SQL mapping ?
|
46
|
+
# (lowerValue<=1 && upperValue==1)
|
47
|
+
def umlx_oneSide?
|
48
|
+
#assoc = uml_association_one
|
49
|
+
#return false if assoc.nil?
|
50
|
+
lowerValue = self.uml_lowerValue_one0
|
51
|
+
if !lowerValue.nil?
|
52
|
+
return false if lowerValue.umlx_to_i>1
|
53
|
+
end
|
54
|
+
upperValue = self.uml_upperValue_one0
|
55
|
+
if !upperValue.nil?
|
56
|
+
return false if upperValue.umlx_to_i!=1
|
57
|
+
end
|
58
|
+
return true
|
59
|
+
end
|
60
|
+
|
61
|
+
# Should this SQL mapping used for this association ?
|
62
|
+
def umlx_manyToMany?
|
63
|
+
assoc = uml_association_one0
|
64
|
+
return false if assoc.nil?
|
65
|
+
return false if !umlx_manySide?
|
66
|
+
otherEnd = umlx_otherEnd
|
67
|
+
return false if otherEnd.nil?
|
68
|
+
return otherEnd.umlx_manySide?
|
69
|
+
end
|
70
|
+
|
71
|
+
# Should this SQL mapping used for this association ?
|
72
|
+
def umlx_oneToMany?
|
73
|
+
assoc = uml_association_one0
|
74
|
+
return false if assoc.nil?
|
75
|
+
return false if !umlx_manySide?
|
76
|
+
otherEnd = umlx_otherEnd
|
77
|
+
return false if otherEnd.nil?
|
78
|
+
return otherEnd.umlx_oneSide?
|
79
|
+
end
|
80
|
+
|
81
|
+
# Should this SQL mapping used for this association ?
|
82
|
+
def umlx_manyToOne?
|
83
|
+
assoc = uml_association_one0
|
84
|
+
return false if assoc.nil?
|
85
|
+
otherEnd = umlx_otherEnd
|
86
|
+
return false if otherEnd.nil?
|
87
|
+
return otherEnd.umlx_oneToMany?
|
88
|
+
end
|
89
|
+
|
90
|
+
# Is this property such an extremity of an SQL mapping ?
|
91
|
+
def umlx_manySide?
|
92
|
+
#assoc = uml_association_one0
|
93
|
+
#return false if assoc.nil?
|
94
|
+
lowerValue = uml_lowerValue_one0
|
95
|
+
if !lowerValue.nil?
|
96
|
+
return true if lowerValue.umlx_to_i>1 || lowerValue.umlx_to_i==-1
|
97
|
+
end
|
98
|
+
upperValue = uml_upperValue_one0
|
99
|
+
if !upperValue.nil?
|
100
|
+
return true if upperValue.umlx_to_i>1 || upperValue.umlx_to_i==-1
|
101
|
+
end
|
102
|
+
return false
|
103
|
+
end
|
104
|
+
def umlx_unidirectionnel?
|
105
|
+
return umlx_otherEnd.nil?
|
106
|
+
#assoc = uml_association_one0
|
107
|
+
#return false if assoc.nil?
|
108
|
+
#return !assoc.uml_ownedEnd.empty?
|
109
|
+
end
|
110
|
+
|
111
|
+
# Is this property such an extremity of an SQL mapping ?
|
112
|
+
def umlx_masterEnd?
|
113
|
+
assoc = uml_association_one0
|
114
|
+
#return false if assoc.nil?
|
115
|
+
#return false if assoc.uml_memberEnd.empty? || assoc.uml_memberEnd.size==1
|
116
|
+
#return self==assoc.uml_memberEnd.first
|
117
|
+
oe=umlx_otherEnd
|
118
|
+
return true if oe.nil?
|
119
|
+
return true if umlx_isNavigable? && !oe.umlx_isNavigable?
|
120
|
+
return false if (!umlx_isNavigable?) && oe.umlx_isNavigable?
|
121
|
+
|
122
|
+
|
123
|
+
#Bidirectionnal association.
|
124
|
+
#First member is arbitrarily chosen as master.
|
125
|
+
return self==assoc.uml_memberEnd.first
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
|
130
|
+
|