class RDF::N3::Algebra::Time::DayOfWeek
For a date-time, its time:dayOfWeek is the the day number within the week, Sunday being 0.
Constants
- NAME
- URI
Public Instance Methods
resolve(resource, position:)
click to toggle source
The time:dayOfWeek operator takes string or dateTime and returns the 0-based day of the week.
@param [RDF::Term] resource @param [:subject, :object] position @return [RDF::Term] @see RDF::N3::ResourceOperator#evaluate
# File lib/rdf/n3/algebra/time/day_of_week.rb, line 15 def resolve(resource, position:) case position when :subject return nil unless resource.literal? resource = resource.as_datetime RDF::Literal(resource.object.strftime("%w").to_i) when :object return nil unless resource.literal? || resource.variable? resource end end