Class: 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]
Instance Attribute Summary
Attributes included from Query
Instance Method Summary collapse
-
#execute(queryable, **options) {|solution| ... } ⇒ RDF::Query::Solutions
Executes this query on the given
queryablegraph 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
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 |