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

strange behavior of backward rule #30

Closed
blackwint3r opened this issue Dec 28, 2021 · 4 comments
Closed

strange behavior of backward rule #30

blackwint3r opened this issue Dec 28, 2021 · 4 comments

Comments

@blackwint3r
Copy link

blackwint3r commented Dec 28, 2021

I’m confused by the behavior of backward rule.
this example:

:Alice :type :human.
{?x :type :animal} <= {?x :type :human}. 
{?x :type :animal} => {?x :type :animal}. # not fired
{?x :type :animal} => {?x :type2 :animal}. # fired.

Give me result:
:Alice :type2 :animal

not what I expected :

:Alice :type :animal
:Alice :type2 :animal

Why did the third rule fired while the second one did not ?

@josd
Copy link
Collaborator

josd commented Dec 28, 2021

This is indeed what EYE currently does.
The conclusion of a backward rule is never asserted as it could be non ground.
The conclusion of a forward rule is asserted when it fails and the premis succeeds.

@blackwint3r
Copy link
Author

blackwint3r commented Dec 28, 2021

Because the conclusion of second rule is succeeds already so it would not assert again. Thank you ! I got it.
But this is a bit counterintuitive, since by {?x :type :animal} => {?x :type :animal}, I told EYE make the conclusion not only succeed but also asserted ...

@josd
Copy link
Collaborator

josd commented Dec 28, 2021

A query would do what you want

$ cat example.n3
PREFIX : <http://example.org/test#>

:Alice :type :human.
{?x :type :animal} <= {?x :type :human}.

$ cat query.n3
PREFIX : <http://example.org/test#>

{?x :type :animal} => {?x :type :animal}.
{?x :type :animal} => {?x :type2 :animal}.

$ eye --quiet --nope example.n3 --query query.n3 2>/dev/null
PREFIX : <http://example.org/test#>

:Alice :type :animal.
:Alice :type2 :animal.

This is because query rules don't assert their conclusions but give them as answers.

@blackwint3r
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants