diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fc25f9c..7a544383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support for `delta` tables on S3 (#24) - Added new command `datacontract catalog` that generates a data contract catalog with an `index.html` file. +### Fixed +- RDF Export: Fix error if owner is not a URI/URN + + ## [0.10.1] - 2024-04-19 ### Fixed diff --git a/datacontract/export/rdf_converter.py b/datacontract/export/rdf_converter.py index 36d5c26c..98af7c0d 100644 --- a/datacontract/export/rdf_converter.py +++ b/datacontract/export/rdf_converter.py @@ -1,7 +1,8 @@ from pydantic import BaseModel from rdflib import Graph, Literal, BNode, RDF, URIRef, Namespace -from datacontract.model.data_contract_specification import DataContractSpecification +from datacontract.model.data_contract_specification import \ + DataContractSpecification def is_literal(property_name): @@ -140,7 +141,7 @@ def add_info(contract, info, graph, dc, dcx): graph.add((bnode_info, dc.version, Literal(info.version))) # add owner - owner = URIRef(info.owner) + owner = Literal(info.owner) graph.add((bnode_info, dc.owner, owner)) # add contact diff --git a/tests/fixtures/export/rdf/datacontract.yaml b/tests/fixtures/export/rdf/datacontract.yaml index 3864c2a6..b13f3059 100644 --- a/tests/fixtures/export/rdf/datacontract.yaml +++ b/tests/fixtures/export/rdf/datacontract.yaml @@ -3,7 +3,7 @@ id: orders-unit-test info: title: Orders Unit Test version: 1.0.0 - owner: urn:acme:checkout + owner: checkout contact: email: team-orders@example.com url: https://wiki.example.com/teams/checkout diff --git a/tests/test_export_rdf.py b/tests/test_export_rdf.py index 811ba5ae..771ef706 100644 --- a/tests/test_export_rdf.py +++ b/tests/test_export_rdf.py @@ -8,7 +8,8 @@ from datacontract.cli import app from datacontract.export.rdf_converter import to_rdf -from datacontract.model.data_contract_specification import DataContractSpecification +from datacontract.model.data_contract_specification import \ + DataContractSpecification logging.basicConfig(level=logging.DEBUG, force=True) @@ -44,7 +45,7 @@ def test_to_rdf(): dcx:email "team-orders@example.com" ; dc1:url "https://wiki.example.com/teams/checkout" ] ; dc1:description "None" ; - dc1:owner ; + dc1:owner "checkout" ; dc1:title "Orders Unit Test" ; dc1:version "1.0.0" ] ; dc1:model ; @@ -140,7 +141,7 @@ def test_to_rdf_complex(): dc1:url "https://teams.microsoft.com/l/channel/acme/checkout" ] ; dc1:description \"\"\"Successful customer orders in the webshop. All orders since 2020-01-01. Orders with their line items are in their current state (no history included). \"\"\" ; - dc1:owner ; + dc1:owner "urn:acme:CheckoutTeam" ; dc1:title "Orders Latest" ; dc1:version "1.0.0" ] ; dc1:model ,