Module: Muml_Package
- Defined in:
- lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/owner.rb,
lib/ontomde-uml2/nocode.rb,
lib/ontomde-uml2/select.rb,
lib/ontomde-uml2/kb/protege.rb,
lib/ontomde-uml2/createAndAdd.rb
Instance Method Summary collapse
- #mainSubClassOfURI ⇒ Object
- #prot_writePackage ⇒ Object
-
#prot_writeSubClassOf ⇒ Object
writes sub class of rdf instructions.
-
#uml_Class_all(ret = Array.new) ⇒ Object
search and returns evry uml class contained in the current package.
-
#uml_Component_all(ret = Array.new) ⇒ Object
search and returns evry uml Component contained in the current package.
-
#uml_Enumeration_all(ret = Array.new) ⇒ Object
search and returns evry uml Enumeration contained in the current package.
-
#uml_UseCase_all(ret = Array.new) ⇒ Object
search and returns evry uml class contained in the current package.
- #umlx_addDependencies(s = Set.new) ⇒ Object
-
#umlx_createAndAddClass(new_uri, new_name = nil) ⇒ Object
Creates and add a new UML Class.
-
#umlx_createAndAddComponent(new_uri, new_name = nil) ⇒ Object
Creates and add a new UML Class.
-
#umlx_createAndAddDataType(new_uri, new_name = nil) ⇒ Object
Creates and add a new UML DataType.
-
#umlx_createAndAddEnumeration(new_uri, new_name = nil) ⇒ Object
Creates and add a new UML Enumeration.
-
#umlx_createAndAddInterface(new_uri, new_name = nil) ⇒ Object
Creates and add a new UML Interface.
-
#umlx_createAndAddPackage(new_uri, new_name = nil) ⇒ Object
Creates and add a new UML package.
-
#umlx_createAndAddStereotype(new_uri, new_name = nil) ⇒ Object
Creates and add a new UML Stereotype.
-
#umlx_getElementNamed(name) ⇒ Object
returns nil or element with the proper name in the current namespace.
-
#umlx_model ⇒ Object
Returns UML Model containing self.
- #umlx_owner=(p) ⇒ Object
- #umlx_owner_one ⇒ Object
Instance Method Details
#mainSubClassOfURI ⇒ Object
117 118 119 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 117 def mainSubClassOfURI return "#{NS_UML_CLASS}#UML_PACKAGE" end |
#prot_writePackage ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 105 def prot_writePackage e=self write("<#{e.prot_uri}> <#{RDF_TYPE_URI}> <#{RDF_METACLASS_URI}> .\n") write("<#{e.prot_uri}> <#{NS_RDF_2000}rdf-schema#label> \"[#{e.uml_name.to_s.nt_escape}]\" .\n") write("<#{e.prot_uri}> <http://protege.stanford.edu/system#role> \"abstract\" .\n") e.append_comment e.prot_writeSubClassOf write("<#{e.prot_uri}> <#{NS_UML_CLASS}#UML_LABEL> \"[#{prot_label}]\" .\n") write("<#{e.prot_uri}> <#{NS_UML_CLASS}#UML_URI> \"#{UriNamespace.instance.unalias(e.rdf_uri)}\" .\n") end |
#prot_writeSubClassOf ⇒ Object
writes sub class of rdf instructions
123 124 125 126 127 128 129 130 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 123 def prot_writeSubClassOf t=umlx_owner_one if t.nil? || t.prot_ignorePackage? write("<#{prot_uri}> <#{RDF_SUBCLASSOF_URI}> <#{mainSubClassOfURI}> .\n") else write("<#{prot_uri}> <#{RDF_SUBCLASSOF_URI}> <#{t.prot_uri}> .\n") end end |
#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_addDependencies(s = Set.new) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ontomde-uml2/nocode.rb', line 22 def umlx_addDependencies(s=Set.new) return if s.include?(self) s.add(self) uml_ownedMember.each { |v| v.umlx_addDependencies(s) } 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.
127 128 129 130 131 132 133 134 135 |
# File 'lib/ontomde-uml2/createAndAdd.rb', line 127 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.
139 140 141 142 143 144 145 146 147 |
# File 'lib/ontomde-uml2/createAndAdd.rb', line 139 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.
151 152 153 154 155 156 157 158 |
# File 'lib/ontomde-uml2/createAndAdd.rb', line 151 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.
103 104 105 106 107 108 109 110 111 |
# File 'lib/ontomde-uml2/createAndAdd.rb', line 103 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.
115 116 117 118 119 120 121 122 123 |
# File 'lib/ontomde-uml2/createAndAdd.rb', line 115 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.
174 175 176 177 178 179 180 181 |
# File 'lib/ontomde-uml2/createAndAdd.rb', line 174 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.
163 164 165 166 167 168 169 |
# File 'lib/ontomde-uml2/createAndAdd.rb', line 163 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
250 251 252 253 254 255 |
# File 'lib/ontomde-uml2/umlx.rb', line 250 def umlx_getElementNamed(name) uml_ownedMember.each { |om| return om if om.uml_name.to_s==name } return super(name) end |
#umlx_model ⇒ Object
Returns UML Model containing self.
312 313 314 315 316 |
# File 'lib/ontomde-uml2/umlx.rb', line 312 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_one ⇒ Object
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 |