On 18/12/2021 16:58, Dragan Lesic wrote:
Hello,
I'm trying to update (delete+insert) some data which has also reification
in it (order of cast members for a movie for example).
When doing delete all triples for a subject that order data seems not to be
deleted.
For example i need to change the order.
After inserting new data, when doing queries I get the new and old data
back.
Executing a delete for RDF-star data is extremely slow.
Queries:
Query data (with order):
PREFIX sub: <https://example.org/movie/>
PREFIX shema: <https://schema.org/>
SELECT DISTINCT ?order ?name
WHERE {
sub:SOMEID shema:cast ?o {|shema:order ?order|} .
?o shema:name ?name .
}
ORDER BY ?order
Returns:
order
name
"0"^^xsd:integer
"Sigourney Weaver"@en
"1"^^xsd:integer
"Annie Potts"@en
"1"^^xsd:integer
"Annie Potts"@en
...
This is wrong, I have the order 1 twice because of an earlier insert. I
want to delete it and insert correctly.
Then delete everything:
PREFIX sub: <https://example.org/movie/>
DELETE
WHERE { sub:SOMEID ?p ?o . }
Then when I insert all data again, with the correct data and no duplicates
(I've checked) and i get the duplicate reference again.
When trying to delete all references first it works but is extremely slow,
takes minutes to complete:
PREFIX sub: <https://example.org/movie/>
PREFIX shema: <https://schema.org/>
delete
where { << sub:SOMEID shema:cast ?o >> shema:order ?order }
Any ideas what I am doing wrong, or how to make it faster?
Thanks in advance.
Hi,
What's the storage? TDB2?
How much data?
I guess there are a lot of "shema:order" triples.
<<>> isn't indexed (there have been no changes in database layout for
RDF-star) so it needs to do:
?X shema:order ?order
then check ?X with << sub:SOMEID shema:cast ?o >>
You could give it a starting point:
DELETE
{ << sub:SOMEID shema:cast ?o >> shema:order ?order }
WHERE {
sub:SOMEID shema:cast ?o {|shema:order ?order|} ;
}
or the use case in one request:
----
DELETE WHERE {
sub:SOMEID shema:cast ?o {|shema:order ?order|} .
}
;
DELETE WHERE { sub:SOMEID ?p ?o . }
----
Andy