Class: ShEx::Algebra::Start

Inherits:
Operator::Unary show all
Includes:
Satisfiable
Defined in:
lib/shex/algebra/start.rb

Constant Summary collapse

NAME =
:start

Constants inherited from Operator::Unary

Operator::Unary::ARITY

Constants inherited from Operator

Operator::ARITY

Instance Attribute Summary

Attributes inherited from Operator

#label, #logger, #operands, #options, #schema

Instance Method Summary collapse

Methods included from Satisfiable

#satisfiable?

Methods inherited from Operator::Unary

#initialize

Methods inherited from Operator

#base_uri, #closed?, #each_descendant, #eql?, #first_ancestor, #focus, #focus=, from_shexj, #initialize, #inspect, #iri, iri, #json_type, #matched, #matched=, #message, #message=, #not_matched, #not_satisfied, #operand, #parent, #parent=, #satisfiable?, #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=, #validate!, value, #value

Constructor Details

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ShEx::Algebra::Operator

Instance Method Details

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

Parameters:

  • focus (RDF::Resource)
  • depth (Integer) (defaults to: 0)

    for logging

  • options (Hash{Symbol => Object})

    Other, operand-specific options

Returns:

  • (Boolean)
  • (Operator)

    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
# File 'lib/shex/algebra/start.rb', line 11

def satisfies?(focus, depth: 0)
  status "", depth: depth
  matched_op = operands.first.satisfies?(focus, depth: depth + 1)
  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