-
Notifications
You must be signed in to change notification settings - Fork 30
Issue 414: list constraints #416
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
base: feat/memberShape
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have linked the new constraint parameters to the same constraint component for memberShape. I believe it would be better to introduce separate constraint components for each of them. It makes the definition more modular but, more importantly, it is perfectly sensible to use for example sh:minListLength without a sh:memberShape constraint.
</table> | ||
<div class="def def-text"> | ||
<div class="def-header">TEXTUAL DEFINITION</div> | ||
<div class="def-text-body" data-validator="MemberShape"> | ||
Let <code>$memberShape</code> be a <a>value</a> of <code>sh:memberShape</code>. | ||
Each <a>value node</a> <code>v</code> must be a <a href="#syntax-rule-SHACL-list">SHACL list</a> - a <a>failure</a> MUST be produced if <code>v</code> is not a SHACL list. | ||
For each <a>value node</a> <code>v</code> that is a valid SHACL list, a <a>failure</a> MUST be produced for each violation of the following conditions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that FAILURE is not the right word here. It should be "validation result". Failure is used when a node shape fails to evaluate due to some low-level problem. Normal constraint violations are validation results.
If <code>sh:maxListLength</code> is present, the number of members in the list <code>v</code> MUST be less than or equal to the value of <code>sh:maxListLength</code>. | ||
</li> | ||
<li> | ||
If <code>sh:uniqList</code> is present and has the value <code>true</code>, the members of the list <code>v</code> MUST be unique. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't like the name uniqList, and would prefer uniqueMembers. The abbreviation uniq is not really necessary for such a short word, and not the list is unique but its members are.
Makes sense! Following this approach; I expect similarly to data-shapes/shacl12-test-suite/tests/core/node/memberShape-001.ttl Lines 121 to 138 in 536ce96
I guess we can expect similar behaviour if there are multiple Is this the behaviour you would expect for validation results? |
I wouldn't worry too much about malformed lists. Usually people use tools to produce them, including editing TTL source code. So if they are reported twice, this shouldn't be the end of the world. |
I also saw a comment about lists not being valid objects of |
Yeah my fault. I deleted the comment because I understood later what you did. |
Closes #414. This PR implements
sh:minListLength
,sh:maxListLength
andsh:uniqList
.My interpretation of the following from the definition of 2.1.1 Constraints, Parameters and Constraint Components is that because the
sh:MemberShapeConstraintComponent
now has multiple parameters; there can only be one occurrence ofsh:memberShape
in a given shape - and I have updated thesh:maxCount
accordingly.This is currently targeted to #403 branch for a smaller diff in the GH UI. #403 should be merged and this targeted to
gh-pages
rather than merging this branch into #403