Merge pull request #350 from lblod/refactor/model-agent-person-organization

Refactor: Introduce generic Agent resource
This commit is contained in:
Alexander van den Berghe
2023-11-27 15:52:15 +00:00
committed by GitHub
13 changed files with 331 additions and 98 deletions

View File

@@ -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",

View File

@@ -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

View File

@@ -0,0 +1,32 @@
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX dc_terms: <http://purl.org/dc/terms/>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?org a dc_terms:Agent .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?org a org:Organization .
}
}
INSERT {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?org a dc_terms:Agent .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?org a org:Organization .
}
}
INSERT {
GRAPH <http://mu.semte.ch/graphs/shared> {
?org a dc_terms:Agent .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/shared> {
?org a org:Organization .
}
}

View File

@@ -0,0 +1,33 @@
PREFIX person: <http://www.w3.org/ns/person#>
PREFIX dc_terms: <http://purl.org/dc/terms/>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?person a dc_terms:Agent .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?person a person:Person .
}
}
INSERT {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?person a dc_terms:Agent .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?person a person:Person .
}
}
INSERT {
GRAPH <http://mu.semte.ch/graphs/shared> {
?person a dc_terms:Agent .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/shared> {
?person a person:Person .
}
}

View File

@@ -0,0 +1,32 @@
PREFIX ch: <http://data.lblod.info/vocabularies/contacthub/>
PREFIX dc_terms: <http://purl.org/dc/terms/>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?agentInPosition a dc_terms:Agent .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?agentInPosition a ch:AgentInPositie .
}
}
INSERT {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?agentInPosition a dc_terms:Agent .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?agentInPosition a ch:AgentInPositie .
}
}
INSERT {
GRAPH <http://mu.semte.ch/graphs/shared> {
?agentInPosition a dc_terms:Agent .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/shared> {
?agentInPosition a ch:AgentInPositie .
}
}

View File

@@ -0,0 +1,36 @@
PREFIX lblodlg: <http://data.lblod.info/vocabularies/leidinggevenden/>
PREFIX ch: <http://data.lblod.info/vocabularies/contacthub/>
PREFIX dc_terms: <http://purl.org/dc/terms/>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?functionary a dc_terms:Agent .
?functionary a ch:AgentInPositie .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?functionary a lblodlg:Functionaris
}
}
INSERT {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?functionary a dc_terms:Agent .
?functionary a ch:AgentInPositie .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?functionary a lblodlg:Functionaris
}
}
INSERT {
GRAPH <http://mu.semte.ch/graphs/shared> {
?functionary a dc_terms:Agent .
?functionary a ch:AgentInPositie .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/shared> {
?functionary a lblodlg:Functionaris
}
}

View File

@@ -0,0 +1,39 @@
PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
PREFIX ch: <http://data.lblod.info/vocabularies/contacthub/>
PREFIX dc_terms: <http://purl.org/dc/terms/>
INSERT {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?mandatory a dc_terms:Agent .
?mandatory a ch:AgentInPositie .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/administrative-unit> {
?mandatory a mandaat:Mandataris
FILTER NOT EXISTS { ?mandatory a ch:AgentInPositie }
}
}
INSERT {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?mandatory a dc_terms:Agent .
?mandatory a ch:AgentInPositie .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/worship-service> {
?mandatory a mandaat:Mandataris
FILTER NOT EXISTS { ?mandatory a ch:AgentInPositie }
}
}
INSERT {
GRAPH <http://mu.semte.ch/graphs/shared> {
?mandatory a dc_terms:Agent .
?mandatory a ch:AgentInPositie .
}
} WHERE {
GRAPH <http://mu.semte.ch/graphs/shared> {
?mandatory a mandaat:Mandataris
FILTER NOT EXISTS { ?mandatory a ch:AgentInPositie }
}
}

View File

@@ -17,7 +17,11 @@ PREFIX persoon_loket: <http://data.vlaanderen.be/ns/persoon#>
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX string: <http://www.w3.org/2000/10/swap/string#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dc_terms: <http://purl.org/dc/terms/>
PREFIX ch: <http://data.lblod.info/vocabularies/contacthub/>
PREFIX person: <http://www.w3.org/ns/person#>
PREFIX lblodlg: <http://data.lblod.info/vocabularies/leidinggevenden/>
PREFIX ere: <http://data.lblod.info/vocabularies/erediensten/>
# DL and OP both use persoon:gebruikteVoornaam but with different semantics (!)
# Hence the mapping is in two steps.
@@ -148,3 +152,34 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
} => {
?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 .
} .

View File

@@ -127,6 +127,18 @@
?s a <http://www.w3.org/ns/person#Person>
}.
{
?s a <http://purl.org/dc/terms/Agent>
} => {
?s a <http://purl.org/dc/terms/Agent>
}.
{
?s a <http://data.lblod.info/vocabularies/contacthub/AgentInPositie>
} => {
?s a <http://data.lblod.info/vocabularies/contacthub/AgentInPositie>
}.
{
?s a <http://www.w3.org/ns/prov#Location>
} => {

View File

@@ -17,6 +17,10 @@ PREFIX persoon_loket: <http://data.vlaanderen.be/ns/persoon#>
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX string: <http://www.w3.org/2000/10/swap/string#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dc_terms: <http://purl.org/dc/terms/>
PREFIX ch: <http://data.lblod.info/vocabularies/contacthub/>
PREFIX person: <http://www.w3.org/ns/person#>
PREFIX lblodlg: <http://data.lblod.info/vocabularies/leidinggevenden/>
# DL and OP both use persoon:gebruikteVoornaam but with different semantics (!)
# Hence the mapping is in two steps.
@@ -171,4 +175,34 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
}
} => {
?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 .
} .

View File

@@ -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",

View File

@@ -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"
}
}

View File

@@ -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"
}
}