From f671b03c2fce1746148fe273d1550816a7297193 Mon Sep 17 00:00:00 2001 From: anitacaron Date: Wed, 26 May 2021 18:41:08 +0100 Subject: [PATCH] update domain and include resources and path in dispatcher --- config/dispatcher/dispatcher.ex | 61 ++++++++- config/resources/domain.json | 219 ++++++++++++++++++++++++++++++-- config/resources/domain.lisp | 9 ++ docker-compose.yml | 19 ++- 4 files changed, 296 insertions(+), 12 deletions(-) create mode 100644 config/resources/domain.lisp diff --git a/config/dispatcher/dispatcher.ex b/config/dispatcher/dispatcher.ex index e3b1b50..4445fd4 100644 --- a/config/dispatcher/dispatcher.ex +++ b/config/dispatcher/dispatcher.ex @@ -10,6 +10,65 @@ defmodule Dispatcher do define_layers [ :api, :frontend, :not_found ] + ############################################################### + # domain.json + ############################################################### + match "/people/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/people/" + end + + match "/mandatories/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/mandatories/" + end + + match "/mandatory-status-codes/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/mandatory-status-codes/" + end + + match "/contact-points/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/contact-points/" + end + + match "/mandates/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/mandates/" + end + + match "/governing-bories/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/governing-bories/" + end + + match "/governing-body-classification-codes/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/governing-body-classification-codes/" + end + + match "/administrative-units/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/administrative-units/" + end + + match "/administrative-unit-classification-codes/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/administrative-unit-classification-codes/" + end + + match "/addresses/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/addresses/" + end + + match "/sites/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/sites/" + end + + match "/identifiers/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/identifiers/" + end + + match "/structured-identifiers/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/structured-identifiers/" + end + + match "/worship-services/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://resource/worship-services/" + end + ############################################################### # sparql endpoint ############################################################### @@ -46,7 +105,7 @@ defmodule Dispatcher do match "/*_path", %{ layer: :frontend } do Proxy.forward conn, [], "http://frontend/index.html" end - + ############################################################### # errors ############################################################### diff --git a/config/resources/domain.json b/config/resources/domain.json index 6a67699..67e7158 100644 --- a/config/resources/domain.json +++ b/config/resources/domain.json @@ -47,7 +47,7 @@ "cardinality": "many" } }, - "new-resource-base": "http://data.lblod.info/persoon/" + "new-resource-base": "http://data.lblod.info/id/persoon/" }, "mandatories": { "name": "mandatory", @@ -84,9 +84,9 @@ "cardinality": "one" } }, - "new-resource-base": "http://data.lblod.info/mandataris/" + "new-resource-base": "http://data.lblod.info/id/mandataris/" }, - "mandatory-status-code": { + "mandatory-status-codes": { "name": "mandatoryStatusCode", "class": "skos:Concept", "attributes": { @@ -94,9 +94,10 @@ "type": "string", "predicate": "skos:prefLabel" } - } + }, + "new-resource-base": "http://data.vlaanderen.be/id/concept/MandatarisStatusCode/" }, - "contactPoints": { + "contact-points": { "name": "contactPoint", "class": "schema:ContactPoint", "attributes": { @@ -124,7 +125,7 @@ "cardinality": "one" } }, - "new-resource-base": "http://data.lblod.info/contactpunt/" + "new-resource-base": "http://data.lblod.info/id/contactpunt/" }, "mandates": { "name": "mandate", @@ -135,14 +136,15 @@ "target": "roleConcept", "cardinality": "one" }, - "governingBody": { + "governingBodies": { "predicate": "org:hasPost", "target": "governingBody", "cardinality": "many" } - } + }, + "new-resource-base": "http://data.lblod.info/id/mandaat/" }, - "governingBodies": { + "governing-bodies": { "name": "governingBody", "class": "besluit:Bestuursorgaan", "attributes": { @@ -154,7 +156,204 @@ "type": "dateTime", "predicate": "mandaat:bindingEinde" } - } + }, + "relationships": { + "administrativeUnit": { + "predicate": "besluit:bestuurt", + "target": "administrativUnit", + "cardinality": "one" + }, + "classification": { + "predicate": "org:classification", + "target": "governingBodyClassificationCode", + "cardinality": "one" + }, + "isTimeSpecializationOf": { + "predicate": "generiek:isTijdspecialisatieVan", + "target": "governingBody", + "cardinality": "one" + }, + "hasTimeSpecializations": { + "predicate": "generiek:isTijdspecialisatieVan", + "target": "goveringBody", + "cardinality": "many", + "inverse": true + }, + "contains": { + "predicate": "org:hasPost", + "target": "mandate", + "cardinality": "many" + } + }, + "new-resource-base": "http://data.lblod.info/id/bestuursorgaan/" + }, + "governing-body-classification-codes": { + "name": "governingBodyClassificationCode", + "class": "skos:Concept", + "attributes": { + "label": { + "type": "string", + "predicate": "skos:prefLabel" + } + }, + "new-resource-base": "http://data.vlaanderen.be/id/concept/BestuursorgaanClassificatieCode/" + }, + "administrative-units": { + "name": "administrativeUnit", + "class": "besluit:Bestuurseenheid", + "attributes": { + "name": { + "type": "string", + "predicate": "skos:prefLabel" + }, + "alternative-name": { + "type": "string", + "predicate": "skos:altLabel" + } + }, + "relationships": { + "classification": { + "predicate": "org:classification", + "target": "administrativeUnitClassificationCode", + "cardinality": "one" + }, + "primary-site": { + "predicate": "org:hasPrimarySite", + "target": "site", + "cardinality": "one" + }, + "identifiers": { + "predicate": "adms:idenfier", + "target": "identifier", + "cardinality": "many" + }, + "governing-bodies": { + "predicate": "besluit:bestuurt", + "target": "governingBody", + "cardinality": "many", + "inverser": true + }, + "contact-points": { + "predicate": "schema:contactPoint", + "target": "contactPoint", + "cardinality": "many" + }, + "sites": { + "predicate": "org:hasSite", + "target": "site", + "cardinality": "many" + } + }, + "new-resource-base": "http://data.lblod.info/id/bestuurseenheid/" + }, + "administrative-unit-classification-codes": { + "name": "administrativeUnitClassificationCode", + "class": "skos:Concept", + "attributes": { + "label": { + "type": "string", + "predicate": "skos:prefLabel" + } + }, + "new-resource-base": "http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/" + }, + "identifiers": { + "name": "identifier", + "class": "adms:Identifier", + "attributes": { + "id-name": { + "type": "string", + "predicate": "skos:notation" + } + }, + "relationships": { + "structured-identifier": { + "predicate": "generiek:gestructureerdeIdentificator", + "target": "structuredIdentifier", + "cardinality": "one" + } + }, + "new-resource-base": "http://data.lblod.info/id/identificator/" + }, + "structured-idenfiers": { + "name": "structuredIdentifier", + "class": "generiek:GestructureerdeIdentificator", + "attributes": { + "local-id": { + "type": "string", + "predicate": "generiek:lokaleIdentificator" + } + }, + "new-resource-base": "http://data.lblod.info/id/gestructureerdeIdentificator/" + }, + "addresses": { + "name": "address", + "class": "locn:Address", + "attributes": { + "number": { + "type": "string", + "predicate": "adres:Adresvoorstelling.huisnummer" + }, + "box-number": { + "type": "string", + "predicate": "adres:Adresvoorstelling.busnummer" + }, + "street": { + "type": "string", + "predicate": "locn:thoroughfare" + }, + "postcode": { + "type": "string", + "predicate": "locn:postCode" + }, + "municipality": { + "type": "string", + "predicate": "adres:gemeentenaam" + }, + "province": { + "type": "string", + "predicate": "locn:adminUnitL2" + }, + "country": { + "type": "string", + "predicate": "adres:land" + }, + "full-address": { + "type": "string", + "predicate": "locn:fullAddress" + } + }, + "new-resource-base": "http://data.lblod.info/id/adres/" + }, + "sites": { + "name": "site", + "class": "org:Site", + "relationships": { + "contact": { + "predicate": "org:siteAddress", + "target": "contactPoint", + "cardinality": "many" + }, + "address": { + "predicate": "organisatie:bestaatUit", + "target": "address", + "cardinality": "one" + } + }, + "new-resource-base": "http://data.lblod.info/id/vestiging/" + }, + "worship-services": { + "name": "worshipService", + "class": "ere:BestuurVanDeEredienst", + "super": ["administrativeUnit"], + "relationships": { + "type": { + "predicate": "ere:typeEredienst", + "target": "eredienstType", + "cardinality": "one" + } + }, + "new-resource-base": "http://data.lblod.info/id/bestuurVanDeEredienst/" } } } \ No newline at end of file diff --git a/config/resources/domain.lisp b/config/resources/domain.lisp new file mode 100644 index 0000000..5cd593a --- /dev/null +++ b/config/resources/domain.lisp @@ -0,0 +1,9 @@ + +(in-package :mu-cl-resources) + +(defparameter *include-count-in-paginated-responses* t) + +; fixes bug in sorting - parameter is a workaround for virtuoso behaviour (see docs) but cause problems for sorting +(defparameter *max-group-sorted-properties* nil) + +(read-domain-file "domain.json") \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1ec8738..aef80b4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -67,6 +67,24 @@ services: - "logging=true" restart: always logging: *default-logging + resource: + image: semtech/mu-cl-resources:1.20.0 + links: + - db:database + volumes: + - ./config/resources:/config + labels: + - "logging=true" + restart: always + logging: *default-logging + cache: + image: semtech/mu-cache:2.0.1 + links: + - resource:backend + labels: + - "logging=true" + restart: always + logging: *default-logging # Ember-Metis uri-info: image: redpencil/mu-uri-info-service:0.2.1 @@ -92,7 +110,6 @@ services: logging: *default-logging labels: - "logging=true" - frontend: image: lblod/frontend-contact-hub labels: