Module: Muml_Package

Defined in:
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/owner.rb,
lib/ontomde-uml2/select.rb,
lib/ontomde-uml2/createAndAdd.rb

Instance Method Summary collapse

Instance Method Details

#uml_Class_all(ret = Array.new) ⇒ Object

search and returns evry uml class contained in the current package. NOTE: inner classes are not included



103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/ontomde-uml2/select.rb', line 103

def uml_Class_all(ret=Array.new)
  uml_ownedMember.each { |n|
    if n.kind_of?(Muml_Enumeration)||n.kind_of?(Muml_Interface) || (n.kind_of?(Muml_Class) && n.umlx_isReallyAClass?)
      ret << n
    elsif n.kind_of?(Muml_Package)  && !n.kind_of?(Muml_Profile)
      n.uml_Class_all(ret)
    else
      #log.debug { "ignored #{n}" }
    end
  }
  return ret
end

#uml_Component_all(ret = Array.new) ⇒ Object

search and returns evry uml Component contained in the current package.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/ontomde-uml2/select.rb', line 149

def uml_Component_all(ret=Array.new)
  uml_ownedMember.each { |n|
    if n.kind_of?(Muml_Component)
      ret << n
      next
    end
    if n.kind_of?(Muml_Package)  && !n.kind_of?(Muml_Profile)
      n.uml_Component_all(ret)
      next
    end
    #log.debug { "ignored #{n}" }
  }
  return ret
end

#uml_Enumeration_all(ret = Array.new) ⇒ Object

search and returns evry uml Enumeration contained in the current package.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/ontomde-uml2/select.rb', line 133

def uml_Enumeration_all(ret=Array.new)
  uml_ownedMember.each { |n|
    if n.kind_of?(Muml_Enumeration)
      ret << n
      next
    end
    if n.kind_of?(Muml_Package)  && !n.kind_of?(Muml_Profile)
      n.uml_Enumeration_all(ret)
      next
    end
    #log.debug { "ignored #{n}" }
  }
  return ret
end

#uml_UseCase_all(ret = Array.new) ⇒ Object

search and returns evry uml class contained in the current package. NOTE: inner classes are not included



117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/ontomde-uml2/select.rb', line 117

def uml_UseCase_all(ret=Array.new)
  uml_ownedMember.each { |n|
    if n.kind_of?(Muml_UseCase)
      ret << n
      next
    end
    if n.kind_of?(Muml_Package)  && !n.kind_of?(Muml_Profile)
      n.uml_UseCase_all(ret)
      next
    end
    #log.debug { "ignored #{n}" }
  }
  return ret
end

#umlx_createAndAddClass(new_uri, new_name = nil) ⇒ Object

Creates and add a new UML Class. Return the newly created element. new_uri should be globaly unique.



112
113
114
115
116
117
118
119
120
# File 'lib/ontomde-uml2/createAndAdd.rb', line 112

def umlx_createAndAddClass(new_uri,new_name=nil)
  c=Cuml_Class.new(rdf_Repository,new_uri)
  uml_ownedMember_add(c)
  c.umlx_owner=self
  c.uml_name=new_name unless new_name.nil?
  c.uml_visibility=::Cuml_VisibilityKind::Public
  #puts "création classe #{new_name} in #{self.java_qualifiedName}"
  return c
end

#umlx_createAndAddComponent(new_uri, new_name = nil) ⇒ Object

Creates and add a new UML Class. Return the newly created element. new_uri should be globaly unique.



124
125
126
127
128
129
130
131
132
# File 'lib/ontomde-uml2/createAndAdd.rb', line 124

def umlx_createAndAddComponent(new_uri,new_name=nil)
  c=Cuml_Component.new(rdf_Repository,new_uri)
  uml_ownedMember_add(c)
  c.umlx_owner=self
  c.uml_name=new_name unless new_name.nil?
  c.uml_visibility=::Cuml_VisibilityKind::Public
  #puts "création classe #{new_name} in #{self.java_qualifiedName}"
  return c
end

#umlx_createAndAddDataType(new_uri, new_name = nil) ⇒ Object

Creates and add a new UML DataType. Return the newly created element. new_uri should be globaly unique.



136
137
138
139
140
141
142
143
# File 'lib/ontomde-uml2/createAndAdd.rb', line 136

def umlx_createAndAddDataType(new_uri,new_name=nil)
  c=Cuml_DataType.new(rdf_Repository,new_uri)
  uml_ownedMember_add(c)
  c.umlx_owner=self
  c.uml_name=new_name unless new_name.nil?
  #puts "création classe #{new_name} in #{self.java_qualifiedName}"
  return c
end

#umlx_createAndAddEnumeration(new_uri, new_name = nil) ⇒ Object

Creates and add a new UML Enumeration. Return the newly created element. new_uri should be globaly unique.



88
89
90
91
92
93
94
95
96
# File 'lib/ontomde-uml2/createAndAdd.rb', line 88

def umlx_createAndAddEnumeration(new_uri,new_name=nil)
  c=Cuml_Enumeration.new(rdf_Repository,new_uri)
  uml_ownedMember_add(c)
  c.umlx_owner=self
  c.uml_name=new_name unless new_name.nil?
  c.uml_visibility=::Cuml_VisibilityKind::Public
  #puts "création classe #{new_name} in #{self.java_qualifiedName}"
  return c
end

#umlx_createAndAddInterface(new_uri, new_name = nil) ⇒ Object

Creates and add a new UML Interface. Return the newly created element. new_uri should be globaly unique.



100
101
102
103
104
105
106
107
108
# File 'lib/ontomde-uml2/createAndAdd.rb', line 100

def umlx_createAndAddInterface(new_uri,new_name=nil)
  c=Cuml_Interface.new(rdf_Repository,new_uri)
  uml_ownedMember_add(c)
  c.umlx_owner=self
  c.uml_name=new_name unless new_name.nil?
  c.uml_visibility=::Cuml_VisibilityKind::Public
  #puts "création classe #{new_name} in #{self.java_qualifiedName}"
  return c
end

#umlx_createAndAddPackage(new_uri, new_name = nil) ⇒ Object

Creates and add a new UML package. Return the newly created element. new_uri should be globaly unique.



159
160
161
162
163
164
165
166
# File 'lib/ontomde-uml2/createAndAdd.rb', line 159

def umlx_createAndAddPackage(new_uri,new_name=nil)
  c=Cuml_Package.new(rdf_Repository,new_uri)
  uml_ownedMember_add(c)
  c.umlx_owner=self
  c.uml_name=new_name unless new_name.nil?
  #puts "creation package #{new_name} dans #{self} (#{self.class.name})"
  return c
end

#umlx_createAndAddStereotype(new_uri, new_name = nil) ⇒ Object

Creates and add a new UML Stereotype. Return the newly created element. new_uri should be globaly unique.



148
149
150
151
152
153
154
# File 'lib/ontomde-uml2/createAndAdd.rb', line 148

def umlx_createAndAddStereotype(new_uri,new_name=nil)
  c=Cuml_Stereotype.new(rdf_Repository,new_uri)
  uml_ownedMember_add(c)
  c.umlx_owner=self
  c.uml_name=new_name unless new_name.nil?
  return c
end

#umlx_getElementNamed(name) ⇒ Object

returns nil or element with the proper name in the current namespace



247
248
249
250
251
252
# File 'lib/ontomde-uml2/umlx.rb', line 247

def umlx_getElementNamed(name)
  uml_ownedMember.each { |om|
    return om if om.uml_name.to_s==name
  }
  return super(name)
end

#umlx_modelObject

Returns UML Model containing self.



309
310
311
312
313
# File 'lib/ontomde-uml2/umlx.rb', line 309

def umlx_model
  p=umlx_owner_one
  return p.umlx_model unless p.nil?
  return self
end

#umlx_owner=(p) ⇒ Object



10
11
12
13
14
15
# File 'lib/ontomde-uml2/owner.rb', line 10

def umlx_owner=(p)
  old=umlx_owner_one
  old.uml_ownedMember.delete(self) unless old.nil?
  p.uml_ownedMember_add(self)
  ext_isReferencedBy_add(p)
end

#umlx_owner_oneObject



3
4
5
6
7
8
9
# File 'lib/ontomde-uml2/owner.rb', line 3

def umlx_owner_one
  #return uml_ownedMember_inv_one0
  ext_isReferencedBy.each { |res|
    return res if res.respond_to?(:uml_ownedMember) && res.uml_ownedMember.include?(self)
  }
  return nil
end