Class: ShEx::Algebra::External

Inherits:
Operator
  • Object
show all
Includes:
ShapeExpression
Defined in:
lib/shex/algebra/external.rb

Constant Summary collapse

NAME =
:external

Constants inherited from Operator

Operator::ARITY

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

#base_uri, #closed?, #dup, #each_descendant, #eql?, #expression, #expressions, #find, #focus, #focus=, from_shexj, #initialize, #inspect, #iri, iri, #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=, #validate!, #value, value

Constructor Details

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

Instance Method Details

#json_typeObject



23
24
25
# File 'lib/shex/algebra/external.rb', line 23

def json_type
  "ShapeExternal"
end

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

S is a ShapeRef and the Schema’s shapes maps reference to a shape expression se2 and satisfies(n, se2, G, m).

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/shex/algebra/external.rb', line 9

def satisfies?(focus, depth: 0)
  extern_shape = nil

  # Find the id for this external
  not_satisfied("Can't find id for this extern", depth: depth) unless id

  schema.external_schemas.each do |schema|
    extern_shape ||= schema.shapes.detect {|s| s.id == id}
  end

  not_satisfied("External not configured for this shape", depth: depth) unless extern_shape
  extern_shape.satisfies?(focus, depth: depth + 1)
end