lib/sparql/algebra/operator/is_blank.rb in sparql-3.1.8 vs lib/sparql/algebra/operator/is_blank.rb in sparql-3.2.0
- old
+ new
@@ -1,11 +1,20 @@
module SPARQL; module Algebra
class Operator
##
# The SPARQL `isBlank` operator.
#
- # @example
+ # [121] BuiltInCall ::= ... | 'isBlank' '(' Expression ')'
+ #
+ # @example SPARQL Grammar
+ # PREFIX : <http://example.org/things#>
+ # SELECT ?x ?v WHERE {
+ # ?x :p ?v .
+ # FILTER isBlank(?v) .
+ # }
+ #
+ # @example SSE
# (prefix ((xsd: <http://www.w3.org/2001/XMLSchema#>)
# (: <http://example.org/things#>))
# (project (?x ?v)
# (filter (isBlank ?v)
# (bgp (triple ?x :p ?v)))))
@@ -27,9 +36,18 @@
case term
when RDF::Node then RDF::Literal::TRUE
when RDF::Term then RDF::Literal::FALSE
else raise TypeError, "expected an RDF::Term, but got #{term.inspect}"
end
+ end
+
+ ##
+ #
+ # Returns a partial SPARQL grammar for this operator.
+ #
+ # @return [String]
+ def to_sparql(**options)
+ "isBlank(" + operands.first.to_sparql(**options) + ")"
end
end # IsBlank
end # Operator
end; end # SPARQL::Algebra