Class: RDF::N3::Algebra::Time::Year
- Inherits:
-
ResourceOperator
- Object
- SPARQL::Algebra::Operator::Binary
- ResourceOperator
- RDF::N3::Algebra::Time::Year
- Defined in:
- lib/rdf/n3/algebra/time/year.rb
Overview
For a date-time, its time:year is the year component.
Constant Summary collapse
Instance Attribute Summary
Attributes included from Enumerable
Instance Method Summary collapse
-
#resolve(resource, position:) ⇒ RDF::Term
The time:year operator takes string or dateTime and extracts the year component.
Methods inherited from ResourceOperator
#as_literal, #execute, #input_operand, #valid?
Methods included from Builtin
#each, #evaluate, #hash, #input_operand, #rank, #to_uri
Instance Method Details
#resolve(resource, position:) ⇒ RDF::Term
The time:year operator takes string or dateTime and extracts the year component.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rdf/n3/algebra/time/year.rb', line 17 def resolve(resource, position:) case position when :subject return nil unless resource.literal? resource.as_datetime.year when :object return nil unless resource.literal? || resource.variable? resource end end |