Module: ShEx
- Defined in:
- lib/shex.rb,
lib/shex/parser.rb,
lib/shex/algebra.rb,
lib/shex/terminals.rb
Overview
A ShEx runtime for RDF.rb.
Defined Under Namespace
Modules: Algebra, Meta, Terminals Classes: Error, NotSatisfied, ParseError, Parser, StructureError
Class Method Summary collapse
-
.execute(expression, queryable, focus, shape, format: 'shexc', **options) ⇒ Boolean
Parse and validate the given ShEx ‘expression` string against `queriable`.
-
.open(filename, format: 'shexc', **options) {|ShEx::Algebra::Schema| ... } ⇒ ShEx::Algebra::Schema
Parses input from the given file name or URL.
-
.parse(expression, format: 'shexc', **options) ⇒ ShEx::Algebra::Schema
Parse the given ShEx ‘query` string.
Class Method Details
.execute(expression, queryable, focus, shape, format: 'shexc', **options) ⇒ Boolean
Parse and validate the given ShEx ‘expression` string against `queriable`.
75 76 77 78 79 80 |
# File 'lib/shex.rb', line 75 def self.execute(expression, queryable, focus, shape, format: 'shexc', **) shex = self.parse(expression, .merge(format: format)) queryable = queryable || RDF::Graph.new shex.satisfies?(focus, queryable, {focus => shape}, ) end |
.open(filename, format: 'shexc', **options) {|ShEx::Algebra::Schema| ... } ⇒ ShEx::Algebra::Schema
Parses input from the given file name or URL.
53 54 55 56 57 |
# File 'lib/shex.rb', line 53 def self.open(filename, format: 'shexc', **, &block) RDF::Util::File.open_file(filename, ) do |file| self.parse(file, .merge(format: format)) end end |
.parse(expression, format: 'shexc', **options) ⇒ ShEx::Algebra::Schema
Parse the given ShEx ‘query` string.
28 29 30 31 32 33 34 35 |
# File 'lib/shex.rb', line 28 def self.parse(expression, format: 'shexc', **) case format when 'shexc' then Parser.new(expression, ).parse when 'shexj' when 'sse' else raise "Unknown expression format: #{format.inspect}" end end |