Skip to content

Instantly share code, notes, and snippets.

@pchampin
Created March 26, 2025 10:28
Show Gist options
  • Save pchampin/ad883b8d6a35ce4d52e5efe50645b353 to your computer and use it in GitHub Desktop.
Save pchampin/ad883b8d6a35ce4d52e5efe50645b353 to your computer and use it in GitHub Desktop.
script for canonicalizing RDF file
#!/usr/bin/bash
# dependency: https://github.com/pchampin/sophia-cli
sop parse "$1" --base x-dummy-base: ! canonicalize
# NB: we use a dummy base so that the result does not depend on the location of "$1".
# Indeed, I use this script primarily to re-process RDF files before git diff,
# so the different copies of the *same* files should not be considered to have different bases.
#
# Snippet from by ~/.gitconfig file
# ```
# [diff "rdf"]
# textconf = rdf-canon
# ```
# where `rdf-canon` is this script, made executable and accessible in the PATH.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment