Method: ShEx.execute

Defined in:
lib/shex.rb

.execute(expression, queryable, focus, shape, format: 'shexc', **options) ⇒ Operand

Parse and validate the given ShEx ‘expression` string against `queriable`.

Examples:

executing a ShExC schema

graph = RDF::Graph.load("etc/doap.ttl")
ShEx.execute('etc/doap.shex', graph, "http://rubygems.org/gems/shex", "")

Parameters:

  • expression (IO, StringIO, String, #to_s)

    (ShExC or ShExJ)

  • focus (RDF::Term)
  • graph (RDF::Queryable)
  • map (Hash{RDF::Resource => RDF::Resource})
  • shapeExterns (Array<Schema, String>)

    ([]) One or more schemas, or paths to ShEx schema resources used for finding external shapes.

  • options (Hash{Symbol => Object})

Returns:

  • (Operand)

    Returns operand graph annotated with satisfied and unsatisfied operations.

Raises:



74
75
76
77
78
79
# File 'lib/shex.rb', line 74

def self.execute(expression, queryable, focus, shape, format: 'shexc', **options)
  shex = self.parse(expression, options.merge(format: format))
  queryable = queryable || RDF::Graph.new

  shex.execute(focus, queryable, {focus => shape}, options)
end