Class: ShEx::Algebra::Not
- Inherits:
-
Operator::Unary
- Object
- Operator
- Operator::Unary
- ShEx::Algebra::Not
- Includes:
- ShapeExpression
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/not.rb
Constant Summary collapse
- NAME =
:not
Constants inherited from Operator::Unary
Constants inherited from Operator
Constants included from SPARQL::Algebra::Expression
SPARQL::Algebra::Expression::PATTERN_PARENTS
Constants included from RDF::Util::Logger
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
- #json_type ⇒ Object
-
#satisfies?(focus, depth: 0) ⇒ Boolean, ShapeExpression
S is a ShapeNot and for the shape expression se2 at shapeExpr, notSatisfies(n, se2, G, m).
-
#validate! ⇒ Operator
expressions must be ShapeExpressions or references to ShapeExpressions and must not reference itself recursively.
Methods included from ShapeExpression
#validate_expressions!, #validate_self_references!
Methods inherited from Operator::Unary
Methods inherited from Operator
#base_uri, #closed?, #dup, #each_descendant, #eql?, #expression, #expressions, #find, #focus, #focus=, #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=, 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?, #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::Unary
Class Method Details
.from_shexj(operator, **options) ⇒ Operator
Creates an operator instance from a parsed ShExJ representation
11 12 13 14 15 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/not.rb', line 11 def self.from_shexj(operator, **) raise ArgumentError unless operator.is_a?(Hash) && operator['type'] == 'ShapeNot' raise ArgumentError, "missing shapeExpr in #{operator.inspect}" unless operator.has_key?('shapeExpr') super end |
Instance Method Details
#json_type ⇒ Object
58 59 60 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/not.rb', line 58 def json_type "ShapeNot" end |
#satisfies?(focus, depth: 0) ⇒ Boolean, ShapeExpression
S is a ShapeNot and for the shape expression se2 at shapeExpr, notSatisfies(n, se2, G, m).
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/not.rb', line 23 def satisfies?(focus, depth: 0) status "" op = expressions.last satisfied_op = begin case op when RDF::Resource schema.enter_shape(op, focus) do |shape| if shape shape.satisfies?(focus, depth: depth + 1) else status "Satisfy as #{op} was re-entered for #{focus}", depth: depth shape end end when ShapeExpression op.satisfies?(focus, depth: depth + 1) end rescue ShEx::NotSatisfied => e return satisfy focus: focus, satisfied: e.expression.unsatisfied, depth: depth end not_satisfied "Expression should not have matched", focus: focus, unsatisfied: satisfied_op, depth: depth end |
#validate! ⇒ Operator
expressions must be ShapeExpressions or references to ShapeExpressions and must not reference itself recursively.
52 53 54 55 56 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/not.rb', line 52 def validate! validate_expressions! validate_self_references! super end |