Skip to content

Commit 62e64d5

Browse files
authored
Merge pull request #381 from ckan/fix-geom-serialization
Fix bug in geometry serialization, locn:Geometry -> locn:geometry
2 parents 616090c + fea3110 commit 62e64d5

5 files changed

Lines changed: 10 additions & 7 deletions

File tree

ckanext/dcat/profiles/euro_dcat_ap_scheming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _graph_from_dataset_v2_scheming(self, dataset_dict, dataset_ref):
272272
self.g.add((spatial_ref, SKOS.prefLabel, Literal(item["text"])))
273273

274274
for field in [
275-
("geom", LOCN.Geometry),
275+
("geom", LOCN.geometry),
276276
("bbox", DCAT.bbox),
277277
("centroid", DCAT.centroid),
278278
]:

ckanext/dcat/tests/profiles/dcat_ap_2/test_scheming_support.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,10 @@ def test_e2e_ckan_to_dcat(self):
264264
g, spatial[0][2], SKOS.prefLabel, dataset["spatial_coverage"][0]["text"]
265265
)
266266

267-
assert len([t for t in g.triples((spatial[0][2], LOCN.Geometry, None))]) == 1
267+
assert len([t for t in g.triples((spatial[0][2], LOCN.geometry, None))]) == 1
268268
# Geometry in WKT
269269
wkt_geom = wkt.dumps(dataset["spatial_coverage"][0]["geom"], decimals=4)
270-
assert self._triple(g, spatial[0][2], LOCN.Geometry, wkt_geom, GSP.wktLiteral)
270+
assert self._triple(g, spatial[0][2], LOCN.geometry, wkt_geom, GSP.wktLiteral)
271271

272272
# Test qualified relation
273273
relation = [t for t in g.triples((dataset_ref, DCAT.qualifiedRelation, None))]

ckanext/dcat/tests/profiles/dcat_ap_3/test_euro_dcatap_3_profile_serialize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,10 @@ def test_e2e_ckan_to_dcat(self):
239239
g, spatial[0][2], SKOS.prefLabel, dataset["spatial_coverage"][0]["text"]
240240
)
241241

242-
assert len([t for t in g.triples((spatial[0][2], LOCN.Geometry, None))]) == 1
242+
assert len([t for t in g.triples((spatial[0][2], LOCN.geometry, None))]) == 1
243243
# Geometry in WKT
244244
wkt_geom = wkt.dumps(dataset["spatial_coverage"][0]["geom"], decimals=4)
245-
assert self._triple(g, spatial[0][2], LOCN.Geometry, wkt_geom, GSP.wktLiteral)
245+
assert self._triple(g, spatial[0][2], LOCN.geometry, wkt_geom, GSP.wktLiteral)
246246

247247
distribution_ref = self._triple(g, dataset_ref, DCAT.distribution, None)[2]
248248
resource = dataset_dict["resources"][0]

ckanext/dcat/tests/profiles/dcat_us_3/test_dcat_us_3_profile_serialize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ def test_e2e_ckan_to_dcat(self):
260260
g, spatial[0][2], SKOS.prefLabel, dataset["spatial_coverage"][0]["text"]
261261
)
262262

263-
assert len([t for t in g.triples((spatial[0][2], LOCN.Geometry, None))]) == 1
263+
assert len([t for t in g.triples((spatial[0][2], LOCN.geometry, None))]) == 1
264264
# Geometry in WKT
265265
wkt_geom = wkt.dumps(dataset["spatial_coverage"][0]["geom"], decimals=4)
266-
assert self._triple(g, spatial[0][2], LOCN.Geometry, wkt_geom, GSP.wktLiteral)
266+
assert self._triple(g, spatial[0][2], LOCN.geometry, wkt_geom, GSP.wktLiteral)
267267

268268
# Alternate identifiers
269269
ids = []

ckanext/dcat/tests/shacl/test_shacl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ def test_validate_dcat_ap_3_graph():
199199
known_failures = [
200200
"Value does not have class skos:Concept",
201201
"Value does not have class dcat:Dataset",
202+
# ckanext-dcat#381
203+
"Value does not have class <http://www.w3.org/ns/locn#Geometry>",
204+
"Value is not of Node Kind shacl:BlankNodeOrIRI"
202205
]
203206

204207
assert set(failures) - set(known_failures) == set(), results_text

0 commit comments

Comments
 (0)