Class: ShEx::Algebra::Start

Inherits:
Operator::Unary show all
Includes:
ShapeExpression
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/start.rb

Constant Summary collapse

NAME =
:start

Constants inherited from Operator::Unary

Operator::Unary::ARITY

Constants inherited from Operator

Operator::ARITY

Constants included from SPARQL::Algebra::Expression

SPARQL::Algebra::Expression::PATTERN_PARENTS

Constants included from RDF::Util::Logger

RDF::Util::Logger::IOWrapper

Instance Attribute Summary

Attributes inherited from Operator

#id, #logger, #operands, #options, #schema

Instance Method Summary collapse

Methods included from ShapeExpression

#validate_expressions!, #validate_self_references!

Methods inherited from Operator::Unary

#initialize

Methods inherited from Operator

#base_uri, #closed?, #dup, #each_descendant, #eql?, #expression, #expressions, #find, #focus, #focus=, from_shexj, #initialize, #inspect, #iri, iri, #json_type, #matched, #matched=, #message, #message=, #not_matched, #not_satisfied, #operand, #parent, #parent=, #references, #satisfied, #satisfied=, #satisfy, #semact?, #semantic_actions, #serialize_value, #status, #structure_error, #to_h, #to_json, #to_sxp, #to_sxp_bin, #triple_expression?, #unmatched, #unmatched=, #unsatisfied, #unsatisfied=, value, #value

Methods included from SPARQL::Algebra::Expression

cast, #constant?, #evaluate, extension, extension?, extensions, for, #invalid?, new, #node?, open, #optimize, #optimize!, parse, register_extension, #to_sxp_bin, #valid?, #variable?

Methods included from RDF::Util::Logger

#log_debug, #log_depth, #log_error, #log_fatal, #log_info, #log_recover, #log_recovering?, #log_statistics, #log_warn, #logger

Constructor Details

This class inherits a constructor from ShEx::Algebra::Operator::Unary

Instance Method Details

#satisfies?(focus, depth: 0) ⇒ Boolean, ShapeExpression

Parameters:

Returns:

  • (Boolean)
  • (ShapeExpression)

    with matched and satisfied accessors for matched triples and sub-expressions

Raises:

  • (ShEx::NotMatched)

    with expression accessor to access matched and unmatched statements along with satisfied and unsatisfied operations.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/start.rb', line 11

def satisfies?(focus, depth: 0)
  status "", depth: depth
  matched_op = case expression
  when RDF::Resource
    schema.enter_shape(expression, focus) do |shape|
      if shape
        shape.satisfies?(focus, depth: depth + 1)
      else
        status "Satisfy as #{expression} was re-entered for #{focus}", depth: depth
        nil
      end
    end
  when ShapeExpression
    expression.satisfies?(focus, depth: depth + 1)
  end
  satisfy focus: focus, satisfied: matched_op, depth: depth
rescue ShEx::NotSatisfied => e
  not_satisfied e.message, focus: focus, unsatisfied: e.expression, depth: depth
  raise
end

#validate!Operator

expressions must be ShapeExpressions or references to ShapeExpressions

Returns:

Raises:



37
38
39
40
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/start.rb', line 37

def validate!
  validate_expressions!
  super
end