fekaputra / shacl-plugin

SHACL4Protege - SHACL constraint validation plugin for Protégé
https://semantic-systems.org
MIT License
34 stars 8 forks source link

SHACL File for example3-data? #32

Closed mdebellis closed 2 years ago

mdebellis commented 3 years ago

I'm creating a revised version of the Pizza tutorial, the extended one here: http://mowl-power.cs.man.ac.uk/protegeowltutorial/resources/ProtegeOWLTutorialP4_v1_3.pdf

I always thought this was the best one but it is a little out of date with the current Protege UI. I also want to add new sections for SPARQL, SWRL, and SHACL. I know the first two very well but am just getting started with SHACL. I added some employees to the Pizza tutorial and then used the existing example in the validator window with ssn as a template to define constraints for employee ssn data properties.

However, then I noticed that there was an example3-data.owl file. I downloaded that and ran the validation. I may just not be understanding how SHACL works but my understanding is that there are separate files for the SHACL shapes. That's what I did with my Pizza example. However, I don't see a shapes file for the example3 owl file and when I looked in the owl file also didn't see any SHACL shapes. But there seems to be constraints about the hasFather property which aren't defined in the sample shapes file that is the default when I start the plugin tab.

I don't understand where the validator is getting those father shape constraints from.

Locke commented 3 years ago

my understanding is that there are separate files for the SHACL shapes

This is also the way we use it here.

In the resources folder there are two files used (I think the other owl/ttl files are only remaining from earlier versions):

Since I created that example I now think it might be a bit too complex for beginners / the very first contact with SHACL.

The hasFather property is defined in example3-data.owl, where also the OWL class Person and the individuals are defined.

In example3.ttl the PersonShape is defined. This file is loaded by default when you open the editor tab of this plugin.

Note that this shape is defined to be closed and does not contain a statement about hasFather. I thought this would be a good example to demonstrate the "closed" property of a shape: as Alice has a hasFather relation but the PersonShape is closed this is a SHACL violation that is detected.

As the pizza tutorial is the de-facto OWL tutorial it could make sense to update the examples provided with this plugin, once you've revised it. I could imagine to drop the example3-data.owl file and instead point to / provide the pizza ontology and to remove the example3.ttl shapes and to load something pizza-related.

mdebellis commented 3 years ago

Andre, thanks very much for that explanation. As I said I'm new to SHACL. I actually think your example is a good one because it helped me understand something about SHACL that I didn't before. I'm not sure if I will include that part of the example in my Pizza example though. There are several more advanced topics (e.g. punning) that I started to include and then thought they were too complex for an intro tutorial. In any case, the new tutorial I'm working on won't be static. I'm sure I will get plenty of feedback on it and I also plan to update it after I release the first version. So I may either on the first release or more likely in future releases include the full power of that example. I can also make some exercises optional for more advanced users.

If you have time, one thing I've been grappling with is how to define the regex for a basic phone number. I have the regex for nnn-nnn-nnnn (by just following and altering the pattern for ssn) but I would like to have: "(nnn) nnn-nnnn" and for some reason I've been having trouble with either the parentheses or the blank space, not sure but the things I've tried haven't worked. Even better have regex for both alternatives with an OR statement. If you know either or both off the top of your head I would appreciate it. Thanks for the help.

Michael

On Sat, Dec 12, 2020 at 5:54 AM André Wolski notifications@github.com wrote:

my understanding is that there are separate files for the SHACL shapes

This is also the way we use it here.

In the resources folder https://github.com/fekaputra/shacl-plugin/tree/master/src/main/resources there are two files used (I think the other owl/ttl files are only remaining from earlier versions):

  • example3-data.owl which defines the OWL ontology and individuals, to be loaded in Protégé Desktop.
  • example3.ttl which defines the SHACL shapes.

Since I created that example I now think it might be a bit too complex for beginners / the very first contact with SHACL.

The hasFather property is defined in example3-data.owl, where also the OWL class Person and the individuals are defined.

In example3.ttl the PersonShape is defined. This file is loaded by default when you open the editor tab of this plugin.

Note that this shape is defined to be closed and does not contain a statement about hasFather. I thought this would be a good example to demonstrate the "closed" property of a shape: as Alice has a hasFather relation but the PersonShape is closed this is a SHACL violation that is detected.

As the pizza tutorial is the de-facto OWL tutorial it could make sense to update the examples provided with this plugin, once you've revised it. I could imagine to drop the example3-data.owl file and instead point to / provide the pizza ontology and to remove the example3.ttl shapes and to load something pizza-related.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fekaputra/shacl-plugin/issues/32#issuecomment-743759531, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7TPBBEPT5JCZLCOFNS3SLSUNYZ3ANCNFSM4UXPM5MQ .