eye
eye copied to clipboard
No output from log:callWithOptional or log:bound
Based on a discussion, we created a rule similar to that below.
It works in eye but there is not output when switched to eye-js
.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix : <http://example.com/>.
:object1 :Title :title1.
:title1 :Type :type1.
:object2 :Title :title2.
:object3 :Title :title3.
:title3 :Type :type3.
{
{
?object :Title ?title.
} log:callWithOptional {
?title :Type ?type.
}.
?type log:bound false.
} => {
?object :TitleWithoutType ?title.
}.
https://n3-editor.herokuapp.com/n3/editor/s/QjFkNFED
@william-vw would it be possible to work with the latest eye-js that is https://eyereasoner.github.io/eye-js/latest/index.js instead of https://eyereasoner.github.io/eye-js/3/latest/index.js ? Or if not possible, then at least work with https://eyereasoner.github.io/eye-js/4/latest/index.js
Oh, the UI is using an old version? That's a red herring apparently
We are still having issues with the JS lib, but as it turns out, only when passing in quads: https://runkit.com/embed/xa0qvolbwp7s
When the input is an n3 string, the output is as expected: https://runkit.com/embed/aywnzamumxq0
Problem with n3
parser?
AHA, got it. Here's what happens. When we pass in parsed quads, they get serialised by the JS in a different order
{
?type <http://www.w3.org/2000/10/swap/log#bound> false .
{
?object <http://example.com/Title> ?title .
}
<http://www.w3.org/2000/10/swap/log#callWithOptional> {
?title <http://example.com/Type> ?type .
} .
} => {
?object <http://example.com/TitleWithoutType> ?title .
} .
<http://example.com/object1> <http://example.com/Title> <http://example.com/title1> .
<http://example.com/title1> <http://example.com/Type> <http://example.com/type1> .
<http://example.com/object2> <http://example.com/Title> <http://example.com/title2> .
<http://example.com/object3> <http://example.com/Title> <http://example.com/title3> .
<http://example.com/title3> <http://example.com/Type> <http://example.com/type3> .
Written this way, the output of eye is also wrong: https://n3-editor.herokuapp.com/n3/editor/s/LEtH5WsO
You are right, this is indeed order dependent and we added a log:call
to impose an order: first call subject, then call object.
So with
{
{
{
?object <http://example.com/Title> ?title .
} <http://www.w3.org/2000/10/swap/log#callWithOptional> {
?title <http://example.com/Type> ?type .
} .
} <http://www.w3.org/2000/10/swap/log#call> {
?type <http://www.w3.org/2000/10/swap/log#bound> false .
} .
} => {
?object <http://example.com/TitleWithoutType> ?title .
} .
<http://example.com/object1> <http://example.com/Title> <http://example.com/title1> .
<http://example.com/title1> <http://example.com/Type> <http://example.com/type1> .
<http://example.com/object2> <http://example.com/Title> <http://example.com/title2> .
<http://example.com/object3> <http://example.com/Title> <http://example.com/title3> .
<http://example.com/title3> <http://example.com/Type> <http://example.com/type3> .
and EYE v3.10.0
it should just give
<http://example.com/object2> <http://example.com/TitleWithoutType> <http://example.com/title2>.
So log:call
is something new added only in 3.10?
Yes indeed it is added in EYE v3.10.0 and PH2 v1.1.0
@william-vw would it be possible to work with the latest eye-js that is https://eyereasoner.github.io/eye-js/latest/index.js instead of https://eyereasoner.github.io/eye-js/3/latest/index.js ? Or if not possible, then at least work with https://eyereasoner.github.io/eye-js/4/latest/index.js
Ok - I switched the editor to https://eyereasoner.github.io/eye-js/latest/index.js
Great and thanks a lot @william-vw ! https://n3-editor.herokuapp.com/n3/editor/s/z8ZKamOl now works perfectly with eye-js
You are right, this is indeed order dependent and we added a
log:call
to impose an order: first call subject, then call object.
I am slightly surprised by this. When parsed, triples have not order. I see how the graphs are chained together by log:call
but should that be even necessary?
Given rule like the original above, wouldn't it be possible to determine that the value of ?title
needs to be evaluated before the :TitleWithoutType
pattern? Regardless of the order of triples...
IMHO there is no general algorithm to do a reordering for any kind of premise triples.
Written this way, the output of eye is also wrong: https://n3-editor.herokuapp.com/n3/editor/s/LEtH5WsO
@josd - should this issue be transferred to https://github.com/eyereasoner/eye?
The log:bound
built-in is order dependent and the order can be imposed with log:call
like done in https://github.com/eyereasoner/eye/issues/82#issuecomment-1475891389
For this particular case we could shift log:bound
to the last position of the premis, but IMHO there is no general rule to fix order dependent issues. See also https://github.com/eyereasoner/eye/issues/25