diff --git a/config/authorization/config.ex b/config/authorization/config.ex index 9dd1843..f6fa2de 100644 --- a/config/authorization/config.ex +++ b/config/authorization/config.ex @@ -57,6 +57,7 @@ defmodule Acl.UserGroups.Config do ] @org_type [ + "http://purl.org/dc/terms/Agent", "http://www.w3.org/ns/org#Organization", "http://data.vlaanderen.be/ns/besluit#Besluit", "https://data.vlaanderen.be/ns/besluitvorming#Beslissingsactiviteit", diff --git a/config/dispatcher/dispatcher.ex b/config/dispatcher/dispatcher.ex index 6e1116c..4ef9420 100644 --- a/config/dispatcher/dispatcher.ex +++ b/config/dispatcher/dispatcher.ex @@ -60,8 +60,8 @@ defmodule Dispatcher do Proxy.forward conn, path, "http://cache/board-position-codes/" end - match "/agents/*path", %{ accept: [:json], layer: :api} do - Proxy.forward conn, path, "http://cache/agents/" + match "/functionaries/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://cache/functionaries/" end match "/agent-status-codes/*path", %{ accept: [:json], layer: :api} do diff --git a/config/migrations/2023/20231117161347-add-agent-type/20231117161502-organisations.sparql b/config/migrations/2023/20231117161347-add-agent-type/20231117161502-organisations.sparql new file mode 100644 index 0000000..cf5d261 --- /dev/null +++ b/config/migrations/2023/20231117161347-add-agent-type/20231117161502-organisations.sparql @@ -0,0 +1,32 @@ +PREFIX org: +PREFIX dc_terms: + +INSERT { + GRAPH { + ?org a dc_terms:Agent . + } +} WHERE { + GRAPH { + ?org a org:Organization . + } +} + +INSERT { + GRAPH { + ?org a dc_terms:Agent . + } +} WHERE { + GRAPH { + ?org a org:Organization . + } +} + +INSERT { + GRAPH { + ?org a dc_terms:Agent . + } +} WHERE { + GRAPH { + ?org a org:Organization . + } +} diff --git a/config/migrations/2023/20231117161347-add-agent-type/20231117161517-people.sparql b/config/migrations/2023/20231117161347-add-agent-type/20231117161517-people.sparql new file mode 100644 index 0000000..d164754 --- /dev/null +++ b/config/migrations/2023/20231117161347-add-agent-type/20231117161517-people.sparql @@ -0,0 +1,33 @@ + +PREFIX person: +PREFIX dc_terms: + +INSERT { + GRAPH { + ?person a dc_terms:Agent . + } +} WHERE { + GRAPH { + ?person a person:Person . + } +} + +INSERT { + GRAPH { + ?person a dc_terms:Agent . + } +} WHERE { + GRAPH { + ?person a person:Person . + } +} + +INSERT { + GRAPH { + ?person a dc_terms:Agent . + } +} WHERE { + GRAPH { + ?person a person:Person . + } +} diff --git a/config/migrations/2023/20231117161347-add-agent-type/20231117161530-agents-in-position.sparql b/config/migrations/2023/20231117161347-add-agent-type/20231117161530-agents-in-position.sparql new file mode 100644 index 0000000..5baa48f --- /dev/null +++ b/config/migrations/2023/20231117161347-add-agent-type/20231117161530-agents-in-position.sparql @@ -0,0 +1,32 @@ +PREFIX ch: +PREFIX dc_terms: + +INSERT { + GRAPH { + ?agentInPosition a dc_terms:Agent . + } +} WHERE { + GRAPH { + ?agentInPosition a ch:AgentInPositie . + } +} + +INSERT { + GRAPH { + ?agentInPosition a dc_terms:Agent . + } +} WHERE { + GRAPH { + ?agentInPosition a ch:AgentInPositie . + } +} + +INSERT { + GRAPH { + ?agentInPosition a dc_terms:Agent . + } +} WHERE { + GRAPH { + ?agentInPosition a ch:AgentInPositie . + } +} diff --git a/config/migrations/2023/20231117161347-add-agent-type/20231123150643-functionaries.sparql b/config/migrations/2023/20231117161347-add-agent-type/20231123150643-functionaries.sparql new file mode 100644 index 0000000..788fc6c --- /dev/null +++ b/config/migrations/2023/20231117161347-add-agent-type/20231123150643-functionaries.sparql @@ -0,0 +1,36 @@ +PREFIX lblodlg: +PREFIX ch: +PREFIX dc_terms: + +INSERT { + GRAPH { + ?functionary a dc_terms:Agent . + ?functionary a ch:AgentInPositie . + } +} WHERE { + GRAPH { + ?functionary a lblodlg:Functionaris + } +} + +INSERT { + GRAPH { + ?functionary a dc_terms:Agent . + ?functionary a ch:AgentInPositie . + } +} WHERE { + GRAPH { + ?functionary a lblodlg:Functionaris + } +} + +INSERT { + GRAPH { + ?functionary a dc_terms:Agent . + ?functionary a ch:AgentInPositie . + } +} WHERE { + GRAPH { + ?functionary a lblodlg:Functionaris + } +} diff --git a/config/migrations/2023/20231117161347-add-agent-type/20231123152046-mandatories.sparql b/config/migrations/2023/20231117161347-add-agent-type/20231123152046-mandatories.sparql new file mode 100644 index 0000000..0904ae2 --- /dev/null +++ b/config/migrations/2023/20231117161347-add-agent-type/20231123152046-mandatories.sparql @@ -0,0 +1,39 @@ +PREFIX mandaat: +PREFIX ch: +PREFIX dc_terms: + +INSERT { + GRAPH { + ?mandatory a dc_terms:Agent . + ?mandatory a ch:AgentInPositie . + } +} WHERE { + GRAPH { + ?mandatory a mandaat:Mandataris + FILTER NOT EXISTS { ?mandatory a ch:AgentInPositie } + } +} + +INSERT { + GRAPH { + ?mandatory a dc_terms:Agent . + ?mandatory a ch:AgentInPositie . + } +} WHERE { + GRAPH { + ?mandatory a mandaat:Mandataris + FILTER NOT EXISTS { ?mandatory a ch:AgentInPositie } + } +} + +INSERT { + GRAPH { + ?mandatory a dc_terms:Agent . + ?mandatory a ch:AgentInPositie . + } +} WHERE { + GRAPH { + ?mandatory a mandaat:Mandataris + FILTER NOT EXISTS { ?mandatory a ch:AgentInPositie } + } +} diff --git a/config/reasoner/dl2op/main-info/mapping.n3 b/config/reasoner/dl2op/main-info/mapping.n3 index 82bebd9..ec1a9a1 100644 --- a/config/reasoner/dl2op/main-info/mapping.n3 +++ b/config/reasoner/dl2op/main-info/mapping.n3 @@ -17,7 +17,11 @@ PREFIX persoon_loket: PREFIX skos: PREFIX string: PREFIX xsd: - +PREFIX dc_terms: +PREFIX ch: +PREFIX person: +PREFIX lblodlg: +PREFIX ere: # DL and OP both use persoon:gebruikteVoornaam but with different semantics (!) # Hence the mapping is in two steps. @@ -148,3 +152,34 @@ PREFIX xsd: } => { ?s generiek:isTijdspecialisatieVan ?o. }. + +# In OP functionaris inherits from agents-in-position, which inherits from Agent +{ + ?s a lblodlg:Functionaris . +} => { + ?s a ch:AgentInPositie , + dc_terms:Agent . +} . + +# In OP mandataris inherits from agents-in-position, which inherits from Agent +{ + ?s a mandaat:Mandataris . +} => { + ?s a ch:AgentInPositie , + dc_terms:Agent . +} . + +# In OP minister inherits from agents-in-position, which inherits from Agent +{ + ?s a ere:RolBedienaar . +} => { + ?s a ch:AgentInPositie , + dc_terms:Agent . +} . + +# In OP Person inherits from Agent +{ + ?s a person:Person . +} => { + ?s a dc_terms:Agent . +} . diff --git a/config/reasoner/dl2op/main-info/query.n3q b/config/reasoner/dl2op/main-info/query.n3q index 3e0781e..2d55202 100644 --- a/config/reasoner/dl2op/main-info/query.n3q +++ b/config/reasoner/dl2op/main-info/query.n3q @@ -127,6 +127,18 @@ ?s a }. +{ + ?s a + } => { + ?s a +}. + +{ + ?s a + } => { + ?s a +}. + { ?s a } => { diff --git a/config/reasoner/dl2op/main/mapping.n3 b/config/reasoner/dl2op/main/mapping.n3 index 1838441..0f79ceb 100644 --- a/config/reasoner/dl2op/main/mapping.n3 +++ b/config/reasoner/dl2op/main/mapping.n3 @@ -17,6 +17,10 @@ PREFIX persoon_loket: PREFIX skos: PREFIX string: PREFIX xsd: +PREFIX dc_terms: +PREFIX ch: +PREFIX person: +PREFIX lblodlg: # DL and OP both use persoon:gebruikteVoornaam but with different semantics (!) # Hence the mapping is in two steps. @@ -171,4 +175,34 @@ PREFIX xsd: } } => { ?s generiek:isTijdspecialisatieVan ?o. -}. +} . + +# In OP functionaris inherits from agents-in-position, which inherits from Agent +{ + ?s a lblodlg:Functionaris . +} => { + ?s a ch:AgentInPositie , + dc_terms:Agent . +} . + +# In OP mandataris inherits from agents-in-position, which inherits from Agent +{ + ?s a mandaat:Mandataris . +} => { + ?s a ch:AgentInPositie , + dc_terms:Agent . +} . + +# In OP AgentInPositie inherits from Agent +{ + ?s a ch:AgentInPositie . +} => { + ?s a dc_terms:Agent . +} . + +# In OP Person inherits from Agent +{ + ?s a person:Person . +} => { + ?s a dc_terms:Agent . +} . diff --git a/config/resources/domain.json b/config/resources/domain.json index b9928be..7a33825 100644 --- a/config/resources/domain.json +++ b/config/resources/domain.json @@ -32,8 +32,25 @@ "nacebel": "http://data.gift/vocabularies/nace-bel/" }, "resources": { + "agents": { + "class": "dc_terms:Agent", + "relationships": { + "position": { + "predicate": "org:holds", + "target": "posts", + "cardinality": "many" + }, + "contacts": { + "predicate": "schema:contactPoint", + "target": "contact-points", + "cardinality": "many" + } + }, + "new-resource-base": "http://data.lblod.info/id/agenten/" + }, "people": { "class": "person:Person", + "super": ["agents"], "attributes": { "given-name": { "type": "string", @@ -61,9 +78,9 @@ "cardinality": "many", "inverse": true }, - "agents": { + "functionaries": { "predicate": "mandaat:isBestuurlijkeAliasVan", - "target": "agents", + "target": "functionaries", "cardinality": "many", "inverse": true } @@ -72,6 +89,7 @@ }, "agents-in-position": { "class": "ch:AgentInPositie", + "super": ["agents"], "attributes": { "agent-start-date": { "type": "date", @@ -83,11 +101,6 @@ } }, "relationships": { - "position": { - "predicate": "org:holds", - "target": "posts", - "cardinality": "one" - }, "person": { "predicate": "org:heldBy", "target": "people", @@ -114,20 +127,17 @@ "target": "organizations", "cardinality": "one" }, - "agents-in-position": { - "predicate": "org:holds", - "target": "agents-in-position", - "cardinality": "many", - "inverse": true + "agent": { + "predicate": "org:heldBy", + "target": "agents", + "cardinality": "one" } }, "new-resource-base": "http://data.lblod.info/id/posities/" }, "mandatories": { "class": "mandaat:Mandataris", - "super": [ - "agents-in-position" - ], + "super": ["agents-in-position"], "attributes": { "start-date": { "type": "date", @@ -170,16 +180,12 @@ "predicate": "skos:prefLabel" } }, - "features": [ - "include-uri" - ], + "features": ["include-uri"], "new-resource-base": "http://data.vlaanderen.be/id/concept/MandatarisStatusCode/" }, "worship-mandatories": { "class": "ere:EredienstMandataris", - "super": [ - "mandatories" - ], + "super": ["mandatories"], "attributes": { "expected-end-date": { "type": "date", @@ -244,9 +250,7 @@ }, "mandates": { "class": "mandaat:Mandaat", - "super": [ - "posts" - ], + "super": ["posts"], "relationships": { "role-board": { "predicate": "org:role", @@ -268,11 +272,9 @@ }, "new-resource-base": "http://data.lblod.info/id/mandaten/" }, - "agents": { + "functionaries": { "class": "lblodlg:Functionaris", - "super": [ - "agents-in-position" - ], + "super": ["agents-in-position"], "attributes": { "start-date": { "type": "datetime", @@ -310,16 +312,12 @@ "predicate": "skos:prefLabel" } }, - "features": [ - "include-uri" - ], + "features": ["include-uri"], "new-resource-base": "http://data.vlaanderen.be/id/concept/functionarisStatusCode/" }, "board-positions": { "class": "lblodlg:Bestuursfunctie", - "super": [ - "posts" - ], + "super": ["posts"], "relationships": { "role-board": { "predicate": "org:role", @@ -369,6 +367,7 @@ }, "organizations": { "class": "org:Organization", + "super": ["agents"], "attributes": { "name": { "type": "string", @@ -490,9 +489,7 @@ }, "administrative-units": { "class": "besluit:Bestuurseenheid", - "super": [ - "organizations" - ], + "super": ["organizations"], "relationships": { "classification": { "predicate": "org:classification", @@ -540,16 +537,12 @@ }, "administrative-unit-classification-codes": { "class": "code:BestuurseenheidClassificatieCode", - "super": [ - "organization-classification-codes" - ], + "super": ["organization-classification-codes"], "new-resource-base": "http://data.vlaanderen.be/id/concept/BestuurseenheidClassificatieCode/" }, "worship-administrative-units": { "class": "ere:EredienstBestuurseenheid", - "super": [ - "administrative-units" - ], + "super": ["administrative-units"], "relationships": { "recognized-worship-type": { "predicate": "ere:typeEredienst", @@ -572,9 +565,7 @@ }, "worship-services": { "class": "ere:BestuurVanDeEredienst", - "super": [ - "worship-administrative-units" - ], + "super": ["worship-administrative-units"], "attributes": { "denomination": { "type": "string", @@ -599,16 +590,12 @@ }, "central-worship-services": { "class": "ere:CentraalBestuurVanDeEredienst", - "super": [ - "worship-administrative-units" - ], + "super": ["worship-administrative-units"], "new-resource-base": "http://data.lblod.info/id/centraleBesturenVanDeEredienst/" }, "representative-bodies": { "class": "ere:RepresentatiefOrgaan", - "super": [ - "organizations" - ], + "super": ["organizations"], "relationships": { "classification": { "predicate": "org:classification", @@ -631,9 +618,7 @@ }, "representative-body-classification-codes": { "class": "ext:RepresentatiefOrgaanClassificatieCode", - "super": [ - "organization-classification-codes" - ], + "super": ["organization-classification-codes"], "new-resource-base": "http://data.vlaanderen.be/id/concept/RepresentatiefOrgaanClassificatieCode/" }, "governing-bodies": { @@ -851,9 +836,7 @@ "predicate": "skos:prefLabel" } }, - "features": [ - "include-uri" - ], + "features": ["include-uri"], "new-resource-base": "http://lblod.data.gift/concepts/" }, "locations": { @@ -906,9 +889,7 @@ }, "ministers": { "class": "ere:RolBedienaar", - "super": [ - "agents-in-position" - ], + "super": ["agents-in-position"], "relationships": { "minister-position": { "predicate": "org:holds", @@ -976,9 +957,7 @@ }, "minister-positions": { "class": "ere:PositieBedienaar", - "super": [ - "posts" - ], + "super": ["posts"], "relationships": { "function": { "predicate": "ere:functie", diff --git a/config/search/config.json b/config/search/config.json index 6e56567..db8733f 100644 --- a/config/search/config.json +++ b/config/search/config.json @@ -250,8 +250,8 @@ } }, { - "type": "agent", - "on_path": "agents", + "type": "functionary", + "on_path": "functionaries", "rdf_type": "http://data.lblod.info/vocabularies/leidinggevenden/Functionaris", "properties": { "given_name": [ @@ -568,14 +568,14 @@ }, { "type": "person", - "composite_types": ["minister", "agent", "mandatory"], + "composite_types": ["minister", "functionary", "mandatory"], "on_path": "people", "properties": [ { "name": "given_name", "mappings": { "minister": "given_name", - "agent": "given_name", + "functionary": "given_name", "mandatory": "given_name" } }, @@ -583,7 +583,7 @@ "name": "person_id", "mappings": { "minister": "person_id", - "agent": "person_id", + "functionary": "person_id", "mandatory": "person_id" } }, @@ -591,7 +591,7 @@ "name": "family_name", "mappings": { "minister": "family_name", - "agent": "family_name", + "functionary": "family_name", "mandatory": "family_name" } }, @@ -599,7 +599,7 @@ "name": "first_name_used", "mappings": { "minister": "first_name_used", - "agent": "first_name_used", + "functionary": "first_name_used", "mandatory": "first_name_used" } }, @@ -607,7 +607,7 @@ "name": "end_date", "mappings": { "minister": "end_date", - "agent": "end_date", + "functionary": "end_date", "mandatory": "end_date" } }, @@ -615,7 +615,7 @@ "name": "organization_id", "mappings": { "minister": "organization_id", - "agent": "organization_id", + "functionary": "organization_id", "mandatory": "organization_id" } }, @@ -623,7 +623,7 @@ "name": "organization_classification", "mappings": { "minister": "organization_classification", - "agent": "organization_classification", + "functionary": "organization_classification", "mandatory": "organization_classification" } }, @@ -631,7 +631,7 @@ "name": "organization_name", "mappings": { "minister": "organization_name", - "agent": "organization_name", + "functionary": "organization_name", "mandatory": "organization_name" } }, @@ -639,7 +639,7 @@ "name": "organization_municipality", "mappings": { "minister": "organization_municipality", - "agent": "organization_municipality", + "functionary": "organization_municipality", "mandatory": "organization_municipality" } }, @@ -647,7 +647,7 @@ "name": "organization_province", "mappings": { "minister": "organization_province", - "agent": "organization_province", + "functionary": "organization_province", "mandatory": "organization_province" } }, @@ -655,7 +655,7 @@ "name": "position_id", "mappings": { "minister": "position_id", - "agent": "position_id", + "functionary": "position_id", "mandatory": "position_id" } }, @@ -663,7 +663,7 @@ "name": "position_name", "mappings": { "minister": "position_name", - "agent": "position_name", + "functionary": "position_name", "mandatory": "position_name" } } diff --git a/config/search/dev/config.json b/config/search/dev/config.json index 13890ba..c58fda3 100644 --- a/config/search/dev/config.json +++ b/config/search/dev/config.json @@ -222,8 +222,8 @@ } }, { - "type": "agent", - "on_path": "agents", + "type": "functionary", + "on_path": "functionaries", "rdf_type": "http://data.lblod.info/vocabularies/leidinggevenden/Functionaris", "properties": { "given_name": [ @@ -540,14 +540,14 @@ }, { "type": "person", - "composite_types": ["minister", "agent", "mandatory"], + "composite_types": ["minister", "functionary", "mandatory"], "on_path": "people", "properties": [ { "name": "given_name", "mappings": { "minister": "given_name", - "agent": "given_name", + "functionary": "given_name", "mandatory": "given_name" } }, @@ -555,7 +555,7 @@ "name": "person_id", "mappings": { "minister": "person_id", - "agent": "person_id", + "functionary": "person_id", "mandatory": "person_id" } }, @@ -563,7 +563,7 @@ "name": "family_name", "mappings": { "minister": "family_name", - "agent": "family_name", + "functionary": "family_name", "mandatory": "family_name" } }, @@ -571,7 +571,7 @@ "name": "first_name_used", "mappings": { "minister": "first_name_used", - "agent": "first_name_used", + "functionary": "first_name_used", "mandatory": "first_name_used" } }, @@ -579,7 +579,7 @@ "name": "end_date", "mappings": { "minister": "end_date", - "agent": "end_date", + "functionary": "end_date", "mandatory": "end_date" } }, @@ -587,7 +587,7 @@ "name": "organization_id", "mappings": { "minister": "organization_id", - "agent": "organization_id", + "functionary": "organization_id", "mandatory": "organization_id" } }, @@ -595,7 +595,7 @@ "name": "organization_classification", "mappings": { "minister": "organization_classification", - "agent": "organization_classification", + "functionary": "organization_classification", "mandatory": "organization_classification" } }, @@ -603,7 +603,7 @@ "name": "organization_name", "mappings": { "minister": "organization_name", - "agent": "organization_name", + "functionary": "organization_name", "mandatory": "organization_name" } }, @@ -611,7 +611,7 @@ "name": "organization_municipality", "mappings": { "minister": "organization_municipality", - "agent": "organization_municipality", + "functionary": "organization_municipality", "mandatory": "organization_municipality" } }, @@ -619,7 +619,7 @@ "name": "organization_province", "mappings": { "minister": "organization_province", - "agent": "organization_province", + "functionary": "organization_province", "mandatory": "organization_province" } }, @@ -627,7 +627,7 @@ "name": "position_id", "mappings": { "minister": "position_id", - "agent": "position_id", + "functionary": "position_id", "mandatory": "position_id" } }, @@ -635,7 +635,7 @@ "name": "position_name", "mappings": { "minister": "position_name", - "agent": "position_name", + "functionary": "position_name", "mandatory": "position_name" } }