[JPL][DCG] Load .pl file from internet

Nhat HV <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Hi experts,

I am able to use prolog with JPL. I try to load .pl file from internet, but, some errors occur. What should I do for loading a pl file from internet?

I have taken demo :

—
JPL.init();

        Term consult_arg[] = {
            new Atom(ExampleJPL001.class.getResource(
            "demo001.pl").getPath())
        };
        Query consult_query
                = new Query(
                        "consult",
                        consult_arg);

        boolean consulted = consult_query.hasSolution();

        System.out.println("consult " + (consult_query.hasSolution() ? "succeeded" : "failed"));

        if (!consulted) {
            System.err.println("Consult failed");
            System.exit(1);
        }
—

 it is OK. But, when I use this code for Java/Servlet:

—
        String filePath = "http://localhost:8080/Website/prolog/demo001.pl";

        System.out.println("filePath = " + filePath);

        Term consult_arg[] = {
            new Atom(
            filePath)
        };
        Query consult_query
                = new Query(
                        "consult",
                        consult_arg);

        boolean consulted = consult_query.query();
—

there is the error:

—
jpl.PrologException: PrologException: error(existence_error(source_sink, 'http://localhost:8080/Website/prolog/demo001.pl'), _0)
—


Best regards,
Nhat HV.

-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.