Skip to content
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

Policy model of duty with a list of consequences can't be handled #3960

Closed
gkirtzou opened this issue Mar 5, 2024 · 4 comments · Fixed by #4085
Closed

Policy model of duty with a list of consequences can't be handled #3960

gkirtzou opened this issue Mar 5, 2024 · 4 comments · Fixed by #4085
Assignees
Labels
bug_report Suspected bugs, awaiting triage
Milestone

Comments

@gkirtzou
Copy link

gkirtzou commented Mar 5, 2024

Bug Report

Describe the Bug

The policy model of Duty contains a single at most connection with Duty, while odrl model says that

A Duty MAY have none, one or many consequence property values of type Duty only when the Duty is referenced by a Rule with the duty or obligation properties.
from https://www.w3.org/TR/odrl-model/#duty

Thus, when one creates a policy that within its obligation has the relation odrl:consequence with a list of odrl:Duty, only the first duty is stored in the db.

Expected Behavior

Being able to handle policies, such as the following one:

{
  "@context": {
    "edc": "https://w3id.org/edc/v0.0.1/ns/",
    "cc": "http://creativecommons.org/ns#",
    "dalicc": "https://dalicc.net/ns#",
    "dalicclib": "https://dalicc.net/licenselibrary/",
    "dcat": "http://www.w3.org/ns/dcat#",
    "dct": "http://purl.org/dc/terms/",
    "foaf": "http://xmlns.com/foaf/0.1/",
    "odrl": "http://www.w3.org/ns/odrl/2/",
    "osl": "http://opensource.org/licenses/",
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "scho": "http://schema.org/",
    "xsd": "http://www.w3.org/2001/XMLSchema#"
  },
  "edc:policy": {
    "@id": "dalicclib:Apache-2.0",
    "@type": "odrl:Set",
    "cc:jurisdiction": "dalicc:worldwide",
    "cc:legalcode": "http://www.apache.org/licenses/LICENSE-2.0",
    "cc:license": "dalicclib:CC-BY-4.0",
    "dct:alternative": [
      "Apache 2.0",
      "Apache License 2.0",
      "Apache License Version 2.0",
      "Apache Version 2.0",
      "A policy with duty on Duty"
    ],
    "dct:publisher": "The Apache Software Foundation",
    "dct:source": "http://www.apache.org/licenses/LICENSE-2.0",
    "dct:title": {
      "@language": "en",
      "@value": "Apache License, Version 2.0"
    },
    "http://spdx.org/rdf/terms#licenseId": "Apache-2.0",
    "odrl:permission": [
      {
        "@type": "odrl:Permission",
        "odrl:action": {
          "@id": "odrl:display"
        }
      },
      {
        "@type": "odrl:Permission",
        "odrl:action": {
          "@id": "odrl:present"
        }
      },
      {
        "@type": "odrl:Permission",
        "odrl:action": {
          "@id": "odrl:reproduce"
        }
      },
      {
        "@type": "odrl:Permission",
        "odrl:action": {
          "@id": "cc:CommercialUse"
        }
      },
      {
        "@type": "odrl:Permission",
        "odrl:action": {
          "@id": "cc:DerivativeWorks"
        }
      },
      {
        "@type": "odrl:Permission",
        "odrl:action": {
          "@id": "dalicc:ModifiedWorks"
        }
      },
      {
        "@type": "odrl:Permission",
        "odrl:action": {
          "@id": "dalicc:chargeDistributionFee"
        }
      }
    ],
    "odrl:prohibition": [
      {
        "@type": "odrl:Prohibition",
        "odrl:action": {
          "@id": "dalicc:promote"
        }
      }
    ],
    "odrl:obligation": [
      {
        "@type": "odrl:Duty",
        "odrl:action": {
          "@id": "odrl:distribute"
        },
        "odrl:consequence": [
          {
            "@type": "odrl:Duty",
            "odrl:action": {
              "@id": "cc:Attribution"
            }
          },
          {
            "@type": "odrl:Duty",
            "odrl:action": {
              "@id": "cc:Notice"
            }
          }
        ]
      }
    ],
    "odrl:target": {
      "@type": "odrl:AssetCollection",
      "dct:type": [
        "dalicc:CreativeWork",
        "http://purl.org/dc/dcmitype/Dataset",
        "http://purl.org/dc/dcmitype/Software"
      ]
    },
    "dalicc:LiabilityLimitation": "In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.",
    "dalicc:WarrantyDisclaimer": "Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.",
    "dalicc:WarrantyOrLiabilityAcceptance": "While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.",
    "dalicc:validityType": "dalicc:perpetual"
  }
}

Observed Behavior

This is the duty created within the db:

[
  {
    "edctype": "dataspaceconnector:duty",
    "target": null,
    "action": {
      "type": "http://www.w3.org/ns/odrl/2/distribute",
      "includedIn": null,
      "constraint": null
    },
    "assignee": null,
    "assigner": null,
    "constraints": [],
    "parentPermission": null,
    "consequence": {
      "edctype": "dataspaceconnector:duty",
      "target": null,
      "action": {
        "type": "http://creativecommons.org/ns#Attribution",
        "includedIn": null,
        "constraint": null
      },
      "assignee": null,
      "assigner": null,
      "constraints": [],
      "parentPermission": null,
      "consequence": null
    }
  }
]

Context Information

Tested on edc v0.3.1, but the problem is expected to be found in v0.5.1, as the Duty model hasn't change in the last 10 months.
Duty class: https://github.com/eclipse-edc/Connector/blob/v0.3.1/spi/common/policy-model/src/main/java/org/eclipse/edc/policy/model/Duty.java#L37

@github-actions github-actions bot added the triage all new issues awaiting classification label Mar 5, 2024
@paullatzelsperger
Copy link
Member

paullatzelsperger commented Mar 5, 2024

@gkirtzou you could workaround this by declaring muliple Duties and joining them in an AndConstraint.
Alternatively, you are welcome to submit a PR.

@paullatzelsperger paullatzelsperger added the bug_report Suspected bugs, awaiting triage label Mar 5, 2024
Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale Open for x days with no activity label Mar 20, 2024
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2024
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale.

@ndr-brt ndr-brt reopened this Mar 29, 2024
@ndr-brt ndr-brt self-assigned this Mar 29, 2024
@ndr-brt ndr-brt removed stale Open for x days with no activity triage all new issues awaiting classification labels Mar 29, 2024
@ndr-brt ndr-brt added this to the Milestone 15 milestone Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug_report Suspected bugs, awaiting triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants