我正在使用 AllegroGraph 4.4。我有他们关于肯尼迪家谱的样本数据库输入。我从他们关于 SPIN 的教程中复制了一个示例。这里是:
(ag.spin:register-spin-function
!ex:age
"prefix kennedy: <http://www.franz.com/simple#>
prefix xs: <http://www.w3.org/2001/XMLSchema#>
select ( (2011 - xs:int(?birthYear)) as ?age ) {
?who kennedy:birth-year ?birthYear .
}"
'(?who))
问题是我不知道在哪里以及如何注册这个函数。我已经尝试过 WebView,但出现此错误:
Non-symbol element !ex:age in binding list.
为什么我不断收到此错误?
我应该在哪里定义规则?
最佳答案
代码是 Common Lisp 代码,应该是源文件的一部分,或者在 REPL 中评估。您收到的错误“绑定(bind)列表中的非符号元素!ex:age”似乎表明系统在尝试处理 !ex:age
时出现阻塞。 .是否执行 setup from the example第一帮助?第一行和最后一行,(enable-!-reader)
, 和 (register-namespace "ex" "http://franz.examples#")
, 似乎是您获得 !ex:age
所需要的要正确阅读。
(enable-!-reader)
(enable-print-decoded t)
(create-triple-store "kennedy")
(load-ntriples "kennedy.ntriples")
(register-namespace "kennedy" "http://www.franz.com/simple#")
(register-namespace "ex" "http://franz.examples#")
关于sparql - 如何定义 SPIN 规则?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9161449/