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

Catalog.Datasets.remove() has no effect #4

Closed sskagemo closed 4 years ago

sskagemo commented 4 years ago

Added a DataService to a catalog as a Dataset, instead of as a DataService. Tried to remove it using the remove()-method. No changes to the catalog.

Below is the turtle-output, which is identical before and after using remove:

<http://brreg.no/catalogs/2> a dcat:Catalog ;
    dct:title "En katalog for BRs SOAP-baserte API-er"@nb ;
    dcat:dataset <http://brreg.no/apis/1> ;
    dcat:service <http://brreg.no/apis/1> .
stigbd commented 4 years ago

Thanks a lot for reporting this. New patch-release resolves the issue.

Note that there are subtle differences related to different ways of removing items from a list. My test uses

# Remove second item
    del catalog.services[1]

https://github.com/Informasjonsforvaltning/datacatalogtordf/blob/e62dc92e4e178684c6fa3b04b48df1fabbafe8ed/tests/test_catalog.py#L303

See also this discussion: https://stackoverflow.com/questions/11520492/difference-between-del-remove-and-pop-on-lists/11520540