Skip to content

Incorrect results when multiple policies have the same target/action combinations. #3

Description

@joachimvh

I'm getting an unexpected result with the following input, using new ODRLEvaluator(new ODRLEngineMultipleSteps()).

Request:

@prefix odrl: <http://www.w3.org/ns/odrl/2/> .

<urn:ucp:policy:2a797ad7-232a-4e1f-853f-81388969e4a1> a odrl:Request;
    odrl:permission <urn:ucp:rule:e3ba21f7-57b0-4a43-988a-3221aba858ef>.
<urn:ucp:rule:e3ba21f7-57b0-4a43-988a-3221aba858ef> a odrl:Permission;
    odrl:action odrl:read;
    odrl:target <http://localhost:3000/alice/other/resource.txt>;
    odrl:assignee <https://modify.pod.knows.idlab.ugent.be/profile/card#me>.

Policy:

@prefix ex: <http://example.org/>.
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .

ex:usagePolicy1 a odrl:Agreement ;
  odrl:permission ex:permission1 .
ex:permission1 a odrl:Permission ;
  odrl:action odrl:modify, odrl:read ;
  odrl:target <http://localhost:3000/alice/other/resource.txt> ;
  odrl:assignee <https://both.pod.knows.idlab.ugent.be/profile/card#me> .

ex:usagePolicy2 a odrl:Agreement ;
  odrl:permission ex:permission2 .
ex:permission2 a odrl:Permission ;
  odrl:action odrl:modify ;
  odrl:target <http://localhost:3000/alice/other/resource.txt> ;
  odrl:assignee <https://modify.pod.knows.idlab.ugent.be/profile/card#me> .

State of the world is just the current time

The resulting report is the following:

@prefix ex: <http://example.org/>.
@prefix odrl: <http://www.w3.org/ns/odrl/2/>.
@prefix report: <http://example.com/report/temp/>.

<urn:uuid:94a5f2fc-d910-470f-b1c4-3c08d9ece998> a report:PolicyReport;
    <http://purl.org/dc/terms/created> "2025-04-08T12:52:10.986Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>;
    report:policy ex:usagePolicy1;
    report:policyRequest <urn:ucp:policy:428b6a05-40cd-49ac-83aa-e128e64ac337>;
    report:ruleReport <urn:uuid:83de2fb9-dc8c-4c7a-958e-19056e40eec1>.
<urn:uuid:2cda4dbd-abf6-4c69-a4bc-3ea6aeff4bf1> a report:PolicyReport;
    <http://purl.org/dc/terms/created> "2025-04-08T12:52:10.986Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>;
    report:policy ex:usagePolicy2;
    report:policyRequest <urn:ucp:policy:428b6a05-40cd-49ac-83aa-e128e64ac337>;
    report:ruleReport <urn:uuid:a93a6aa8-1c4f-43bf-85a8-89f66af7fae5>.
<urn:uuid:83de2fb9-dc8c-4c7a-958e-19056e40eec1> a report:PermissionReport;
    report:attemptState report:Attempted;
    report:rule ex:permission1;
    report:ruleRequest <urn:ucp:rule:dcfcc0ac-12c8-4c94-85c0-f52b90270d07>;
    report:premiseReport <urn:uuid:b5b481b7-2b3f-4ed5-9c03-fba6cb606cf5>, <urn:uuid:396fb126-0cda-4efe-a290-3f5e54be7d57>, <urn:uuid:34f5d001-4ea5-416d-be6d-fc054a940e6f>, <urn:uuid:f85721b7-4131-4a91-8d35-6e0fbe7e94f8>.
<urn:uuid:a93a6aa8-1c4f-43bf-85a8-89f66af7fae5> a report:PermissionReport;
    report:attemptState report:Attempted;
    report:rule ex:permission2;
    report:ruleRequest <urn:ucp:rule:dcfcc0ac-12c8-4c94-85c0-f52b90270d07>;
    report:premiseReport <urn:uuid:b5b481b7-2b3f-4ed5-9c03-fba6cb606cf5>, <urn:uuid:f8ea227e-f9e2-41ed-af36-a2f900031004>, <urn:uuid:34f5d001-4ea5-416d-be6d-fc054a940e6f>.
<urn:uuid:b5b481b7-2b3f-4ed5-9c03-fba6cb606cf5> a report:TargetReport;
    report:satisfactionState report:Satisfied.
<urn:uuid:396fb126-0cda-4efe-a290-3f5e54be7d57> a report:PartyReport.
<urn:uuid:f8ea227e-f9e2-41ed-af36-a2f900031004> a report:PartyReport;
    report:satisfactionState report:Satisfied.
<urn:uuid:34f5d001-4ea5-416d-be6d-fc054a940e6f> a report:ActionReport;
    report:satisfactionState report:Satisfied.
<urn:uuid:f85721b7-4131-4a91-8d35-6e0fbe7e94f8> a report:ActionReport;
    report:satisfactionState report:Satisfied.
<urn:uuid:a93a6aa8-1c4f-43bf-85a8-89f66af7fae5> report:activationState report:Active.
<urn:uuid:83de2fb9-dc8c-4c7a-958e-19056e40eec1> report:activationState report:Inactive.
<urn:uuid:396fb126-0cda-4efe-a290-3f5e54be7d57> report:satisfactionState report:Unsatisfied.

According to this result the second policy should be active, even though the action value is incorrect.
If the first policy is not present in the file, or does not have both the read and modify actions, the second policy will not be active.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions