Class: SPARQL::Algebra::Operator::IsIRI

Inherits:
Unary show all
Includes:
Evaluatable
Defined in:
lib/sparql/algebra/operator/is_iri.rb

Overview

The SPARQL isIRI/isURI operator.

Examples:

(prefix ((xsd: <http://www.w3.org/2001/XMLSchema#>)
         (: <http://example.org/things#>))
  (project (?x ?v)
    (filter (isIRI ?v)
      (bgp (triple ?x :p ?v)))))

See Also:

Constant Summary

NAME =
[:isIRI, :isURI]

Constants inherited from Unary

Unary::ARITY

Constants inherited from SPARQL::Algebra::Operator

ARITY

Instance Attribute Summary

Attributes inherited from SPARQL::Algebra::Operator

#operands, #options

Instance Method Summary collapse

Methods included from Evaluatable

#evaluate, #memoize

Methods inherited from Unary

#initialize

Methods inherited from SPARQL::Algebra::Operator

arity, base_uri, #base_uri, base_uri=, #boolean, #constant?, #eql?, #evaluatable?, evaluate, #executable?, for, #initialize, #inspect, #operand, #optimize, prefixes, #prefixes, prefixes=, #to_sse, #to_sxp, #variable?

Methods included from Expression

cast, #constant?, #evaluate, for, new, open, #optimize, parse, #to_sse, #variable?

Constructor Details

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

Instance Method Details

#apply(term) ⇒ RDF::Literal::Boolean

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

Parameters:

Returns:

  • (RDF::Literal::Boolean)

    true or false

Raises:

  • (TypeError)

    if the operand is not an RDF term



26
27
28
29
30
31
32
# File 'lib/sparql/algebra/operator/is_iri.rb', line 26

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