Skip to content

Commit

Permalink
fix geojson/jsonld export issue (#11588)
Browse files Browse the repository at this point in the history
* fixes jsonld export issue for geojson features
* Adds test
  • Loading branch information
aarongundel authored Nov 7, 2024
1 parent 191b1a3 commit 814aef7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arches/app/datatypes/core/geojson_feature_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ def to_rdf(self, edge_info, edge):
data = edge_info["range_tile_data"]
if data["type"] == "FeatureCollection":
for f in data["features"]:
del f["id"]
if "id" in f:
del f["id"]
del f["properties"]
g.add(
(
Expand Down
3 changes: 3 additions & 0 deletions releases/7.6.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Fixes bug that prevented some Arches Application front-end components from being loaded #[11561](https://github.com/archesproject/arches/issues/11561)

- Fix issue with JSON-LD export failing when geojson features have no "id". [11587](https://github.com/archesproject/arches/issues/11587)

### Dependency changes:

```
Expand All @@ -20,6 +22,7 @@ JavaScript:
1. Upgrade to version 7.6.0 before proceeding by following the upgrade process in the [Version 7.6.0 release notes](https://github.com/archesproject/arches/blob/dev/7.6.x/releases/7.6.0.md)

2. Upgrade to Arches 7.6.3

```
pip install --upgrade arches==7.6.3
```
Expand Down
25 changes: 25 additions & 0 deletions tests/exporter/datatype_to_rdf_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,31 @@ def test_rdf_concept(self):
in graph
)

def test_rdf_geojson(self):
dt = self.DT.get_instance("geojson-feature-collection")
edge_info = {}
edge_info["range_tile_data"] = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "1",
"geometry": {
"type": "Point",
"coordinates": [13.400257324930152, 52.50578474077699],
},
"properties": {},
}
],
}
edge_info["r_uri"] = URIRef("http://vocab.getty.edu/aat/300047196")
edge_info["d_uri"] = URIRef("http://vocab.getty.edu/aat/300047196")
edge = Mock()
edge.ontologyproperty = CIDOC_NS["P2_has_type"]
edge.rangenode.ontologyclass = CIDOC_NS["E55_Type"]
graph = dt.to_rdf(edge_info, edge)
self.assertTrue("13.400257324930152" in str(graph.serialize()))

def test_rdf_concept_list(self):
dt = self.DT.get_instance("concept-list")
concept_list = [
Expand Down

0 comments on commit 814aef7

Please sign in to comment.