2012-02-06 36 views
3

我正在使用AllegroGraph 4.4。我有他们关于肯尼迪家谱的样本数据库输入。我从他们的SPIN教程中复制了一个例子。那就是:如何定义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. 

为什么我不断收到这个错误?

我应该在哪里定义规则?

回答

1

代码是Common Lisp代码,应该是源文件的一部分,或者在REPL中进行评估。您收到的错误“非符号元素!例如:绑定列表中的年龄”似乎表示在尝试处理!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#")