Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ckanext-odsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open-Data
ckanext-odsh
Commits
8a5c84fa
Commit
8a5c84fa
authored
2 years ago
by
Jesper Zedlitz
Browse files
Options
Downloads
Patches
Plain Diff
Hinweis auf Musterdatensatz in den Metadaten
closes
#40
parent
11a47c97
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!21
Merge dev to master
,
!18
Hinweis auf Musterdatensatz in den Metadaten
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ckanext/odsh/helpers.py
+29
-0
29 additions, 0 deletions
ckanext/odsh/helpers.py
ckanext/odsh/plugin.py
+1
-0
1 addition, 0 deletions
ckanext/odsh/plugin.py
ckanext/odsh/templates/package/snippets/info.html
+12
-0
12 additions, 0 deletions
ckanext/odsh/templates/package/snippets/info.html
with
42 additions
and
0 deletions
ckanext/odsh/helpers.py
+
29
−
0
View file @
8a5c84fa
...
...
@@ -492,3 +492,32 @@ def odsh_load_mdk_sample_dataset():
raise
return
result
def
odsh_load_raw_mdk_sample_dataset
():
'''
Load sample dataset (Musterkatalog/Musterdatensatz).
See https://bertelsmannstift.github.io/Musterdatenkatalog/def/musterdatensatz.rdf
and corresponding mapping in mdk_mapping.json file.
'''
path
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
default_sample_data_file_path
=
os
.
path
.
join
(
path
,
"
../../mdk_mapping.json
"
)
sample_data_file_path
=
config
.
get
(
'
ckanext.odsh.sample_data_file_path
'
,
default_sample_data_file_path
)
try
:
with
open
(
sample_data_file_path
)
as
mapping_json
:
result
=
json
.
loads
(
mapping_json
.
read
(),
object_pairs_hook
=
OrderedDict
)
except
IOError
as
err
:
log
.
error
(
'
Could not load sample dataset mapping file from {}
'
.
format
(
sample_data_file_path
)
)
raise
except
ValueError
as
err
:
log
.
error
(
'
Could not convert sample dataset mapping file from json.
\n
Sample dataset mapping file: {}
'
.
format
(
sample_data_file_path
)
)
raise
return
result
This diff is collapsed.
Click to expand it.
ckanext/odsh/plugin.py
+
1
−
0
View file @
8a5c84fa
...
...
@@ -382,6 +382,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
'
tpsh_get_address_org
'
:
helpers_tpsh
.
get_address_org
,
'
tpsh_get_body_mail
'
:
helpers_tpsh
.
get_body_mail
,
'
odsh_load_mdk_sample_dataset
'
:
odsh_helpers
.
odsh_load_mdk_sample_dataset
,
'
odsh_load_raw_mdk_sample_dataset
'
:
odsh_helpers
.
odsh_load_raw_mdk_sample_dataset
,
}
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/templates/package/snippets/info.html
+
12
−
0
View file @
8a5c84fa
...
...
@@ -81,6 +81,18 @@ Example:
</div>
{% endblock license %}
{% block musterdatensatz %}
{% set musterdatensatzURI = h.odsh_extract_value_from_extras(pkg.extras,'reference') %}
{% if musterdatensatzURI %}
{% set mdk=h.odsh_load_raw_mdk_sample_dataset() %}
{% set musterdatensatzName = mdk[musterdatensatzURI] %}
<div
class=
"musterdatensatz-detail info-detail"
>
<div>
Musterdatensatz:
</div>
<a
href=
"/dataset?reference={{ musterdatensatzURI }}"
>
{{ musterdatensatzName }}
</a>
</div>
{% endif %}
{% endblock musterdatensatz %}
{% endblock package_info_inner %}
</div>
{% set map_text = h.odsh_get_spatial_text(pkg) %}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment