AllegroGraph check existing triple

白昼怎懂夜的黑 提交于 2020-01-04 08:00:27

问题


I am using AllegroGraph 4. I have a triple store, and I am trying to add new triples only if they don't already exist.

Here is my Prolog query:

(select (?news) (alfas ?news) (a-- ?news !tst:has-annotation !tst:Test)))

where alfas checks for a condition(it works fine) and a-- is defined like this:

(<-- (a-- ?s ?p ?o)
;; Fails unless all parts ground.
(lisp (not (triple-exists-p ?s ?p ?o)))
(lisp (add-triple ?s ?p ?o)))

I have also tried defining it like this:

(<-- (a-- ?s ?p ?o)
;; Fails unless all parts ground.
(lisp (not (get-triple :s ?s :p ?p :o ?o)))
(lisp (add-triple ?s ?p ?o)))

But the triple is added anyway, no matter if it already exists or not. Why?

来源:https://stackoverflow.com/questions/9095983/allegrograph-check-existing-triple

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!