Sha256: 4bebbfd2c3a83a805824446ca688a201edf337a5c6b03330f068d54c501140cb
Contents?: true
Size: 1.95 KB
Versions: 8
Compression:
Stored size: 1.95 KB
Contents
module SPARQL; module Algebra class Operator ## # The SPARQL relational `=` (equal) comparison operator. # # [114] RelationalExpression ::= NumericExpression ('=' NumericExpression)? # # @example SPARQL Grammar # PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> # PREFIX : <http://example.org/things#> # SELECT ?x # WHERE { ?x :p ?v . FILTER ( ?v = 1 ) } # # @example SSE # (prefix # ((xsd: <http://www.w3.org/2001/XMLSchema#>) (: <http://example.org/things#>)) # (project (?x) (filter (= ?v 1) (bgp (triple ?x :p ?v))))) # # @see https://www.w3.org/TR/sparql11-query/#OperatorMapping # @see https://www.w3.org/TR/sparql11-query/#func-RDFterm-equal class Equal < Compare NAME = :'=' ## # Returns TRUE if `term1` and `term2` are the same RDF term as defined in Resource Description Framework (RDF): Concepts and Abstract Syntax [CONCEPTS]; produces a type error if the arguments are both literal but are not the same RDF term *; returns FALSE otherwise. `term1` and `term2` are the same if any of the following is true: # # * term1 and term2 are equivalent IRIs as defined in 6.4 RDF URI References of [CONCEPTS]. # * term1 and term2 are equivalent literals as defined in 6.5.1 Literal Equality of [CONCEPTS]. # * term1 and term2 are the same blank node as described in 6.6 Blank Nodes of [CONCEPTS]. # # @param [RDF::Term] term1 # an RDF term # @param [RDF::Term] term2 # an RDF term # @return [RDF::Literal::Boolean] `true` or `false` # @raise [TypeError] if either operand is not an RDF term or operands are not comperable # # @see RDF::Term#== def apply(term1, term2, **options) term1 = term1.dup.extend(RDF::TypeCheck) term2 = term2.dup.extend(RDF::TypeCheck) RDF::Literal(term1 == term2) end end # Equal end # Operator end; end # SPARQL::Algebra
Version data entries
8 entries across 8 versions & 1 rubygems