0

我在尝试使用interprolog时遇到了很困难的时间

我有一些代码,试图调用 prolog 命令,问题是我的 prolog 数据库的实际加载。这是代码:

    myEngine = new NativeEngine();
    myEngine.consultFromPackage("userlist.p", LoginHandler.class);
    boolean x = myEngine.deterministicGoal("has_access(user,pass)");

当我运行程序 prolog 初始化正常时,它会尝试查找位于同一包(第二行代码)中的 userlist.p,然后抛出此错误:

Exception in thread "AWT-EventQueue-0" com.declarativa.interprolog.util.IPException: Problem consulting from package archive:C:\Users\Keval\AppData\Local\Temp\IP_6971701367857416872\userlist.p
at com.declarativa.interprolog.AbstractPrologEngine.consultFromPackage(AbstractPrologEngine.java)
at handlers.LoginHandler.actionPerformed(LoginHandler.java:25)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

我查看了consultFromPackage的代码:

public void consultFromPackage(String filename,Object requester){
        String path = cleanPath(copyToTemp(filename,requester).getPath());
        path = unescapedFilePath(path);
        progressMessage("consultFromPackage:"+path);
        if (!command("consult('"+path+"')"))
        throw new IPException("Problem consulting from package archive:"+path);
    }

但我似乎无法找到问题的根源......我知道这有点遥远,但在这一点上任何帮助表示赞赏。

谢谢

4

1 回答 1

0

我的猜测是路径出了点问题,并且没有user.p在预期的位置找到。尝试从一个最小的命令行测试程序开始,以了解这些库如何在一个简单的原型中工作。

于 2010-03-01T04:21:54.060 回答