Sha256: 0c89089eafcb0c89ff6ad0c7476ea88a3a62e454a0c3626ec1a47ff46b4185b0
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
module SPARQL; module Algebra class Operator ## # The SPARQL logical `exists` operator. # # @example # (prefix ((ex: <http://www.example.org/>)) # (filter (exists # (filter (notexists (bgp (triple ?s ?p ex:o2))) # (bgp (triple ?s ?p ex:o1)))) # (bgp (triple ?s ?p ex:o)))) # # @see http://www.w3.org/TR/sparql11-query/#func-abs # @see http://www.w3.org/TR/xpath-functions/#func-abs class Exists < Operator::Unary include Evaluatable NAME = [:exists] ## # Exvaluating this operator executes the query in the first operator passing in each existing bindings. # # @param [RDF::Query::Solution] bindings # a query solution containing zero or more variable bindings # @param [Hash{Symbol => Object}] options ({}) # options passed from query # @option options[RDF::Queryable] queryable # queryable to execute, using bindings as an initial solution. # @return [RDF::Literal::Boolean] `true` or `false` def evaluate(bindings, options = {}) solutions = RDF::Query::Solutions.new << bindings queryable = options[:queryable] !operand(0).execute(queryable, options.merge( :solutions => solutions, :depth => options[:depth].to_i + 1)).empty? end end # Exists end # Operator end; end # SPARQL::Algebra
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sparql-1.1.1 | lib/sparql/algebra/operator/exists.rb |
sparql-1.1.0 | lib/sparql/algebra/operator/exists.rb |
sparql-1.1.0p0 | lib/sparql/algebra/operator/exists.rb |