From 8c9b075447fa939d4f100dbff2d49d1fa2fe33ee Mon Sep 17 00:00:00 2001 From: Nils Ove Tendenes Date: Mon, 18 Mar 2024 08:53:58 +0100 Subject: [PATCH] chore: rm sparql graph specification from queries --- .github/workflows/coverage.yml | 1 + ...ncepts-7ae7a4ad-1c7c-47a1-8f83-c154ca98dbba.json | 2 +- ...258028-0c8a2616-6a9b-4394-b0e3-33074d8c870f.json | 2 +- ...767880-f3c0e9ca-934e-4ea1-bc1d-4e496da56b54.json | 2 +- ...rvices-231595e6-0ef7-4224-8b37-9b8f164aa528.json | 2 +- ...244132-95a4739c-fe68-4b36-919e-896df9830219.json | 2 +- ...258028-ba92a50c-5ef0-406f-82b4-3b5b0a008152.json | 2 +- ...tasets-767627a7-28c2-4d65-b5ce-835effab0ee5.json | 2 +- ...244132-ab8001c4-966b-4e44-b617-93b4c4675a6b.json | 2 +- ...244132-ed239cd1-4289-4e77-a2bb-daeabef7a573.json | 2 +- ...258028-3a7e8201-a9cd-4746-ba0e-489392e5f655.json | 2 +- ...ts-NAP-f0ba32c5-88b2-48b9-94fc-399c14d3ac59.json | 2 +- ...models-09356022-3b25-41f3-8bed-bf475c8e1a4b.json | 2 +- ...258028-e06965ee-8935-494b-bbf8-5f1750208fdf.json | 2 +- src/fdk_organization_bff/sparql/concept_queries.py | 8 ++++++-- .../sparql/dataservice_queries.py | 6 ++++-- src/fdk_organization_bff/sparql/dataset_queries.py | 13 +++++++++---- .../sparql/informationmodel_queries.py | 8 ++++++-- 18 files changed, 39 insertions(+), 23 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 851cf09..99e92f0 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,3 +10,4 @@ jobs: sessions: tests secrets: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/mock_mappings/mappings/sparql-from-concepts-7ae7a4ad-1c7c-47a1-8f83-c154ca98dbba.json b/mock_mappings/mappings/sparql-from-concepts-7ae7a4ad-1c7c-47a1-8f83-c154ca98dbba.json index 87a311b..8ca7d63 100644 --- a/mock_mappings/mappings/sparql-from-concepts-7ae7a4ad-1c7c-47a1-8f83-c154ca98dbba.json +++ b/mock_mappings/mappings/sparql-from-concepts-7ae7a4ad-1c7c-47a1-8f83-c154ca98dbba.json @@ -2,7 +2,7 @@ "id" : "7ae7a4ad-1c7c-47a1-8f83-c154ca98dbba", "name" : "", "request" : { - "url" : "/sparql?query=%0A++++++++PREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0A++++++++PREFIX+skos:+%3Chttp://www.w3.org/2004/02/skos/core%23%3E%0A++++++++SELECT+?organizationNumber+(COUNT(DISTINCT+?concept)+AS+?count)%0A++++++++FROM+%3Chttps://concepts.fellesdatakatalog.digdir.no%3E%0A++++++++WHERE+%7B%7B%0A++++++++++++?concept+a+skos:Concept+.%0A++++++++++++?concept+dct:publisher+?publisher+.%0A++++++++++++?publisher+dct:identifier+?organizationNumber+.%0A++++++++%7D%7D%0A++++++++GROUP+BY+?organizationNumber%0A++++", + "url" : "/sparql?query=%0A++++++++PREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0A++++++++PREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0A++++++++PREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0A++++++++PREFIX+skos:+%3Chttp://www.w3.org/2004/02/skos/core%23%3E%0A++++++++SELECT+?organizationNumber+(COUNT(DISTINCT+?concept)+AS+?count)%0A++++++++WHERE+%7B%7B%0A++++++++++++?concept+a+skos:Concept+.%0A++++++++++++%3Frecord+foaf%3AprimaryTopic+%3Fconcept+.%0A++++++++++++%3Frecord+a+dcat%3ACatalogRecord+.%0A++++++++++++?concept+dct:publisher+?publisher+.%0A++++++++++++?publisher+dct:identifier+?organizationNumber+.%0A++++++++%7D%7D%0A++++++++GROUP+BY+?organizationNumber%0A++++", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-concepts-910258028-0c8a2616-6a9b-4394-b0e3-33074d8c870f.json b/mock_mappings/mappings/sparql-from-concepts-910258028-0c8a2616-6a9b-4394-b0e3-33074d8c870f.json index 1682da4..d480d57 100644 --- a/mock_mappings/mappings/sparql-from-concepts-910258028-0c8a2616-6a9b-4394-b0e3-33074d8c870f.json +++ b/mock_mappings/mappings/sparql-from-concepts-910258028-0c8a2616-6a9b-4394-b0e3-33074d8c870f.json @@ -2,7 +2,7 @@ "id" : "0c8a2616-6a9b-4394-b0e3-33074d8c870f", "name" : "", "request" : { - "url" : "/sparql?query=%0A++++++++PREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0A++++++++PREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0A++++++++PREFIX+skos:+%3Chttp://www.w3.org/2004/02/skos/core%23%3E%0A++++++++SELECT+DISTINCT+?concept+?issued%0A++++++++FROM+%3Chttps://concepts.fellesdatakatalog.digdir.no%3E%0A++++++++WHERE+%7B%7B%0A++++++++++++?concept+a+skos:Concept+.%0A++++++++++++?record+foaf:primaryTopic+?concept+.%0A++++++++++++?record+dct:issued+?issued+.%0A++++++++++++?concept+dct:publisher+?publisher+.%0A++++++++++++?publisher+dct:identifier+%22910258028%22+.%0A++++++++%7D%7D%0A++++", + "url" : "/sparql?query=%0A++++++++PREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0A++++++++PREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0A++++++++PREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0A++++++++PREFIX+skos:+%3Chttp://www.w3.org/2004/02/skos/core%23%3E%0A++++++++SELECT+DISTINCT+?concept+?issued%0A++++++++WHERE+%7B%7B%0A++++++++++++?concept+a+skos:Concept+.%0A++++++++++++?record+foaf:primaryTopic+?concept+.%0A++++++++++++%3Frecord+a+dcat%3ACatalogRecord+.%0A++++++++++++?record+dct:issued+?issued+.%0A++++++++++++?concept+dct:publisher+?publisher+.%0A++++++++++++?publisher+dct:identifier+%22910258028%22+.%0A++++++++%7D%7D%0A++++", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-concepts-974767880-f3c0e9ca-934e-4ea1-bc1d-4e496da56b54.json b/mock_mappings/mappings/sparql-from-concepts-974767880-f3c0e9ca-934e-4ea1-bc1d-4e496da56b54.json index e246f5a..e1a5d7e 100644 --- a/mock_mappings/mappings/sparql-from-concepts-974767880-f3c0e9ca-934e-4ea1-bc1d-4e496da56b54.json +++ b/mock_mappings/mappings/sparql-from-concepts-974767880-f3c0e9ca-934e-4ea1-bc1d-4e496da56b54.json @@ -2,7 +2,7 @@ "id" : "f3c0e9ca-934e-4ea1-bc1d-4e496da56b54", "name" : "", "request" : { - "url" : "/sparql?query=%0A++++++++PREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0A++++++++PREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0A++++++++PREFIX+skos:+%3Chttp://www.w3.org/2004/02/skos/core%23%3E%0A++++++++SELECT+DISTINCT+?concept+?issued%0A++++++++FROM+%3Chttps://concepts.fellesdatakatalog.digdir.no%3E%0A++++++++WHERE+%7B%7B%0A++++++++++++?concept+a+skos:Concept+.%0A++++++++++++?record+foaf:primaryTopic+?concept+.%0A++++++++++++?record+dct:issued+?issued+.%0A++++++++++++?concept+dct:publisher+?publisher+.%0A++++++++++++?publisher+dct:identifier+%22974767880%22+.%0A++++++++%7D%7D%0A++++", + "url" : "/sparql?query=%0A++++++++PREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0A++++++++PREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0A++++++++PREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0A++++++++PREFIX+skos:+%3Chttp://www.w3.org/2004/02/skos/core%23%3E%0A++++++++SELECT+DISTINCT+?concept+?issued%0A++++++++WHERE+%7B%7B%0A++++++++++++?concept+a+skos:Concept+.%0A++++++++++++?record+foaf:primaryTopic+?concept+.%0A++++++++++++%3Frecord+a+dcat%3ACatalogRecord+.%0A++++++++++++?record+dct:issued+?issued+.%0A++++++++++++?concept+dct:publisher+?publisher+.%0A++++++++++++?publisher+dct:identifier+%22974767880%22+.%0A++++++++%7D%7D%0A++++", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-dataservices-231595e6-0ef7-4224-8b37-9b8f164aa528.json b/mock_mappings/mappings/sparql-from-dataservices-231595e6-0ef7-4224-8b37-9b8f164aa528.json index 81b428c..1183ac1 100644 --- a/mock_mappings/mappings/sparql-from-dataservices-231595e6-0ef7-4224-8b37-9b8f164aa528.json +++ b/mock_mappings/mappings/sparql-from-dataservices-231595e6-0ef7-4224-8b37-9b8f164aa528.json @@ -2,7 +2,7 @@ "id" : "231595e6-0ef7-4224-8b37-9b8f164aa528", "name" : "sparql", "request" : { - "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0ASELECT+?organizationNumber+(COUNT(DISTINCT+?service)+AS+?count)%0AFROM+%3Chttps://dataservices.fellesdatakatalog.digdir.no%3E%0AWHERE+%7B%7B%0A++++?service+a+dcat:DataService+.%0A++++?service+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+?organizationNumber+.%0A%7D%7D%0AGROUP+BY+?organizationNumber", + "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0ASELECT+?organizationNumber+(COUNT(DISTINCT+?service)+AS+?count)%0A++++?service+a+dcat:DataService+.%0A++++?record+foaf:primaryTopic+?service+.%0A++++?record+a+dcat%3ACatalogRecord+.%0A++++?service+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+?organizationNumber+.%0A%7D%7D%0AGROUP+BY+?organizationNumber", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-dataservices-910244132-95a4739c-fe68-4b36-919e-896df9830219.json b/mock_mappings/mappings/sparql-from-dataservices-910244132-95a4739c-fe68-4b36-919e-896df9830219.json index d0c3a95..334b9fc 100644 --- a/mock_mappings/mappings/sparql-from-dataservices-910244132-95a4739c-fe68-4b36-919e-896df9830219.json +++ b/mock_mappings/mappings/sparql-from-dataservices-910244132-95a4739c-fe68-4b36-919e-896df9830219.json @@ -2,7 +2,7 @@ "id" : "95a4739c-fe68-4b36-919e-896df9830219", "name" : "", "request" : { - "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0A%0ASELECT+DISTINCT+?service+?issued%0AFROM+%3Chttps://dataservices.fellesdatakatalog.digdir.no%3E%0AWHERE+%7B%7B%0A++++?service+a+dcat:DataService+.%0A++++?record+foaf:primaryTopic+?service+.%0A++++?record+dct:issued+?issued+.%0A++++?service+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+%22910244132%22+.%0A%7D%7D", + "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0A%0ASELECT+DISTINCT+?service+?issued%0AWHERE+%7B%7B%0A++++?service+a+dcat:DataService+.%0A++++?record+foaf:primaryTopic+?service+.%0A++++?record+a+dcat%3ACatalogRecord+.%0A++++?record+dct:issued+?issued+.%0A++++?service+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+%22910244132%22+.%0A%7D%7D", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-dataservices-910258028-ba92a50c-5ef0-406f-82b4-3b5b0a008152.json b/mock_mappings/mappings/sparql-from-dataservices-910258028-ba92a50c-5ef0-406f-82b4-3b5b0a008152.json index ea5c107..bc7d714 100644 --- a/mock_mappings/mappings/sparql-from-dataservices-910258028-ba92a50c-5ef0-406f-82b4-3b5b0a008152.json +++ b/mock_mappings/mappings/sparql-from-dataservices-910258028-ba92a50c-5ef0-406f-82b4-3b5b0a008152.json @@ -2,7 +2,7 @@ "id" : "ba92a50c-5ef0-406f-82b4-3b5b0a008152", "name" : "", "request" : { - "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0A%0ASELECT+DISTINCT+?service+?issued%0AFROM+%3Chttps://dataservices.fellesdatakatalog.digdir.no%3E%0AWHERE+%7B%7B%0A++++?service+a+dcat:DataService+.%0A++++?record+foaf:primaryTopic+?service+.%0A++++?record+dct:issued+?issued+.%0A++++?service+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+%22910258028%22+.%0A%7D%7D", + "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0A%0ASELECT+DISTINCT+?service+?issued%0AWHERE+%7B%7B%0A++++?service+a+dcat:DataService+.%0A++++?record+foaf:primaryTopic+?service+.%0A++++?record+a+dcat%3ACatalogRecord+.%0A++++?record+dct:issued+?issued+.%0A++++?service+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+%22910258028%22+.%0A%7D%7D", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-datasets-767627a7-28c2-4d65-b5ce-835effab0ee5.json b/mock_mappings/mappings/sparql-from-datasets-767627a7-28c2-4d65-b5ce-835effab0ee5.json index 0efe2bf..5c1a77f 100644 --- a/mock_mappings/mappings/sparql-from-datasets-767627a7-28c2-4d65-b5ce-835effab0ee5.json +++ b/mock_mappings/mappings/sparql-from-datasets-767627a7-28c2-4d65-b5ce-835effab0ee5.json @@ -2,7 +2,7 @@ "id" : "767627a7-28c2-4d65-b5ce-835effab0ee5", "name" : "sparql", "request" : { - "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0ASELECT+?organizationNumber+(COUNT(DISTINCT+?dataset)+AS+?count)%0AFROM+%3Chttps://datasets.fellesdatakatalog.digdir.no%3E%0AWHERE+%7B%7B%0A++++?dataset+a+dcat:Dataset+.%0A++++?dataset+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+?organizationNumber+.%0A%7D%7D%0AGROUP+BY+?organizationNumber", + "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0ASELECT+?organizationNumber+(COUNT(DISTINCT+?dataset)+AS+?count)%0AWHERE+%7B%7B%0A++++?dataset+a+dcat:Dataset+.%0A++++?record+foaf:primaryTopic+?dataset+.%0A++++?record+a+dcat%3ACatalogRecord+.%0A++++?dataset+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+?organizationNumber+.%0A%7D%7D%0AGROUP+BY+?organizationNumber", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-datasets-910244132-ab8001c4-966b-4e44-b617-93b4c4675a6b.json b/mock_mappings/mappings/sparql-from-datasets-910244132-ab8001c4-966b-4e44-b617-93b4c4675a6b.json index 06e78c4..95c418f 100644 --- a/mock_mappings/mappings/sparql-from-datasets-910244132-ab8001c4-966b-4e44-b617-93b4c4675a6b.json +++ b/mock_mappings/mappings/sparql-from-datasets-910244132-ab8001c4-966b-4e44-b617-93b4c4675a6b.json @@ -2,7 +2,7 @@ "id" : "ab8001c4-966b-4e44-b617-93b4c4675a6b", "name" : "", "request" : { - "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0APREFIX+fdk:+%3Chttps://raw.githubusercontent.com/Informasjonsforvaltning/fdk-reasoning-service/main/src/main/resources/ontology/fdk.owl%23%3E%0A%0ASELECT+DISTINCT+?dataset+?issued+?isAuthoritative+?isOpenData%0AFROM+%3Chttps://datasets.fellesdatakatalog.digdir.no%3E%0AWHERE+%7B%7B%0A++++?dataset+a+dcat:Dataset+.%0A++++?dataset+fdk:isRelatedToTransportportal+?isNAP+.%0A++++FILTER+(STR(?isNAP)+%3D+%22true%22)%0A++++?record+foaf:primaryTopic+?dataset+.%0A++++?record+dct:issued+?issued+.%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isOpenData+?isOpenData+.+%7D%7D%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isAuthoritative+?isAuthoritative+.+%7D%7D%0A++++?dataset+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+%22910244132%22+.%0A%7D%7D", + "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0APREFIX+fdk:+%3Chttps://raw.githubusercontent.com/Informasjonsforvaltning/fdk-reasoning-service/main/src/main/resources/ontology/fdk.owl%23%3E%0A%0ASELECT+DISTINCT+?dataset+?issued+?isAuthoritative+?isOpenData%0AWHERE+%7B%7B%0A++++?dataset+a+dcat:Dataset+.%0A++++?dataset+fdk:isRelatedToTransportportal+?isNAP+.%0A++++FILTER+(STR(?isNAP)+%3D+%22true%22)%0A++++?record+foaf:primaryTopic+?dataset+.%0A++++?record+a+dcat%3ACatalogRecord+.%0A++++?record+dct:issued+?issued+.%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isOpenData+?isOpenData+.+%7D%7D%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isAuthoritative+?isAuthoritative+.+%7D%7D%0A++++?dataset+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+%22910244132%22+.%0A%7D%7D", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-datasets-910244132-ed239cd1-4289-4e77-a2bb-daeabef7a573.json b/mock_mappings/mappings/sparql-from-datasets-910244132-ed239cd1-4289-4e77-a2bb-daeabef7a573.json index 4ef6eb5..c08da9e 100644 --- a/mock_mappings/mappings/sparql-from-datasets-910244132-ed239cd1-4289-4e77-a2bb-daeabef7a573.json +++ b/mock_mappings/mappings/sparql-from-datasets-910244132-ed239cd1-4289-4e77-a2bb-daeabef7a573.json @@ -2,7 +2,7 @@ "id" : "ed239cd1-4289-4e77-a2bb-daeabef7a573", "name" : "", "request" : { - "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0APREFIX+fdk:+%3Chttps://raw.githubusercontent.com/Informasjonsforvaltning/fdk-reasoning-service/main/src/main/resources/ontology/fdk.owl%23%3E%0A%0ASELECT+DISTINCT+?dataset+?issued+?isAuthoritative+?isOpenData%0AFROM+%3Chttps://datasets.fellesdatakatalog.digdir.no%3E%0AWHERE+%7B%7B%0A++++?dataset+a+dcat:Dataset+.%0A++++?record+foaf:primaryTopic+?dataset+.%0A++++?record+dct:issued+?issued+.%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isOpenData+?isOpenData+.+%7D%7D%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isAuthoritative+?isAuthoritative+.+%7D%7D%0A++++?dataset+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+%22910244132%22+.%0A%7D%7D", + "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0APREFIX+fdk:+%3Chttps://raw.githubusercontent.com/Informasjonsforvaltning/fdk-reasoning-service/main/src/main/resources/ontology/fdk.owl%23%3E%0A%0ASELECT+DISTINCT+?dataset+?issued+?isAuthoritative+?isOpenData%0A++++?dataset+a+dcat:Dataset+.%0A++++?record+foaf:primaryTopic+?dataset+.%0A++++?record+a+dcat%3ACatalogRecord+.%0A++++?record+dct:issued+?issued+.%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isOpenData+?isOpenData+.+%7D%7D%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isAuthoritative+?isAuthoritative+.+%7D%7D%0A++++?dataset+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+%22910244132%22+.%0A%7D%7D", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-datasets-910258028-3a7e8201-a9cd-4746-ba0e-489392e5f655.json b/mock_mappings/mappings/sparql-from-datasets-910258028-3a7e8201-a9cd-4746-ba0e-489392e5f655.json index 5517557..abb6586 100644 --- a/mock_mappings/mappings/sparql-from-datasets-910258028-3a7e8201-a9cd-4746-ba0e-489392e5f655.json +++ b/mock_mappings/mappings/sparql-from-datasets-910258028-3a7e8201-a9cd-4746-ba0e-489392e5f655.json @@ -2,7 +2,7 @@ "id" : "3a7e8201-a9cd-4746-ba0e-489392e5f655", "name" : "", "request" : { - "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0APREFIX+fdk:+%3Chttps://raw.githubusercontent.com/Informasjonsforvaltning/fdk-reasoning-service/main/src/main/resources/ontology/fdk.owl%23%3E%0A%0ASELECT+DISTINCT+?dataset+?issued+?isAuthoritative+?isOpenData%0AFROM+%3Chttps://datasets.fellesdatakatalog.digdir.no%3E%0AWHERE+%7B%7B%0A++++?dataset+a+dcat:Dataset+.%0A++++?record+foaf:primaryTopic+?dataset+.%0A++++?record+dct:issued+?issued+.%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isOpenData+?isOpenData+.+%7D%7D%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isAuthoritative+?isAuthoritative+.+%7D%7D%0A++++?dataset+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+%22910258028%22+.%0A%7D%7D", + "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0APREFIX+fdk:+%3Chttps://raw.githubusercontent.com/Informasjonsforvaltning/fdk-reasoning-service/main/src/main/resources/ontology/fdk.owl%23%3E%0A%0ASELECT+DISTINCT+?dataset+?issued+?isAuthoritative+?isOpenData%0A++++?dataset+a+dcat:Dataset+.%0A++++?record+foaf:primaryTopic+?dataset+.%0A++++?record+a+dcat%3ACatalogRecord+.%0A++++?record+dct:issued+?issued+.%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isOpenData+?isOpenData+.+%7D%7D%0A++++OPTIONAL+%7B%7B+?dataset+fdk:isAuthoritative+?isAuthoritative+.+%7D%7D%0A++++?dataset+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+%22910258028%22+.%0A%7D%7D", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-datasets-NAP-f0ba32c5-88b2-48b9-94fc-399c14d3ac59.json b/mock_mappings/mappings/sparql-from-datasets-NAP-f0ba32c5-88b2-48b9-94fc-399c14d3ac59.json index 6a907fd..6313f2a 100644 --- a/mock_mappings/mappings/sparql-from-datasets-NAP-f0ba32c5-88b2-48b9-94fc-399c14d3ac59.json +++ b/mock_mappings/mappings/sparql-from-datasets-NAP-f0ba32c5-88b2-48b9-94fc-399c14d3ac59.json @@ -2,7 +2,7 @@ "id" : "f0ba32c5-88b2-48b9-94fc-399c14d3ac59", "name" : "", "request" : { - "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0APREFIX+fdk:+%3Chttps://raw.githubusercontent.com/Informasjonsforvaltning/fdk-reasoning-service/main/src/main/resources/ontology/fdk.owl%23%3E%0A%0ASELECT+?organizationNumber+(COUNT(DISTINCT+?dataset)+AS+?count)%0AFROM+%3Chttps://datasets.fellesdatakatalog.digdir.no%3E%0AWHERE+%7B%7B%0A++++?dataset+a+dcat:Dataset+.%0A++++?dataset+fdk:isRelatedToTransportportal+?isNAP+.%0A++++FILTER+(STR(?isNAP)+%3D+%22true%22)%0A++++?dataset+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+?organizationNumber+.%0A%7D%7D%0AGROUP+BY+?organizationNumber", + "url" : "/sparql?query=%0APREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0APREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0APREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0APREFIX+fdk:+%3Chttps://raw.githubusercontent.com/Informasjonsforvaltning/fdk-reasoning-service/main/src/main/resources/ontology/fdk.owl%23%3E%0A%0ASELECT+?organizationNumber+(COUNT(DISTINCT+?dataset)+AS+?count)%0A++++?dataset+a+dcat:Dataset+.%0A++++?record+foaf:primaryTopic+?dataset+.%0A++++?record+a+dcat%3ACatalogRecord+.%0A++++?dataset+fdk:isRelatedToTransportportal+?isNAP+.%0A++++FILTER+(STR(?isNAP)+%3D+%22true%22)%0A++++?dataset+dct:publisher+?publisher+.%0A++++?publisher+dct:identifier+?organizationNumber+.%0A%7D%7D%0AGROUP+BY+?organizationNumber", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-informationmodels-09356022-3b25-41f3-8bed-bf475c8e1a4b.json b/mock_mappings/mappings/sparql-from-informationmodels-09356022-3b25-41f3-8bed-bf475c8e1a4b.json index e512f43..fd03a90 100644 --- a/mock_mappings/mappings/sparql-from-informationmodels-09356022-3b25-41f3-8bed-bf475c8e1a4b.json +++ b/mock_mappings/mappings/sparql-from-informationmodels-09356022-3b25-41f3-8bed-bf475c8e1a4b.json @@ -2,7 +2,7 @@ "id" : "09356022-3b25-41f3-8bed-bf475c8e1a4b", "name" : "", "request" : { - "url" : "/sparql?query=%0A++++++++PREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0A++++++++PREFIX+modelldcatno:+%3Chttps://data.norge.no/vocabulary/modelldcatno%23%3E%0A++++++++SELECT+?organizationNumber+(COUNT(DISTINCT+?informationmodel)+AS+?count)%0A++++++++FROM+%3Chttps://informationmodels.fellesdatakatalog.digdir.no%3E%0A++++++++WHERE+%7B%7B%0A++++++++++++?informationmodel+a+modelldcatno:InformationModel+.%0A++++++++++++?informationmodel+dct:publisher+?publisher+.%0A++++++++++++?publisher+dct:identifier+?organizationNumber+.%0A++++++++%7D%7D%0A++++++++GROUP+BY+?organizationNumber%0A++++", + "url" : "/sparql?query=%0A++++++++PREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0A++++++++PREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0A++++++++PREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0A++++++++PREFIX+modelldcatno:+%3Chttps://data.norge.no/vocabulary/modelldcatno%23%3E%0A++++++++SELECT+?organizationNumber+(COUNT(DISTINCT+?informationmodel)+AS+?count)%0A++++++++WHERE+%7B%7B%0A++++++++++++?informationmodel+a+modelldcatno:InformationModel+.%0A++++++++++++?record+foaf:primaryTopic+?informationmodel+.%0A++++++++++++?record+a+dcat%3ACatalogRecord+.%0A++++++++++++?informationmodel+dct:publisher+?publisher+.%0A++++++++++++?publisher+dct:identifier+?organizationNumber+.%0A++++++++%7D%7D%0A++++++++GROUP+BY+?organizationNumber%0A++++", "method" : "GET" }, "response" : { diff --git a/mock_mappings/mappings/sparql-from-informationmodels-910258028-e06965ee-8935-494b-bbf8-5f1750208fdf.json b/mock_mappings/mappings/sparql-from-informationmodels-910258028-e06965ee-8935-494b-bbf8-5f1750208fdf.json index c5ae79c..e6062d0 100644 --- a/mock_mappings/mappings/sparql-from-informationmodels-910258028-e06965ee-8935-494b-bbf8-5f1750208fdf.json +++ b/mock_mappings/mappings/sparql-from-informationmodels-910258028-e06965ee-8935-494b-bbf8-5f1750208fdf.json @@ -2,7 +2,7 @@ "id" : "e06965ee-8935-494b-bbf8-5f1750208fdf", "name" : "", "request" : { - "url" : "/sparql?query=%0A++++++++PREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0A++++++++PREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0A++++++++PREFIX+modelldcatno:+%3Chttps://data.norge.no/vocabulary/modelldcatno%23%3E%0A++++++++SELECT+DISTINCT+?informationmodel+?issued%0A++++++++FROM+%3Chttps://informationmodels.fellesdatakatalog.digdir.no%3E%0A++++++++WHERE+%7B%7B%0A++++++++++++?informationmodel+a+modelldcatno:InformationModel+.%0A++++++++++++?record+foaf:primaryTopic+?informationmodel+.%0A++++++++++++?record+dct:issued+?issued+.%0A++++++++++++?informationmodel+dct:publisher+?publisher+.%0A++++++++++++?publisher+dct:identifier+%22910258028%22+.%0A++++++++%7D%7D%0A++++", + "url" : "/sparql?query=%0A++++++++PREFIX+dct:+%3Chttp://purl.org/dc/terms/%3E%0A++++++++PREFIX+dcat:+%3Chttp://www.w3.org/ns/dcat%23%3E%0A++++++++PREFIX+foaf:+%3Chttp://xmlns.com/foaf/0.1/%3E%0A++++++++PREFIX+modelldcatno:+%3Chttps://data.norge.no/vocabulary/modelldcatno%23%3E%0A++++++++SELECT+DISTINCT+?informationmodel+?issued%0A++++++++WHERE+%7B%7B%0A++++++++++++?informationmodel+a+modelldcatno:InformationModel+.%0A++++++++++++?record+foaf:primaryTopic+?informationmodel+.%0A++++++++++++?record+a+dcat%3ACatalogRecord+.%0A++++++++++++?record+dct:issued+?issued+.%0A++++++++++++?informationmodel+dct:publisher+?publisher+.%0A++++++++++++?publisher+dct:identifier+%22910258028%22+.%0A++++++++%7D%7D%0A++++", "method" : "GET" }, "response" : { diff --git a/src/fdk_organization_bff/sparql/concept_queries.py b/src/fdk_organization_bff/sparql/concept_queries.py index 6a1d28c..bf2901a 100644 --- a/src/fdk_organization_bff/sparql/concept_queries.py +++ b/src/fdk_organization_bff/sparql/concept_queries.py @@ -7,11 +7,14 @@ def build_concepts_by_publisher_query() -> str: """Build query to count concepts grouped by publisher.""" return """ PREFIX dct: + PREFIX dcat: + PREFIX foaf: PREFIX skos: SELECT ?organizationNumber (COUNT(DISTINCT ?concept) AS ?count) - FROM WHERE {{ ?concept a skos:Concept . + ?record foaf:primaryTopic ?concept . + ?record a dcat:CatalogRecord . ?concept dct:publisher ?publisher . ?publisher dct:identifier ?organizationNumber . }} @@ -24,13 +27,14 @@ def build_org_concepts_query(organization_id: str) -> str: return Template( """ PREFIX dct: + PREFIX dcat: PREFIX foaf: PREFIX skos: SELECT DISTINCT ?concept ?issued - FROM WHERE {{ ?concept a skos:Concept . ?record foaf:primaryTopic ?concept . + ?record a dcat:CatalogRecord . ?record dct:issued ?issued . ?concept dct:publisher ?publisher . ?publisher dct:identifier "$org_id" . diff --git a/src/fdk_organization_bff/sparql/dataservice_queries.py b/src/fdk_organization_bff/sparql/dataservice_queries.py index 067c407..5f2d8a2 100644 --- a/src/fdk_organization_bff/sparql/dataservice_queries.py +++ b/src/fdk_organization_bff/sparql/dataservice_queries.py @@ -8,10 +8,12 @@ def build_dataservices_by_publisher_query() -> str: return """ PREFIX dct: PREFIX dcat: +PREFIX foaf: SELECT ?organizationNumber (COUNT(DISTINCT ?service) AS ?count) -FROM WHERE {{ ?service a dcat:DataService . + ?record foaf:primaryTopic ?service . + ?record a dcat:CatalogRecord . ?service dct:publisher ?publisher . ?publisher dct:identifier ?organizationNumber . }} @@ -27,10 +29,10 @@ def build_org_dataservice_query(organization_id: str) -> str: PREFIX dcat: SELECT DISTINCT ?service ?issued -FROM WHERE {{ ?service a dcat:DataService . ?record foaf:primaryTopic ?service . + ?record a dcat:CatalogRecord . ?record dct:issued ?issued . ?service dct:publisher ?publisher . ?publisher dct:identifier "$org_id" . diff --git a/src/fdk_organization_bff/sparql/dataset_queries.py b/src/fdk_organization_bff/sparql/dataset_queries.py index c734945..f50c8be 100644 --- a/src/fdk_organization_bff/sparql/dataset_queries.py +++ b/src/fdk_organization_bff/sparql/dataset_queries.py @@ -13,10 +13,10 @@ def build_org_datasets_query(organization_id: str) -> str: PREFIX fdk: SELECT DISTINCT ?dataset ?issued ?isAuthoritative ?isOpenData -FROM WHERE {{ ?dataset a dcat:Dataset . ?record foaf:primaryTopic ?dataset . + ?record a dcat:CatalogRecord . ?record dct:issued ?issued . OPTIONAL {{ ?dataset fdk:isOpenData ?isOpenData . }} OPTIONAL {{ ?dataset fdk:isAuthoritative ?isAuthoritative . }} @@ -38,9 +38,10 @@ def build_nap_org_datasets_query(organization_id: str) -> str: PREFIX fdk: SELECT DISTINCT ?dataset ?issued ?isAuthoritative ?isOpenData -FROM WHERE {{ ?dataset a dcat:Dataset . + ?record foaf:primaryTopic ?dataset . + ?record a dcat:CatalogRecord . ?dataset fdk:isRelatedToTransportportal ?isNAP . FILTER (STR(?isNAP) = "true") ?record foaf:primaryTopic ?dataset . @@ -60,10 +61,12 @@ def build_datasets_by_publisher_query() -> str: return """ PREFIX dct: PREFIX dcat: +PREFIX foaf: SELECT ?organizationNumber (COUNT(DISTINCT ?dataset) AS ?count) -FROM WHERE {{ ?dataset a dcat:Dataset . + ?record foaf:primaryTopic ?dataset . + ?record a dcat:CatalogRecord . ?dataset dct:publisher ?publisher . ?publisher dct:identifier ?organizationNumber . }} @@ -75,12 +78,14 @@ def build_nap_datasets_by_publisher_query() -> str: return """ PREFIX dct: PREFIX dcat: +PREFIX foaf: PREFIX fdk: SELECT ?organizationNumber (COUNT(DISTINCT ?dataset) AS ?count) -FROM WHERE {{ ?dataset a dcat:Dataset . + ?record foaf:primaryTopic ?dataset . + ?record a dcat:CatalogRecord . ?dataset fdk:isRelatedToTransportportal ?isNAP . FILTER (STR(?isNAP) = "true") ?dataset dct:publisher ?publisher . diff --git a/src/fdk_organization_bff/sparql/informationmodel_queries.py b/src/fdk_organization_bff/sparql/informationmodel_queries.py index 3812b6e..c44908c 100644 --- a/src/fdk_organization_bff/sparql/informationmodel_queries.py +++ b/src/fdk_organization_bff/sparql/informationmodel_queries.py @@ -7,11 +7,14 @@ def build_informationmodels_by_publisher_query() -> str: """Build query to count informationmodels grouped by publisher.""" return """ PREFIX dct: + PREFIX dcat: + PREFIX foaf: PREFIX modelldcatno: SELECT ?organizationNumber (COUNT(DISTINCT ?informationmodel) AS ?count) - FROM WHERE {{ ?informationmodel a modelldcatno:InformationModel . + ?record foaf:primaryTopic ?informationmodel . + ?record a dcat:CatalogRecord . ?informationmodel dct:publisher ?publisher . ?publisher dct:identifier ?organizationNumber . }} @@ -24,13 +27,14 @@ def build_org_informationmodels_query(organization_id: str) -> str: return Template( """ PREFIX dct: + PREFIX dcat: PREFIX foaf: PREFIX modelldcatno: SELECT DISTINCT ?informationmodel ?issued - FROM WHERE {{ ?informationmodel a modelldcatno:InformationModel . ?record foaf:primaryTopic ?informationmodel . + ?record a dcat:CatalogRecord . ?record dct:issued ?issued . ?informationmodel dct:publisher ?publisher . ?publisher dct:identifier "$org_id" .