Module: Muml_Classifier

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

Constant Summary collapse

ProtegeURI =
Hash.new
RDF_METACLASS_URI =

RDF metaclass for a classifier

"#{NS_UML_CLASS}#UML_METACLASS"

Instance Method Summary collapse

Instance Method Details

#mainSubClassOfURIObject



233
234
235
# File 'lib/ontomde-uml2-kb/protege.rb', line 233

def mainSubClassOfURI
  return  "#{NS_UML_CLASS}#UML_CLASS"
end

#prot_labelObject

label used in protege 2000



99
100
101
# File 'lib/ontomde-uml2-kb/protege.rb', line 99

def prot_label
  return "#{prot_uri_local}"
end

#prot_uri_localObject



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

def prot_uri_local
  b="#{prot_safe(uml_name)}"
  s=b
  i=1
  while true
    if ProtegeURI[s].nil?
      ProtegeURI[s]=self
      return s
    end
    return s if ProtegeURI[s]==self
    i=i+1
    s=b+"_"+i.to_s
  end
end

#prot_writeNTripleObject

writes RDF triple elements describing this classifier element.



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/ontomde-uml2-kb/protege.rb', line 238

def prot_writeNTriple
  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")
  if e.uml_isAbstract?  || e.kind_of?(Muml_Interface) #|| e.kind_of?(Muml_UseCase)
    write("<#{e.prot_uri}> <http://protege.stanford.edu/system#role> \"abstract\" .\n")
  end
  e.append_comment
  e.prot_writeSubClassOf

  write("<#{e.prot_uri}> <#{RDF_SUBCLASSOF_URI}> <#{mainSubClassOfURI}> .\n")
  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_writeSubClassOfObject

writes sub class of rdf instructions



216
217
218
219
220
# File 'lib/ontomde-uml2-kb/protege.rb', line 216

def prot_writeSubClassOf
  uml_generalization.each { |g|
    write("<#{prot_uri}> <#{RDF_SUBCLASSOF_URI}> <#{g.uml_general_one.prot_uri}> .\n")
  }
end