Class: SPARQL::Algebra::Operator::IsIRI
- Includes:
- Evaluatable
- Defined in:
- lib/sparql/algebra/operator/is_iri.rb
Overview
The SPARQL isIRI/isURI operator.
[121] BuiltInCall ::= ... | 'isIRI' '(' Expression ')'
Constant Summary collapse
- NAME =
[:isIRI, :isURI]
Instance Method Summary collapse
-
#apply(term, **options) ⇒ RDF::Literal::Boolean
Returns
trueif the operand is anRDF::URI,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::URI, false otherwise.
34 35 36 37 38 39 40 |
# File 'lib/sparql/algebra/operator/is_iri.rb', line 34 def apply(term, **) case term when RDF::URI 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.
49 50 51 |
# File 'lib/sparql/algebra/operator/is_iri.rb', line 49 def to_sparql(**) "isIRI(" + operands.first.to_sparql(**) + ")" end |