lib/shex/algebra/satisfiable.rb in shex-0.1.0 vs lib/shex/algebra/satisfiable.rb in shex-0.2.0
- old
+ new
@@ -1,36 +1,18 @@
require 'sparql/algebra'
-require 'sparql/extensions'
module ShEx::Algebra
# Implements `satisfies?` and `not_satisfies?`
module Satisfiable
##
# Satisfies method
- # @param [RDF::Resource] n
- # @return [Boolean] `true` if satisfied, `false` if it does not apply
- # @raise [ShEx::NotSatisfied] if not satisfied
+ # @param [RDF::Resource] focus
+ # @return [TripleExpression] with `matched` and `satisfied` accessors for matched triples and sub-expressions
+ # @raise [ShEx::NotMatched] with `expression` accessor to access `matched` and `unmatched` statements along with `satisfied` and `unsatisfied` operations.
# @see [https://shexspec.github.io/spec/#shape-expression-semantics]
- def satisfies?(n)
+ def satisfies?(focus)
raise NotImplementedError, "#satisfies? Not implemented in #{self.class}"
end
-
- ##
- # Satisfies method
- # @param [RDF::Resource] n
- # @return [Boolean] `true` if not satisfied, `false` if it does not apply
- # @raise [ShEx::NotSatisfied] if satisfied
- # @see [https://shexspec.github.io/spec/#shape-expression-semantics]
- def not_satisfies?(n)
- begin
- satisfies?(n)
- rescue ShEx::NotSatisfied => e
- log_recover(self.class.const_get(:NAME), "ignore error: #{e.message}", depth: options.fetch(:depth, 0))
- return true # Expected it to not satisfy
- end
- not_satisfied "Expression should not have matched"
- end
- alias_method :notSatisfies?, :not_satisfies?
##
# Included TripleExpressions
# @return [Array<TripleExpressions>]
def triple_expressions