From 27aa754a1eabfe98e1f74c6878e0aed1a6b7f557 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Wed, 12 Jun 2024 10:52:19 +0200 Subject: [PATCH] Use `$this` in queries netwerk-digitaal-erfgoed/ld-workbench#79 --- kb-nbt/generator-stage-1.rq | 6 +-- nafotos-test/generator-stage-1.rq | 76 +++++++++++++++---------------- nafotos/generator-stage-1.rq | 34 +++++++------- 3 files changed, 58 insertions(+), 58 deletions(-) diff --git a/kb-nbt/generator-stage-1.rq b/kb-nbt/generator-stage-1.rq index 320dd6e..977edf2 100644 --- a/kb-nbt/generator-stage-1.rq +++ b/kb-nbt/generator-stage-1.rq @@ -4,10 +4,10 @@ prefix edm: prefix dc: construct { - ?this a edm:ProvidedCHO ; + $this a edm:ProvidedCHO ; edm:type "TEXT" ; dc:title ?name . -} +} where { $this rdfs:label ?name . -} \ No newline at end of file +} diff --git a/nafotos-test/generator-stage-1.rq b/nafotos-test/generator-stage-1.rq index 70a5427..ff135ca 100644 --- a/nafotos-test/generator-stage-1.rq +++ b/nafotos-test/generator-stage-1.rq @@ -4,9 +4,9 @@ PREFIX dcterms: PREFIX skos: PREFIX edm: PREFIX ore: -PREFIX nao: -PREFIX foaf: -PREFIX odrl: +PREFIX nao: +PREFIX foaf: +PREFIX odrl: PREFIX doap: PREFIX svcs: @@ -14,7 +14,7 @@ CONSTRUCT { # uri_cho ?Foto a edm:ProvidedCHO ; - edm:type ?edm_type ; + edm:type ?edm_type ; dc:creator ?creator ; # dc:publisher ?publisher ; ??? dc:description ?description ; @@ -28,13 +28,13 @@ CONSTRUCT { dc:date ?date ; dcterms:isPartOf ?is_part_of . - ?this a ore:Aggregation ; + $this a ore:Aggregation ; edm:aggregatedCHO ?Foto ; - edm:provider ?provider ; - edm:dataProvider ?dataProvider ; -# edm:rights ?rights ; - edm:isShownBy ?isShownBy ; - edm:isShownAt ?isShownAt . + edm:provider ?provider ; + edm:dataProvider ?dataProvider ; +# edm:rights ?rights ; + edm:isShownBy ?isShownBy ; + edm:isShownAt ?isShownAt . ?isShownBy a edm:WebResource ; svcs:has_service ?uri_iiif . @@ -45,7 +45,7 @@ CONSTRUCT { } WHERE { - # ?uri_ore = ?Fotobeschrijving + # ?uri_ore = ?Fotobeschrijving # ?uri_cho = ?Foto # Fixed values ... @@ -56,7 +56,7 @@ CONSTRUCT { # iterator levert Fotorecords op $this dc:identifier ?identifier ; - dcterms:creator/skos:prefLabel ?_creator . + dcterms:creator/skos:prefLabel ?_creator . BIND(IF(LANG(?_creator)="",STRLANG(?_creator, "nl"),?_creator) AS ?creator) $this edm:isShownAt ?isShownAt . @@ -69,44 +69,44 @@ CONSTRUCT { ?Foto a nao:Archiefeenheid . ?Fotobeschrijving foaf:primaryTopic ?Foto . - # License "conversion" (via "filter" en bind) - # > - ?Fotobeschrijving odrl:hasPolicy . + # License "conversion" (via "filter" en bind) + # > + ?Fotobeschrijving odrl:hasPolicy . BIND(IRI("http://creativecommons.org/publicdomain/mark/1.0/") as ?policy) OPTIONAL { ?Foto nao:isMateriaaltype ?_material . BIND(IF(LANG(?_material)="",STRLANG(?_material, "nl"),?_material) AS ?material) } - OPTIONAL { - ?Fotobeschrijving dcterms:subject/skos:prefLabel ?_subject . - BIND(IF(LANG(?_subject)="",STRLANG(?_subject, "nl"),?_subject) AS ?subject) + OPTIONAL { + ?Fotobeschrijving dcterms:subject/skos:prefLabel ?_subject . + BIND(IF(LANG(?_subject)="",STRLANG(?_subject, "nl"),?_subject) AS ?subject) } - OPTIONAL { - ?Fotobeschrijving nao:trefwoordAlgemeen ?_subject . - BIND(IF(LANG(?_subject)="",STRLANG(?_subject, "nl"),?_subject) AS ?subject) + OPTIONAL { + ?Fotobeschrijving nao:trefwoordAlgemeen ?_subject . + BIND(IF(LANG(?_subject)="",STRLANG(?_subject, "nl"),?_subject) AS ?subject) } - OPTIONAL { - ?Fotobeschrijving nao:trefwoordLocatie ?_spatial . - BIND(IF(LANG(?_spatial)="",STRLANG(?_spatial, "nl"),?_spatial) AS ?spatial) + OPTIONAL { + ?Fotobeschrijving nao:trefwoordLocatie ?_spatial . + BIND(IF(LANG(?_spatial)="",STRLANG(?_spatial, "nl"),?_spatial) AS ?spatial) } -# OPTIONAL { +# OPTIONAL { # ?Fotobeschrijving dc:coverage ?temporal . # } OPTIONAL { ?Fotobeschrijving dcterms:date ?date } - OPTIONAL { - ?Fotobeschrijving nao:titelFotocollectie ?_is_part_of . - BIND(IF(LANG(?_is_part_of)="",STRLANG(?_is_part_of, "nl"),?_is_part_of) AS ?is_part_of) + OPTIONAL { + ?Fotobeschrijving nao:titelFotocollectie ?_is_part_of . + BIND(IF(LANG(?_is_part_of)="",STRLANG(?_is_part_of, "nl"),?_is_part_of) AS ?is_part_of) } - OPTIONAL { - ?Fotobeschrijving nao:titelFotoserie ?_is_part_of . - BIND(IF(LANG(?_is_part_of)="",STRLANG(?_is_part_of, "nl"),?_is_part_of) AS ?is_part_of) + OPTIONAL { + ?Fotobeschrijving nao:titelFotoserie ?_is_part_of . + BIND(IF(LANG(?_is_part_of)="",STRLANG(?_is_part_of, "nl"),?_is_part_of) AS ?is_part_of) } - OPTIONAL { - ?Fotobeschrijving dc:description ?_description . - BIND(IF(LANG(?_description)="",STRLANG(?_description, "nl"),?_description) AS ?description) + OPTIONAL { + ?Fotobeschrijving dc:description ?_description . + BIND(IF(LANG(?_description)="",STRLANG(?_description, "nl"),?_description) AS ?description) } - OPTIONAL { - ?Fotobeschrijving nao:toelichting ?_description . + OPTIONAL { + ?Fotobeschrijving nao:toelichting ?_description . BIND(IF(LANG(?_description)="",STRLANG(?_description, "nl"),?_description) AS ?description) - } -} \ No newline at end of file + } +} diff --git a/nafotos/generator-stage-1.rq b/nafotos/generator-stage-1.rq index f2d5190..c49ec7a 100644 --- a/nafotos/generator-stage-1.rq +++ b/nafotos/generator-stage-1.rq @@ -4,9 +4,9 @@ PREFIX dcterms: PREFIX skos: PREFIX edm: PREFIX ore: -PREFIX nao: -PREFIX foaf: -PREFIX odrl: +PREFIX nao: +PREFIX foaf: +PREFIX odrl: PREFIX doap: PREFIX svcs: @@ -14,7 +14,7 @@ CONSTRUCT { # uri_cho ?Foto a edm:ProvidedCHO ; - edm:type ?edm_type ; + edm:type ?edm_type ; dc:creator ?creator ; # dc:publisher ?publisher ; ??? dc:description ?description ; @@ -28,13 +28,13 @@ CONSTRUCT { dc:date ?date ; dcterms:isPartOf ?is_part_of . - ?this a ore:Aggregation ; + $this a ore:Aggregation ; edm:aggregatedCHO ?Foto ; - edm:provider ?provider ; - edm:dataProvider ?dataProvider ; - edm:rights ?rights ; - edm:isShownBy ?isShownBy ; - edm:isShownAt ?isShownAt . + edm:provider ?provider ; + edm:dataProvider ?dataProvider ; + edm:rights ?rights ; + edm:isShownBy ?isShownBy ; + edm:isShownAt ?isShownAt . ?isShownBy a edm:WebResource ; svcs:has_service ?uri_iiif . @@ -45,7 +45,7 @@ CONSTRUCT { } WHERE { - # ?uri_ore = ?Fotobeschrijving + # ?uri_ore = ?Fotobeschrijving # ?uri_cho = ?Foto # Fixed values ... @@ -56,7 +56,7 @@ CONSTRUCT { # iterator levert Fotorecords op $this dc:identifier ?identifier ; - dcterms:creator/skos:prefLabel ?_creator . + dcterms:creator/skos:prefLabel ?_creator . BIND(STRLANG(?_creator, "nl") AS ?creator) $this edm:isShownAt ?isShownAt . @@ -67,15 +67,15 @@ CONSTRUCT { $this ore:aggregates ?Foto . ?Foto a nao:Archiefeenheid . - + ?Fotobeschrijving foaf:primaryTopic ?Foto . OPTIONAL { ?Foto nao:isMateriaaltype ?_material . BIND(STRLANG(?_material, "nl") AS ?material) } - # License "conversion" (via "filter" en bind) - # > + # License "conversion" (via "filter" en bind) + # > BIND(IRI("http://creativecommons.org/publicdomain/mark/1.0/") as ?policy) - ?Fotobeschrijving odrl:hasPolicy . + ?Fotobeschrijving odrl:hasPolicy . OPTIONAL { ?Fotobeschrijving dcterms:subject/skos:prefLabel ?_subject . BIND(STRLANG(?_subject, "nl") AS ?subject) } OPTIONAL { ?Fotobeschrijving nao:trefwoordAlgemeen ?_subject . BIND(STRLANG(?_subject, "nl") AS ?subject) } @@ -85,6 +85,6 @@ CONSTRUCT { OPTIONAL { ?Fotobeschrijving nao:titelFotocollectie ?_is_part_of . BIND(STRLANG(?_is_part_of, "nl") AS ?is_part_of) } OPTIONAL { ?Fotobeschrijving nao:titelFotoserie ?_is_part_of . BIND(STRLANG(?_is_part_of, "nl") AS ?is_part_of) } OPTIONAL { ?Fotobeschrijving dc:description ?_description . BIND(STRLANG(?_description, "nl") AS ?description) } - OPTIONAL { ?Fotobeschrijving nao:toelichting ?_description . BIND(STRLANG(?_description, "nl") AS ?description) } + OPTIONAL { ?Fotobeschrijving nao:toelichting ?_description . BIND(STRLANG(?_description, "nl") AS ?description) } } LIMIT 1000