【问题标题】:How to define a SPIN rule?如何定义 SPIN 规则?
【发布时间】:2012-02-06 14:15:54
【问题描述】:

我正在使用 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.

为什么我总是收到这个错误?

我应该在哪里定义规则?

【问题讨论】:

    标签: sparql allegrograph spin-rdf


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-13
      • 1970-01-01
      • 1970-01-01
      • 2022-11-16
      • 1970-01-01
      • 2021-02-13
      • 1970-01-01
      相关资源
      最近更新 更多