Class: OWL::Thing
- Inherits:
-
RDFS::Resource
- Object
- RDFS::Resource
- OWL::Thing
- Defined in:
- lib/objectmanager/owl/thing.rb
Overview
Resembles the ontology root.
Class Attribute Summary collapse
-
.class_uri ⇒ Object
Returns the value of attribute class_uri.
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
uri of the resource (for instances of this class: rdf resources).
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(resource, options = {}) ⇒ Thing
constructor
Creates a new OWL::Thing.
-
#label ⇒ Object
(also: #labelize)
return the localname as label.
-
#roots ⇒ Object
the roots of the ontology (only available from Jena).
Methods inherited from RDFS::Resource
#ancestors, #geopoint, #geopoints, #gmarker, #is_class?, #is_image?, #is_mappable?, #is_property?, #latitude, #localname, #longitude, #parents, #properties, #range, #resources_for_property, #stripped_uri, #types
Constructor Details
#initialize(resource, options = {}) ⇒ Thing
Creates a new OWL::Thing.
parameters:
1 resource ( RDFS::Resource or URI String )
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/objectmanager/owl/thing.rb', line 21 def initialize( resource, ={} ) @@log.deep "Formulating new Owl::Thing #{resource} from #{resource.class}" @uri = case resource when OWL::Thing @@log.warn "Redundant new OWL::Thing, resource already was one." resource.uri when RDFS::Resource resource.uri when String resource else raise ActiveRdfError, "Resource #{resource} (#{resource.class}) is improperly formulated" return nil end # @data_stores = options[ :from ] || RUBIC_DATASTORES # @predicates = Hash.new end |
Class Attribute Details
.class_uri ⇒ Object
Returns the value of attribute class_uri.
11 12 13 |
# File 'lib/objectmanager/owl/thing.rb', line 11 def class_uri @class_uri end |
Instance Attribute Details
#uri ⇒ Object (readonly)
uri of the resource (for instances of this class: rdf resources)
15 16 17 |
# File 'lib/objectmanager/owl/thing.rb', line 15 def uri @uri end |
Class Method Details
.==(other) ⇒ Object
46 47 48 |
# File 'lib/objectmanager/owl/thing.rb', line 46 def self.==(other) other.respond_to?(:uri) ? other.uri == self.uri : false end |
.uri ⇒ Object
45 |
# File 'lib/objectmanager/owl/thing.rb', line 45 def self.uri; class_uri.uri; end |
Instance Method Details
#label ⇒ Object Also known as: labelize
return the localname as label
55 56 57 58 |
# File 'lib/objectmanager/owl/thing.rb', line 55 def label @label = Namespace.localname( self.uri ).capitalize return @label end |
#roots ⇒ Object
the roots of the ontology (only available from Jena)
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/objectmanager/owl/thing.rb', line 62 def roots begin if @roots.nil? then @roots = Array.new ActiveRubic::Base.find( :roots, :ontology => self.uri ).each do |root| @roots << OwlClass.new( root ) end end return @roots rescue return Array.new end end |