Skip to content

Instantly share code, notes, and snippets.

@namedgraph
Last active January 19, 2021 13:25
Show Gist options
  • Save namedgraph/58d95d8d0cb77238381f367c97b44000 to your computer and use it in GitHub Desktop.
Save namedgraph/58d95d8d0cb77238381f367c97b44000 to your computer and use it in GitHub Desktop.
Hash of RDF graph using SPARQL (blank nodes not considered!)
SELECT (SHA1(GROUP_CONCAT(?tripleStr)) AS ?graphHash)
WHERE
{ { SELECT DISTINCT ?s ?p ?o
WHERE
{ ?s ?p ?o }
}
BIND(concat(str(?s), " ", str(?p), " ", str(?o)) AS ?tripleStr)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment