Sha256: 72db40cecff787041ca97279ff71503af7f2ff4fcc9fc48ed398927ac20b287a
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
module SPARQL; module Algebra class Operator ## # The SPARQL GraphPattern `reduced` operator. # # [9] SelectClause ::= 'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( ( Var | ( '(' Expression 'AS' Var ')' ) )+ | '*' ) # # @example SPARQL Grammar # PREFIX : <http://example.org/> # PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> # SELECT REDUCED ?v # WHERE { ?x ?p ?v } # # @example SSE # (prefix ((: <http://example.org/>) # (xsd: <http://www.w3.org/2001/XMLSchema#>)) # (reduced # (project (?v) # (bgp (triple ?x ?p ?v))))) # # @see https://www.w3.org/TR/sparql11-query/#sparqlAlgebra class Reduced < Operator::Unary include Query NAME = [:reduced] ## # Executes this query on the given `queryable` graph or repository. # Removes duplicate solutions from the solution set. # # @param [RDF::Queryable] queryable # the graph or repository to query # @param [Hash{Symbol => Object}] options # any additional keyword options # @yield [solution] # each matching solution # @yieldparam [RDF::Query::Solution] solution # @yieldreturn [void] ignored # @return [RDF::Query::Solutions] # the resulting solution sequence # @see https://www.w3.org/TR/sparql11-query/#sparqlAlgebra def execute(queryable, **options, &block) @solutions = operands.last. execute(queryable, depth: options[:depth].to_i + 1, **options).reduced @solutions.each(&block) if block_given? @solutions end ## # # Returns a partial SPARQL grammar for this operator. # # @return [String] def to_sparql(**options) operands.first.to_sparql(reduced: true, **options) end end # Reduced end # Operator end; end # SPARQL::Algebra
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sparql-3.2.4 | lib/sparql/algebra/operator/reduced.rb |
sparql-3.2.3 | lib/sparql/algebra/operator/reduced.rb |
sparql-3.2.1 | lib/sparql/algebra/operator/reduced.rb |