eyereasoner / eye

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

list:memberAt not working for a list from a ttl file #121

Closed MichelSc closed 3 days ago

MichelSc commented 4 days ago

list:memberAt does not work for a list from a ttl file.

I have a ttl file with 1 list :

:list1 :list ( :a :b :c ).

I have a n3 file, applying list:memberAt on that list:

{
    :list1 :list ?l.
    (?l ?index) list:memberAt :b.
    (?l 1) list:memberAt ?elem.
} => {
    :result :index ?index.
    :result :elem ?elem.
}.

Running this query gives nothing: NOK. I expect to receive

ns1:result ns1:index 1 .
ns1:result ns1:elem ns1:b.

If I put the list statement in the n3 file, I get the expected result.

If I rewrite list:memberAt as follows, then the list statement from a ttl file works.

{
    ( ?list 0 ) :memberAt ?member.
} <= {
    ?list rdf:first ?member.
}.
{
    ( ?list ?index ) :memberAt ?member.
} <= {
    ?list rdf:rest ?tail.
    ( ?tail ?index-minus1 ) :memberAt ?member.
    ( ?index-minus1 1 ) math:sum ?index.
}.

Note that the other list builtins work OK for list from ttl files.

Seems related to #120 and #117, where statements in ttl files give a different result from the same statements n3 files.

josd commented 4 days ago

Should now be working fine in EYE v10.30.3 (2024-11-13). A few other list: built-ins were also fixed.

MichelSc commented 3 days ago

Works ok with 10.30.3.

josd commented 3 days ago

Thanks