Class: SPARQL::Algebra::Operator::FunctionCall

Inherits:
Operator
  • Object
show all
Includes:
Evaluatable
Defined in:
lib/sparql/algebra/operator/function_call.rb

Overview

The SPARQL function_call operator.

[70] FunctionCall ::= iri ArgList

Examples:

SPARQL Grammar

PREFIX xsd:   <http://www.w3.org/2001/XMLSchema#>
SELECT *
WHERE { ?s ?p ?o . FILTER xsd:integer(?o) }

SSE

(prefix
 ((xsd: <http://www.w3.org/2001/XMLSchema#>))
 (filter (xsd:integer ?o)
  (bgp (triple ?s ?p ?o))))

See Also:

Constant Summary collapse

NAME =
:function_call

Instance Method Summary collapse

Methods included from Evaluatable

#evaluate, #memoize, #replace_aggregate!, #replace_vars!

Instance Method Details

#apply(iri, *args, **options) ⇒ RDF::Term

Invokes the function with the passed arguments.

Parameters:

Returns:



34
35
36
37
# File 'lib/sparql/algebra/operator/function_call.rb', line 34

def apply(iri, *args, **options)
  args = RDF.nil == args.last ? args[0..-2] : args
  SPARQL::Algebra::Expression.extension(iri, *args, **options)
end

#to_sparql(**options) ⇒ String

Returns a partial SPARQL grammar for this operator.

Returns:

  • (String)


55
56
57
58
59
60
61
# File 'lib/sparql/algebra/operator/function_call.rb', line 55

def to_sparql(**options)
  iri, args = operands
  iri.to_sparql(**options) +
    '(' +
    args.to_sparql(delimiter: ', ', **options) +
    ')'
end

#to_sxp_binArray

Returns the SPARQL S-Expression (SSE) representation of this expression.

Remove the optional argument.

Returns:

See Also:



46
47
48
# File 'lib/sparql/algebra/operator/function_call.rb', line 46

def to_sxp_bin
  @operands.map(&:to_sxp_bin)
end