class RDF::Node

Public Class Methods

add_entailment(method, proc) click to toggle source

Add an entailment method. The method accepts no arguments, and returns or yields an array of values associated with the particular entailment method @param [Symbol] method @param [Proc] proc

# File lib/rdf/reasoner/extensions.rb, line 68
def add_entailment(method, proc)
  @@entailments[method] = proc
end

Public Instance Methods

domain_compatible?(resource, queryable, options = {}) click to toggle source

Determine if the domain of a property term is consistent with the specified resource in `queryable`.

@param [RDF::Resource] resource @param [RDF::Queryable] queryable @param [Hash{Symbol => Object}] options ({}) @option options [Array<RDF::Vocabulary::Term>] :types

Fully entailed types of resource, if not provided, they are queried
# File lib/rdf/reasoner/extensions.rb, line 92
def domain_compatible?(resource, queryable, options = {})
  %w(owl rdfs schema).map {|r| "domain_compatible_#{r}?".to_sym}.all? do |meth|
    !self.respond_to?(meth) || self.send(meth, resource, queryable, **options)
  end
end
entail(method, &block) click to toggle source

Perform an entailment on this term.

@param [Symbol] method A registered entailment method @yield term @yieldparam [Term] term @return [Array<Term>]

# File lib/rdf/reasoner/extensions.rb, line 80
def entail(method, &block)
  self.send(@@entailments.fetch(method), &block)
end
range_compatible?(resource, queryable, options = {}) click to toggle source

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

@param [RDF::Resource] resource @param [RDF::Queryable] queryable @param [Hash{Symbol => Object}] options ({}) @option options [Array<RDF::Vocabulary::Term>] :types

Fully entailed types of resource, if not provided, they are queried
# File lib/rdf/reasoner/extensions.rb, line 108
def range_compatible?(resource, queryable, options = {})
  %w(owl rdfs schema).map {|r| "range_compatible_#{r}?".to_sym}.all? do |meth|
    !self.respond_to?(meth) || self.send(meth, resource, queryable, options)
  end
end