问题
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