class SPARQL::Algebra::Operator::Seconds
The SPARQL
logical `seconds` operator.
Returns the seconds part of the lexical form of `arg`.
@example
(prefix ((: <http://example.org/>)) (project (?s ?x) (extend ((?x (seconds ?date))) (bgp (triple ?s :date ?date)))))
Constants
- NAME
Public Instance Methods
apply(operand, **options)
click to toggle source
Returns the seconds part of arg as an integer.
@param [RDF::Literal] operand
the operand
@return [RDF::Literal] @raise [TypeError] if the operand is not a simple literal
# File lib/sparql/algebra/operator/seconds.rb, line 27 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.second) end