【问题标题】:Using aleph with SWI-prolog: source_sink `library(aleph)' does not exist将 aleph 与 SWI-prolog 一起使用:source_sink `library(aleph)' 不存在
【发布时间】:2018-06-17 20:04:53
【问题描述】:

我正在尝试使用 SWI-Prolog 导入 Aleph。当我运行我的程序时,我收到以下错误。我需要做什么才能导入library(aleph)?顺便说一句,我已经为我的程序下载了aleph.pl。 这是我的测试程序,我知道库 aleph 一定有问题。

:- use_module(library(aleph)).
:- aleph.

我得到了错误:

ERROR: c:/users/mac/desktop/swi-prolog/aleph draft/1.pl:1:
    source_sink `library(aleph)' does not exist
Warning: c:/users/mac/desktop/swi-prolog/aleph draft/1.pl:1:
        Goal (directive) failed: user:use_module(library(aleph))
ERROR: c:/users/mac/desktop/swi-prolog/aleph draft/1.pl:2:
        catch/3: Undefined procedure: aleph/0
Warning: c:/users/mac/desktop/swi-prolog/aleph draft/1.pl:2:
        Goal (directive) failed: user:aleph
Welcome to SWI-Prolog (threaded, 32 bits, version 7.6.4)

【问题讨论】:

    标签: prolog package swi-prolog package-management aleph-ilp


    【解决方案1】:

    您应该使用安装程序:

    ?- pack_install(aleph).
    
    % Contacting server at http://www.swi-prolog.org/pack/query ... ok
    Install aleph@5 from GIT at https://github.com/friguzzi/aleph.git Y/n? 
    % Cloning into '/home/carlo/lib/swipl/pack/aleph'...
    % Contacting server at http://www.swi-prolog.org/pack/query ... ok
    % "aleph.git" was downloaded 6 times
    Package:                aleph
    Title:                  Aleph Inductive Logic Prorgramming system
    Installed version:      5
    Author:                 Fabrizio Riguzzi <fabrizio.riguzzi@unife.it>
    Activate pack "aleph" Y/n? 
    true.
    
    ?- use_module(library(aleph)).
    true.
    

    【讨论】:

    • 当我启动命令时:?- pack_install(aleph)。我得到如下错误,我做错了什么? % 与swi-prolog.org/pack/query 的服务器联系... ok 从github.com/friguzzi/aleph.git 的GIT 安装aleph@5 是/否?错误:source_sink `path(git)' 不存在
    • 你可以从 github.com 手动下载 zip(如果你还没有完成,不清楚你之前下载了什么)并将下载文件的路径提供给 pack_install,我想。请参阅docs。或install git,但只是尝试一个包似乎有点矫枉过正
    • 我已经完成了这些步骤并成功安装了aleph,但我仍然收到如下错误。我猜我是不是下载了错误的版本。 1 ?- use_module(library(aleph)). % library(arithmetic) compiled into arithmetic 0.00 sec, 115 clauses % library(broadcast) compiled into broadcast 0.00 sec, 13 clauses % library(time) compiled into time 0.02 sec, 1,332 clauses ERROR: d:/swi-prologportable/app/swi-prolog/pack/aleph/prolog/aleph.pl:4878:1: Syntax error: Operator expected % library(aleph) compiled into aleph 0.14 sec, 3,394 clauses true.
    • 在第 4878 行有 $trace。您可以尝试将其注释掉。如果我们相信上面的注释,那么从第 4848 行开始的代码块似乎未使用。当然,我的 SWI-Prolog(最新版本,从源代码编译)没有给出错误的事实,让我怀疑整个正确性。 Aleph 似乎是一个复杂的应用程序...
    • 我把它注释掉了,它可以工作,但你提到的代码块似乎没有使用。因为当我尝试运行我的简单示例时,其输出中没有归纳。我的代码可能有错误吗?我在回答中展示了一个例子。
    【解决方案2】:

    这是我试过的例子,我没有得到归纳理论。

    % Aleph initialization
        :- aleph.
    
    % Mode declarations
    % mode(RecallNumber,PredicateMode).
    % - output
    :- modeh(*,grandparent(+person,+person)).
    :- modeb(*,father(-person,-person)).
    
    :-begin_bg.
    person(john).
    person(johnJunior).
    person(johnJuniorJunior).
    person(jack).
    person(jackJunior).
    person(jackJuniorJunior).
    father(johnJunior, john).
    father(johnJuniorJunior, johnJunior).
    father(jackJunior, jack).
    father(jackJuniorJunior, jackJunior).
    
    :-determination(grandparent/2,father/2).
    
    :-end_bg.
    
    :-begin_in_pos.
    grandparent(john, johnJuniorJunior).
    grandparent(jack, jackJuniorJunior).
    :-end_in_pos.
    
    :-begin_in_neg.
    grandparent(jack, john).
    :-end_in_neg.
    
    :-aleph_read_all.
    

    这是我的输出:

    [theory]
    
    [Rule 1] [Pos cover = 1 Neg cover = 0]
    grandparent(john,johnJuniorJunior).
    
    [Rule 2] [Pos cover = 1 Neg cover = 0]
    grandparent(jack,jackJuniorJunior).
    
    [time taken] [0.015625]
    [total clauses constructed] [2]
    true.
    

    我猜 aleph systeme 没用。

    【讨论】:

    • 最好先让包含的示例工作,从简单到复杂......对不起,我现在没有时间关注这个问题,我很确定 Fabrizio Riguzzi 会对任何严重的错误报告感兴趣,或者更好的是,在 github 上拉取请求
    猜你喜欢
    • 2016-04-01
    • 2015-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多