Class: SPARQL::Algebra::Operator::IsBlank

Inherits:
Unary show all
Defined in:
lib/sparql/algebra/operator/is_blank.rb

Overview

The SPARQL isBlank operator.

See Also:

Constant Summary

NAME =
:isBlank

Constants inherited from Unary

ARITY

Instance Method Summary (collapse)

Methods inherited from Unary

#initialize

Methods inherited from SPARQL::Algebra::Operator

#boolean, #constant?, evaluate, #initialize, #operand, #to_sse, #variable?

Constructor Details

This class inherits a constructor from SPARQL::Algebra::Operator::Unary

Instance Method Details

- (RDF::Literal::Boolean) evaluate(solution)

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

Parameters:

  • (RDF::Query::Solution) solution

Returns:

  • (RDF::Literal::Boolean)

    true or false

Raises:

  • (TypeError)

    if the operand is not an RDF::Term



16
17
18
19
20
21
22
# File 'lib/sparql/algebra/operator/is_blank.rb', line 16

def evaluate(solution)
  case term = operand(0, solution)
    when RDF::Node then RDF::Literal::TRUE
    when RDF::Term then RDF::Literal::FALSE
    else raise TypeError, "expected an RDF::Term, but got #{term.inspect}"
  end
end