w3c / shacl

SHACL Community Group (Post-REC activitities)
27 stars 4 forks source link

Inverse Property Value Rules #19

Open tpluscode opened 1 year ago

tpluscode commented 1 year ago

At the moment SHACL-AF only defines the shorthand syntax and behaviour of Property Value Rules when the path is an IRI

I think it should also be allowed to have property rules set on properties whose property is sh:InversePath. That can be trivially achieved by switching places of sh:object and sh:subject of the implicit triple rule:

8.5.2 Inverse Property Value Rules

Similar to [Property Value Rule](#8.5.2) but with `sh:object` and `sh:subject` reversed, 
that is for the implicit rule `T`:

- T sh:subject V
- T sh:object sh:this
HolgerKnublauch commented 1 year ago

Sounds plausible.

tpluscode commented 8 months ago

Would you accept PR, actually?

HolgerKnublauch commented 8 months ago

Have you implemented this and encountered problems? I do remember that I thought about this but didn't go there because that inverse case caused complications. I guess it is because they may produce "cycles" where inferring one "forward" value may later also infer an "inverse" value. Or, at the minimum, I didn't see enough value to include that feature, although from a symmetry point of view it would make sense.

What is your specific use case?

tpluscode commented 8 months ago

I don't remember exact details now but I found this missing when implementing a SPARQL Query generator

HolgerKnublauch commented 8 months ago

In my implementation of sh:path node expressions, the system will automatically "infer" properties that have a sh:values rule. If we were to add this for the inverse direction, it would at least complicate these cases. Unless there is a strong use case and evidence that this has a reasonable cost-benefits ratio, I would rather table this for a future WG.

tpluscode commented 8 months ago

I would rather table this for a future WG.

Fair enough