Commit 39976286 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed URL ports. Added creators to catalog in dcat api.

parent 069fc49f
Pipeline #101321 passed with stages
in 30 minutes and 19 seconds
...@@ -40,12 +40,12 @@ def get_optional_entry_prop(entry, name): ...@@ -40,12 +40,12 @@ def get_optional_entry_prop(entry, name):
class Mapping(): class Mapping():
def __init__(self): def __init__(self):
self.g = Graph() self.g = Graph()
self.g.namespace_manager.bind('rdf', RDF) self.g.bind('rdf', RDF)
self.g.namespace_manager.bind('dcat', DCAT) self.g.bind('dcat', DCAT)
self.g.namespace_manager.bind('dct', DCT) self.g.bind('dct', DCT)
self.g.namespace_manager.bind('vcard', VCARD) self.g.bind('vcard', VCARD)
self.g.namespace_manager.bind('foaf', FOAF) self.g.bind('foaf', FOAF)
self.g.namespace_manager.bind('hydra', HYDRA) self.g.bind('hydra', HYDRA)
self.persons = {} self.persons = {}
...@@ -76,6 +76,9 @@ class Mapping(): ...@@ -76,6 +76,9 @@ class Mapping():
self.g.add((hydra_collection, RDF.type, HYDRA.collection)) 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): def map_entry(self, entry: EntryMetadata, slim=False):
dataset = URIRef(url('datasets', entry.calc_id)) dataset = URIRef(url('datasets', entry.calc_id))
......
...@@ -177,8 +177,7 @@ tests = NomadConfig( ...@@ -177,8 +177,7 @@ tests = NomadConfig(
def api_url(ssl: bool = True, api: str = 'api'): def api_url(ssl: bool = True, api: str = 'api'):
protocol = 'https' if services.https and ssl else 'http' protocol = 'https' if services.https and ssl else 'http'
host_and_port = services.api_host.strip('/') host_and_port = services.api_host.strip('/')
standard_port = 443 if protocol == 'https' else 80 if services.api_port not in [80, 443]:
if services.api_port != standard_port:
host_and_port += ':' + str(services.api_port) host_and_port += ':' + str(services.api_port)
base_path = services.api_base_path.strip('/') base_path = services.api_base_path.strip('/')
return f'{protocol}://{host_and_port}/{base_path}/{api}' return f'{protocol}://{host_and_port}/{base_path}/{api}'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment