Sha256: 127de71fb0a1dfaf2f4cf81c9dfd4da9e517af81464b638ce8a18079535c3b27
Contents?: true
Size: 988 Bytes
Versions: 1
Compression:
Stored size: 988 Bytes
Contents
module RDF::N3::Algebra::Time ## # For a date-time, its time:hour is the hour in the 24 hour clock. # # @see https://www.w3.org/TR/xpath-functions/#func-hours-from-dateTime class Hour < RDF::N3::Algebra::ResourceOperator NAME = :timeHour URI = RDF::N3::Time.hour ## # The time:hour operator takes string or dateTime and extracts the hour component. # # @param [RDF::Term] resource # @param [:subject, :object] position # @return [RDF::Term] # @see RDF::N3::ResourceOperator#evaluate def resolve(resource, position:) case position when :subject return nil unless resource.literal? resource.as_datetime.hours when :object return nil unless resource.literal? || resource.variable? resource end end ## # There is no hour unless it was specified in the lexical form def valid?(subject, object) subject.value.match?(%r(^\d{4}-\d{2}-\d{2}T\d{2})) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rdf-n3-3.3.0 | lib/rdf/n3/algebra/time/hour.rb |