Sparql Query to fetch and delete duplicate records

374 Views Asked by At

in allegro-graph database i have created an rdf type Product which has id, barcode, name predicates. Barcode is made as optional. Here in database, there are multiple duplicate records for barcode (which of type string). Now, i want to fetch the records of barcode whose count is greater than 1 and delete them.

Below is my query,

SELECT ?product ?barCode WHERE
{
  ?product rdf:type product:Product .
  optional { ?product product:barcode ?barCode .}
}
group by ?product ?barcode
having(count(?barcode) > 1)

This query has to display the results if the barcode record count is greater than 1. But the result ends up in giving "No Result".

Is there a way to fetch and delete the duplicates? Can anyone help me to write a query for this?

Thank you!

0

There are 0 best solutions below