eyereasoner / eye

Euler Yet another proof Engine
https://eyereasoner.github.io/eye/
MIT License
124 stars 17 forks source link

Repeated statements in ttl file cause unexpected reasoning result #120

Open MichelSc opened 3 weeks ago

MichelSc commented 3 weeks ago

I use eye version

EYE v10.22.5 (2024-09-11)
SWI-Prolog version 8.4.2

I have a ttl file with my data and model (2 instances, 2 classes)

:d rdf:type :D.
:d rdf:type :D.
:e rdf:type :E.

Note the repetition of statement :d rdf:type :D

I associate a number to instances according to their type:

{
    ?d :op 1.
} <= {
    ?d rdf:type :D.
}.
{
    ?e :op 2.
} <= {
    ?e rdf:type :E.
}.

I want to map a list of instances to their associated number:

:let :myl (:d :e).
{
    :let :myl ?l.
    ( ?v { ?l list:member ?e. ?e :op ?v} ?vs ) log:collectAllIn _:x.
} => {
    :result :is ?vs.
}.

I get the result

ns1:result ns1:is (1 1 2).

Note the repetition of 1: NOK. I expect to receive (1 2).

If I remove the repetition of statement :d rdf:type :D, I get the expected result.

If I put my data and model in the n3 file, I get the expected result.

josd commented 3 weeks ago

Thanks for your observation and with EYE v10.27.6 (2024-10-23) we now have

$ cat ms1.ttl
@prefix : <http://example.org/#>.

:d a :D.
:d a :D.
:e a :E.
$ cat ms1.n3
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix : <http://example.org/#>.

{
    ?d :op 1.
} <= {
    ?d a :D.
}.

{
    ?e :op 2.
} <= {
    ?e a :E.
}.

:let :myl (:d :e).
{
    :let :myl ?l.
    ( ?v { ?l list:member ?e. ?e :op ?v} ?vs ) log:collectAllIn _:x.
} => {
    :result :is ?vs.
}.
$ eye --quiet --nope --turtle ms1.ttl ms1.n3 --pass-only-new
@prefix ns1: <http://example.org/#>.

ns1:result ns1:is (1 2).
MichelSc commented 3 weeks ago

Successfully tested with 10.27.6

Thank you