Informasjonsforvaltning / datacatalogtordf

A library that will map a data catalog (inkl dataset, dataservices and other dcat resources) to rdf
Apache License 2.0
5 stars 0 forks source link

landing_page.to_rdf() splits landing_page-url into a list of characters #9

Closed sskagemo closed 3 years ago

sskagemo commented 3 years ago
>>> from datacatalogtordf import Dataset
>>> dataset = Dataset()
>>> dataset.identifier = "http://example.com/datasets/1"
>>> dataset.landing_page = "http://enurl.com"
>>> dataset.to_rdf().decode()
'@prefix dcat: <http://www.w3.org/ns/dcat#> .\n\n<http://example.com/datasets/1> a dcat:Dataset ;\n    dcat:landingPage <.>,\n        </>,\n        <:>,\n        <c>,\n        <e>,\n        <h>,\n        <l>,\n        <m>,\n        <n>,\n        <o>,\n        <p>,\n        <r>,\n        <t>,\n        <u> .\n\n'
>>> dataset.landing_page
'http://enurl.com'
>>> 
sskagemo commented 3 years ago

But this works:

>>> dataset.landing_page = ["http://enurl.com"]
>>> dataset.to_rdf().decode()
'@prefix dcat: <http://www.w3.org/ns/dcat#> .\n\n<http://example.com/datasets/1> a dcat:Dataset ;\n    dcat:landingPage <http://enurl.com> .\n\n'
>>> 

So I guess it means landing_page must be a list, but then maybe there should be an error when it is used with a string?

sskagemo commented 3 years ago

I believe this issue should be closed as "learning-Python-basics-by-mistakes"; dataset.landing_page is a list, and values should be added by .append(), not = ... Thank you for listening!