Class: DOWL::LabelledDocObject

Inherits:
DocObject show all
Defined in:
lib/dowl/util.rb

Direct Known Subclasses

Class, Property

Instance Attribute Summary

Attributes inherited from DocObject

#resource, #schema

Instance Method Summary collapse

Methods inherited from DocObject

#get_literal

Constructor Details

#initialize(resource, schema) ⇒ LabelledDocObject

Returns a new instance of LabelledDocObject.



19
20
21
# File 'lib/dowl/util.rb', line 19

def initialize(resource, schema)
   super(resource, schema)
end

Instance Method Details

#<=>(other) ⇒ Object



45
46
47
# File 'lib/dowl/util.rb', line 45

def <=>(other)
  return label().downcase <=> other.label().downcase
end

#commentObject



37
38
39
# File 'lib/dowl/util.rb', line 37

def comment()
  return get_literal(DOWL::Namespaces::RDFS.comment)
end

#labelObject



33
34
35
# File 'lib/dowl/util.rb', line 33

def label()
  return get_literal(DOWL::Namespaces::RDFS.label)
end

#short_nameObject



23
24
25
26
27
28
29
30
31
# File 'lib/dowl/util.rb', line 23

def short_name()
  uri = @resource.to_s
  ontology_uri = @schema.ontology.uri
  if ontology_uri.end_with?("#") || ontology_uri.end_with?("/")
    ontology_uri = ontology_uri[0..-2]
  end
  name = uri.gsub(/#{ontology_uri}(\/|#)?/, "")
  return name
end

#statusObject



41
42
43
# File 'lib/dowl/util.rb', line 41

def status()      
  return get_literal(DOWL::Namespaces::VS.term_status)
end