Skip to content

Commit

Permalink
Add reglement filter on thema
Browse files Browse the repository at this point in the history
  • Loading branch information
MPParsley committed May 31, 2024
1 parent 0ee8fd2 commit 9df1f4e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
11 changes: 11 additions & 0 deletions webcomponents/reglementen-lijst/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ <h2 class="h3" slot="title" style="display:flex;flex-direction:column;gap:30px;m
</h2>
</reglementen-lijst>

<reglementen-lijst
sparql-endpoint="https://probe.stad.gent/sparql"
aantal="5"
taxonomy="http://stad.gent/id/concepts/decision_making_themes"
concepts="http://stad.gent/id/concepts/decision_making_themes/concept_30"
>
<h2 class="h3" slot="title" style="display:flex;flex-direction:column;gap:30px;margin:0 0 30px 0;padding:0 20px;">
Meest recente reglementen Stad Gent mbt Mobiliteit
</h2>
</reglementen-lijst>

<reglementen-lijst
sparql-endpoint="https://probe.stad.gent/sparql"
aantal="1"
Expand Down
24 changes: 24 additions & 0 deletions webcomponents/reglementen-lijst/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,26 @@ class ReglementenLijst extends HTMLElement {
filterparams += `VALUES ?type { ${Object.keys(ReglementenLijst.types).map((type) => `<${type}>`).join(" ")} }`;
}

// Taxonomy filter.
let queryThema = '';
const taxonomy = this.getAttribute('taxonomy') || 'http://stad.gent/id/concepts/decision_making_themes';
const concepts = this.getAttribute('concepts');
if (concepts) {
const conceptsArray = concepts.split(" ");
queryThema = `
?besluit ext:hasAnnotation ?annotation .
?annotation ext:withTaxonomy ?thema ;
ext:creationDate ?date ;
ext:hasLabel ?label .
?label ext:isTaxonomy ?concept .
VALUES ?thema { <${taxonomy}> }
VALUES ?concept { ` + conceptsArray.map(concept => `<${concept.trim()}>`).join(" ") + ` }
FILTER (!CONTAINS(STR(?url), "/notulen"))
FILTER (!CONTAINS(STR(?orgaan), "personeel"))
FILTER (!CONTAINS(STR(?orgaan), "gemeenteraad"))
`;
}

let queryBestuursorgaan = `
prov:wasGeneratedBy/dct:subject ?agendapunt .
Expand All @@ -150,6 +170,7 @@ class ReglementenLijst extends HTMLElement {
PREFIX besluit: <http://data.vlaanderen.be/ns/besluit#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
SELECT
DISTINCT ?besluit ?title ?publicatie_datum ?agendapunt ?zitting ?orgaan ?url ?status ?type
Expand All @@ -163,6 +184,7 @@ class ReglementenLijst extends HTMLElement {
${queryBestuursorgaan}
?bestuursorgaanURI skos:prefLabel ?orgaan .
${queryThema}
${filterparams}
FILTER (!CONTAINS(STR(?url), "/notulen"))
FILTER (!CONTAINS(STR(?orgaan), "personeel"))
Expand All @@ -180,6 +202,7 @@ class ReglementenLijst extends HTMLElement {
PREFIX besluit: <http://data.vlaanderen.be/ns/besluit#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
SELECT
(COUNT(DISTINCT(?besluit)) AS ?count)
Expand All @@ -193,6 +216,7 @@ class ReglementenLijst extends HTMLElement {
${queryBestuursorgaan}
?bestuursorgaanURI skos:prefLabel ?orgaan .
${queryThema}
${filterparams}
FILTER (!CONTAINS(STR(?url), "/notulen"))
FILTER (!CONTAINS(STR(?orgaan), "personeel"))
Expand Down

0 comments on commit 9df1f4e

Please sign in to comment.