Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern Matcher: NotLink AbsentLink not working #215

Closed
linas opened this issue Aug 20, 2015 · 2 comments
Closed

Pattern Matcher: NotLink AbsentLink not working #215

linas opened this issue Aug 20, 2015 · 2 comments

Comments

@linas
Copy link
Member

linas commented Aug 20, 2015

Since AbsentLink requests that a certain pattern be absent from the atomspace, NotLink AbsentLink should have the semantics that the pattern is present. However, this currently fails. This is marked as an enhancement/feature-request, since it dates back over five years, to the original introduction of optional links in the pattern matcher.

Some examples:

;; print something and return an atom.
(define (sayit) (display "ola\n") (ConceptNode "trigger"))

;; threee slightly different bindlinks
(define fnd (BindLink
     (EvaluationLink
         (PredicateNode "room status")
         (VariableNode "$stat"))
   (ExecutionOutputLink
      (GroundedSchemaNode "scm: sayit") (ListLink))))

(define abs (BindLink
   (AbsentLink
     (EvaluationLink
         (PredicateNode "room status")
         (VariableNode "$stat")))
   (ExecutionOutputLink
      (GroundedSchemaNode "scm: sayit") (ListLink))))

(define nabs (BindLink
   (NotLink (AbsentLink
     (EvaluationLink
         (PredicateNode "room status")
         (VariableNode "$stat"))))
   (ExecutionOutputLink
      (GroundedSchemaNode "scm: sayit") (ListLink))))

If one runs this, one gets

(cog-bind fnd)  ;;; prints nothing, returns empty set.
(cog-bind abs) ;;; prints 'ola', returns 'trigger'
(cog-bind nabs)  ;; throws C++ exception

Now, define the following, and run again:

(EvaluationLink (PredicateNode "room status") (ConceptNode "occupied"))
(cog-bind fnd) ;;; prints 'ola', returns 'trigger'
(cog-bind abs) ;;; prints nothing, returns empty set
(cog-bind nabs) ;; throws c++ exception.

Hint: use cog-delete to delete the EvaluationLink, if you want to run this again.

This issue is closely related to issue #217 which says that AbsentLink is the same as NotLink-ChocieLink. It will probably be hard to implement, because the concept of absence can only be proved in the affirmative, not the negative: AbsentLinks are usual virtual links, that are evaluated only after all of thier arguments are already grounded.

This is marked "enhancement" because it is low-priority, it is not needed for any current projects; it is not blocking any work. It also has a reasonable work-around: just use an arity-1 ChoiceLink!

@linas
Copy link
Member Author

linas commented May 20, 2019

Fixed in #2174

1 similar comment
@linas
Copy link
Member Author

linas commented May 20, 2019

Fixed in #2174

@linas linas closed this as completed May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant