Class: Ldpath::LoosePropertySelector

Inherits:
Selector
  • Object
show all
Defined in:
lib/ldpath/selectors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Selector

#evaluate, #loading

Constructor Details

#initialize(property) ⇒ LoosePropertySelector

Returns a new instance of LoosePropertySelector.



91
92
93
# File 'lib/ldpath/selectors.rb', line 91

def initialize(property)
  @property = property
end

Instance Attribute Details

#propertyObject (readonly)

Returns the value of attribute property.



90
91
92
# File 'lib/ldpath/selectors.rb', line 90

def property
  @property
end

Instance Method Details

#evaluate_one(uri, context) ⇒ Object



95
96
97
98
99
100
101
# File 'lib/ldpath/selectors.rb', line 95

def evaluate_one(uri, context)
  return PropertySelector.new(property).evaluate_one(uri_context) unless defined? RDF::Reasoner

  context.query([uri, nil, nil]).lazy.select do |result|
    result.predicate.entail(:subPropertyOf).include? property
  end.map(&:object)
end