lib/sparql/algebra/operator/clear.rb in sparql-3.2.0 vs lib/sparql/algebra/operator/clear.rb in sparql-3.2.1
- old
+ new
@@ -6,16 +6,22 @@
#
# The CLEAR operation removes all the triples in the specified graph(s) in the Graph Store.
#
# [32] Clear ::= 'CLEAR' 'SILENT'? GraphRefAll
#
- # @example SPARQL Grammar
+ # @example SPARQL Grammar (SILENT DEFAULT)
# CLEAR SILENT DEFAULT
#
- # @example SSE
+ # @example SSE (SILENT DEFAULT)
# (update (clear silent default))
#
+ # @example SPARQL Grammar (IRI)
+ # CLEAR GRAPH <http://example.com/>
+ #
+ # @example SSE (IRI)
+ # (update (clear <http://example.com/>))
+ #
# @see https://www.w3.org/TR/sparql11-update/#clear
class Clear < Operator
include SPARQL::Algebra::Update
NAME = [:clear]
@@ -68,10 +74,14 @@
#
# Returns a partial SPARQL grammar for this operator.
#
# @return [String]
def to_sparql(**options)
- "CLEAR " + operands.to_sparql(**options)
+ silent = operands.first == :silent
+ str = "CLEAR "
+ str << "SILENT " if operands.first == :silent
+ str << "GRAPH " if operands.last.is_a?(RDF::URI)
+ str << operands.last.to_sparql(**options)
end
end # Clear
end # Operator
end; end # SPARQL::Algebra