class RDF::N3::Algebra::Time::Day
For a date-time, its time:day is the day of the month.
Constants
- NAME
- URI
Public Instance Methods
resolve(resource, position:)
click to toggle source
The time:day operator takes string or dateTime and extracts the day component.
@param [RDF::Term] resource @param [:subject, :object] position @return [RDF::Term] @see RDF::N3::ResourceOperator#evaluate
# File lib/rdf/n3/algebra/time/day.rb, line 17 def resolve(resource, position:) case position when :subject return nil unless resource.literal? resource.as_datetime.day when :object return nil unless resource.literal? || resource.variable? resource end end
valid?(subject, object)
click to toggle source
There is no day unless it was specified in the lexical form
# File lib/rdf/n3/algebra/time/day.rb, line 30 def valid?(subject, object) subject.value.match?(%r(^\d{4}-\d{2}-\d{2})) end