Class: ShEx::Algebra::Stem
- Inherits:
-
Operator::Unary
- Object
- Operator
- Operator::Unary
- ShEx::Algebra::Stem
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/stem.rb
Direct Known Subclasses
Constant Summary collapse
- NAME =
:stem
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
-
#match?(value, depth: 0) ⇒ Boolean
For a node n and constraint value v, nodeSatisfies(n, v) if n matches some valueSetValue vsv in v.
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=, #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::Unary
Class Method Details
.from_shexj(operator, **options) ⇒ Operator
Creates an operator instance from a parsed ShExJ representation
10 11 12 13 14 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/stem.rb', line 10 def self.from_shexj(operator, **) raise ArgumentError unless operator.is_a?(Hash) && %w(IriStem LiteralStem LanguageStem).include?(operator['type']) raise ArgumentError, "missing stem in #{operator.inspect}" unless operator.has_key?('stem') super end |
Instance Method Details
#json_type ⇒ Object
30 31 32 33 34 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/stem.rb', line 30 def json_type # FIXME: This is funky, due to oddities in normative shexj t = self.class.name.split('::').last #parent.is_a?(Value) ? "#{t}Range" : t end |
#match?(value, depth: 0) ⇒ Boolean
For a node n and constraint value v, nodeSatisfies(n, v) if n matches some valueSetValue vsv in v. A term matches a valueSetValue if:
- vsv is a Stem with stem st and nodeIn(n, st).
20 21 22 23 24 25 26 27 28 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/shex-f64040a493d0/lib/shex/algebra/stem.rb', line 20 def match?(value, depth: 0) if value.start_with?(operands.first) status "matched #{value}", depth: depth true else status "not matched #{value}", depth: depth false end end |