Skip to content

sils-webinfo/shacl-and-owl

Repository files navigation

SHACL and OWL

For this assignment you will try your hand at

  • creating SHACL shapes to validate data, and
  • creating an OWL ontology to make inferences about data.

The data can either be a variation of the same Rijksmuseum data you've used for past assignments, or a new dataset you come up with yourself.

You will be editing four files:

  1. data-invalid.ttl A version of your data that is expected to fail SHACL validation.
  2. data-valid.ttl A version of your data that is expected to pass SHACL validation.
  3. shapes.ttl The SHACL shapes that data-valid.ttl (but not data-invalid.ttl) should conform to.
  4. ontology.ttl An OWL ontology that enables inferences over data-valid.ttl.

Validating with SHACL

  1. Create two copies of your data file and name them data-invalid.ttl and data-valid.ttl.

  2. Edit shapes.ttl, writing some shapes that you expect your data will not conform to.

  3. Run make report-invalid.ttl to validate data-invalid.ttl using your shapes.

  4. Open report-invalid.ttl; at the top you should see:

    [ rdf:type     sh:ValidationReport ;
      sh:conforms  false ;
    

    … telling you that validation failed (as expected).

  5. Edit data-valid.ttl, fixing the problems that were causing data-invalid.ttl not to validate.

  6. Run make report-valid.ttl to validate data-valid.ttl using your shapes.

  7. Open report-valid.ttl; at the top you should see:

    [ rdf:type     sh:ValidationReport ;
      sh:conforms  true
    ] .
    

    … telling you that validation succeeded (as expected).

You'll probably want to refer to the core constraint components in the SHACL specification, as well as the example I've provided. This Introduction to SHACL may also be helpful.

Inferring with OWL

  1. Edit ontology.ttl, writing some class and property definitions that will enable inferences over your data.

  2. Run make all.ttl to generate all.ttl, which will include the triples from data-valid.ttl plus any new triples inferred from data-valid.ttl and ontology.ttl. (This will also generate inferred.ttl, which will include only the inferred triples.)

  3. Verify that all.ttl includes the inferred triples that you expected to see.

You may want to refer to the OWL 2 Primer, as well as the examples [1, 2] I've provided.

Submitting the assignment

To submit the assignment, run:

make submission.zip

This will check that:

  • data-invalid.ttl does not conform to shapes.ttl
  • data-valid.ttl does conform to shapes.ttl
  • inferred.ttl contains triples inferred from data-valid.ttl and ontology.ttl

You will get an error if any of these checks do not pass.

Once the checks pass, submit the zip file at https://aeshin.org/teaching/assignment/212/submit/

Finally, you should commit and push the following files:

  1. data-invalid.ttl
  2. data-valid.ttl
  3. shapes.ttl
  4. ontology.ttl

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published