Module: ShEx::Algebra::TripleExpression
- Included in:
- EachOf, Inclusion, OneOf, TripleConstraint
- Defined in:
- lib/shex/algebra/triple_expression.rb
Overview
Implements ‘neigh`, `arcs_out`, `args_in` and `matches`
Instance Method Summary collapse
-
#matches(t) ⇒ Array<RDF::Statement>
‘matches`: asserts that a triple expression is matched by a set of triples that come from the neighbourhood of a node in an RDF graph.
-
#maximum ⇒ Integer, Float::INFINITY
Maximum constraint (defaults to 1).
-
#minimum ⇒ Integer
Minimum constraint (defaults to 1).
-
#triple_constraints ⇒ Array<TripleConstraints>
Included TripleConstraints.
-
#triple_expression? ⇒ Boolean
This operator includes TripleExpression.
Instance Method Details
#matches(t) ⇒ Array<RDF::Statement>
‘matches`: asserts that a triple expression is matched by a set of triples that come from the neighbourhood of a node in an RDF graph. The expression `matches(T, expr, m)` indicates that a set of triples `T` can satisfy these rules…
Behavior should be overridden in subclasses, which end by calling this through ‘super`.
16 17 18 |
# File 'lib/shex/algebra/triple_expression.rb', line 16 def matches(t) raise NotImplementedError, "#matches Not implemented in #{self.class}" end |
#maximum ⇒ Integer, Float::INFINITY
Maximum constraint (defaults to 1)
38 39 40 41 |
# File 'lib/shex/algebra/triple_expression.rb', line 38 def maximum op = operands.detect {|o| o.is_a?(Array) && o.first == :max} || [:max, 1] op[1] == '*' ? Float::INFINITY : op[1] end |
#minimum ⇒ Integer
Minimum constraint (defaults to 1)
30 31 32 33 |
# File 'lib/shex/algebra/triple_expression.rb', line 30 def minimum op = operands.detect {|o| o.is_a?(Array) && o.first == :min} || [:min, 1] op[1] end |
#triple_constraints ⇒ Array<TripleConstraints>
Included TripleConstraints
23 24 25 |
# File 'lib/shex/algebra/triple_expression.rb', line 23 def triple_constraints operands.select {|o| o.is_a?(TripleExpression)}.map(&:triple_constraints).flatten.uniq end |
#triple_expression? ⇒ Boolean
This operator includes TripleExpression
44 |
# File 'lib/shex/algebra/triple_expression.rb', line 44 def triple_expression?; true; end |