Module: Muml_Operation
- Defined in:
- lib/ontomde-uml2/uml2.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/owner.rb,
lib/ontomde-uml2/nocode.rb,
lib/ontomde-uml2/depencies.rb,
lib/ontomde-uml2/kb/protege.rb,
lib/ontomde-uml2/createAndAdd.rb,
lib/ontomde-uml2/autoImplement.rb
Instance Method Summary collapse
- #kb_writeComponentOperation ⇒ Object
- #umlx_addDependencies(s = Set.new) ⇒ Object
-
#umlx_class_one ⇒ Object
uml_ownedAttribute_inv_one is sometime broken (RSM does not consistently populate this field) umlx_class_one figures out the correct value of uml_ownedAttribute_inv_one.
-
#umlx_computeDirectDepencies(ret = Set.new) ⇒ Object
returns every class this elements depends on.
- #umlx_createAndAddParameter(new_uri, new_name = nil) ⇒ Object
-
#umlx_createAndAddReturnParameter(new_uri, new_name = "return") ⇒ Object
Create and add a return parameter.
-
#umlx_isConstructor? ⇒ Boolean
Returns true if operation is a constructor NOTE: RSM stereotype is “Create”, MagicDraw “create”.
-
#umlx_owner_one ⇒ Object
returns element owner if found, nil otherwise.
-
#umlx_returnResult_one0 ⇒ Object
retrieve operation return parameter if any (nil otherwise).
- #umlx_signature ⇒ Object
Instance Method Details
#kb_writeComponentOperation ⇒ Object
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 723 def kb_writeComponentOperation u="#{rdf_uri}_soaOp" write <<END <#{u}> <#{NS_RDF_2000}rdf-schema#label> "" . <#{u}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{Mrdf_Repository::SERVICE_URI}> . <#{u}> <#{NS_RDF_2000}rdf-schema#comment> "Definition for service #{uml_name}" . <#{u}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> . END (uml_ownedParameter+uml_returnResult).each { |p| up="#{p.rdf_uri}-soaMapping" write <<END <#{up}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> . <#{up}> <http://protege.stanford.edu/system#maxCardinality> "1" . <#{up}> <#{NS_RDF_2000}rdf-schema#label> "param#{p}" . <#{up}> <#{NS_RDF_2000}rdf-schema#domain> <#{u}> . <#{up}> <#{NS_RDF_2000}rdf-schema#range> <#{Mrdf_Repository::DATAFILTER_URI}> . <#{up}> <#{NS_RDF_2000}rdf-schema#comment> "service" . END } end |
#umlx_addDependencies(s = Set.new) ⇒ Object
31 32 |
# File 'lib/ontomde-uml2/nocode.rb', line 31 def umlx_addDependencies(s=Set.new) end |
#umlx_class_one ⇒ Object
uml_ownedAttribute_inv_one is sometime broken (RSM does not consistently populate this field) umlx_class_one figures out the correct value of uml_ownedAttribute_inv_one
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
# File 'lib/ontomde-uml2/umlx.rb', line 559 def umlx_class_one return uml_ownedOperation_inv_one ## ## ret=uml_class_one ## #ret=uml_ownedAttribute_inv_one0 ## return ret unless ret.nil? ## ## #use ext_isReferencedBy ## ext_isReferencedBy.each { |o| ## next unless o.respond_to?(:uml_ownedOperation) ## o.uml_ownedOperation.each { |c| ## return o if c==self ## } ## } ## log.error("umlx_class_one not found in model for #{self}:#{self.class}") ## return nil end |
#umlx_computeDirectDepencies(ret = Set.new) ⇒ Object
returns every class this elements depends on
16 17 18 19 20 21 |
# File 'lib/ontomde-uml2/depencies.rb', line 16 def umlx_computeDirectDepencies(ret=Set.new) (uml_returnResult+uml_ownedParameter).each { |a| a.umlx_computeDirectDepencies(ret) } return ret end |
#umlx_createAndAddParameter(new_uri, new_name = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/ontomde-uml2/createAndAdd.rb', line 6 def umlx_createAndAddParameter(new_uri,new_name=nil) p=Cuml_Parameter.new(rdf_Repository,new_uri) uml_ownedParameter_add(p) p.uml_name=new_name unless new_name.nil? p.uml_isUnique=RDF_TRUE p.uml_isOrdered=RDF_FALSE p.uml_direction=Cuml_ParameterDirectionKind::In return p end |
#umlx_createAndAddReturnParameter(new_uri, new_name = "return") ⇒ Object
Create and add a return parameter.
18 19 20 21 22 23 24 25 26 |
# File 'lib/ontomde-uml2/createAndAdd.rb', line 18 def umlx_createAndAddReturnParameter(new_uri,new_name="return") p=Cuml_Parameter.new(rdf_Repository,new_uri) uml_ownedParameter_add(p) p.uml_name=new_name p.uml_isUnique=RDF_TRUE p.uml_isOrdered=RDF_FALSE p.uml_direction=Cuml_ParameterDirectionKind::Return return p end |
#umlx_isConstructor? ⇒ Boolean
Returns true if operation is a constructor NOTE: RSM stereotype is “Create”, MagicDraw “create”
608 609 610 |
# File 'lib/ontomde-uml2/umlx.rb', line 608 def umlx_isConstructor? return umlx_hasStereotype?("Create") end |
#umlx_owner_one ⇒ Object
returns element owner if found, nil otherwise
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ontomde-uml2/owner.rb', line 46 def umlx_owner_one ext_isReferencedBy.each { |res| next unless res.kind_of?(Muml_Classifier) next if res.kind_of?(Muml_Association) next unless res.uml_ownedOperation.include?(self) return res } log.error("umlx_owner_one not found for #{self.class} #{self}") return nil end |
#umlx_returnResult_one0 ⇒ Object
retrieve operation return parameter if any (nil otherwise)
294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/ontomde-uml2/uml2.rb', line 294 def umlx_returnResult_one0 fp=nil uml_returnResult.each { |p| #pour RSM (non conformite de l'export) next unless p.uml_direction_one.isReturn? fp=p } uml_ownedParameter.each { |p| next unless p.uml_direction_one.isReturn? fp=p } return fp end |
#umlx_signature ⇒ Object
204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/ontomde-uml2/autoImplement.rb', line 204 def umlx_signature #todo: take parameter into account r="#{uml_name}(" sep="" uml_ownedParameter.each { |p| next if Cuml_ParameterDirectionKind::Return==p.uml_direction_one r="#{r}#{sep}#{p.umlx_signature}" sep="," } r="#{r})" return r end |