Class: SPARQL::Algebra::Operator::Service
- Inherits:
-
SPARQL::Algebra::Operator
- Object
- SPARQL::Algebra::Operator
- SPARQL::Algebra::Operator::Service
- Includes:
- Query
- Defined in:
- lib/sparql/algebra/operator/service.rb
Overview
The SPARQL Service operator.
[59] ServiceGraphPattern ::= ‘SERVICE’ ‘SILENT’? VarOrIri GroupGraphPattern
Constant Summary collapse
- NAME =
[:service]
Constants inherited from SPARQL::Algebra::Operator
Constants included from Expression
Instance Attribute Summary
Attributes included from Query
Attributes inherited from SPARQL::Algebra::Operator
Instance Method Summary collapse
-
#execute(queryable, **options) {|solution| ... } ⇒ RDF::Query::Solutions
Executes this query on the given
queryable
graph or repository. -
#optimize(**options) ⇒ Prefix
Returns an optimized version of this query.
-
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this term.
Methods included from Query
#each_solution, #empty?, #failed?, #graph_name=, #matched?, #query_yields_boolean?, #query_yields_solutions?, #query_yields_statements?, #unshift, #variables
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, #initialize, #inspect, #ndvars, #node?, #operand, #optimize!, #parent, #parent=, #prefixes, prefixes, prefixes=, #rewrite, #to_binary, to_sparql, #to_sxp, #to_sxp_bin, #validate!, #variable?, #variables, #vars
Methods included from Expression
cast, #constant?, #evaluate, extension, extension?, extensions, for, #invalid?, new, #node?, open, #optimize!, parse, register_extension, #to_sxp_bin, #valid?, #validate!, #variable?
Constructor Details
This class inherits a constructor from SPARQL::Algebra::Operator
Instance Method Details
#execute(queryable, **options) {|solution| ... } ⇒ RDF::Query::Solutions
Executes this query on the given queryable
graph or repository. Really a pass-through, as this is a syntactic object used for providing graph_name for URIs.
48 49 50 51 52 53 54 55 |
# File 'lib/sparql/algebra/operator/service.rb', line 48 def execute(queryable, **, &block) debug() {"Service"} silent = operands.first == :silent location, query = operands query_sparql = query.to_sparql debug() {"query: #{query_sparql}"} raise NotImplementedError, "SERVICE operator not implemented" end |
#optimize(**options) ⇒ Prefix
Returns an optimized version of this query.
Replace with the query with URIs having their lexical shortcut removed
64 65 66 |
# File 'lib/sparql/algebra/operator/service.rb', line 64 def optimize(**) operands.last.optimize(**) end |
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this term.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/sparql/algebra/operator/service.rb', line 73 def to_sparql(**) silent = operands.first == :silent ops = silent ? operands[1..-1] : operands location, query = ops str = "SERVICE " str << "SILENT " if silent str << location.to_sparql(**) + " {" + query.to_sparql(**) + "}" str end |