class SPARQL::Algebra::Operator::Hours
The SPARQL
logical `hours` operator.
@example
(prefix ((: <http://example.org/>)) (project (?s ?x) (extend ((?x (hours ?date))) (bgp (triple ?s :date ?date)))))
Constants
- NAME
Public Instance Methods
apply(operand, **options)
click to toggle source
Returns the hours part of `arg` as an integer. The value is as given in the lexical form of the XSD dateTime.
@param [RDF::Literal] operand
the operand
@return [RDF::Literal] @raise [TypeError] if the operand is not a simple literal
# File lib/sparql/algebra/operator/hours.rb, line 25 def apply(operand, **options) raise TypeError, "expected an RDF::Literal::DateTime, but got #{operand.inspect}" unless operand.is_a?(RDF::Literal::DateTime) RDF::Literal(operand.object.hour) end