Repository navigation
Feat/normalisation - #12
Open
woutslabbinck wants to merge 16 commits into
Open
woutslabbinck wants to merge 16 commits into
woutslabbinck wants to merge 16 commits into
Conversation
…profile is corrupt
…t of test fails because of closed rule shape. Also fix normalisation for odrl logical constraint operands
…ctual creation of the ODRL voc. We must not test that during validation of policies
…creating the voc). Also fixes action validation
… + ODRL Logical constraint needs to be added as a type to the other test case; other test cases can not be fixed yet
…ust now contain the expected one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Normalisation steps and closed shapes
Changes
Normalisation (
src/Normalisation.ts)odrl:Permission/Prohibition/Duty), constraints and logical constraints.odrl:inheritFrom(cycles are rejected).dct:isReplacedBy), including chains (cycles and external policies are rejected).Closed shapes (
src/shapes/modules/):PolicyShape,:RuleShape,:ConstraintShapeand:LogicalConstraintShapearesh:closed.dctermsmetadata is ignored (a-01-dcterms-closed-list.ttl).odrl:includedIn) and R113 (odrl:implies): they describe the ODRL vocabulary, not policies.Profiles (
src/profiles/Profile.ts), so profile terms pass the closed shapesTests
Known failures (13 of 510)
odrl:Policy. A directsh:inwould fix this, but it rejects policies also typedodrl:Asset(49 TOSL examples). Whether a policy may be an asset is still open.odrl:Permission, so the profile type is not checked.tosl:onDispute,tosl:liability,tosl:limitationOfLiability,tosl:trigger) that are not part of the ODRL Profile mechanism, so the closed shapes reject them.Summary
test/unit/PolicyShapes.test.ts:policy1 a :MyPolicyis reportedodrl:Policy; R107 only requires one policy typeodrl:Assettest/unit/Validator.test.tsodrl:Assettest/unit/Validator.test.tsodrl:Permission; the extra rule type is not checkedtest/unit/Validator.test.tstest/integration/TOSLProfile.test.tstosl:triggerpossibly1–2. R107: policy type (potential fix, blocked by an open issue)
N2 (
inferPolicy) addsrdf:type odrl:Policyto every subject ofodrl:permission/prohibition/obligation.R107 uses
sh:qualifiedValueShape+sh:qualifiedMinCount 1, so one valid type is enough and an unknown type (:MyPolicy,prof:MyPolicywithout the profile) passes.Potential fix: a direct
sh:inonrdf:type, so every type must be a policy class (profile subclasses ofodrl:Policyare appended bysrc/profiles/Profile.ts):sh:property [ sh:path rdf:type ; sh:in ( odrl:Policy odrl:Agreement odrl:Assertion odrl:Offer odrl:Privacy odrl:Request odrl:Set odrl:Ticket ) ; ] ;This fixes tests 1 and 2, but breaks 49 TOSL examples: their policies are typed both as a policy and as
odrl:Asset, which is not a policy class.Open issue:
odrl:Assetcannot simply be added to the list.With
odrl:Assetadded, tests 1 and 2 pass and no other test breaks (tested), but the shape would then state that a policy may also be an asset.That is not decided yet, so neither variant of the fix can be applied:
sh:inwith policy classes onlyodrl:Assetare rejectedsh:inwith policy classes +odrl:Asset3–4. Profile rule subclass with the wrong relation (no fix)
Neither policy declares
odrl:profile, so both are validated with the plain ODRL shapes.N2 (
inferRules) adds:rule a odrl:Permission, so:RuleShape'ssh:oris satisfied andprof:MyRuleis ignored.Catching this would mean allowing only one type per rule (see the note in the test), which ODRL does not require.
5–13. TOSL examples (no fix: invalid policies, except possibly
tosl:trigger)The examples use TOSL properties that are not an extension point of the ODRL Profile mechanism (ODRL IM §3.3).
A profile may add Policy/Rule subclasses,
odrl:relation/odrl:function/odrl:operandsubproperties, and Action/LeftOperand/RightOperand/Operator/ConflictTerm instances, but not arbitrary properties on a Policy or Rule.The closed
:PolicyShapeand:RuleShapecorrectly reject them (sh:ClosedConstraintComponent).elsevier/API_Service_Agreement_2017.ttltosl:onDispute,tosl:trigger:PolicyShape,:RuleShapeelsevier/clause-1.2.ttltosl:trigger:RuleShapeelsevier/clause-6.ttltosl:onDispute:PolicyShapeopenai/Europe_terms_of_use_2024.ttltosl:onDispute,tosl:limitationOfLiability,tosl:liability:PolicyShapeopenai/openai_28_liability04.ttltosl:limitationOfLiability:PolicyShapeopenai/openai_29_liability05.ttltosl:liability:PolicyShapeopenai/openai_31_litigation01.ttltosl:onDispute:PolicyShapeopenai/openai_32_litigation02.ttltosl:onDispute:PolicyShapeopenai/openai_40_litigation03.ttltosl:onDispute:PolicyShapeThe same properties on an asset pass, because
:AssetShapeis not closed.tosl:trigger(possible fix): it links a Permission to a Duty, likeodrl:duty,odrl:remedyandodrl:consequence.The Profile mechanism does not document such rule-to-rule relations, but it also does not document the relation between a policy and a profile rule subclass, and for that case we decided to support it (
addRuleTypesinsrc/profiles/Profile.ts).By the same reasoning, a profile property with a rule class as domain and range could be added to
:RuleShape, which would fixclause-1.2.ttl.API_Service_Agreement_2017.ttlwould still fail ontosl:onDispute.tosl:onDispute,tosl:liabilityandtosl:limitationOfLiabilitylink a policy to a non-ODRL class (tosl:DisputeResolution,tosl:Liability), so this reasoning does not apply to them.The reported messages are misleading: a closed-shape violation shows the shape's node-level message ("Policies must be identified by an IRI." or "A rule must be typed as odrl:Permission, odrl:Prohibition or odrl:Duty.").