Class: Ldpath::TapSelector

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Selector

#loading

Constructor Details

#initialize(identifier, tap) ⇒ TapSelector

Returns a new instance of TapSelector.



141
142
143
144
# File 'lib/ldpath/selectors.rb', line 141

def initialize(identifier, tap)
  @identifier = identifier
  @tap = tap
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



140
141
142
# File 'lib/ldpath/selectors.rb', line 140

def identifier
  @identifier
end

#tapObject (readonly)

Returns the value of attribute tap.



140
141
142
# File 'lib/ldpath/selectors.rb', line 140

def tap
  @tap
end

Instance Method Details

#evaluate(program, uris, context) ⇒ Object



146
147
148
149
150
151
152
153
# File 'lib/ldpath/selectors.rb', line 146

def evaluate(program, uris, context)
  program.meta[identifier] = tap.evaluate(program, uris, context).map { |x| RDF::Literal.new(x.to_s).canonicalize.object }

  Array(uris).map do |uri|
    loading program, uri, context
    evaluate_one uri, context
  end.flatten.compact
end

#evaluate_one(uri, context) ⇒ Object



155
156
157
# File 'lib/ldpath/selectors.rb', line 155

def evaluate_one(uri, context)
  uri
end