Module: SPARQL::Grammar
- Defined in:
- lib/sparql/grammar.rb,
lib/sparql/grammar/parser11.rb,
lib/sparql/grammar/terminals11.rb
Overview
Implementation Notes
The parser is driven through a rules table contained in lib/sparql/grammar/meta.rb. This includes branch rules to indicate productions to be taken based on a current production.
The meta.rb file is generated from etc/sparql11.bnf using the ebnf
gem.
ebnf --ll1 Query --format rb \
--mod-name SPARQL::Grammar::Meta \
--output lib/sparql/grammar/meta.rb \
etc/sparql11.bnf
Defined Under Namespace
Modules: Meta, Terminals Classes: Parser
Class Method Summary collapse
-
.open(filename, **options) {|reader| ... } ⇒ Object
Parses input from the given file name or URL.
-
.parse(query, **options, &block) ⇒ Parser
Parse the given SPARQL
query
string. -
.tokenize(query, **options) {|lexer| ... } ⇒ Lexer
Tokenizes the given SPARQL
query
string. -
.valid?(query, **options) ⇒ Boolean
Returns
true
if the given SPARQLquery
string is valid.
Class Method Details
.open(filename, **options) {|reader| ... } ⇒ Object
Parses input from the given file name or URL.
270 271 272 273 274 |
# File 'lib/sparql/grammar.rb', line 270 def self.open(filename, **, &block) RDF::Util::File.open_file(filename, **) do |file| self.parse(file, **, &block) end end |
.parse(query, **options, &block) ⇒ Parser
Parse the given SPARQL query
string.
254 255 256 |
# File 'lib/sparql/grammar.rb', line 254 def self.parse(query, **, &block) Parser.new(query, **).parse([:update] ? :UpdateUnit : :QueryUnit) end |
.tokenize(query, **options) {|lexer| ... } ⇒ Lexer
Tokenizes the given SPARQL query
string.
305 306 307 |
# File 'lib/sparql/grammar.rb', line 305 def self.tokenize(query, **, &block) Lexer.tokenize(query, **, &block) end |