class SPARQL::Algebra::Operator::IsTriple

The SPARQL `isTRIPLE` operator.

Returns true if term is an RDF-star triple. Returns false otherwise.

@see w3c.github.io/rdf-star/rdf-star-cg-spec.html#istriple

Constants

NAME

Public Instance Methods

apply(term, **options) click to toggle source

Returns `true` if the operand is an `RDF::Statement`, `false` otherwise.

@param [RDF::Term] term

an RDF term

@return [RDF::Literal::Boolean] `true` or `false` @raise [TypeError] if the operand is not an RDF term

# File lib/sparql/algebra/operator/is_triple.rb, line 21
def apply(term, **options)
  case term
    when RDF::Statement  then RDF::Literal::TRUE
    when RDF::Term then RDF::Literal::FALSE
    else raise TypeError, "expected an RDF::Term, but got #{term.inspect}"
  end
end