udata 10.0.1.dev32350__py2.py3-none-any.whl → 10.0.1.dev32359__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/rdf.py +20 -5
- udata/rdf.py +1 -0
- udata/tests/dataset/test_dataset_rdf.py +11 -3
- {udata-10.0.1.dev32350.dist-info → udata-10.0.1.dev32359.dist-info}/METADATA +2 -1
- {udata-10.0.1.dev32350.dist-info → udata-10.0.1.dev32359.dist-info}/RECORD +9 -9
- {udata-10.0.1.dev32350.dist-info → udata-10.0.1.dev32359.dist-info}/LICENSE +0 -0
- {udata-10.0.1.dev32350.dist-info → udata-10.0.1.dev32359.dist-info}/WHEEL +0 -0
- {udata-10.0.1.dev32350.dist-info → udata-10.0.1.dev32359.dist-info}/entry_points.txt +0 -0
- {udata-10.0.1.dev32350.dist-info → udata-10.0.1.dev32359.dist-info}/top_level.txt +0 -0
udata/core/dataset/rdf.py
CHANGED
|
@@ -21,6 +21,7 @@ from udata.core.spatial.models import SpatialCoverage
|
|
|
21
21
|
from udata.harvest.exceptions import HarvestSkipException
|
|
22
22
|
from udata.models import db
|
|
23
23
|
from udata.rdf import (
|
|
24
|
+
ADMS,
|
|
24
25
|
DCAT,
|
|
25
26
|
DCATAP,
|
|
26
27
|
DCT,
|
|
@@ -200,16 +201,30 @@ def dataset_to_rdf(dataset, graph=None):
|
|
|
200
201
|
# unless there is already an upstream URI
|
|
201
202
|
id = dataset_to_graph_id(dataset)
|
|
202
203
|
|
|
204
|
+
graph = graph or Graph(namespace_manager=namespace_manager)
|
|
205
|
+
d = graph.resource(id)
|
|
206
|
+
|
|
203
207
|
# Expose upstream identifier if present
|
|
204
208
|
if dataset.harvest and dataset.harvest.dct_identifier:
|
|
205
|
-
identifier
|
|
209
|
+
d.set(DCT.identifier, Literal(dataset.harvest.dct_identifier))
|
|
210
|
+
|
|
211
|
+
alt = graph.resource(BNode())
|
|
212
|
+
alternate_identifier = Literal(
|
|
213
|
+
endpoint_for(
|
|
214
|
+
"datasets.show_redirect",
|
|
215
|
+
"api.dataset",
|
|
216
|
+
dataset=dataset.id,
|
|
217
|
+
_external=True,
|
|
218
|
+
)
|
|
219
|
+
)
|
|
220
|
+
alt.set(RDF.type, ADMS.Identifier)
|
|
221
|
+
alt.set(DCT.creator, Literal(current_app.config["SITE_TITLE"]))
|
|
222
|
+
alt.set(SKOS.notation, alternate_identifier)
|
|
223
|
+
d.set(ADMS.identifier, alt)
|
|
206
224
|
else:
|
|
207
|
-
identifier
|
|
208
|
-
graph = graph or Graph(namespace_manager=namespace_manager)
|
|
225
|
+
d.set(DCT.identifier, Literal(dataset.id))
|
|
209
226
|
|
|
210
|
-
d = graph.resource(id)
|
|
211
227
|
d.set(RDF.type, DCAT.Dataset)
|
|
212
|
-
d.set(DCT.identifier, Literal(identifier))
|
|
213
228
|
d.set(DCT.title, Literal(dataset.title))
|
|
214
229
|
d.set(DCT.description, Literal(dataset.description))
|
|
215
230
|
d.set(DCT.issued, Literal(dataset.created_at))
|
udata/rdf.py
CHANGED
|
@@ -49,6 +49,7 @@ DCT = DCTERMS # More common usage
|
|
|
49
49
|
VCARD = Namespace("http://www.w3.org/2006/vcard/ns#")
|
|
50
50
|
|
|
51
51
|
namespace_manager = NamespaceManager(Graph())
|
|
52
|
+
namespace_manager.bind("adms", ADMS)
|
|
52
53
|
namespace_manager.bind("dcat", DCAT)
|
|
53
54
|
namespace_manager.bind("dcatap", DCATAP)
|
|
54
55
|
namespace_manager.bind("dct", DCT)
|
|
@@ -32,6 +32,7 @@ from udata.core.organization.factories import OrganizationFactory
|
|
|
32
32
|
from udata.i18n import gettext as _
|
|
33
33
|
from udata.mongo import db
|
|
34
34
|
from udata.rdf import (
|
|
35
|
+
ADMS,
|
|
35
36
|
DCAT,
|
|
36
37
|
DCATAP,
|
|
37
38
|
DCT,
|
|
@@ -85,7 +86,7 @@ class DatasetToRdfTest:
|
|
|
85
86
|
assert d.value(DCT.modified) == Literal(dataset.last_modified)
|
|
86
87
|
assert d.value(DCAT.landingPage) is None
|
|
87
88
|
|
|
88
|
-
def test_all_dataset_fields(self):
|
|
89
|
+
def test_all_dataset_fields(self, app):
|
|
89
90
|
resources = ResourceFactory.build_batch(3)
|
|
90
91
|
org = OrganizationFactory(name="organization")
|
|
91
92
|
contact = ContactPointFactory(
|
|
@@ -101,8 +102,11 @@ class DatasetToRdfTest:
|
|
|
101
102
|
acronym="acro",
|
|
102
103
|
organization=org,
|
|
103
104
|
contact_point=contact,
|
|
104
|
-
harvest=HarvestDatasetMetadata(
|
|
105
|
+
harvest=HarvestDatasetMetadata(
|
|
106
|
+
remote_url=remote_url, dct_identifier="foobar-identifier"
|
|
107
|
+
),
|
|
105
108
|
)
|
|
109
|
+
app.config["SITE_TITLE"] = "Test site title"
|
|
106
110
|
d = dataset_to_rdf(dataset)
|
|
107
111
|
g = d.graph
|
|
108
112
|
|
|
@@ -114,7 +118,11 @@ class DatasetToRdfTest:
|
|
|
114
118
|
assert isinstance(d.identifier, URIRef)
|
|
115
119
|
uri = url_for("api.dataset", dataset=dataset.id, _external=True)
|
|
116
120
|
assert str(d.identifier) == uri
|
|
117
|
-
assert d.value(DCT.identifier) == Literal(
|
|
121
|
+
assert d.value(DCT.identifier) == Literal("foobar-identifier")
|
|
122
|
+
alternate_identifier = d.value(ADMS.identifier)
|
|
123
|
+
assert alternate_identifier.value(RDF.type).identifier == ADMS.Identifier
|
|
124
|
+
assert f"datasets/{dataset.id}" in alternate_identifier.value(SKOS.notation)
|
|
125
|
+
assert alternate_identifier.value(DCT.creator) == Literal("Test site title")
|
|
118
126
|
assert d.value(DCT.title) == Literal(dataset.title)
|
|
119
127
|
assert d.value(SKOS.altLabel) == Literal(dataset.acronym)
|
|
120
128
|
assert d.value(DCT.description) == Literal(dataset.description)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: udata
|
|
3
|
-
Version: 10.0.1.
|
|
3
|
+
Version: 10.0.1.dev32359
|
|
4
4
|
Summary: Open data portal
|
|
5
5
|
Home-page: https://github.com/opendatateam/udata
|
|
6
6
|
Author: Opendata Team
|
|
@@ -159,6 +159,7 @@ It is collectively taken care of by members of the
|
|
|
159
159
|
* you will need https://github.com/opendatateam/udata-search-service/pull/48
|
|
160
160
|
- Expose the "landingPage" in DCAT RDF [#3183](https://github.com/opendatateam/udata/pull/3183)
|
|
161
161
|
- Licence.guess: extract first URL for better matching [#3185](https://github.com/opendatateam/udata/pull/3185)
|
|
162
|
+
- Expose the dataset's alternate identifier in RDF [#3186](https://github.com/opendatateam/udata/pull/3186)
|
|
162
163
|
|
|
163
164
|
## 9.2.4 (2024-10-22)
|
|
164
165
|
|
|
@@ -10,7 +10,7 @@ udata/errors.py,sha256=E8W7b4PH7c5B85g_nsUMt8fHqMVpDFOZFkO6wMPl6bA,117
|
|
|
10
10
|
udata/factories.py,sha256=MoklZnU8iwNL25dm3JsoXhoQs1PQWSVYL1WvcUBtJqM,492
|
|
11
11
|
udata/i18n.py,sha256=Q7UELAhKOW7DmUX8BjEMnqqhQxcR6d3ioSmj90A62cg,8992
|
|
12
12
|
udata/mail.py,sha256=MShopArrtXyn8SnXtNbWUR0C4mTj1gI3a3Lf_1We-j4,2167
|
|
13
|
-
udata/rdf.py,sha256=
|
|
13
|
+
udata/rdf.py,sha256=iK86sKDjLEt76XLBTThxX7ESm0l--QwcIQuYzFaOnKI,16777
|
|
14
14
|
udata/routing.py,sha256=x9WcpYikR45j3C_0Bi2Zoa2treSCW_oDYWMHwbdLAmE,7242
|
|
15
15
|
udata/sentry.py,sha256=ekcxqUSqxfM98TtvCsPaOoX5i2l6PEcYt7kb4l3od-Q,3223
|
|
16
16
|
udata/settings.py,sha256=RBrjxz6l6wPqwJULIUlpym320Cd9em7A7xz7_gmnjpc,18043
|
|
@@ -104,7 +104,7 @@ udata/core/dataset/forms.py,sha256=H2oeAD8XckMugnwUcyuKv7o1Xq1rEIlLz9FtxujqbIE,6
|
|
|
104
104
|
udata/core/dataset/models.py,sha256=1x5zfKQAHBTCxhxz4sl-EK9BEVYsUVyBORULOg55FTU,37382
|
|
105
105
|
udata/core/dataset/permissions.py,sha256=zXQ6kU-Ni3Pl5tDtat-ZPupug9InsNeCN7xRLc2Vcrc,1097
|
|
106
106
|
udata/core/dataset/preview.py,sha256=IwCqiNTjjXbtA_SSKF52pwnzKKEz0GyYM95QNn2Dkog,2561
|
|
107
|
-
udata/core/dataset/rdf.py,sha256=
|
|
107
|
+
udata/core/dataset/rdf.py,sha256=YqsRPrrcwWaV13hflpcEOaN3VXpWW3X8VRtUT2qJH60,26383
|
|
108
108
|
udata/core/dataset/search.py,sha256=NXPdBsKeLMeC0tsHSP7xFYilU58xCm4gdU0Yk5XHInM,5607
|
|
109
109
|
udata/core/dataset/signals.py,sha256=WN4sV-lJlNsRkhcnhoy0SYJvCoYmK_5QFYZd1u-h4gs,161
|
|
110
110
|
udata/core/dataset/tasks.py,sha256=F31TDKaawtOx6oxmWh9Vu24m0R4KVMouxFyAbaXVG6E,9609
|
|
@@ -639,7 +639,7 @@ udata/tests/dataset/test_dataset_actions.py,sha256=bgDjVYjOvu3sX_FCTCzf2snZYSprs
|
|
|
639
639
|
udata/tests/dataset/test_dataset_commands.py,sha256=zMPJG2wYwKBee2zI65kmboxf59Zqa84DDjT8V5wj9uo,801
|
|
640
640
|
udata/tests/dataset/test_dataset_events.py,sha256=hlrpoOiBbnX_COUI9Pzdqlp45GZZDqu5piwupbnPiTI,3601
|
|
641
641
|
udata/tests/dataset/test_dataset_model.py,sha256=VPF17L5sMpKcFo7JNKmgXnKGAgzy1Ejo470avn3bdcQ,30874
|
|
642
|
-
udata/tests/dataset/test_dataset_rdf.py,sha256=
|
|
642
|
+
udata/tests/dataset/test_dataset_rdf.py,sha256=BKaspmNYHQ5vrf_UCXteWjis4nq1iz6V5YCVxoUbTQw,35443
|
|
643
643
|
udata/tests/dataset/test_dataset_tasks.py,sha256=rSafDjCiOyEb2_tVUDN4wqGylF6Yf9VNB769SLmxlwI,2283
|
|
644
644
|
udata/tests/dataset/test_resource_preview.py,sha256=fp9mSL7unhyM66GR0gwhgX3OGQ4TJt7G9xU-CjsL3HI,3908
|
|
645
645
|
udata/tests/features/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -705,9 +705,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=TpMlhwj07t7CPkzXn-qmHG4aTq6ZT7
|
|
|
705
705
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=vRqSEt9Jds--Wic-hYMkdjYaWzeHFnUn3wD5XvQL-qE,44877
|
|
706
706
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=bc-BmgT91ZJJB9DKc5YDsHqyxBhOjDJdbOy-UPo-NjA,28163
|
|
707
707
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=BKVmr4M88pfgZMU4sHIyDObV5M9E8ezZ9m7jviy2PE4,51369
|
|
708
|
-
udata-10.0.1.
|
|
709
|
-
udata-10.0.1.
|
|
710
|
-
udata-10.0.1.
|
|
711
|
-
udata-10.0.1.
|
|
712
|
-
udata-10.0.1.
|
|
713
|
-
udata-10.0.1.
|
|
708
|
+
udata-10.0.1.dev32359.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
709
|
+
udata-10.0.1.dev32359.dist-info/METADATA,sha256=hPcO_cGu0iLmqjkyWoUmvQcqLk1CSeJp4NxsYsACGho,134253
|
|
710
|
+
udata-10.0.1.dev32359.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
|
711
|
+
udata-10.0.1.dev32359.dist-info/entry_points.txt,sha256=3SKiqVy4HUqxf6iWspgMqH8d88Htk6KoLbG1BU-UddQ,451
|
|
712
|
+
udata-10.0.1.dev32359.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
|
|
713
|
+
udata-10.0.1.dev32359.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|