- From: Holger Knublauch <holger@topquadrant.com>
- Date: Thu, 23 Sep 2021 10:29:16 +1000
- To: felix@sasakiatcf.com, public-shacl@w3.org
- Message-ID: <d808c602-883c-66f6-b190-836c1185d001@topquadrant.com>
On 2021-09-22 10:00 pm, felix@sasakiatcf.com wrote: > > Thanks a lot for the example, Holger. > > I tried this out. Attached is > > 1. your shape testshape.ttl > 2. a testfile that throws an error, as expected > testdata-fails-as-exepected.ttl > 3. a testfile that does not throw an error: testdata-does-not-fail.ttl . > > The difference between 2) and 3) is that 3) has the same value for the > ex:myProperty property. Does this make a difference? > Ah yes, that's a good point. Path expressions will eliminate duplicates, so it will pass the maxCount constraint for this corner case! If the hierarchy is acyclic, the following should work, doing a skos:broader+ instead of skos:broader*. It basically means "None of the parent concepts can have a value for ex:myProperty". ex:BranchShape a sh:NodeShape ; sh:targetSubjectsOf ex:myProperty ; sh:property [ sh:path ( [ sh:oneOrMorePath skos:broader ] ex:myProperty ) ; sh:maxCount 0 ; ] . (This is again untested, as a dry pen-and-paper exercise) Holger > I am using the TopQuadrant implementation > > https://github.com/TopQuadrant/shacl/ > <https://github.com/TopQuadrant/shacl/> > > Regards > > Felix > > *Von:*Holger Knublauch <holger@topquadrant.com> > *Gesendet:* Mittwoch, 22. September 2021 02:14 > *An:* public-shacl@w3.org > *Betreff:* Re: Constraints on a property in a SKOS hierarchy > > On 2021-09-21 6:57 pm, felix@sasakiatcf.com > <mailto:felix@sasakiatcf.com> wrote: > > Dear all, > > I would like to to the following: > > 1. Define a property “ex:myProperty” for a skos:Concept. > 2. In a given SKOS taxonomy, the following constraint should be > formulated: for the taxonomy, the property should appear zero > or more times in one “branch” of the taxonomy. > > If you really mean zero or more times, then this wouldn't constrain > anything. My understanding is you want to say zero or one time, i.e. > that there can be at most one value per branch? > > 3. > > The following would be a valid SKOS RDF graph: > > example:animal a skos:Concept; ex:myProperty “some value”. > > example:bird a skos:Concept; skos:broader example:animal. > > The following would be a non-valid SKOS RDF graph, since > example:bird is connected to another concept (example:animal) that > already has ex:myProperty: > > example:animal a skos:Concept; ex:myProperty “some value”. > > example:bird a skos:Concept; skos:broader example:animal; > ex:myProperty “some value”. > > Given the above assumption, could this simply become a maxCount 1 on a > path expression skos:broader* / ex:myProperty? > > Untested draft: > > ex:BranchShape > a sh:NodeShape ; > sh:targetSubjectsOf ex:myProperty ; > sh:property [ > sh:path ( [ sh:zeroOrMorePath skos:broader ] ex:myProperty ) ; > sh:maxCount 1 ; > ] . > > I guess instead of the sh:targetSubjectsOf you could also simply > attach this to all skos:Concepts. > > Holger > > How would I formulate 2) in SHACL? > > Regards > > Felix >
Received on Thursday, 23 September 2021 00:29:35 UTC