class RDF::N3::Algebra::Time::Year
For a date-time, its time:year is the year component.
Constants
- NAME
- URI
Public Instance Methods
Source
# 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
The time:year operator takes string or dateTime and extracts the year component.
@param [RDF::Term] resource @param [:subject, :object] position @return [RDF::Term] @see RDF::N3::ResourceOperator#evaluate