Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange use of sh:or for targetClass declarations in SHACL shapes #6

Open
labra opened this issue Jan 1, 2025 · 4 comments
Open

Strange use of sh:or for targetClass declarations in SHACL shapes #6

labra opened this issue Jan 1, 2025 · 4 comments

Comments

@labra
Copy link

labra commented Jan 1, 2025

@jesswr pointed me to the catalog shape that appears here and I think the use of sh:or to declare optional target class declarations is not currently supported in SHACL.

I mean, this pattern:

:SolidProjectResourceShape a sh:NodeShape ;
 sh:or (
   [ sh:targetClass soar:PodService ]
   [ sh:targetClass schema:LearningResource ]
 );
 . . .

which probably means that :SolidProjectResourceShape can be applied to either soar:PodService or schema:LearningResource or any other element in that list does not work in SHACL as far as I know.

I think a simpler way to declare it would just be:

:SolidProjectResourceShape a sh:NodeShape ;
 sh:targetClass soar:PodService, schema:LearningResource, ...
 . . .
@jeswr
Copy link

jeswr commented Jan 1, 2025

I agree, and have been working on an alternate version of this shape at https://github.com/jeswr/solid-catalog/blob/main/shapes/catalog.shc which I will contribute shortly.

@jeswr
Copy link

jeswr commented Jan 12, 2025

which I will contribute shortly.

Doubt I will be able to come to it for at least a month so don't be worried about stepping on my toes if you get to it first @jeff-zucker

@jeff-zucker
Copy link
Member

@labra - Yes, I agree, my first pass at a SHACL shape for the catalog needs much work. I think your suggestion to turn it into a simple list will work for now. I was aiming for something I still do not how to accomplish in SHACL so am open to ideas. I want to be able to define a generalized catalog-record shape and then have specific additional properties for the various target classes. If anyone can point me to some examples or writing about this kind of subclassing withing SHACL, I'd appreciate it.

@jeswr
Copy link

jeswr commented Jan 13, 2025

https://www.w3.org/TR/shacl/#AndConstraintComponent is what you're after.

Only downside is that devtools like LDO tend to not be designed for logical constraints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants