2012-02-06 86 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#")