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

Inherits:
SPARQL::Algebra::Operator show all
Includes:
Evaluatable
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/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

Constants inherited from SPARQL::Algebra::Operator

ARITY, IsURI, URI

Constants included from Expression

Expression::PATTERN_PARENTS

Constants included from RDF::Util::Logger

RDF::Util::Logger::IOWrapper

Instance Attribute Summary

Attributes inherited from SPARQL::Algebra::Operator

#operands

Instance Method Summary collapse

Methods included from Evaluatable

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

Methods inherited from SPARQL::Algebra::Operator

#aggregate?, arity, base_uri, #base_uri, base_uri=, #bind, #boolean, #constant?, #deep_dup, #each_descendant, #eql?, #evaluatable?, evaluate, #executable?, #first_ancestor, for, #formulae, #initialize, #inspect, #mergable?, #ndvars, #node?, #operand, #optimize, #optimize!, #parent, #parent=, prefixes, #prefixes, prefixes=, #rewrite, #to_binary, to_sparql, #to_sxp, #validate!, #variable?, #variables, #vars

Methods included from Expression

cast, #constant?, #evaluate, extension, extension?, extensions, for, #invalid?, new, #node?, open, #optimize, #optimize!, parse, register_extension, #valid?, #validate!, #variable?

Methods included from RDF::Util::Logger

#log_debug, #log_depth, #log_error, #log_fatal, #log_info, #log_recover, #log_recovering?, #log_statistics, #log_warn, #logger

Constructor Details

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

Instance Method Details

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

Invokes the function with the passed arguments.

Parameters:

Returns:



34
35
36
37
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/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:



55
56
57
58
59
60
61
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/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 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/function_call.rb', line 46

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