Module: Muml_Parameter
- Defined in:
- lib/ontomde-uml2/cardinality.rb,
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/kb/protege.rb,
lib/ontomde-uml2/autoImplement.rb
Overview
Provides helpers to help map a UML model to a Relationnal database.
Instance Method Summary collapse
- #prot_writeNTriple_parameter(owner) ⇒ Object
-
#umlx_copyToAttributeProperty(oa) ⇒ Object
copy elements to the attribute property in Muml_Classifier module.
-
#umlx_oneSide? ⇒ Boolean
Is this property such an extremity of an SQL mapping ? (lowerValue<=1 && upperValue==1).
-
#umlx_signature ⇒ Object
Returns parameter signature Examples: String[], int, …
Instance Method Details
#prot_writeNTriple_parameter(owner) ⇒ Object
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/ontomde-uml2/kb/protege.rb', line 262 def prot_writeNTriple_parameter(owner) o=self # e=owner # write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#domain> <#{e.prot_uri}> .\n"); # append_comment # o.uml_type.each { |t| # if (t.kind_of?(Cuml_PrimitiveType)) # write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{t.prot_uri}> .\n") # write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#range> "#{t.prot_primitive_type}" .\n}) # elsif t.kind_of?(Cuml_Enumeration) # write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .\n") # write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#range> "symbol" .\n}) # t.uml_ownedLiteral.each {|c| # write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#allowedValues> "#{c}" .\n}) # } # else # write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{t.prot_uri}> .\n") # end # } write("<#{o.prot_uri}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_SLOT> .\n") write("<#{o.prot_uri}> <http://protege.stanford.edu/kb#UML_LABEL> \"#{o.prot_label} (#{owner.prot_label} from #{owner.umlx_owner_one.prot_label})\".\n") write("<#{o.prot_uri}> <#{NS_UML_CLASS}#UML_URI> \"#{UriNamespace.instance.unalias(o.rdf_uri)}\" .\n") write("<#{o.prot_uri}> <#{RDF_LABEL_URI}> \"#{o.uml_name.to_s.nt_escape}\" .\n") cardUp=umlx_upperValueIsOne? ? "1" : "*" cardLow=umlx_lowerValueIsZero? ? "0" : "1" # if ! uml_qualifier.empty? # #qualifiers changes cardinality semantics # cardLow="0" # cardUp="*" # end #if isComposition # log.debug "est une composition" # cardLow="1" #end if cardLow!="0" write("<#{o.prot_uri}> <http://protege.stanford.edu/system#minCardinality> \"#{cardLow}\" .\n") end if cardUp!="-1" write("<#{o.prot_uri}> <http://protege.stanford.edu/system#maxCardinality> \"#{cardUp}\" .\n") end end |
#umlx_copyToAttributeProperty(oa) ⇒ Object
copy elements to the attribute property in Muml_Classifier module
82 83 84 85 86 87 88 |
# File 'lib/ontomde-uml2/umlx.rb', line 82 def umlx_copyToAttributeProperty(oa) oa.uml_upperValue=self.uml_upperValue oa.uml_lowerValue=self.uml_lowerValue oa.uml_type=self.uml_type oa.uml_isOrdered=self.uml_isOrdered oa.uml_isUnique=self.uml_isUnique end |
#umlx_oneSide? ⇒ Boolean
Is this property such an extremity of an SQL mapping ? (lowerValue<=1 && upperValue==1)
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ontomde-uml2/cardinality.rb', line 5 def umlx_oneSide? #assoc = uml_association_one0 #return false if assoc.nil? lowerValue = self.uml_lowerValue_one0 if !lowerValue.nil? return false if lowerValue.umlx_to_i>1 end upperValue = self.uml_upperValue_one0 if !upperValue.nil? return false if upperValue.umlx_to_i!=1 end return true end |
#umlx_signature ⇒ Object
Returns parameter signature Examples: String[], int, …
221 222 223 |
# File 'lib/ontomde-uml2/autoImplement.rb', line 221 def umlx_signature return self.uml_type end |