Module: ShEx::Algebra::ShapeExpression
- Defined in:
- lib/shex/algebra/shape_expression.rb
Overview
Implements satisfies?
and not_satisfies?
Instance Method Summary collapse
-
#satisfies?(focus, depth: 0, **options) ⇒ ShapeExpression
Satisfies method.
-
#validate_expressions! ⇒ Object
expressions must be ShapeExpressions or references.
-
#validate_self_references! ⇒ Object
An Operator with a label must contain a reference to itself.
Instance Method Details
#satisfies?(focus, depth: 0, **options) ⇒ ShapeExpression
Satisfies method
15 16 17 |
# File 'lib/shex/algebra/shape_expression.rb', line 15 def satisfies?(focus, depth: 0, **) raise NotImplementedError, "#satisfies? Not implemented in #{self.class}" end |
#validate_expressions! ⇒ Object
expressions must be ShapeExpressions or references.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/shex/algebra/shape_expression.rb', line 23 def validate_expressions! expressions.each do |op| case op when ShapeExpression when RDF::Resource ref = schema.find(op) ref.is_a?(ShapeExpression) || structure_error("#{json_type} must reference a ShapeExpression: #{ref}") else structure_error("#{json_type} must be a ShapeExpression or reference: #{op.to_sxp}") end end end |
#validate_self_references! ⇒ Object
An Operator with a label must contain a reference to itself.
41 42 43 44 45 46 |
# File 'lib/shex/algebra/shape_expression.rb', line 41 def validate_self_references! return # FIXME: needs to stop at a TripleConstraint each_descendant do |op| structure_error("#{json_type} must not reference itself (#{id}): #{op.to_sxp}") if op.references.include?(id) end end |