Module: Muml_TypedElement

Defined in:
lib/ontomde-uml2/umlx.rb,
lib/ontomde-uml2/depencies.rb,
lib/ontomde-uml2/kb/protege.rb

Constant Summary collapse

RDF_METACLASS_URI =

Metaclass URI used for a property in Protege

"http://protege.stanford.edu/kb#UML_SLOT"

Instance Method Summary collapse

Instance Method Details

#cardWithSameName(str) ⇒ Object

check model for homonym properties



234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/ontomde-uml2/kb/protege.rb', line 234

def cardWithSameName(str)
  @@otherWithSameName_cache||=nil
  return 	@@otherWithSameName_cache[str] if @@otherWithSameName_cache
  @@otherWithSameName_cache=Hash.new(0)

  rdf_Repository.uml_Class_all.each {|c| c.uml_ownedAttribute.each {|e|
      str2=e.uml_name.to_s
      @@otherWithSameName_cache[str2]+=1
    }}
  @@otherWithSameName_cache.each { |k,v|
    log.warn "WARNING: UML Model contains homonyms property : #{k} (#{v} times)" if v>1 && !k.include?("$")
  }
  return 	@@otherWithSameName_cache[str]
end

#otherWithSameName?Boolean

returns true if an homonym property exists in model

Returns:

  • (Boolean)


226
227
228
229
230
231
# File 'lib/ontomde-uml2/kb/protege.rb', line 226

def otherWithSameName?
  n= cardWithSameName(uml_name.to_s)
  return false if n==1
  return true if n>1
  log.error "Error: #{n} #{uml_name.to_s}"
end

#prot_labelObject

returns protege label for this property



250
251
252
253
254
255
# File 'lib/ontomde-uml2/kb/protege.rb', line 250

def prot_label
  return "#{prot_safe(uml_name)}" unless uml_name.to_s.empty?
  oe=umlx_otherEnd
  return "inv_#{prot_safe(oe.uml_name)}" unless oe.uml_name.to_s.empty?
  return "#{prot_safe(uri)}"
end

#umlx_computeDirectDepencies(ret = Set.new) ⇒ Object

returns every class this elements depends on



26
27
28
29
# File 'lib/ontomde-uml2/depencies.rb', line 26

def umlx_computeDirectDepencies(ret=Set.new)
  ret.add(uml_type_one)
  return ret
end

#umlx_lowerValueIsOne?Boolean

Returns true if lowerValue is equal to one NOTE:

  • returns true if lowerValue is undefined or empty

Returns:

  • (Boolean)


174
175
176
177
178
# File 'lib/ontomde-uml2/umlx.rb', line 174

def umlx_lowerValueIsOne?
  return true if uml_lowerValue.empty? # 1 is assumed to be defaut
  return uml_lowerValue_one.umlx_equalOne?
  #return (uml_lowerValue.empty? || uml_lowerValue.to_s=="1")
end

#umlx_lowerValueIsZero?Boolean

returns true if lowerValue is equal to zero NOTE:

  • returns true if lowerValue is undefined or empty

Returns:

  • (Boolean)


183
184
185
186
187
# File 'lib/ontomde-uml2/umlx.rb', line 183

def umlx_lowerValueIsZero?
  return true if uml_lowerValue.empty? # 0 is assumed to be defaut
  return uml_lowerValue_one.umlx_equalZero?
  #return (uml_lowerValue.empty? || uml_lowerValue.to_s=="0")
end

#umlx_upperValueIsOne?Boolean

Returns true if upperValue is equal to one NOTE:

  • returns true if upperValue is undefined or empty

Returns:

  • (Boolean)


165
166
167
168
169
# File 'lib/ontomde-uml2/umlx.rb', line 165

def umlx_upperValueIsOne?
  return true if uml_upperValue.empty? # 1 is assumed to be defaut
  return uml_upperValue_one.umlx_equalOne?
  #return (uml_upperValue.empty? || uml_upperValue.to_s=="1")
end