I use AllegroGraph 4. I have a triple store, and I try to add new triples only if they do not already exist.
Here is my Prolog request:
(select (?news) (alfas ?news) (a-- ?news !tst:has-annotation !tst:Test)))
where alfas checks the condition (works fine), and a--is defined as follows:
(<-- (a-- ?s ?p ?o)
;; Fails unless all parts ground.
(lisp (not (triple-exists-p ?s ?p ?o)))
(lisp (add-triple ?s ?p ?o)))
I also tried to define 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 in any case, regardless of whether it already exists or not. Why?
source
share