Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
e644b3ca
Commit
e644b3ca
authored
May 27, 2021
by
Markus Scheidgen
Browse files
Merge branch 'dcat-catalog-full' into 'v0.10.4'
Dcat catalog full See merge request
!344
parents
f03a0472
39976286
Pipeline
#102356
passed with stages
in 24 minutes and 21 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/app/flask/dcat/catalog.py
View file @
e644b3ca
...
...
@@ -67,5 +67,5 @@ class Catalog(Resource):
es_response
=
es_search
.
execute
()
mapping
=
Mapping
()
mapping
.
map_catalog
(
es_response
.
hits
,
after
,
modified_since
)
mapping
.
map_catalog
(
es_response
.
hits
,
after
,
modified_since
,
slim
=
False
)
return
rdf_respose
(
mapping
.
g
)
nomad/app/flask/dcat/mapping.py
View file @
e644b3ca
...
...
@@ -40,16 +40,16 @@ def get_optional_entry_prop(entry, name):
class
Mapping
():
def
__init__
(
self
):
self
.
g
=
Graph
()
self
.
g
.
namespace_manager
.
bind
(
'rdf'
,
RDF
)
self
.
g
.
namespace_manager
.
bind
(
'dcat'
,
DCAT
)
self
.
g
.
namespace_manager
.
bind
(
'dct'
,
DCT
)
self
.
g
.
namespace_manager
.
bind
(
'vcard'
,
VCARD
)
self
.
g
.
namespace_manager
.
bind
(
'foaf'
,
FOAF
)
self
.
g
.
namespace_manager
.
bind
(
'hydra'
,
HYDRA
)
self
.
g
.
bind
(
'rdf'
,
RDF
)
self
.
g
.
bind
(
'dcat'
,
DCAT
)
self
.
g
.
bind
(
'dct'
,
DCT
)
self
.
g
.
bind
(
'vcard'
,
VCARD
)
self
.
g
.
bind
(
'foaf'
,
FOAF
)
self
.
g
.
bind
(
'hydra'
,
HYDRA
)
self
.
persons
=
{}
def
map_catalog
(
self
,
entries
,
after
:
str
,
modified_since
):
def
map_catalog
(
self
,
entries
,
after
:
str
,
modified_since
,
slim
=
True
):
def
uri_ref
(
after
):
kwargs
=
dict
()
if
after
is
not
None
:
...
...
@@ -64,7 +64,7 @@ class Mapping():
self
.
g
.
add
((
catalog
,
RDF
.
type
,
DCAT
.
Catalog
))
last_entry
=
None
for
entry
in
entries
:
self
.
g
.
add
((
catalog
,
DCT
.
dataset
,
self
.
map_entry
(
entry
,
slim
=
True
)))
self
.
g
.
add
((
catalog
,
DCT
.
dataset
,
self
.
map_entry
(
entry
,
slim
=
slim
)))
last_entry
=
entry
hydra_collection
=
uri_ref
(
after
)
...
...
@@ -76,6 +76,9 @@ class Mapping():
self
.
g
.
add
((
hydra_collection
,
RDF
.
type
,
HYDRA
.
collection
))
for
person
in
self
.
persons
.
values
():
self
.
g
.
add
((
catalog
,
DCT
.
creator
,
person
))
def
map_entry
(
self
,
entry
:
EntryMetadata
,
slim
=
False
):
dataset
=
URIRef
(
url
(
'datasets'
,
entry
.
calc_id
))
...
...
nomad/config.py
View file @
e644b3ca
...
...
@@ -177,8 +177,7 @@ tests = NomadConfig(
def
api_url
(
ssl
:
bool
=
True
,
api
:
str
=
'api'
):
protocol
=
'https'
if
services
.
https
and
ssl
else
'http'
host_and_port
=
services
.
api_host
.
strip
(
'/'
)
standard_port
=
443
if
protocol
==
'https'
else
80
if
services
.
api_port
!=
standard_port
:
if
services
.
api_port
not
in
[
80
,
443
]:
host_and_port
+=
':'
+
str
(
services
.
api_port
)
base_path
=
services
.
api_base_path
.
strip
(
'/'
)
return
f
'
{
protocol
}
://
{
host_and_port
}
/
{
base_path
}
/
{
api
}
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment