class RDF::N3::Algebra::Time::Timezone

For a date-time, its time:timeZone is the trailing timezone offset part, e.g. ā€œ-05:00ā€.

@see www.w3.org/TR/xpath-functions/#func-timezone-from-dateTime

Constants

NAME
URI

Public Instance Methods

resolve(resource, position:) click to toggle source

The time:timeZone operator takes string or dateTime and extracts the timeZone component.

@param [RDF::Term] resource @param [:subject, :object] position @return [RDF::Term] @see RDF::N3::ResourceOperator#evaluate

# File lib/rdf/n3/algebra/time/timezone.rb, line 17
def resolve(resource, position:)
  case position
  when :subject
    return nil unless resource.literal?
    resource.as_datetime.tz
  when :object
    return nil unless resource.literal? || resource.variable?
    resource
  end
end
valid?(subject, object) click to toggle source

There is no timezone unless it was specified in the lexical form and is not ā€œZā€

# File lib/rdf/n3/algebra/time/timezone.rb, line 30
def valid?(subject, object)
  md = subject.value.match(%r(^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[\+-][\d-]+)))
  md && md[1].to_s != 'Z'
end