Class: SPARQL::Algebra::Operator::IsTriple
- Includes:
- Evaluatable
- Defined in:
- lib/sparql/algebra/operator/is_triple.rb
Overview
The SPARQL isTRIPLE operator.
Returns true if term is an RDF-star triple. Returns false otherwise.
[121] BuiltInCall ::= ... | 'isTreiple' '(' Expression ')'
Constant Summary collapse
- NAME =
:isTRIPLE
Instance Method Summary collapse
-
#apply(term, **options) ⇒ RDF::Literal::Boolean
Returns
trueif the operand is anRDF::Statement,falseotherwise. -
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this operator.
Methods included from Evaluatable
#evaluate, #memoize, #replace_aggregate!, #replace_vars!
Instance Method Details
#apply(term, **options) ⇒ RDF::Literal::Boolean
Returns true if the operand is an RDF::Statement, false otherwise.
44 45 46 47 48 49 50 |
# File 'lib/sparql/algebra/operator/is_triple.rb', line 44 def apply(term, **) 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 |
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this operator.
57 58 59 |
# File 'lib/sparql/algebra/operator/is_triple.rb', line 57 def to_sparql(**) "isTRIPLE(" + operands.first.to_sparql(**) + ")" end |