udata 12.0.2.dev13__py3-none-any.whl → 12.0.2.dev14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of udata might be problematic. Click here for more details.
- udata/harvest/tests/dcat/bnodes.xml +17 -1
- udata/harvest/tests/test_dcat_backend.py +25 -0
- udata/rdf.py +29 -2
- udata/settings.py +6 -1
- {udata-12.0.2.dev13.dist-info → udata-12.0.2.dev14.dist-info}/METADATA +1 -1
- {udata-12.0.2.dev13.dist-info → udata-12.0.2.dev14.dist-info}/RECORD +10 -10
- {udata-12.0.2.dev13.dist-info → udata-12.0.2.dev14.dist-info}/WHEEL +0 -0
- {udata-12.0.2.dev13.dist-info → udata-12.0.2.dev14.dist-info}/entry_points.txt +0 -0
- {udata-12.0.2.dev13.dist-info → udata-12.0.2.dev14.dist-info}/licenses/LICENSE +0 -0
- {udata-12.0.2.dev13.dist-info → udata-12.0.2.dev14.dist-info}/top_level.txt +0 -0
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
xmlns:dcterms="http://purl.org/dc/terms/"
|
|
12
12
|
xmlns:vcard="http://www.w3.org/2006/vcard/ns#"
|
|
13
13
|
xmlns:schema="http://schema.org/"
|
|
14
|
+
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
|
|
14
15
|
>
|
|
15
16
|
<dcat:Catalog rdf:about="http://data.test.org/">
|
|
16
17
|
<dcat:dataset>
|
|
@@ -45,7 +46,6 @@
|
|
|
45
46
|
<dcterms:title>Sample DCAT Catalog</dcterms:title>
|
|
46
47
|
<dcat:dataset>
|
|
47
48
|
<dcat:Dataset>
|
|
48
|
-
<dcat:theme>Theme 2</dcat:theme>
|
|
49
49
|
<dcat:contactPoint rdf:resource="http://data.test.org/contacts/1"/>
|
|
50
50
|
<dcat:landingPage>http://data.test.org/datasets/1</dcat:landingPage>
|
|
51
51
|
<dcat:keyword>Tag 3</dcat:keyword>
|
|
@@ -75,6 +75,17 @@
|
|
|
75
75
|
<dcat:distribution rdf:resource="http://data.test.org/datasets/1/resources/1"/>
|
|
76
76
|
<dcterms:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2016-12-14T18:59:02.737480</dcterms:issued>
|
|
77
77
|
<dcterms:identifier>1</dcterms:identifier>
|
|
78
|
+
<dcat:theme>
|
|
79
|
+
<skos:Concept>
|
|
80
|
+
<skos:prefLabel xml:lang="fr">Répartition des espèces</skos:prefLabel>
|
|
81
|
+
<skos:inScheme>
|
|
82
|
+
<skos:ConceptScheme>
|
|
83
|
+
<dcterms:title xml:lang="fr">GEMET - INSPIRE themes, version 1.0</dcterms:title>
|
|
84
|
+
<dcterms:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-07-27</dcterms:issued>
|
|
85
|
+
</skos:ConceptScheme>
|
|
86
|
+
</skos:inScheme>
|
|
87
|
+
</skos:Concept>
|
|
88
|
+
</dcat:theme>
|
|
78
89
|
</dcat:Dataset>
|
|
79
90
|
</dcat:dataset>
|
|
80
91
|
<dcat:dataset>
|
|
@@ -110,6 +121,7 @@
|
|
|
110
121
|
</dct:spatial>
|
|
111
122
|
<dcterms:identifier>2</dcterms:identifier>
|
|
112
123
|
<dct:conformsTo rdf:nodeID="Ne0189e93917c4f67a412fc44883322e7"/>
|
|
124
|
+
<dcat:theme rdf:resource="http://bnode.namespace.voc/theme/hy"/>
|
|
113
125
|
</dcat:Dataset>
|
|
114
126
|
</dcat:dataset>
|
|
115
127
|
<dcat:service>
|
|
@@ -185,4 +197,8 @@
|
|
|
185
197
|
<dct:type rdf:resource="http://inspire.ec.europa.eu/glossary/SpatialReferenceSystem"/>
|
|
186
198
|
<dct:title xml:lang="fr">RGF93 / Lambert-93 (EPSG:2154)</dct:title>
|
|
187
199
|
</rdf:Description>
|
|
200
|
+
<skos:Concept rdf:about="http://bnode.namespace.voc/theme/hy">
|
|
201
|
+
<skos:inScheme rdf:resource="http://inspire.ec.europa.eu/theme"/>
|
|
202
|
+
<skos:prefLabel>Hydrographie</skos:prefLabel>
|
|
203
|
+
</skos:Concept>
|
|
188
204
|
</rdf:RDF>
|
|
@@ -445,6 +445,23 @@ class DcatBackendTest:
|
|
|
445
445
|
assert resources_by_title["Resource 3-1"].schema.url is None
|
|
446
446
|
assert resources_by_title["Resource 3-1"].schema.version == "2.2.0"
|
|
447
447
|
|
|
448
|
+
@pytest.mark.options(SCHEMA_CATALOG_URL="https://example.com/schemas")
|
|
449
|
+
def test_harvest_inspire_themese(self, rmock):
|
|
450
|
+
rmock.get("https://example.com/schemas", json=ResourceSchemaMockData.get_mock_data())
|
|
451
|
+
|
|
452
|
+
filename = "bnodes.xml"
|
|
453
|
+
url = mock_dcat(rmock, filename)
|
|
454
|
+
org = OrganizationFactory()
|
|
455
|
+
source = HarvestSourceFactory(backend="dcat", url=url, organization=org)
|
|
456
|
+
|
|
457
|
+
actions.run(source)
|
|
458
|
+
|
|
459
|
+
datasets = {d.harvest.dct_identifier: d for d in Dataset.objects}
|
|
460
|
+
|
|
461
|
+
assert set(datasets["1"].tags).issuperset(set(["repartition-des-especes", "inspire"]))
|
|
462
|
+
assert set(datasets["2"].tags).issuperset(set(["hydrographie", "inspire"]))
|
|
463
|
+
assert "inspire" not in datasets["3"].tags
|
|
464
|
+
|
|
448
465
|
def test_simple_nested_attributes(self, rmock):
|
|
449
466
|
filename = "nested.jsonld"
|
|
450
467
|
url = mock_dcat(rmock, filename)
|
|
@@ -672,6 +689,9 @@ class DcatBackendTest:
|
|
|
672
689
|
assert dataset.temporal_coverage is not None
|
|
673
690
|
assert dataset.temporal_coverage.start == date(2004, 11, 3)
|
|
674
691
|
assert dataset.temporal_coverage.end == date(2005, 3, 30)
|
|
692
|
+
assert set(dataset.tags) == set(
|
|
693
|
+
["inspire", "biodiversity-dynamics"]
|
|
694
|
+
) # The DCAT.theme with rdf:resource don't have labels properly defined
|
|
675
695
|
|
|
676
696
|
def test_sigoreme_xml_catalog(self, rmock):
|
|
677
697
|
LicenseFactory(id="fr-lo", title="Licence ouverte / Open Licence")
|
|
@@ -911,6 +931,7 @@ class CswDcatBackendTest:
|
|
|
911
931
|
"oise",
|
|
912
932
|
"somme",
|
|
913
933
|
"aisne",
|
|
934
|
+
# "inspire", TODO: the geonetwork v4 examples use broken URI as theme resources, check if this is still a problem or not
|
|
914
935
|
]
|
|
915
936
|
)
|
|
916
937
|
assert dataset.harvest.issued_at.date() == date(2017, 1, 1)
|
|
@@ -1085,6 +1106,7 @@ class CswIso19139DcatBackendTest:
|
|
|
1085
1106
|
"donnees-ouvertes",
|
|
1086
1107
|
"plu",
|
|
1087
1108
|
"usage-des-sols",
|
|
1109
|
+
"inspire",
|
|
1088
1110
|
]
|
|
1089
1111
|
)
|
|
1090
1112
|
assert dataset.harvest.issued_at.date() == date(2017, 10, 7)
|
|
@@ -1195,3 +1217,6 @@ class CswIso19139DcatBackendTest:
|
|
|
1195
1217
|
assert dataset.extras["dcat"].get("rights") is None
|
|
1196
1218
|
for resource in dataset.resources:
|
|
1197
1219
|
assert resource.extras["dcat"].get("rights") is None
|
|
1220
|
+
|
|
1221
|
+
# Additional INSPIRE tag due to the dataset having a GEMET INSPIRE theme
|
|
1222
|
+
assert "inspire" in dataset.tags
|
udata/rdf.py
CHANGED
|
@@ -128,6 +128,12 @@ EU_HVD_CATEGORIES = {
|
|
|
128
128
|
HVD_LEGISLATION = "http://data.europa.eu/eli/reg_impl/2023/138/oj"
|
|
129
129
|
TAG_TO_EU_HVD_CATEGORIES = {slugify_tag(EU_HVD_CATEGORIES[uri]): uri for uri in EU_HVD_CATEGORIES}
|
|
130
130
|
|
|
131
|
+
INSPIRE_GEMET_THEME_NAMESPACE = "http://inspire.ec.europa.eu/theme"
|
|
132
|
+
INSPIRE_GEMET_SCHEME_URIS = [
|
|
133
|
+
INSPIRE_GEMET_THEME_NAMESPACE,
|
|
134
|
+
"http://www.eionet.europa.eu/gemet/inspire_themes",
|
|
135
|
+
]
|
|
136
|
+
|
|
131
137
|
AGENT_ROLE_TO_RDF_PREDICATE = {
|
|
132
138
|
"contact": DCAT.contactPoint,
|
|
133
139
|
"publisher": DCT.publisher,
|
|
@@ -303,16 +309,37 @@ def theme_labels_from_rdf(rdf):
|
|
|
303
309
|
"""
|
|
304
310
|
Get theme labels to use as keywords.
|
|
305
311
|
Map HVD keywords from known URIs resources if HVD support is activated.
|
|
312
|
+
Map INSPIRE keyword from known themes if INSPIRE support is activated.
|
|
313
|
+
- An INSPIRE dataset is a dataset with a theme INSPIRE encoded with gmd:descriptiveKeywords/gmd:MD_Keywords.
|
|
314
|
+
In DCAT, it is shown as a DCAT.theme with a SKOS.inScheme pointing to to the INSPIRE thesaurus.
|
|
315
|
+
We filter on this thesaurus based on its name (expecting "GEMET - INSPIRE themes, version 1.0") or its uri.
|
|
306
316
|
"""
|
|
307
317
|
for theme in rdf.objects(DCAT.theme):
|
|
308
318
|
if isinstance(theme, RdfResource):
|
|
319
|
+
label = rdf_value(theme, SKOS.prefLabel)
|
|
309
320
|
uri = theme.identifier.toPython()
|
|
310
321
|
if current_app.config["HVD_SUPPORT"] and uri in EU_HVD_CATEGORIES:
|
|
322
|
+
# Map label from EU HVD categories
|
|
311
323
|
label = EU_HVD_CATEGORIES[uri]
|
|
312
324
|
# Additionnally yield hvd keyword
|
|
313
325
|
yield "hvd"
|
|
314
|
-
|
|
315
|
-
|
|
326
|
+
if current_app.config["INSPIRE_SUPPORT"]:
|
|
327
|
+
if uri.startswith(INSPIRE_GEMET_THEME_NAMESPACE):
|
|
328
|
+
yield "inspire"
|
|
329
|
+
else:
|
|
330
|
+
# Check if the theme belongs to the GEMET INSPIRE scheme
|
|
331
|
+
if scheme := theme.value(SKOS.inScheme):
|
|
332
|
+
scheme_title = (
|
|
333
|
+
rdf_value(scheme, DCT.title)
|
|
334
|
+
or rdf_value(scheme, SKOS.prefLabel)
|
|
335
|
+
or rdf_value(scheme, RDFS.label)
|
|
336
|
+
)
|
|
337
|
+
scheme_uri = scheme.identifier.toPython()
|
|
338
|
+
if (
|
|
339
|
+
scheme_title
|
|
340
|
+
and scheme_title.lower() == "gemet - inspire themes, version 1.0"
|
|
341
|
+
) or scheme_uri in INSPIRE_GEMET_SCHEME_URIS:
|
|
342
|
+
yield "inspire"
|
|
316
343
|
else:
|
|
317
344
|
label = theme.toPython()
|
|
318
345
|
if label:
|
udata/settings.py
CHANGED
|
@@ -324,9 +324,14 @@ class Defaults(object):
|
|
|
324
324
|
S3_ACCESS_KEY_ID = None
|
|
325
325
|
S3_SECRET_ACCESS_KEY = None
|
|
326
326
|
|
|
327
|
-
# Specific support for hvd
|
|
327
|
+
# Specific support for hvd:
|
|
328
|
+
# - map HVD categories URIs to keywords
|
|
328
329
|
HVD_SUPPORT = True
|
|
329
330
|
|
|
331
|
+
# Specific support for inspire:
|
|
332
|
+
# - add inspire keyword during harvest if GEMETE INSPIRE thesaurus is used in DCAT.theme
|
|
333
|
+
INSPIRE_SUPPORT = True
|
|
334
|
+
|
|
330
335
|
ACTIVATE_TERRITORIES = False
|
|
331
336
|
# The order is important to compute parents/children, smaller first.
|
|
332
337
|
HANDLED_LEVELS = tuple()
|
|
@@ -7,10 +7,10 @@ udata/errors.py,sha256=E8W7b4PH7c5B85g_nsUMt8fHqMVpDFOZFkO6wMPl6bA,117
|
|
|
7
7
|
udata/factories.py,sha256=MoklZnU8iwNL25dm3JsoXhoQs1PQWSVYL1WvcUBtJqM,492
|
|
8
8
|
udata/i18n.py,sha256=bC9ajf66YgcYoJffvresLZLa32rb6NsY-JGMtFiVsG4,8163
|
|
9
9
|
udata/mail.py,sha256=Huhx_1QthJkLvuRUuP6jqb5Qq5R4iSmqeEpLVO9ZkQ4,2671
|
|
10
|
-
udata/rdf.py,sha256=
|
|
10
|
+
udata/rdf.py,sha256=dQSYVS2NrMRE6fsrbGwXl_roM0k6jtt1JPtMhHxeVGg,20970
|
|
11
11
|
udata/routing.py,sha256=Hnc1ktmKVS-RUHNKw2zYTft2HJ903FhjtlcenQ9igwI,8044
|
|
12
12
|
udata/sentry.py,sha256=ekcxqUSqxfM98TtvCsPaOoX5i2l6PEcYt7kb4l3od-Q,3223
|
|
13
|
-
udata/settings.py,sha256=
|
|
13
|
+
udata/settings.py,sha256=99A0b87QX6AukPlodoaBBd45RpyBINshimnH_3LvJMg,21850
|
|
14
14
|
udata/sitemap.py,sha256=oRRWoPI7ZsFFnUAOqGT1YuXFFKHBe8EcRnUCNHD7xjM,979
|
|
15
15
|
udata/tags.py,sha256=ydq4uokd6bzdeGVSpEXASVtGvDfO2LfQs9mptvvKJCM,631
|
|
16
16
|
udata/tasks.py,sha256=Sv01dhvATtq_oHOBp3J1j1VT1HQe0Pab7zxwIeIdKoo,5122
|
|
@@ -324,7 +324,7 @@ udata/harvest/tests/person.jsonld,sha256=I7Ynh-PQlNeD51I1LrCgYOEjhL-WBeb65xzIE_s
|
|
|
324
324
|
udata/harvest/tests/test_actions.py,sha256=d5TTFTbs4PdBydWICqDtfoeo3zLyzcNDzv4aMH9spxo,25881
|
|
325
325
|
udata/harvest/tests/test_api.py,sha256=gSuICkPy3KVRUhHAyudXVf_gLwiB7SoriUp3DLXWDdA,21611
|
|
326
326
|
udata/harvest/tests/test_base_backend.py,sha256=ow8ecGtD836mUqyPWYjkS5nx0STyT5RMLgBdDyOhts4,19233
|
|
327
|
-
udata/harvest/tests/test_dcat_backend.py,sha256=
|
|
327
|
+
udata/harvest/tests/test_dcat_backend.py,sha256=WB7jSjRuFvSAjskKVhW5lUfiJHomL3hwebSJ3f8ubEI,51842
|
|
328
328
|
udata/harvest/tests/test_filters.py,sha256=PT2qopEIoXsqi8MsNDRuhNH7jGXiQo8r0uJrCOUd4aM,2465
|
|
329
329
|
udata/harvest/tests/test_models.py,sha256=f9NRR2_S4oZFgF8qOumg0vv-lpnEBJbI5vNtcwFdSqM,831
|
|
330
330
|
udata/harvest/tests/test_notifications.py,sha256=MMzTzkv-GXMNFeOwAi31rdTsAXyLCLOSna41zOtaJG0,816
|
|
@@ -344,7 +344,7 @@ udata/harvest/tests/csw_dcat/geonetworkv4-page-1.xml,sha256=k2pKidlQvJpoltGFm9HN
|
|
|
344
344
|
udata/harvest/tests/csw_dcat/geonetworkv4-page-3.xml,sha256=fsN0E4TVd_ts-sYA612yBP-gRAwpyQWqJdNm7ohczbs,20945
|
|
345
345
|
udata/harvest/tests/csw_dcat/geonetworkv4-page-5.xml,sha256=0VmPp1kspik7YAmOFyr-3yJLzWGA6kuQp_x_w-W385o,21213
|
|
346
346
|
udata/harvest/tests/dcat/bnodes.jsonld,sha256=Leqny-ccp30564yojQYYckw_HKbhR0f5qUCaavc2ruE,7964
|
|
347
|
-
udata/harvest/tests/dcat/bnodes.xml,sha256=
|
|
347
|
+
udata/harvest/tests/dcat/bnodes.xml,sha256=k1AGGPD8P4qSIxzS2vorJMNnf1sw4Deq3Kwm_rDJMaM,12137
|
|
348
348
|
udata/harvest/tests/dcat/catalog.xml,sha256=7bXxQDAu-BRppqIq4WAu6QAdOGOSbf900zBzJttP30k,12785
|
|
349
349
|
udata/harvest/tests/dcat/evian.json,sha256=R3RxP5azUuf9aZ9fU7n6iJkfbJ6oj-Zej2cjOtkYr8M,16647
|
|
350
350
|
udata/harvest/tests/dcat/flat.jsonld,sha256=BAw08MDhtW9Px3q6RAoTIqO_OwJmAwBS9EpC8BY_x98,8459
|
|
@@ -625,9 +625,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=nv80xZLfIfUsSOMBcr29L268FDc_Gt
|
|
|
625
625
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=bUp-7Ray8t8ALgJk3Icw1jmiGIc9_pEJQHiGw_2EU2o,50989
|
|
626
626
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=Y_XpUxD074wXc63oJTnoVOyOQ2lmBxl-MrgluZ0Qdw4,27961
|
|
627
627
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=qh8mrz9AFuVQtXYSSP4QWsXLM_Lv3EHVifHT1NflWXY,57529
|
|
628
|
-
udata-12.0.2.
|
|
629
|
-
udata-12.0.2.
|
|
630
|
-
udata-12.0.2.
|
|
631
|
-
udata-12.0.2.
|
|
632
|
-
udata-12.0.2.
|
|
633
|
-
udata-12.0.2.
|
|
628
|
+
udata-12.0.2.dev14.dist-info/licenses/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
629
|
+
udata-12.0.2.dev14.dist-info/METADATA,sha256=y3BF3EBBTZacX22DKY4alYa20nE8CbbU_tKLwv6iz6s,5174
|
|
630
|
+
udata-12.0.2.dev14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
631
|
+
udata-12.0.2.dev14.dist-info/entry_points.txt,sha256=v2u12qO11i2lyLNIp136WmLJ-NHT-Kew3Duu8J-AXPM,614
|
|
632
|
+
udata-12.0.2.dev14.dist-info/top_level.txt,sha256=EF6CE6YSHd_og-8LCEA4q25ALUpWVe8D0okOLdMAE3A,6
|
|
633
|
+
udata-12.0.2.dev14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|