Class: ShEx::Algebra::NodeConstraint
- Includes:
- ShapeExpression
- Defined in:
- lib/shex/algebra/node_constraint.rb
Constant Summary collapse
- NAME =
:nodeConstraint
Constants inherited from Operator
Instance Attribute Summary
Attributes inherited from Operator
#id, #logger, #operands, #options, #schema
Class Method Summary collapse
-
.from_shexj(operator, **options) ⇒ Operator
Creates an operator instance from a parsed ShExJ representation.
Instance Method Summary collapse
-
#satisfies?(focus, depth: 0) ⇒ Boolean, ShapeExpression
S is a NodeConstraint and satisfies2(focus, se) as described below in Node Constraints.
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=, #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=, #validate!, #value, value
Constructor Details
This class inherits a constructor from ShEx::Algebra::Operator
Class Method Details
.from_shexj(operator, **options) ⇒ Operator
Creates an operator instance from a parsed ShExJ representation
12 13 14 15 |
# File 'lib/shex/algebra/node_constraint.rb', line 12 def self.from_shexj(operator, **) raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == 'NodeConstraint' super end |
Instance Method Details
#satisfies?(focus, depth: 0) ⇒ Boolean, ShapeExpression
S is a NodeConstraint and satisfies2(focus, se) as described below in Node Constraints. Note that testing if a node satisfies a node constraint does not require a graph or shapeMap.
22 23 24 25 26 27 28 29 30 |
# File 'lib/shex/algebra/node_constraint.rb', line 22 def satisfies?(focus, depth: 0) status "", depth: depth satisfies_node_kind?(focus, depth: depth + 1) && satisfies_datatype?(focus, depth: depth + 1) && satisfies_string_facet?(focus, depth: depth + 1) && satisfies_numeric_facet?(focus, depth: depth + 1) && satisfies_values?(focus, depth: depth + 1) && satisfy(depth: depth) end |