udata 10.5.1.dev35928__py2.py3-none-any.whl → 10.5.1.dev35978__py2.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/core/dataset/apiv2.py +2 -0
- udata/core/dataset/rdf.py +3 -3
- udata/harvest/tests/test_dcat_backend.py +1 -4
- udata/tests/dataset/test_dataset_rdf.py +69 -2
- {udata-10.5.1.dev35928.dist-info → udata-10.5.1.dev35978.dist-info}/METADATA +3 -2
- {udata-10.5.1.dev35928.dist-info → udata-10.5.1.dev35978.dist-info}/RECORD +10 -10
- {udata-10.5.1.dev35928.dist-info → udata-10.5.1.dev35978.dist-info}/LICENSE +0 -0
- {udata-10.5.1.dev35928.dist-info → udata-10.5.1.dev35978.dist-info}/WHEEL +0 -0
- {udata-10.5.1.dev35928.dist-info → udata-10.5.1.dev35978.dist-info}/entry_points.txt +0 -0
- {udata-10.5.1.dev35928.dist-info → udata-10.5.1.dev35978.dist-info}/top_level.txt +0 -0
udata/core/dataset/apiv2.py
CHANGED
|
@@ -488,6 +488,8 @@ class ResourceAPI(API):
|
|
|
488
488
|
resource = get_by(dataset.resources, "id", rid)
|
|
489
489
|
else:
|
|
490
490
|
resource = CommunityResource.objects(id=rid).first()
|
|
491
|
+
if resource:
|
|
492
|
+
dataset = resource.dataset
|
|
491
493
|
if not resource:
|
|
492
494
|
apiv2.abort(404, "Resource does not exist")
|
|
493
495
|
|
udata/core/dataset/rdf.py
CHANGED
|
@@ -558,7 +558,7 @@ def frequency_from_rdf(term):
|
|
|
558
558
|
|
|
559
559
|
def mime_from_rdf(resource):
|
|
560
560
|
# DCAT.mediaType *should* only be used when defined as IANA
|
|
561
|
-
mime = rdf_value(resource, DCAT.mediaType)
|
|
561
|
+
mime = rdf_value(resource, DCAT.mediaType, parse_label=True)
|
|
562
562
|
if not mime:
|
|
563
563
|
return
|
|
564
564
|
if IANAFORMAT in mime:
|
|
@@ -568,7 +568,7 @@ def mime_from_rdf(resource):
|
|
|
568
568
|
|
|
569
569
|
|
|
570
570
|
def format_from_rdf(resource):
|
|
571
|
-
format = rdf_value(resource, DCT.format)
|
|
571
|
+
format = rdf_value(resource, DCT.format, parse_label=True)
|
|
572
572
|
if not format:
|
|
573
573
|
return
|
|
574
574
|
if EUFORMAT in format or IANAFORMAT in format:
|
|
@@ -591,7 +591,7 @@ def title_from_rdf(rdf, url):
|
|
|
591
591
|
last_part = url.split("/")[-1]
|
|
592
592
|
if "." in last_part and "?" not in last_part:
|
|
593
593
|
return last_part
|
|
594
|
-
fmt =
|
|
594
|
+
fmt = format_from_rdf(rdf)
|
|
595
595
|
lang = current_app.config["DEFAULT_LANGUAGE"]
|
|
596
596
|
with i18n.language(lang):
|
|
597
597
|
if fmt:
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
|
-
import re
|
|
4
3
|
import xml.etree.ElementTree as ET
|
|
5
4
|
from datetime import date
|
|
6
5
|
|
|
@@ -969,9 +968,7 @@ class CswIso19139DcatBackendTest:
|
|
|
969
968
|
== "http://atom.geo-ide.developpement-durable.gouv.fr/atomArchive/GetResource?id=fr-120066022-ldd-cab63273-b3ae-4e8a-ae1c-6192e45faa94&datasetAggregate=true"
|
|
970
969
|
)
|
|
971
970
|
assert resource.type == "main"
|
|
972
|
-
|
|
973
|
-
# Sadly resource format is parsed as a blank node. Format parsing should be improved.
|
|
974
|
-
assert re.match(r"n[0-9a-f]{32}", resource.format)
|
|
971
|
+
assert resource.format == "mapinfo tab"
|
|
975
972
|
|
|
976
973
|
# Computed from source config `remote_url_prefix` + `dct:identifier` from `isPrimaryTopicOf`
|
|
977
974
|
if remote_url_prefix:
|
|
@@ -5,7 +5,7 @@ import pytest
|
|
|
5
5
|
import requests
|
|
6
6
|
from flask import url_for
|
|
7
7
|
from rdflib import BNode, Graph, Literal, Namespace, URIRef
|
|
8
|
-
from rdflib.namespace import FOAF, RDF
|
|
8
|
+
from rdflib.namespace import FOAF, RDF, RDFS
|
|
9
9
|
from rdflib.resource import Resource as RdfResource
|
|
10
10
|
|
|
11
11
|
from udata.core.contact_point.factories import ContactPointFactory
|
|
@@ -672,7 +672,7 @@ class RdfToDatasetTest:
|
|
|
672
672
|
|
|
673
673
|
assert resource.title == "somefile.csv"
|
|
674
674
|
|
|
675
|
-
def
|
|
675
|
+
def test_resource_title_from_format_value(self):
|
|
676
676
|
node = BNode()
|
|
677
677
|
g = Graph()
|
|
678
678
|
url = "https://www.somewhere.com/no-extension/"
|
|
@@ -686,6 +686,23 @@ class RdfToDatasetTest:
|
|
|
686
686
|
|
|
687
687
|
assert resource.title == _("{format} resource").format(format="csv")
|
|
688
688
|
|
|
689
|
+
def test_resource_title_from_format_label(self):
|
|
690
|
+
node = BNode()
|
|
691
|
+
g = Graph()
|
|
692
|
+
url = "https://www.somewhere.com/no-extension/"
|
|
693
|
+
|
|
694
|
+
g.set((node, RDF.type, DCAT.Distribution))
|
|
695
|
+
g.set((node, DCAT.downloadURL, URIRef(url)))
|
|
696
|
+
format = BNode()
|
|
697
|
+
g.add((node, DCT.format, format))
|
|
698
|
+
g.add((format, RDF.type, DCT.MediaType))
|
|
699
|
+
g.add((format, RDFS.label, Literal("CSV")))
|
|
700
|
+
|
|
701
|
+
resource = resource_from_rdf(g)
|
|
702
|
+
resource.validate()
|
|
703
|
+
|
|
704
|
+
assert resource.title == _("{format} resource").format(format="csv")
|
|
705
|
+
|
|
689
706
|
def test_resource_generic_title(self):
|
|
690
707
|
node = BNode()
|
|
691
708
|
g = Graph()
|
|
@@ -801,6 +818,56 @@ class RdfToDatasetTest:
|
|
|
801
818
|
assert isinstance(dataset, Dataset)
|
|
802
819
|
assert len(dataset.resources) == 1
|
|
803
820
|
|
|
821
|
+
def test_resource_format_from_mediatype_uriref(self):
|
|
822
|
+
node = BNode()
|
|
823
|
+
g = Graph()
|
|
824
|
+
url = "https://www.somewhere.com/no-extension/"
|
|
825
|
+
|
|
826
|
+
g.set((node, RDF.type, DCAT.Distribution))
|
|
827
|
+
g.set((node, DCAT.downloadURL, URIRef(url)))
|
|
828
|
+
format = URIRef("http://publications.europa.eu/resource/authority/file-type/CSV")
|
|
829
|
+
g.add((format, RDF.type, DCT.MediaType))
|
|
830
|
+
g.add((node, DCT.format, format))
|
|
831
|
+
|
|
832
|
+
resource = resource_from_rdf(g)
|
|
833
|
+
resource.validate()
|
|
834
|
+
|
|
835
|
+
assert resource.format == "csv"
|
|
836
|
+
|
|
837
|
+
def test_resource_format_from_mediatype_label(self):
|
|
838
|
+
node = BNode()
|
|
839
|
+
g = Graph()
|
|
840
|
+
url = "https://www.somewhere.com/no-extension/"
|
|
841
|
+
|
|
842
|
+
g.set((node, RDF.type, DCAT.Distribution))
|
|
843
|
+
g.set((node, DCAT.downloadURL, URIRef(url)))
|
|
844
|
+
format = BNode()
|
|
845
|
+
g.add((node, DCT.format, format))
|
|
846
|
+
g.add((format, RDF.type, DCT.MediaType))
|
|
847
|
+
g.add((format, RDFS.label, Literal("CSV")))
|
|
848
|
+
|
|
849
|
+
resource = resource_from_rdf(g)
|
|
850
|
+
resource.validate()
|
|
851
|
+
|
|
852
|
+
assert resource.format == "csv"
|
|
853
|
+
|
|
854
|
+
def test_resource_format_from_mediatype_uriref_and_label(self):
|
|
855
|
+
node = BNode()
|
|
856
|
+
g = Graph()
|
|
857
|
+
url = "https://www.somewhere.com/no-extension/"
|
|
858
|
+
|
|
859
|
+
g.set((node, RDF.type, DCAT.Distribution))
|
|
860
|
+
g.set((node, DCAT.downloadURL, URIRef(url)))
|
|
861
|
+
format = URIRef("http://publications.europa.eu/resource/authority/file-type/SHP")
|
|
862
|
+
g.add((format, RDF.type, DCT.MediaType))
|
|
863
|
+
g.add((format, RDFS.label, Literal("ESRI Shapefile")))
|
|
864
|
+
g.add((node, DCT.format, format))
|
|
865
|
+
|
|
866
|
+
resource = resource_from_rdf(g)
|
|
867
|
+
resource.validate()
|
|
868
|
+
|
|
869
|
+
assert resource.format == "esri shapefile"
|
|
870
|
+
|
|
804
871
|
def test_match_license_from_license_uri(self):
|
|
805
872
|
license = LicenseFactory()
|
|
806
873
|
node = BNode()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: udata
|
|
3
|
-
Version: 10.5.1.
|
|
3
|
+
Version: 10.5.1.dev35978
|
|
4
4
|
Summary: Open data portal
|
|
5
5
|
Home-page: https://github.com/opendatateam/udata
|
|
6
6
|
Author: Opendata Team
|
|
@@ -142,7 +142,8 @@ It is collectively taken care of by members of the
|
|
|
142
142
|
|
|
143
143
|
## Current (in progress)
|
|
144
144
|
|
|
145
|
-
-
|
|
145
|
+
- Fix invalid resource format from harvested RDF records [#3354](https://github.com/opendatateam/udata/pull/3354)
|
|
146
|
+
- Expose `dataset_id` for CommunityResource in /dataset/resource/id [#3258](https://github.com/opendatateam/udata/pull/3258)
|
|
146
147
|
|
|
147
148
|
## 10.5.0 (2025-07-02)
|
|
148
149
|
|
|
@@ -97,7 +97,7 @@ udata/core/dataset/actions.py,sha256=mX6xox0PiMrbcAPZ3VZsI26rfM-ciYfEXxN6sqqImKA
|
|
|
97
97
|
udata/core/dataset/activities.py,sha256=RtY06G6FiEMr8NY26kaYKCXwGdcGtBJv2U8kWgFTRxE,3048
|
|
98
98
|
udata/core/dataset/api.py,sha256=BxfsxwQO3k3IJ6lozosT-l5_kGz2bmSpzoUVJpsBg44,35434
|
|
99
99
|
udata/core/dataset/api_fields.py,sha256=scDu5BUkD0QMoQEARtk5yMjA0h_O-lgu0AjW396qV4k,18090
|
|
100
|
-
udata/core/dataset/apiv2.py,sha256=
|
|
100
|
+
udata/core/dataset/apiv2.py,sha256=2PWGDTelPQntMqmj8GtiFoTGW3bIBHMr3xQJdihVsYg,20921
|
|
101
101
|
udata/core/dataset/commands.py,sha256=__hPAk_6iHtgMnEG51ux0vbNWJHxUjXhi1ukH4hF5jY,3714
|
|
102
102
|
udata/core/dataset/constants.py,sha256=fKn21GzRShZv6pzKy3TvEK1cevQ9H3dOFE-xTRuE0lA,2971
|
|
103
103
|
udata/core/dataset/csv.py,sha256=OmfHUX5d325XJva2lqHNEBJz3vROfEqkiu1rBfS6Reg,3612
|
|
@@ -108,7 +108,7 @@ udata/core/dataset/forms.py,sha256=7KUxuFcEGT0MUe0cZCiZtsnZhvGgvEd68pe13NgeSMI,6
|
|
|
108
108
|
udata/core/dataset/models.py,sha256=_zsUDRl4xUt2Rp1QuIw2f85FxBNx_e2XgpiXVxVQ-tE,42889
|
|
109
109
|
udata/core/dataset/permissions.py,sha256=zXQ6kU-Ni3Pl5tDtat-ZPupug9InsNeCN7xRLc2Vcrc,1097
|
|
110
110
|
udata/core/dataset/preview.py,sha256=IwCqiNTjjXbtA_SSKF52pwnzKKEz0GyYM95QNn2Dkog,2561
|
|
111
|
-
udata/core/dataset/rdf.py,sha256=
|
|
111
|
+
udata/core/dataset/rdf.py,sha256=Bc83-JdY_2yuSUGnELVlhIQd7j1zIEX6d6CCw5RrOL4,31728
|
|
112
112
|
udata/core/dataset/search.py,sha256=E7LqHBnq3sMefvmLwTpiw-Ovem2a3NJswHesRjctboE,5627
|
|
113
113
|
udata/core/dataset/signals.py,sha256=WN4sV-lJlNsRkhcnhoy0SYJvCoYmK_5QFYZd1u-h4gs,161
|
|
114
114
|
udata/core/dataset/tasks.py,sha256=6FzeLzJRQxzq7sBLUE8H8ZGLByix2EDOzGAsA8FteX8,10019
|
|
@@ -305,7 +305,7 @@ udata/harvest/tests/person.jsonld,sha256=I7Ynh-PQlNeD51I1LrCgYOEjhL-WBeb65xzIE_s
|
|
|
305
305
|
udata/harvest/tests/test_actions.py,sha256=Hm5MpOEFXBvFzcNMu7hvrWIiP6fiOXLuDOyrykL-4tc,25224
|
|
306
306
|
udata/harvest/tests/test_api.py,sha256=dyCXhKgOO0XmCPgH_36sob8WVhtMB2WX1johbfzJtDI,21553
|
|
307
307
|
udata/harvest/tests/test_base_backend.py,sha256=ow8ecGtD836mUqyPWYjkS5nx0STyT5RMLgBdDyOhts4,19233
|
|
308
|
-
udata/harvest/tests/test_dcat_backend.py,sha256=
|
|
308
|
+
udata/harvest/tests/test_dcat_backend.py,sha256=O2SOSz34DwBxta9RrDJ2wGxxfwTKFyCHTEc1bH0oRI8,43717
|
|
309
309
|
udata/harvest/tests/test_filters.py,sha256=PT2qopEIoXsqi8MsNDRuhNH7jGXiQo8r0uJrCOUd4aM,2465
|
|
310
310
|
udata/harvest/tests/test_models.py,sha256=f9NRR2_S4oZFgF8qOumg0vv-lpnEBJbI5vNtcwFdSqM,831
|
|
311
311
|
udata/harvest/tests/test_notifications.py,sha256=MMzTzkv-GXMNFeOwAi31rdTsAXyLCLOSna41zOtaJG0,816
|
|
@@ -663,7 +663,7 @@ udata/tests/dataset/test_dataset_actions.py,sha256=bgDjVYjOvu3sX_FCTCzf2snZYSprs
|
|
|
663
663
|
udata/tests/dataset/test_dataset_commands.py,sha256=zMPJG2wYwKBee2zI65kmboxf59Zqa84DDjT8V5wj9uo,801
|
|
664
664
|
udata/tests/dataset/test_dataset_events.py,sha256=hlrpoOiBbnX_COUI9Pzdqlp45GZZDqu5piwupbnPiTI,3601
|
|
665
665
|
udata/tests/dataset/test_dataset_model.py,sha256=av4RhOnT-52qs-WL1NCn6R2SMa_fzDcoV-06vjccsdw,33891
|
|
666
|
-
udata/tests/dataset/test_dataset_rdf.py,sha256=
|
|
666
|
+
udata/tests/dataset/test_dataset_rdf.py,sha256=7SorX0e0VD3hmj8C0qXA4Vb3Q3xl2qaE4ijRfeQ12PM,44537
|
|
667
667
|
udata/tests/dataset/test_dataset_tasks.py,sha256=n1W2Pg0ez02d66zQG3N93kh7dpR2yLMRDqUI6PnPaI0,3088
|
|
668
668
|
udata/tests/dataset/test_resource_preview.py,sha256=fp9mSL7unhyM66GR0gwhgX3OGQ4TJt7G9xU-CjsL3HI,3908
|
|
669
669
|
udata/tests/features/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -731,9 +731,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=9sCd1MUKvtVP_sOXvK-G5v4PfWkkdA
|
|
|
731
731
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=-eJptz9s63rjkdm-3HJi_2t70pyv3-8EuXBn-B2qI_4,48419
|
|
732
732
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=qduXntHWe__KaUxJ4JwwyGG3eSgYb1auGdNax0lS49c,29169
|
|
733
733
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=6QCuLMCRjgyAvu9U7i0P19ae8fm_uStfmxHLqUO9EoY,55394
|
|
734
|
-
udata-10.5.1.
|
|
735
|
-
udata-10.5.1.
|
|
736
|
-
udata-10.5.1.
|
|
737
|
-
udata-10.5.1.
|
|
738
|
-
udata-10.5.1.
|
|
739
|
-
udata-10.5.1.
|
|
734
|
+
udata-10.5.1.dev35978.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
735
|
+
udata-10.5.1.dev35978.dist-info/METADATA,sha256=l3P4t1fQD1qEtuDbmqjvBeMR4L4t-U0ImI-n2jk_a10,149092
|
|
736
|
+
udata-10.5.1.dev35978.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
|
|
737
|
+
udata-10.5.1.dev35978.dist-info/entry_points.txt,sha256=ETvkR4r6G1duBsh_V_fGWENQy17GTFuobi95MYBAl1A,498
|
|
738
|
+
udata-10.5.1.dev35978.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
|
|
739
|
+
udata-10.5.1.dev35978.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|