SKOS Vocabulary Diff

Compare two versions of a SKOS vocabulary by meaning, not by text. The order of the statements, the prefixes and the file format do not count, and neither does the side a relation is written from. You get what was added, removed and changed, and whether the new version breaks more integrity rules than the old one. To look at a single vocabulary, use the SKOS Explorer; to check it against rules of your own, the SHACL Validator.

Turtle, RDF/XML, JSON-LD, N-Triples or TriG, up to 1024 KB each

The example is the company vocabulary before and after a round of edits: a product renamed, a module added, a client removed and one link that breaks an integrity rule.

🔍 How the comparison works
  • By meaning. Both versions are read as RDF and compared statement by statement, so reordering, reformatting, other prefixes or another file format are not changes.
  • One spelling per statement. skos:narrower is compared as the skos:broader it implies, skos:hasTopConcept as skos:topConceptOf, skos:narrowMatch as skos:broadMatch, and skos:related, skos:exactMatch, skos:closeMatch and skos:relatedMatch count in both directions. A changed link therefore shows on both concepts it joins.
  • Named resources only. Blank nodes have no name that survives from one file to the next. SKOS-XL labels are compared through the plain labels they imply and ordered collections through their members; the order of the members is not compared.
  • SKOS only. Statements with properties from other vocabularies (Dublin Core, OWL and so on) are not compared.
  • A renamed URI is a removal and an addition. The comparison goes by URI, so a concept whose URI changed shows as one removed and one added.
  • Regression. Both versions go through the same checks as in the SKOS Explorer. The result is called a regression when the new version has more violations of the six integrity conditions than the old one. Warnings and notes are shown but do not decide it.
  • Limits and privacy. 1024 KB and 60,000 statements per version, 60 requests per hour per address, shared with the SKOS Explorer. Both versions are processed in memory for the one request and are not stored or logged. Nothing is fetched from the web.
💡 Use it in a build (API)

No key is needed. The full description is in the OpenAPI document.

cURL

curl -s -X POST https://devops.majbase.com/skos-explorer/diff/api \
  -F "old_file=@vocabulary-main.ttl" -F "new_file=@vocabulary.ttl"

Fail the build on a regression

git show origin/main:vocabulary.ttl > /tmp/old.ttl
verdict=$(curl -s -X POST https://devops.majbase.com/skos-explorer/diff/api \
  -F "old_file=@/tmp/old.ttl" -F "new_file=@vocabulary.ttl" | jq -r .verdict)
echo "SKOS diff: $verdict"
[ "$verdict" != "regression" ] && [ "$verdict" != "null" ]

Response fields

  • verdict: identical, changed or regression.
  • summary: added, removed, changed, unchanged (resources), statements_added, statements_removed, new_violations, fixed_violations.
  • added, removed, changed: one entry per resource with uri, label, kind and its added and removed statements (property, value, lang, label). At most 500 per list; truncated says when a list was cut.
  • checks: the checks whose count differs, with before and after. old and new: format, size and verdict of each version.
  • Errors come back as {"error": "…"} with status 400 (unreadable or too large; the message names the version) or 429 (rate limit).