Class: RDF::URI
- Inherits:
-
Object
- Object
- RDF::URI
- Defined in:
- lib/rdf/reasoner/extensions.rb
Constant Summary collapse
- @@entailments =
{}
Class Method Summary collapse
-
.add_entailment(method, proc) ⇒ Object
Add an entailment method.
Instance Method Summary collapse
-
#domain_compatible?(resource, queryable, options = {}) ⇒ Boolean
Determine if the domain of a property term is consistent with the specified resource in ‘queryable`.
-
#entail(method) {|term| ... } ⇒ Array<Term>
Perform an entailment on this term.
-
#range_compatible?(resource, queryable, options = {}) ⇒ Boolean
Determine if the range of a property term is consistent with the specified resource in ‘queryable`.
Class Method Details
.add_entailment(method, proc) ⇒ Object
Add an entailment method. The method accepts no arguments, and returns or yields an array of values associated with the particular entailment method
13 14 15 |
# File 'lib/rdf/reasoner/extensions.rb', line 13 def add_entailment(method, proc) @@entailments[method] = proc end |
Instance Method Details
#domain_compatible?(resource, queryable, options = {}) ⇒ Boolean
Determine if the domain of a property term is consistent with the specified resource in ‘queryable`.
37 38 39 40 41 |
# File 'lib/rdf/reasoner/extensions.rb', line 37 def domain_compatible?(resource, queryable, = {}) %w(owl rdfs schema).map {|r| "domain_compatible_#{r}?".to_sym}.all? do |meth| !self.respond_to?(meth) || self.send(meth, resource, queryable, ) end end |
#entail(method) {|term| ... } ⇒ Array<Term>
Perform an entailment on this term.
25 26 27 |
# File 'lib/rdf/reasoner/extensions.rb', line 25 def entail(method, &block) self.send(@@entailments.fetch(method), &block) end |
#range_compatible?(resource, queryable, options = {}) ⇒ Boolean
Determine if the range of a property term is consistent with the specified resource in ‘queryable`.
Specific entailment regimes should insert themselves before this to apply the appropriate semantic condition
53 54 55 56 57 |
# File 'lib/rdf/reasoner/extensions.rb', line 53 def range_compatible?(resource, queryable, = {}) %w(owl rdfs schema).map {|r| "range_compatible_#{r}?".to_sym}.all? do |meth| !self.respond_to?(meth) || self.send(meth, resource, queryable, ) end end |