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

Backend UI API Wrapper: Get Catalog Endpoint with 0.2.x #333

Closed
3 tasks
Tracked by #399
efiege opened this issue Jun 27, 2023 · 1 comment
Closed
3 tasks
Tracked by #399

Backend UI API Wrapper: Get Catalog Endpoint with 0.2.x #333

efiege opened this issue Jun 27, 2023 · 1 comment
Assignees
Labels
kind/enhancement New feature or request
Milestone

Comments

@efiege
Copy link

efiege commented Jun 27, 2023

Feature Request

Description

Dealing with JSON-LD in Angular templates does not work, so before we add an intermediate layer into our UI we want to deal with the JSON-LD in our UI API Wrapper. Thus we want to add a new endpoint to type safely use the EDC Version 0 APIs from our UI.

Old Request:
GET | https://base.de/control/data/catalog?providerUrl=https://base2.de/control/api/v1/ids/data&limit=10000000

Old Response:

{
  "id": "default",
  "contractOffers": [
    {
      "id": "cats-proxy:e2f04d62-394a-4a99-9f7f-8ac167c4e9fe",
      "policy": {
        "permissions": [
          {
            "edctype": "dataspaceconnector:permission",
            "uid": null,
            "target": "urn:artifact:google-proxy",
            "action": {
              "type": "USE",
              "includedIn": null,
              "constraint": null
            },
            "assignee": null,
            "assigner": null,
            "constraints": [
              {
                "edctype": "AtomicConstraint",
                "leftExpression": {
                  "edctype": "dataspaceconnector:literalexpression",
                  "value": "ALWAYS_TRUE"
                },
                "rightExpression": {
                  "edctype": "dataspaceconnector:literalexpression",
                  "value": "true"
                },
                "operator": "EQ"
              }
            ],
            "duties": []
          }
        ],
        "prohibitions": [],
        "obligations": [],
        "extensibleProperties": {},
        "inheritsFrom": null,
        "assigner": null,
        "assignee": null,
        "target": "urn:artifact:google-proxy",
        "@type": {
          "@policytype": "set"
        }
      },
      "asset": {
        "id": "urn:artifact:google-proxy",
        "createdAt": 1687856946886,
        "properties": {
          "asset:prop:byteSize": null,
          "asset:prop:name": "google-proxy",
          "asset:prop:description": "HttpProxy",
          "asset:prop:id": "urn:artifact:google-proxy",
          "asset:prop:originatorOrganization": "sovity GmbH",
          "asset:prop:fileName": null,
          "asset:prop:originator": "https://base.de/control/api/v1/ids/data",
          "asset:prop:language": "https://w3id.org/idsa/code/EN"
        }
      },
      "provider": "urn:connector:demo-edc-2",
      "consumer": "urn:connector:demo-edc",
      "offerStart": null,
      "offerEnd": null,
      "contractStart": "2023-06-27T09:09:06.695Z",
      "contractEnd": "2024-06-26T09:09:06.692Z"
    },
    {
      "id": "google-neu-cd:0c0047af-d512-4a3e-8fdb-82a690e5c76d",
      "policy": {
        "permissions": [
          {
            "edctype": "dataspaceconnector:permission",
            "uid": null,
            "target": "urn:artifact:google-neu",
            "action": {
              "type": "USE",
              "includedIn": null,
              "constraint": null
            },
            "assignee": null,
            "assigner": null,
            "constraints": [
              {
                "edctype": "AtomicConstraint",
                "leftExpression": {
                  "edctype": "dataspaceconnector:literalexpression",
                  "value": "ALWAYS_TRUE"
                },
                "rightExpression": {
                  "edctype": "dataspaceconnector:literalexpression",
                  "value": "true"
                },
                "operator": "EQ"
              }
            ],
            "duties": []
          }
        ],
        "prohibitions": [],
        "obligations": [],
        "extensibleProperties": {},
        "inheritsFrom": null,
        "assigner": null,
        "assignee": null,
        "target": "urn:artifact:google-neu",
        "@type": {
          "@policytype": "set"
        }
      },
      "asset": {
        "id": "urn:artifact:google-neu",
        "createdAt": 1687856946886,
        "properties": {
          "asset:prop:byteSize": null,
          "asset:prop:name": "google-neu",
          "asset:prop:description": "https://google.de",
          "asset:prop:id": "urn:artifact:google-neu",
          "asset:prop:originatorOrganization": "sovity GmbH",
          "asset:prop:fileName": null,
          "asset:prop:originator": "https://base2.de/control/api/v1/ids/data",
          "asset:prop:language": "https://w3id.org/idsa/code/EN"
        }
      },
      "provider": "urn:connector:demo-edc-2",
      "consumer": "urn:connector:demo-edc",
      "offerStart": null,
      "offerEnd": null,
      "contractStart": "2023-06-27T09:09:06.704Z",
      "contractEnd": "2024-06-26T09:09:06.704Z"
    }
  ]
}

New Request:
POST | https://base.de/control/data/catalog?
body:

{
    "@context": {
        "edc": "https://w3id.org/edc/v0.0.1/ns/"
    },
    "protocol": "dataspace-protocol-http",
    "providerUrl": "{{PROVIDER_EDC_PROTOCOL_URL}}",
    "querySpec": {
        "@type": "QuerySpecDto",
        "offset": 0,
        "limit": 10
    }
}

New Response:

{
    "@id": "ef10dc5d-157b-4c68-a5f9-a59531f96b66",
    "@type": "dcat:Catalog",
    "dcat:dataset": [
        {
            "@id": "0ff9f927-8b7e-4b53-8012-82840448d39b",
            "@type": "dcat:Dataset",
            "odrl:hasPolicy": {
                "@id": "contract-definition-2:http-source-2:19df122b-14bc-4028-a51e-35e89860f4fe",
                "@type": "odrl:Set",
                "odrl:permission": [],
                "odrl:prohibition": [],
                "odrl:obligation": [],
                "odrl:target": "http-source-2"
            },
            "dcat:distribution": [],
            "http://w3id.org/mds#transportMode": "Road",
            "asset:prop:contenttype": "text/plain",
            "asset:prop:version": "1.0",
            "http://w3id.org/mds#geoReferenceMethod": "Geo Ref Method Test",
            "http://w3id.org/mds#dataModel": "CSV",
            "http://w3id.org/mds#dataSubcategory": "Hazard Warnings",
            "asset:prop:language": "https://w3id.org/idsa/code/EN",
            "asset:prop:keywords": "keyword1,keyword2",
            "asset:prop:name": "test-document",
            "asset:prop:description": "test-document",
            "asset:prop:endpointDocumentation": "https://github.com/Mobility-Data-Space/mobility-data-space/wiki/MDS-Ontology",
            "edc:type": "AzureStorage",
            "asset:prop:publisher": "https://sovity.de/",
            "http://w3id.org/mds#dataCategory": "Traffic Information",
            "edc:id": "http-source-2",
            "asset:prop:standardLicense": "https://creativecommons.org/licenses/by/4.0/"
        },
        {
            "@id": "31f27689-c4a1-4f62-bd2d-5b718492a1d3",
            "@type": "dcat:Dataset",
            "odrl:hasPolicy": {
                "@id": "contract-definition-5:http-source-5:a5126ee0-c4ef-472f-949b-9640380e2288",
                "@type": "odrl:Set",
                "odrl:permission": [],
                "odrl:prohibition": [],
                "odrl:obligation": [],
                "odrl:target": "http-source-5"
            },
            "dcat:distribution": [],
            "asset:prop:name": "http source",
            "asset:prop:description": "http source asset description",
            "edc:id": "http-source-5"
        },
        {
            "@id": "37f92cbb-0b36-40ea-bae7-f04c5251b00b",
            "@type": "dcat:Dataset",
            "odrl:hasPolicy": {
                "@id": "contract-definition-6:http-source-6:06eacaae-140a-45e9-bb27-918a93261b90",
                "@type": "odrl:Set",
                "odrl:permission": {
                    "odrl:target": "http-source-6",
                    "odrl:action": {
                        "odrl:type": "USE"
                    },
                    "odrl:constraint": [
                        {
                            "odrl:leftOperand": "POLICY_EVALUATION_TIME",
                            "odrl:operator": {
                                "@id": "odrl:gteq"
                            },
                            "odrl:rightOperand": "2022-05-31T22:00:00.000Z"
                        },
                        {
                            "odrl:leftOperand": "POLICY_EVALUATION_TIME",
                            "odrl:operator": {
                                "@id": "odrl:lt"
                            },
                            "odrl:rightOperand": "2030-06-30T22:00:00.000Z"
                        }
                    ]
                },
                "odrl:prohibition": [],
                "odrl:obligation": [],
                "odrl:target": "http-source-6"
            },
            "dcat:distribution": [],
            "asset:prop:name": "http source",
            "asset:prop:description": "http source asset description",
            "edc:id": "http-source-6"
        }
    ],
    "dcat:service": {
        "@id": "7bdabf0d-38f9-4faa-9f03-8e7430d65c4b",
        "@type": "dcat:DataService",
        "dct:terms": "connector",
        "dct:endpointUrl": "http://edc:11003/api/v1/ids"
    },
    "edc:participantId": "provider",
    "@context": {
        "dct": "https://purl.org/dc/terms/",
        "edc": "https://w3id.org/edc/v0.0.1/ns/",
        "dcat": "https://www.w3.org/ns/dcat/",
        "odrl": "http://www.w3.org/ns/odrl/2/",
        "dspace": "https://w3id.org/dspace/v0.8/"
    }
}

Solution Proposal and Work Breakdown

  • Convert GET to POST request
  • Set the correct body for the POST request
  • Interpret the new catalog response
@efiege efiege added the kind/enhancement New feature or request label Jun 27, 2023
@SebastianOpriel SebastianOpriel added this to the Migration MS8->0.1.x milestone Jul 13, 2023
@richardtreier richardtreier changed the title Migrate Catalog-Call to Management Api Version 0.1.2 Backend UI API Wrapper: Catalog Endpoint with 0.2.x Aug 1, 2023
@tmberthold tmberthold removed their assignment Aug 2, 2023
@richardtreier richardtreier changed the title Backend UI API Wrapper: Catalog Endpoint with 0.2.x Backend UI API Wrapper: Get Catalog Endpoint with 0.2.x Aug 3, 2023
@richardtreier
Copy link
Collaborator

done in sovity/edc-ce#525

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

5 participants