Class: ShEx::Algebra::NodeConstraint

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

Constant Summary collapse

NAME =
:nodeConstraint

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

Class Method Summary collapse

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=, #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

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?, #validate!, #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

Class Method Details

.from_shexj(operator, **options) ⇒ Operator

Creates an operator instance from a parsed ShExJ representation

Returns:

Raises:

  • (ArgumentError)


12
13
14
15
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/node_constraint.rb', line 12

def self.from_shexj(operator, **options)
  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.

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.



22
23
24
25
26
27
28
29
30
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/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