Skip to content

Commit

Permalink
fix json-ld template
Browse files Browse the repository at this point in the history
  • Loading branch information
SpeckiJ committed Nov 18, 2024
1 parent bf0d681 commit 7d269b0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
6 changes: 6 additions & 0 deletions pygeoapi/provider/csw_facade_dcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ def _owslibrecord2record(self, record):
'href': link['url']
})

if record.rights:
right = ""
for link in record.rights:
right += link
feature["properties"]["rights"] = right

return feature

def __repr__(self):
Expand Down
23 changes: 19 additions & 4 deletions pygeoapi/schemas/dcat/dcat-template.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,23 @@
"foaf": "http://xmlns.com/foaf/0.1/",
"@version": 1.1
},
{% set _dummy = data.pop('@context') %}
{% set _dummy = data.pop('@id') %}
{% set repr_json = data|tojson %}
{{ repr_json[1:-1] }}
"type": "Feature"
{% set toplevel = ['id', 'geometry', 'time', 'properties', 'links'] %}
{% set blacklist = ['type', '@context', '@id', 'gsp:hasGeometry', 'schema:geo'] %}
{%- for k,v in data.items() -%}
{# toplevel #}
{%- if k in toplevel -%}
,{{k|tojson}}:{{v|tojson}}
{%- endif -%}
{% endfor %}
,"properties": {
"identifier": {{ data["id"]|tojson }}
{%- for k,v in data.items() -%}
{# properties #}
{%- if not (k in toplevel or k in blacklist) -%}
,{{k|tojson}}:{{v|tojson}}
{%- endif -%}
{%- endfor -%}
}

}

0 comments on commit 7d269b0

Please sign in to comment.