From eb3a0f67a37e08e6a080d7c687b621d3e4e07d49 Mon Sep 17 00:00:00 2001 From: Miel Vander Sande Date: Wed, 28 Aug 2024 15:20:32 +0200 Subject: [PATCH 1/7] Change org query --- queries/graph.organization.sparql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/queries/graph.organization.sparql b/queries/graph.organization.sparql index 42cefd3..bb74f38 100644 --- a/queries/graph.organization.sparql +++ b/queries/graph.organization.sparql @@ -10,6 +10,7 @@ SELECT DISTINCT ?dcterms_description ?foaf_homepage ?ha_org_allows_bzt +?ha_org_allows_iiif ?ha_org_allows_overlay ?ha_org_has_logo ?ha_org_request_form @@ -30,6 +31,7 @@ WHERE { OPTIONAL { ?id haOrg:hasLogo ?ha_org_has_logo } BIND (EXISTS { ?id haOrg:hasPreference haPref:logo-embedding } AS ?ha_org_allows_overlay) BIND (EXISTS { ?id haOrg:hasPreference haPref:visitor-space-publication } AS ?ha_org_allows_bzt) + BIND (EXISTS { ?id haOrg:hasPreference haPref:iiif-dissemination } AS ?ha_org_allows_iiif) OPTIONAL { ?id haOrg:requestForm ?ha_org_request_form } OPTIONAL { ?id haOrg:sector ?ha_org_sector } OPTIONAL { From bc9c365cb9eeaa99d5249ac96aeef2b4e26e97f3 Mon Sep 17 00:00:00 2001 From: Miel Vander Sande Date: Thu, 29 Aug 2024 16:34:35 +0200 Subject: [PATCH 2/7] Replace allows* properties with preferences table --- queries/graph.organization.sparql | 12 ++++++------ queries/graph.organization_has_preference.sparql | 12 ++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 queries/graph.organization_has_preference.sparql diff --git a/queries/graph.organization.sparql b/queries/graph.organization.sparql index bb74f38..4b9fdfb 100644 --- a/queries/graph.organization.sparql +++ b/queries/graph.organization.sparql @@ -9,9 +9,9 @@ SELECT DISTINCT ?id ?dcterms_description ?foaf_homepage -?ha_org_allows_bzt -?ha_org_allows_iiif -?ha_org_allows_overlay +# ?ha_org_allows_bzt +# ?ha_org_allows_iiif +# ?ha_org_allows_overlay ?ha_org_has_logo ?ha_org_request_form ?ha_org_sector @@ -29,9 +29,9 @@ WHERE { OPTIONAL { ?id dct:description ?dcterms_description } OPTIONAL { ?id foaf:homepage ?foaf_homepage } OPTIONAL { ?id haOrg:hasLogo ?ha_org_has_logo } - BIND (EXISTS { ?id haOrg:hasPreference haPref:logo-embedding } AS ?ha_org_allows_overlay) - BIND (EXISTS { ?id haOrg:hasPreference haPref:visitor-space-publication } AS ?ha_org_allows_bzt) - BIND (EXISTS { ?id haOrg:hasPreference haPref:iiif-dissemination } AS ?ha_org_allows_iiif) + # BIND (EXISTS { ?id haOrg:hasPreference haPref:logo-embedding } AS ?ha_org_allows_overlay) + # BIND (EXISTS { ?id haOrg:hasPreference haPref:visitor-space-publication } AS ?ha_org_allows_bzt) + # BIND (EXISTS { ?id haOrg:hasPreference haPref:iiif-dissemination } AS ?ha_org_allows_iiif) OPTIONAL { ?id haOrg:requestForm ?ha_org_request_form } OPTIONAL { ?id haOrg:sector ?ha_org_sector } OPTIONAL { diff --git a/queries/graph.organization_has_preference.sparql b/queries/graph.organization_has_preference.sparql new file mode 100644 index 0000000..a05323f --- /dev/null +++ b/queries/graph.organization_has_preference.sparql @@ -0,0 +1,12 @@ +PREFIX skos: +PREFIX haOrg: + +SELECT DISTINCT +?organization_id +?ha_pref +?created_at +?updated_at +WHERE { + ?id a haOrg:ContentPartner; + haOrg:hasPreference/skos:prefLabel ?ha_pref . +} From 7d076dcba1e6b2f6646a8cc2409a2c824ed3bd5a Mon Sep 17 00:00:00 2001 From: Miel Vander Sande Date: Fri, 30 Aug 2024 10:15:14 +0200 Subject: [PATCH 3/7] Include id from URI instead of label --- queries/graph.organization_has_preference.sparql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/queries/graph.organization_has_preference.sparql b/queries/graph.organization_has_preference.sparql index a05323f..c633295 100644 --- a/queries/graph.organization_has_preference.sparql +++ b/queries/graph.organization_has_preference.sparql @@ -8,5 +8,7 @@ SELECT DISTINCT ?updated_at WHERE { ?id a haOrg:ContentPartner; - haOrg:hasPreference/skos:prefLabel ?ha_pref . + haOrg:hasPreference ?ha_pref_res . + + BIND (REPLACE(STR(?ha_pref_res), "^.*/([^/]*)$", "$1") as ?ha_pref) } From e5c9c3fe39b72114ad28c5fdef16dd91e12a9dec Mon Sep 17 00:00:00 2001 From: Miel Vander Sande Date: Fri, 30 Aug 2024 10:21:00 +0200 Subject: [PATCH 4/7] Fix prefence query --- queries/graph.organization_has_preference.sparql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/queries/graph.organization_has_preference.sparql b/queries/graph.organization_has_preference.sparql index c633295..ec7d394 100644 --- a/queries/graph.organization_has_preference.sparql +++ b/queries/graph.organization_has_preference.sparql @@ -1,3 +1,4 @@ +# position: 1 PREFIX skos: PREFIX haOrg: @@ -7,7 +8,7 @@ SELECT DISTINCT ?created_at ?updated_at WHERE { - ?id a haOrg:ContentPartner; + ?organization_id a haOrg:ContentPartner; haOrg:hasPreference ?ha_pref_res . BIND (REPLACE(STR(?ha_pref_res), "^.*/([^/]*)$", "$1") as ?ha_pref) From dfd093d096afd4e4f9faa4dfb810edd4648a2cef Mon Sep 17 00:00:00 2001 From: Miel Vander Sande Date: Fri, 30 Aug 2024 14:43:10 +0200 Subject: [PATCH 5/7] Avoid filter not exists on license in carrier query --- queries/graph.carrier.sparql | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/queries/graph.carrier.sparql b/queries/graph.carrier.sparql index e9a8035..e58d70c 100644 --- a/queries/graph.carrier.sparql +++ b/queries/graph.carrier.sparql @@ -31,7 +31,7 @@ SELECT DISTINCT ?created_at ?updated_at WHERE { - ?intellectual_entity_id rel:isr ?rep. + ?intellectual_entity_id rel:isr ?rep; schema:license ?schema_license. ?rep premis:storedAt ?id. ?id a haObj:PhysicalCarrier; schema:name ?schema_name; @@ -42,20 +42,18 @@ WHERE { ?intellectual_entity_id dct:format "image". } # Only include the right licenses - FILTER EXISTS { - ?intellectual_entity_id schema:license ?schema_license - VALUES ?schema_license { - haLicId:VIAA-PUBLIEK-METADATA-LTD - haLicId:VIAA-PUBLIEK-METADATA-ALL - haLicId:VIAA-PUBLIEK-CONTENT - haLicId:BEZOEKERTOOL-METADATA-ALL - haLicId:BEZOEKERTOOL-CONTENT - haLicId:VIAA-INTRA_CP-METADATA-ALL - haLicId:VIAA-INTRA_CP-CONTENT - haLicId:Publiek-Domein - haLicId:COPYRIGHT-UNDETERMINED - } + VALUES ?schema_license { + haLicId:VIAA-PUBLIEK-METADATA-LTD + haLicId:VIAA-PUBLIEK-METADATA-ALL + haLicId:VIAA-PUBLIEK-CONTENT + haLicId:BEZOEKERTOOL-METADATA-ALL + haLicId:BEZOEKERTOOL-CONTENT + haLicId:VIAA-INTRA_CP-METADATA-ALL + haLicId:VIAA-INTRA_CP-CONTENT + haLicId:Publiek-Domein + haLicId:COPYRIGHT-UNDETERMINED } + FILTER (langMatches(lang(?schema_name), "nl") && langMatches(lang(?premis_medium), "en")) From fd1b7b74846b9039073357f5421ee08b1cb6c7d2 Mon Sep 17 00:00:00 2001 From: Miel Vander Sande Date: Mon, 2 Sep 2024 12:05:20 +0200 Subject: [PATCH 6/7] Add order by to avoid duplicates. Include all files for now --- queries/graph.file.sparql | 30 ++++++++++++++++-------------- queries/graph.includes.sparql | 3 ++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/queries/graph.file.sparql b/queries/graph.file.sparql index 71306b0..99d306f 100644 --- a/queries/graph.file.sparql +++ b/queries/graph.file.sparql @@ -33,10 +33,11 @@ WHERE { premis:originalName ?premis_original_name; premis:storedAt/rdf:value ?premis_stored_at ; ebucore:hasMimeType ?ebucore_has_mime_type ; - prov:wasDerivedFrom/schema:dateModified ?modified ; - (rel:isi|ebucore:hasMediaFragment)/rel:rep ?ie. + prov:wasDerivedFrom/schema:dateModified ?modified . + # (rel:isi|ebucore:hasMediaFragment)/rel:rep ?ie. - ?ie schema:license ?schema_license; dct:format ?format . + # ?ie dct:format ?format . + # ?ie schema:license ?schema_license # VALUES ?schema_license { # haLicId:VIAA-PUBLIEK-METADATA-LTD @@ -51,16 +52,16 @@ WHERE { # } # Do not include images - VALUES ?format { - #"image" - "video" - "videofragment" - "audiofragment" - "audio" - "film" - "newspaperpage" - "newspaper" - } + # VALUES ?format { + # #"image" + # "video" + # "videofragment" + # "audiofragment" + # "audio" + # "film" + # "newspaperpage" + # "newspaper" + # } FILTER (!isLiteral(?since) || ?modified >= ?since ) @@ -80,4 +81,5 @@ WHERE { BIND (xsd:double(?schema_duration_res) AS ?schema_duration) } -} \ No newline at end of file +} +ORDER BY ?id \ No newline at end of file diff --git a/queries/graph.includes.sparql b/queries/graph.includes.sparql index 6899314..b965b7c 100644 --- a/queries/graph.includes.sparql +++ b/queries/graph.includes.sparql @@ -63,4 +63,5 @@ WHERE { ?file_id prov:wasDerivedFrom/schema:dateModified ?modified . FILTER (!isLiteral(?since) || ?modified >= ?since ) -} \ No newline at end of file +} +ORDER BY ?representation_id ?file_id \ No newline at end of file From d8a3f14deff4982603743140c32c24648eea2c78 Mon Sep 17 00:00:00 2001 From: Miel Vander Sande Date: Mon, 2 Sep 2024 14:29:25 +0200 Subject: [PATCH 7/7] Remove newline --- queries/graph.file.sparql | 1 - 1 file changed, 1 deletion(-) diff --git a/queries/graph.file.sparql b/queries/graph.file.sparql index 99d306f..21ef073 100644 --- a/queries/graph.file.sparql +++ b/queries/graph.file.sparql @@ -80,6 +80,5 @@ WHERE { ?id schema:duration ?schema_duration_res. BIND (xsd:double(?schema_duration_res) AS ?schema_duration) } - } ORDER BY ?id \ No newline at end of file