Project:RedirectionScript

From MaRDI portal
Revision as of 14:49, 29 February 2024 by Larissa (talk | contribs)

SPARQL queries

Count number of items that redirect to another item

SELECT (COUNT (DISTINCT ?o) AS ?count)
WHERE
{
   ?o owl:sameAs ?sa .
}

Get mapping of original items to the ones they were redirected to

SELECT DISTINCT ?o ?sa
WHERE
{
  ?o owl:sameAs ?sa .
}

Get all items that redirect to somewhere else and are still referenced in another item

SELECT DISTINCT ?o 
WHERE
{
  ?o owl:sameAs ?sa .
  ?new ?p ?o
}

Script

https://github.com/MaRDI4NFDI/docker-importer/blob/main/bot_scripts/reroute.py

The script takes as input a csv file with the output of the second sparql query that maps old ids to new ids.