Class: OWL::ObjectProperty
- Inherits:
-
RDFS::Resource
- Object
- RDFS::Resource
- OWL::ObjectProperty
- Defined in:
- lib/objectmanager/owl/object_property.rb
Overview
Resembles a property in OWL context.
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
-
#domain ⇒ Object
returns the resources that are a domain for the given ObjectProperty.
-
#initialize(resource, options = {}) ⇒ ObjectProperty
constructor
Creates a new OWL::Class.
-
#inverse ⇒ Object
(also: #inverse_of)
returns the inverse of the given bidirectional ObjectProperty.
-
#range ⇒ Object
returns the resources that are in the range of the given ObjectProperty.
Methods inherited from RDFS::Resource
#ancestors, #geopoint, #geopoints, #gmarker, #is_class?, #is_image?, #is_mappable?, #is_property?, #latitude, #localname, #longitude, #parents, #properties, #resources_for_property, #stripped_uri, #types
Constructor Details
#initialize(resource, options = {}) ⇒ ObjectProperty
Creates a new OWL::Class.
parameters:
1 resource ( RDFS::Resource or URI )
2 options ( Hash; )
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/objectmanager/owl/object_property.rb', line 19 def initialize( resource, ={} ) @@log.deep "Formulating new OWL::ObjectProperty #{resource} from #{resource.class}" @uri = case resource when OWL::ObjectProperty @@log.warn "Redundant new OWL::ObjectProperty, 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.
8 9 10 |
# File 'lib/objectmanager/owl/object_property.rb', line 8 def class_uri @class_uri end |
Instance Attribute Details
#uri ⇒ Object (readonly)
uri of the resource (for instances of this class: rdf resources)
12 13 14 |
# File 'lib/objectmanager/owl/object_property.rb', line 12 def uri @uri end |
Class Method Details
.==(other) ⇒ Object
44 45 46 |
# File 'lib/objectmanager/owl/object_property.rb', line 44 def self.==(other) other.respond_to?(:uri) ? other.uri == self.uri : false end |
.uri ⇒ Object
43 |
# File 'lib/objectmanager/owl/object_property.rb', line 43 def self.uri; class_uri.uri; end |
Instance Method Details
#domain ⇒ Object
returns the resources that are a domain for the given ObjectProperty
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/objectmanager/owl/object_property.rb', line 64 def domain begin if @domain.nil? @domain = ActiveRubic::Base.query( Query.new.distinct( :domain ).where( :domain, self, :any ) ) end return @domain rescue @@log.error $! end end |
#inverse ⇒ Object Also known as: inverse_of
returns the inverse of the given bidirectional ObjectProperty
53 54 55 56 57 58 59 60 |
# File 'lib/objectmanager/owl/object_property.rb', line 53 def inverse if @inverse.nil? # ActiveRubic always returns values in an Array, but a property # can have only one inverse values. @inverse = ActiveRubic::Base.find( :inverse, :property => self ).first end return @inverse end |
#range ⇒ Object
returns the resources that are in the range of the given ObjectProperty
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/objectmanager/owl/object_property.rb', line 77 def range begin if @range.nil? @range = ActiveRubic::Base.find( :within_range, :property => self ) end return @range rescue @@log.error $! end end |