I would like to add a new node if and only if another node with the same
properties does not exists. Something like this:
INSERT {
ex:item-X a ex:Item;
ex:serial "XYZ" .
} if and only if there is not already another node with (ex:serial "XYZ")
After trial and error I got this working
INSERT {
ex:item-X a ex:Item;
ex:serial "XYZ" .
}
WHERE {
FILTER NOT EXISTS {
[] a ex:Item;
ex:serial "XYZ" .
}
}
my problem is that I don't understand why it's working. First of all, is the
query correct? Second, how does Jena compute this query? Why does that work,
but not this one?
WHERE {
?s ?p ?o .
FILTER NOT EXISTS {
[] a ex:Item;
ex:serial "XYZ" .
}
}