Skip to content

Commit

Permalink
Merge pull request #80 from opendata-swiss/feat/make-format-dcat-ap-c…
Browse files Browse the repository at this point in the history
…onformant

feat: make format dcat ap conformant
  • Loading branch information
sarusarah authored Sep 26, 2023
2 parents 74dc6ff + e98fd2f commit 4372073
Show file tree
Hide file tree
Showing 5 changed files with 881 additions and 12 deletions.
17 changes: 17 additions & 0 deletions ckanext/dcatapchharvest/dcat_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"dct": DCT,
}

format_namespaces = {
"skos": SKOS,
"rdf": RDF,
}

license_namespaces = {
"skos": SKOS,
Expand Down Expand Up @@ -222,3 +226,16 @@ def get_pagination(catalog_graph):
for obj in catalog_graph.objects(pagination_node, ref):
pagination[key] = unicode(obj)
return pagination


def get_format_values():
g = Graph()
for prefix, namespace in format_namespaces.items():
g.bind(prefix, namespace)
file = os.path.join(__location__, 'formats.xml')
g.parse(file, format='xml')
format_values = {}
for format_uri_ref in g.subjects():
format_extension = format_uri_ref.split('/')[-1]
format_values[format_extension] = format_uri_ref
return format_values
Loading

0 comments on commit 4372073

Please sign in to comment.