Pengine issue

I’m using: pengines and JavaPengines library latest version on Github

I want the code to: I want to send a sourceText and query to the pengines server using the JavaPengines library.

But what I’m getting is: However, from the extensive trial and error, it seems the JavaPengine library is somehow not compiling or executing the sourceText being sent.

My code looks like this:

PengineBuilder builder = new PengineBuilder();
        try {
            builder.setServer("http://localhost:3030/");
            builder.setDestroy(false);
            builder.setSrctext("cat(tom).");
            builder.removeAsk();
            pengine = builder.newPengine();
            pengine.dumpStateDebug();

            Query query = pengine.ask("cat(X).");
            pengine.dumpStateDebug();

            if ( !query.hasNext() )
                fail("Query did not fetch result");

        } catch (MalformedURLException
            | CouldNotCreateException
            | PengineNotReadyException e) {
                e.printStackTrace();
                fail("could not query server: " + e.getLocalizedMessage());
        } finally {
            if ( pengine != null && !pengine.isDestroyed() )
                pengine.destroy();
        }

FYI, tried to debug this with @ AnnieTheObscure already and raising it here as discussed with her. Thanks Annie for all the help and thanks to everyone here in advance for your help.

Since bitrot in the JavaPengines libs is already a candidate, you might try running the tests. If you have JavaPengines running already should be trivial to do.

I don’t think there has been renaming in the Prolog part or the JavaScript part. Git log might help.

1 Like

Jan - at one point didn’t the x-prolog script tag support go away, or some such? My memory is hazy here, but remember some interaction with you and Torbjorn when writing JavaPengines.

I’ve been writing a Pengine plugin for Netbeans (my preferred IDE), and have playing with the Java Pengines library, and noted a few issues.
@anniepoo There is currently a bug in the JavaPengines java library. It is sending Srctext with the name ‘srctext’, whereas it should be ‘src_text’, similarly, srcurl maybe should be src_url (not tested).
When using the library, the ask query should not end with a period since behind the scenes the query is embedded inside an ask() prolog term!
Hopefully this should get you kickstarted.

1 Like

Hey, thanks!
if you’ve patched your version, could you send a PR? if not, sighosh, sounds like a fix - anyway, if somebody sends pr that’d be cool.