Skip to content

Commit

Permalink
Merge pull request #131 from opendata-swiss/update_license_to_uri
Browse files Browse the repository at this point in the history
Update mapping for the terms of use
  • Loading branch information
bellisk authored Aug 8, 2024
2 parents 086db07 + 9fde651 commit 8512c1d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 16 deletions.
8 changes: 4 additions & 4 deletions ckanext/geocat/tests/test_distribution_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def setUp(self):
def test_resources_are_picked_up_correctly_with_dataset_fields(self):
self.assertEquals(4, len(self.distributions))
for distribution in self.distributions:
self.assertEquals(distribution.get('rights'), "NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired")
self.assertEquals(distribution.get('license'), "NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired")
self.assertEquals(distribution.get('rights'), "https://opendata.swiss/terms-of-use/#terms_open")
self.assertEquals(distribution.get('license'), "https://opendata.swiss/terms-of-use/#terms_open")
self.assertEquals(distribution.get('issued'), self.dataset.get('issued'))
self.assertEquals(distribution.get('modified'), self.dataset.get('modified'))
self._is_multi_lang(distribution['title'])
Expand Down Expand Up @@ -111,8 +111,8 @@ def setUp(self):
def test_fields_that_come_from_the_dataset(self):
self.assertEquals(6, len(self.distributions))
for distribution in self.distributions:
self.assertEquals(distribution.get('rights'), "NonCommercialAllowed-CommercialAllowed-ReferenceRequired")
self.assertEquals(distribution.get('license'), "NonCommercialAllowed-CommercialAllowed-ReferenceRequired")
self.assertEquals(distribution.get('rights'), "https://opendata.swiss/terms-of-use/#terms_by")
self.assertEquals(distribution.get('license'), "https://opendata.swiss/terms-of-use/#terms_by")
self.assertEquals(distribution.get('issued'), self.dataset.get('issued'))
self.assertEquals(distribution.get('modified'), self.dataset.get('modified'))
self._is_multi_lang(distribution['title'])
Expand Down
46 changes: 38 additions & 8 deletions ckanext/geocat/utils/geocat-terms-of-use.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:skosxl="http://www.w3.org/2008/05/skos-xl#"
xmlns:dc11="http://purl.org/dc/elements/1.1/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:dc="http://purl.org/dc/terms/">
Expand All @@ -18,44 +20,72 @@
<dc:modified>2019-09-24</dc:modified>
</skos:ConceptScheme>

<skos:Concept rdf:about="https://opendata.swiss/en/terms-of-use/#terms_open">
<skos:Concept rdf:about="http://dcat-ap.ch/vocabulary/licenses/terms_open">
<skos:prefLabel xml:lang="en">Opendata OPEN: Open use.</skos:prefLabel>
<skos:prefLabel xml:lang="fr">Opendata OPEN: Utilisation libre.</skos:prefLabel>
<skos:prefLabel xml:lang="de">Opendata OPEN: Freie Nutzung.</skos:prefLabel>
<skos:prefLabel xml:lang="it">Opendata OPEN: Libero utilizzo.</skos:prefLabel>
<skos:altLabel xml:lang="de">Freie Nutzung</skos:altLabel>
<skos:altLabel xml:lang="fr">Utilisation libre</skos:altLabel>
<skos:mappingRelation>NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired</skos:mappingRelation>
<skosxl:prefLabel>
<skosxl:Label>
<skosxl:literalForm xml:lang="en">NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired</skosxl:literalForm>
<rdfs:label xml:lang="en">NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired</rdfs:label>
</skosxl:Label>
</skosxl:prefLabel>
<skos:mappingRelation>https://opendata.swiss/terms-of-use/#terms_open</skos:mappingRelation>
<foaf:homepage rdf:resource="https://opendata.swiss/terms-of-use/#terms_open"/>
</skos:Concept>

<skos:Concept rdf:about="https://opendata.swiss/en/terms-of-use/#terms_by">
<skos:Concept rdf:about="http://dcat-ap.ch/vocabulary/licenses/terms_by">
<skos:prefLabel xml:lang="en">Opendata BY: Open use. Must provide the source.</skos:prefLabel>
<skos:prefLabel xml:lang="fr">Opendata BY: Utilisation libre. Obligation d’indiquer la source.</skos:prefLabel>
<skos:prefLabel xml:lang="de">Opendata BY: Freie Nutzung. Quellenangabe ist Pflicht.</skos:prefLabel>
<skos:prefLabel xml:lang="it">Opendata BY: Libero utilizzo. Indicazione della fonte obbligatoria. Utilizzo a fini commerciali ammesso soltanto previo consenso del titolare dei dati</skos:prefLabel>
<skos:altLabel xml:lang="de">Freie Nutzung. Quellenangabe ist Pflicht.</skos:altLabel>
<skos:altLabel xml:lang="fr">Utilisation libre. Obligation d’indiquer la source.</skos:altLabel>
<skos:mappingRelation>NonCommercialAllowed-CommercialAllowed-ReferenceRequired</skos:mappingRelation>
<skosxl:prefLabel>
<skosxl:Label>
<skosxl:literalForm xml:lang="en">NonCommercialAllowed-CommercialAllowed-ReferenceRequired</skosxl:literalForm>
<rdfs:label xml:lang="en">NonCommercialAllowed-CommercialAllowed-ReferenceRequired</rdfs:label>
</skosxl:Label>
</skosxl:prefLabel>
<skos:mappingRelation>https://opendata.swiss/terms-of-use/#terms_by</skos:mappingRelation>
<foaf:homepage rdf:resource="https://opendata.swiss/terms-of-use/#terms_by"/>
</skos:Concept>

<skos:Concept rdf:about="https://opendata.swiss/en/terms-of-use/#terms_ask">
<skos:Concept rdf:about="http://dcat-ap.ch/vocabulary/licenses/terms_ask">
<skos:prefLabel xml:lang="en">Opendata ASK: Open use. Use for commercial purposes requires permission of the data owner.</skos:prefLabel>
<skos:prefLabel xml:lang="fr">Opendata ASK: Utilisation libre. Utilisation à des fins commerciales uniquement avec l’autorisation du fournisseur des données.</skos:prefLabel>
<skos:prefLabel xml:lang="de">Opendata ASK: Freie Nutzung. Kommerzielle Nutzung nur mit Bewilligung des Datenlieferanten zulässig.</skos:prefLabel>
<skos:prefLabel xml:lang="it">Opendata ASK: Libero utilizzo. Utilizzo a fini commerciali ammesso soltanto previo consenso del titolare dei dati.</skos:prefLabel>
<skos:altLabel xml:lang="de">Freie Nutzung. Kommerzielle Nutzung nur mit Bewilligung des Datenlieferanten zulässig.</skos:altLabel>
<skos:altLabel xml:lang="fr">Utilisation libre. Utilisation à des fins commerciales uniquement avec l’autorisation du fournisseur des données.</skos:altLabel>
<skos:mappingRelation>NonCommercialAllowed-CommercialWithPermission-ReferenceNotRequired</skos:mappingRelation>
<skosxl:prefLabel>
<skosxl:Label>
<skosxl:literalForm xml:lang="en">NonCommercialAllowed-CommercialWithPermission-ReferenceNotRequired</skosxl:literalForm>
<rdfs:label xml:lang="en">NonCommercialAllowed-CommercialWithPermission-ReferenceNotRequired</rdfs:label>
</skosxl:Label>
</skosxl:prefLabel>
<skos:mappingRelation>https://opendata.swiss/terms-of-use/#terms_ask</skos:mappingRelation>
<foaf:homepage rdf:resource="https://opendata.swiss/terms-of-use/#terms_ask"/>
</skos:Concept>

<skos:Concept rdf:about="https://opendata.swiss/en/terms-of-use/#terms_by_ask">
<skos:Concept rdf:about="http://dcat-ap.ch/vocabulary/licenses/terms_by_ask">
<skos:prefLabel xml:lang="en">Opendata BY ASK: Open use. Must provide the source. Use for commercial purposes requires permission of the data owner.</skos:prefLabel>
<skos:prefLabel xml:lang="fr">Opendata BY ASK: Utilisation libre. Obligation d’indiquer la source. Utilisation commerciale uniquement avec l’autorisation du fournisseur des données.</skos:prefLabel>
<skos:prefLabel xml:lang="de">Opendata BY ASK: Freie Nutzung. Quellenangabe ist Pflicht. Kommerzielle Nutzung nur mit Bewilligung des Datenlieferanten zulässig.</skos:prefLabel>
<skos:prefLabel xml:lang="it">Opendata BY ASK: Libero utilizzo. Indicazione della fonte obbligatoria. Utilizzo a fini commerciali ammesso soltanto previo consenso del titolare dei dati.</skos:prefLabel>
<skos:altLabel xml:lang="de">Freie Nutzung. Quellenangabe ist Pflicht. Kommerzielle Nutzung nur mit Bewilligung des Datenlieferanten zulässig.</skos:altLabel>
<skos:altLabel xml:lang="fr">Utilisation libre. Obligation d’indiquer la source. Utilisation commerciale uniquement avec l’autorisation du fournisseur des données.</skos:altLabel>
<skos:mappingRelation>NonCommercialAllowed-CommercialWithPermission-ReferenceRequired</skos:mappingRelation>
<skosxl:prefLabel>
<skosxl:Label>
<skosxl:literalForm xml:lang="en">NonCommercialAllowed-CommercialWithPermission-ReferenceRequired</skosxl:literalForm>
<rdfs:label xml:lang="en">NonCommercialAllowed-CommercialWithPermission-ReferenceRequired</rdfs:label>
</skosxl:Label>
</skosxl:prefLabel>
<skos:mappingRelation>https://opendata.swiss/terms-of-use/#terms_by_ask</skos:mappingRelation>
<foaf:homepage rdf:resource="https://opendata.swiss/terms-of-use/#terms_by_ask"/>
</skos:Concept>

</rdf:RDF>
8 changes: 4 additions & 4 deletions ckanext/geocat/utils/mapping_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

DCT = Namespace("http://purl.org/dc/terms/")
SKOS = Namespace("http://www.w3.org/2004/02/skos/core#")
TERMS_OF_USE_OPEN = 'NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired' # noqa
TERMS_OF_USE_BY = 'NonCommercialAllowed-CommercialAllowed-ReferenceRequired' # noqa
TERMS_OF_USE_ASK = 'NonCommercialAllowed-CommercialWithPermission-ReferenceNotRequired' # noqa
TERMS_OF_USE_BY_ASK = 'NonCommercialAllowed-CommercialWithPermission-ReferenceRequired' # noqa
TERMS_OF_USE_OPEN = 'https://opendata.swiss/terms-of-use/#terms_open'
TERMS_OF_USE_BY = 'https://opendata.swiss/terms-of-use#terms_by'
TERMS_OF_USE_ASK = 'https://opendata.swiss/terms-of-use#terms_ask'
TERMS_OF_USE_BY_ASK = 'https://opendata.swiss/terms-of-use#terms_by_ask'
VALID_TERMS_OF_USE = [
TERMS_OF_USE_BY,
TERMS_OF_USE_ASK,
Expand Down

0 comments on commit 8512c1d

Please sign in to comment.