Skip to content

Commit

Permalink
Merge pull request #14 from viaacode/arc-2448-add-preferences-to-kg-p…
Browse files Browse the repository at this point in the history
…ostgres-etl

Arc 2448 add preferences to kg postgres etl
  • Loading branch information
mielvds authored Sep 2, 2024
2 parents e2c3200 + d8a3f14 commit d4cc400
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 38 deletions.
38 changes: 20 additions & 18 deletions queries/graph.carrier.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ SELECT DISTINCT
?created_at
?updated_at
WHERE {
?intellectual_entity_id rel:isr ?rep; dct:format ?format.
?rep premis:storedAt ?id.
?id a haObj:PhysicalCarrier;
schema:name ?schema_name;
premis:medium/skos:prefLabel ?premis_medium.
?intellectual_entity_id rel:isr ?rep;
schema:license ?schema_license;
dct:format ?format.

# Do not include images
VALUES ?format {
Expand All @@ -48,21 +46,25 @@ WHERE {
"newspaperpage"
"newspaper"
}

# 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
}

?rep premis:storedAt ?id.

?id a haObj:PhysicalCarrier;
schema:name ?schema_name;
premis:medium/skos:prefLabel ?premis_medium.

FILTER (langMatches(lang(?schema_name), "nl") && langMatches(lang(?premis_medium), "en"))

Expand Down
31 changes: 16 additions & 15 deletions queries/graph.file.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 )

Expand All @@ -79,5 +80,5 @@ WHERE {
?id schema:duration ?schema_duration_res.
BIND (xsd:double(?schema_duration_res) AS ?schema_duration)
}

}
}
ORDER BY ?id
3 changes: 2 additions & 1 deletion queries/graph.includes.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ WHERE {

?file_id prov:wasDerivedFrom/schema:dateModified ?modified .
FILTER (!isLiteral(?since) || ?modified >= ?since )
}
}
ORDER BY ?representation_id ?file_id
10 changes: 6 additions & 4 deletions queries/graph.organization.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ SELECT DISTINCT
?id
?dcterms_description
?foaf_homepage
?ha_org_allows_bzt
?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
Expand All @@ -28,8 +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: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 {
Expand Down
15 changes: 15 additions & 0 deletions queries/graph.organization_has_preference.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# position: 1
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX haOrg: <https://data.hetarchief.be/ns/organization/>

SELECT DISTINCT
?organization_id
?ha_pref
?created_at
?updated_at
WHERE {
?organization_id a haOrg:ContentPartner;
haOrg:hasPreference ?ha_pref_res .

BIND (REPLACE(STR(?ha_pref_res), "^.*/([^/]*)$", "$1") as ?ha_pref)
}

0 comments on commit d4cc400

Please sign in to comment.