Running IPTC Sport Schema Unit Tests

While creating the IPTC Sport Schema, we wanted to make sure that we weren’t “breaking the model” each time we made a change to the ontology, and that example SPARQL queries would still work.

So we built a simple framework to help with our design process.

We created a set of SPARQL queries, each in a text file. They correspond to our use cases. You can see the raw files at https://github.com/iptc/sport-schema/tree/main/queries.

Each of the SPARQL queries has a corresponding “expected output” file: https://github.com/iptc/sport-schema/tree/main/queries/output/.

We then create a simple Shell script to run each of the queries against our sample data, and compare the output against its “expected output” file.

If there is a difference between the two, we know that something has gone wrong.

“Sanity checking” queries

We have also created some queries related to the model itself, and “sanity checking” our sample data.

These queries include:

Running the tests locally

If you have checked out the repository, you can run the unit tests by simply running the shell script:

tools/run-test-queries.sh