- From: Holger Knublauch <holger@topquadrant.com>
- Date: Fri, 5 Jun 2020 10:01:04 +1000
- To: public-shacl@w3.org
- Message-ID: <2361e184-d5f3-bde9-4a3a-39864d340c10@topquadrant.com>
On 5/06/2020 03:08, Vladimir Alexiev wrote:
> If you look at
> https://lists.w3.org/Archives/Public/public-shacl/2020Jun/0005.html,
> we plan to use more complex targeting than targetClass, eg
> ex:PoliticianReferenceShape a sh:NodeShape;
> sh:property [sh:path rdf:type; sh:in (foaf:Person dbo:Person)];
> sh:property [sh:path dc:type; sh:hasValue "politician"];
> But that's not the point. The point is that if I distribute the props
> in some meaningful way
> (eg name, birthDate in shape Person and party, politics in shape
> Politician),
> I cannot close either of them because I need to close the union of them.
>
> Maybe I can use sh:and, and then sh:closed will look at all props
> occurring in the different branches of the sh:and and traversing down
> to sh:path?
>
> ex:PoliticianShape a sh:NodeShape;
> sh:target ex:PoliticianReferenceShape;
> sh:and (
> ex:PersonShape
> [sh:property [sh:path ex:politics; sh:in ("Democrat" "Republican")]]
> [sh:property [sh:path ex:party; sh:node ex:PartyReferenceShape]]
> );
> sh:closed true
> .
No, sh:and cannot be used, because sh:closed will only look at direct
sh:property triples on the same level in the same shape.
(And besides, sh:and doesn't add meaning anyway and only ever
contributed to confusion I think. Maybe it's a candidate for deprecation
in the future alongside targets at property shapes, but I digress).
I see no solution for your scenario at the moment except using
SHACL-SPARQL to define your own constraint component. We did something
similar in
http://datashapes.org/constraints.html#ClosedByTypesConstraintComponent
because the core sh:closed didn't cover our usual use cases.
Holger
Received on Friday, 5 June 2020 00:01:21 UTC