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.



102
103
104
105
106
# File 'lib/ldpath/selectors.rb', line 102

def initialize(property)
  @property = property

  super
end

Instance Attribute Details

#propertyObject (readonly)

Returns the value of attribute property.



100
101
102
# File 'lib/ldpath/selectors.rb', line 100

def property
  @property
end

Instance Method Details

#evaluate_one(uri, context) ⇒ Object



108
109
110
111
112
113
114
# File 'lib/ldpath/selectors.rb', line 108

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