Sha256: ace2260b341173688f1ecd4ccdda66948f4e3468b49d8583f65eba1cfaa8ce81

Contents?: true

Size: 1.4 KB

Versions: 10

Compression:

Stored size: 1.4 KB

Contents

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL GraphPattern `prefix` operator.
    #
    # @example
    #   (prefix ((: <http://example/>))
    #     (graph ?g
    #       (bgp (triple ?s ?p ?o))))
    #
    # @see http://www.w3.org/TR/rdf-sparql-query/#QSynIRI
    class Prefix < Binary
      include Query
      
      NAME = [:prefix]

      ##
      # Executes this query on the given `queryable` graph or repository.
      # Really a pass-through, as this is a syntactic object used for providing
      # context for URIs.
      #
      # @param  [RDF::Queryable] queryable
      #   the graph or repository to query
      # @param  [Hash{Symbol => Object}] options
      #   any additional keyword options
      # @return [RDF::Query::Solutions]
      #   the resulting solution sequence
      # @see    http://www.w3.org/TR/rdf-sparql-query/#sparqlAlgebra
      def execute(queryable, options = {})
        @solutions = operands.last.execute(queryable, options.merge(:depth => options[:depth].to_i + 1))
      end
      
      ##
      # Returns an optimized version of this query.
      #
      # If optimize operands, and if the first two operands are both Queries, replace
      # with the unique sum of the query elements
      #
      # @return [Union, RDF::Query] `self`
      def optimize
        operands.last.optimize
      end
    end # Prefix
  end # Operator
end; end # SPARQL::Algebra

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sparql-1.0.2 lib/sparql/algebra/operator/prefix.rb
sparql-1.0.1 lib/sparql/algebra/operator/prefix.rb
sparql-1.0.0 lib/sparql/algebra/operator/prefix.rb
sparql-0.3.3 lib/sparql/algebra/operator/prefix.rb
sparql-0.3.2 lib/sparql/algebra/operator/prefix.rb
sparql-0.3.1 lib/sparql/algebra/operator/prefix.rb
sparql-0.3.0 lib/sparql/algebra/operator/prefix.rb
sparql-0.1.1 lib/sparql/algebra/operator/prefix.rb
sparql-0.1.0 lib/sparql/algebra/operator/prefix.rb
sparql-0.0.2 lib/sparql/algebra/operator/prefix.rb