prolog - 如何使用 SWI-Prolog 在 Aleph 中获得更复杂的理论?
问题描述
我厌倦了用 Aleph 来获得一个理论,但我只有一个头和一个身体,实际上我想要更多的身体。
我的输入文件是:
:- use_module(library(aleph)).
:- if(current_predicate(use_rendering/1)).
:- use_rendering(prolog).
:- endif.
:- aleph.
:- modeh(*,attr2col(+attribute)).
:- modeb(*,type(+attribute,-class)).
:- modeb(*,attrs(+class,+attribute)).
:-determination(attr2col/1, type/2).
:-determination(attr2col/1, attrs/2).
:-begin_bg.
class(clerk).
class(manager).
attribute(boss).
attribute(notype).
attribute(noattrs).
attrs(manager,boss).
attrs(manager,notype).
type(notype,manager).
type(boss,manager).
:-end_bg.
:-begin_in_pos.
attr2col(boss).
attr2col(notype).
:-end_in_pos.
:-begin_in_neg.
attr2col(clerk).
attr2col(manager).
:-end_in_neg.
:-aleph_read_all.
我的输出是:
attr2col(A) :-
type(A,B).
我想要的是:
attr2col(A) :- attribute(A), attrs(B,A), type(A,C).
现在只有一具尸体,但我想要三具。并且有'attribute(A)'作为一个主体,如何只用一个变量添加这样的东西?
解决方案
您可以尝试以下几件事:
为您的谓词添加模式声明和确定
attribute
。在模式声明中尝试不同的 + 和 - 组合
检查所需子句正文中的所有文字是否确实需要正确预测结果。
干杯/JCR
推荐阅读
- javascript - 如何通过双击按钮将视频倒回到开头并在视频暂停时显示海报图像
- javascript - window.console 可以被覆盖吗?它是只读的吗?
- c# - 如何确保一次只运行一个后台任务?
- angular - Angular 6 中的图像压缩
- mysql - 获取表名、列名、数据类型和字符最大长度 mySQL
- react-native - 如何在反应原生的Flatlist中设置行高
- windows - 不显示消息框 MessageBoxA()
- node.js - javascript函数设置的表单字段值的req.body值未定义
- facebook - Facebook 在验证用户 Rails 后重定向到注册页面
- angular - Angular - 视图绑定到数组未更新