eyereasoner / eye-js

A distribution of EYE reasoner in the JavaScript ecosystem using Webassembly.
https://eyereasoner.github.io/eye-js/example/
MIT License
39 stars 5 forks source link

Using --strings flag? #129

Closed william-vw closed 1 year ago

william-vw commented 1 year ago

I tried the following as per the README (great job btw :-) to pass any flag to eye-js: https://notation3.org/eyejs/test-strings.html

But the "--strings" flag does not seem to work. As a sanity check I also tried with "--pass-only-new" which outputs the expected inferences. Also checked the N3 code with the command-line eye (using strings flag) and it works there.

jeswr commented 1 year ago

I've just tried running the following with the eye-js cli

$ npx eyereasoner --quiet --strings ./data.n3

where data.n3 is

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix : <http://example.org/>.

:Let :output "abc" .

{ :Let :output ?out } => { 1 log:outputString ?out } .

and there is no output so there does seem to be a bug.

@josd is the log:outputString using stdout differently from other results in eye?

josd commented 1 year ago

It is in exactly the same way that the output via --strings is written. When I test locally, I also don't see any output from

<script src="https://code.jquery.com/jquery-3.6.3.min.js"></script>
<script src="https://eyereasoner.github.io/eye-js/3/latest/index.js"></script>

<script>
    async function eyeWithFlags(files, flags) {
        let output = "";
        const Module = await eyereasoner.SwiplEye({ print: (str) => { output += str + "\n" }, arguments: ['-q'] });

        for (let file of files)
            Module.FS.writeFile(file.path, file.data);

        eyereasoner.queryOnce(Module, 'main', flags);
        return output;
    }
</script>

<script type="module">

    const data = `
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix : <http://example.org/>.

:Let :output "abc" .

{ :Let :output ?out } => { 1 log:outputString ?out } .
`

    let out = await eyeWithFlags([
            { path: 'data.n3', data: data }
        ], 
        ['--nope', '--pass-only-new', '--n3', './data.n3'] // works
        // ['--strings', '--n3', './data.n3'] // does not work
    );
    console.log(out);

</script>
jeswr commented 1 year ago

This is fixed as of v3.1.2 :tada: - lets leave this issue open until we add some tests to avoid regressions.

jeswr commented 1 year ago

:tada: This issue has been resolved in version 4.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: