From d46102df3fe311615ae5d1475d046b3373e2973f Mon Sep 17 00:00:00 2001 From: "iva.dimitrova" Date: Mon, 15 Jan 2024 17:30:04 +0100 Subject: [PATCH] new queries --- static/ao/objectImagesURLS-iterator.rq | 4 + static/ao/objectImagesURLs-generator.rq | 69 ++++++++ static/ao/objectLocations-iterator.rq | 4 + static/ao/objectsETL-dates-generator.rq | 98 ++++++++++++ static/ao/objectsETL-dates-iterator.rq | 4 + static/ao/objectsETL-generator.rq | 158 +++++++++++++++++++ static/ao/objectsETL-iterator.rq | 5 + static/ao/objectsLocations-generator.rq | 201 ++++++++++++++++++++++++ 8 files changed, 543 insertions(+) create mode 100644 static/ao/objectImagesURLS-iterator.rq create mode 100644 static/ao/objectImagesURLs-generator.rq create mode 100644 static/ao/objectLocations-iterator.rq create mode 100644 static/ao/objectsETL-dates-generator.rq create mode 100644 static/ao/objectsETL-dates-iterator.rq create mode 100644 static/ao/objectsETL-generator.rq create mode 100644 static/ao/objectsETL-iterator.rq create mode 100644 static/ao/objectsLocations-generator.rq diff --git a/static/ao/objectImagesURLS-iterator.rq b/static/ao/objectImagesURLS-iterator.rq new file mode 100644 index 0000000..0b09596 --- /dev/null +++ b/static/ao/objectImagesURLS-iterator.rq @@ -0,0 +1,4 @@ +prefix objectImageURLs: +select * where { + $this objectImageURLs:ObjectNumber ?object. +} \ No newline at end of file diff --git a/static/ao/objectImagesURLs-generator.rq b/static/ao/objectImagesURLs-generator.rq new file mode 100644 index 0000000..42bf226 --- /dev/null +++ b/static/ao/objectImagesURLs-generator.rq @@ -0,0 +1,69 @@ +prefix aat: +prefix crm: +prefix crmdig: +prefix la: +prefix objectImageURLs: +prefix rdfs: + +construct { + ?objectNumber a crm:E22_Human-Made_Object. + #objectImages + ?_objectNumber crm:P65_shows_visual_item _:visvualItem. + _:visvualItem a crm:E36_Visual_Item; + la:digitally_shown_by _:digitalObject. + + _:digitalObject a crmdig:D1_Digital_Object; + rdfs:label "Digitized Image of Painting"; + crm:P2_has_type aat:300215302; + la:access_point ?uri. + + _:digitalObject crm:P104_is_subject_to ?_SAlicense. + ?_SAlicense a crm:E30_Right; + crm:P2_has_type . + + _:digitalObject crm:P67i_is_referred_to_by ?_DEEDlicenseLabel. + ?_DEEDlicenseLabel a crm:E33_E41_Linguistic_Appellation; + crm:P2_has_type aat:300435434; + rdfs:label ; + crm:P190_has_symbolic_content ?authValue. + + _:digitalObject crm:P104_is_subject_to ?_NDlicense. + ?_license a crm:E30_Right; + crm:P2_has_type . + + + _:digitalObject crm:P67i_is_referred_to_by ?_licenseLabel. + ?_licenseLabel a crm:E33_E41_Linguistic_Appellation; + crm:P2_has_type aat:300435434; + rdfs:label ?authValue; + crm:P190_has_symbolic_content ?authValue. +} +where { + graph { + $this objectImageURLs:ObjectNumber ?object. + filter(regex(?object, "^[a-zA-Z]+-\\d+-\\d+$") || regex(?object, "^\\d+-\\d+[a-zA-Z]$") || regex(?object, "^\\d+-\\d+$")) + bind(iri(concat(str(), str(?object))) as ?objectNumber). + + optional { + filter (objectImageURLs:AuthValue != "CC-BY-SA 4.0" || objectImageURLs:AuthValue != "CC-BY-SA 4.0 NMVW/WM") + bind(bnode() as ?_SAlicense) + } + + optional { + filter (objectImageURLs:AuthValue != "Public domain" || objectImageURLs:AuthValue != "PD-anon-70-EU") + $this objectImageURLs:AuthValue ?authValue. + bind(bnode() as ?_DEEDlicenseLabel) + } + + optional { + filter (objectImageURLs:AuthValue != "CC-BY-NC-ND 4.0") + bind(bnode() as ?_NDlicense) + } + + optional { + filter (objectImageURLs:AuthValue != "Copyrightstatus onbekend") + $this objectImageURLs:AuthValue ?authValue. + bind(bnode() as ?_licenseLabel) + } + } +} \ No newline at end of file diff --git a/static/ao/objectLocations-iterator.rq b/static/ao/objectLocations-iterator.rq new file mode 100644 index 0000000..b7fa659 --- /dev/null +++ b/static/ao/objectLocations-iterator.rq @@ -0,0 +1,4 @@ +prefix objectLocations: +select * where { + $this objectLocations:ObjectNumber ?objectNumber. +} \ No newline at end of file diff --git a/static/ao/objectsETL-dates-generator.rq b/static/ao/objectsETL-dates-generator.rq new file mode 100644 index 0000000..feb0d20 --- /dev/null +++ b/static/ao/objectsETL-dates-generator.rq @@ -0,0 +1,98 @@ +prefix aat: +prefix archiveRelated: +prefix dct: +prefix crm: +prefix rdfs: +construct { + #DateBegin && DateEnd - check when they are present |This needs to be done because of the way in which source data is being supplied. + ?objects crm:P108i_was_produced_by ?production. + ?production a crm:E12_Production; + crm:P4_has_time-span ?dates; + rdfs:label ?dated. + ?dates a crm:E52_Time-Span. + ?dates crm:P82a_begin_of_the_begin ?newBeginDate; + crm:P82b_end_of_the_end ?newEndDate. +} +where { + graph { + ?subject archiveRelated:ObjectNumber ?objectNumber. + # ?subject ?objectNumberPredicate ?objectNumber. + # filter(replace(str(?objectNumberPredicate),".*[/]","") = "ObjectNumber") + bind(iri(concat(str(), str(?objectNumber))) as ?objects). + #DateBegin && DateEnd - check when they are present |This needs to be done because of the way in which source data is being supplied. + # DateBegin && DateEnd are not 0 + optional { + filter exists { + $this archiveRelated:DateBegin ?dateBegin. + filter (?dateBegin != "0000-01-01") + $this archiveRelated:DateEnd ?dateEnd. + filter (?dateEnd != "0000-01-01") + } + bind (bnode() as ?production). + bind (bnode() as ?dates). + optional { + filter exists { + $this archiveRelated:Dated ?dated. + } + $this archiveRelated:Dated ?dated. + } + optional { + filter not exists{ + $this archiveRelated:Dated ?dated. + } + bind("DateBegin and DateEnd" as ?dated) + } + $this archiveRelated:DateBegin ?dateBegin. + $this archiveRelated:DateEnd ?dateEnd. + bind(if(strstarts(?dateBegin, "-"), concat("0",strafter(?dateBegin,"-")), ?dateBegin) as ?newBeginDate). + bind(if(strstarts(?dateEnd, "-"), concat("0",strafter(?dateEnd,"-")), ?dateEnd) as ?newEndDate). + } + # DateBegin is not 0 && DateEnd is 0 + optional { + filter exists { + $this archiveRelated:DateBegin ?dateBegin. + filter (?dateBegin != "0000-01-01") + $this archiveRelated:DateEnd ?dateEnd. + filter (?dateEnd = "0000-01-01") + } + bind (bnode() as ?production). + bind (bnode() as ?dates). + #Check whether 'Dated' is empty or not + optional { + $this archiveRelated:Dated ?dated. + } + optional { + filter not exists{ + $this archiveRelated:Dated ?dated. + } + bind("DateBegin and DateEnd" as ?dated) + } + # DateBegin + $this archiveRelated:DateBegin ?dateBegin. + bind(if(strstarts(?dateBegin, "-"), concat("0",strafter(?dateBegin,"-")), ?dateBegin) as ?newBeginDate). + } + # DateBegin is 0 && DateEnd is not 0 + optional { + filter exists { + $this archiveRelated:DateBegin ?dateBegin. + filter (?dateBegin = "0000-01-01") + $this archiveRelated:DateEnd ?dateEnd. + filter (?dateEnd != "0000-01-01") + } + bind (bnode() as ?production). + bind (bnode() as ?dates). + #Check whether 'Dated' is empty or not + optional { + $this archiveRelated:Dated ?dated. + } + optional { + filter not exists{ + $this archiveRelated:Dated ?dated. + } + bind("DateBegin and DateEnd" as ?dated) + } + $this archiveRelated:DateBegin ?dateEnd. + bind(if(strstarts(?dateEnd, "-"), concat("0",strafter(?dateEnd,"-")), ?dateEnd) as ?newEndDate). + } + } +} \ No newline at end of file diff --git a/static/ao/objectsETL-dates-iterator.rq b/static/ao/objectsETL-dates-iterator.rq new file mode 100644 index 0000000..34647dc --- /dev/null +++ b/static/ao/objectsETL-dates-iterator.rq @@ -0,0 +1,4 @@ +prefix archiveRelated: +select * where { + $this archiveRelated:ObjectNumber ?objectNumber. +} \ No newline at end of file diff --git a/static/ao/objectsETL-generator.rq b/static/ao/objectsETL-generator.rq new file mode 100644 index 0000000..05d5fd5 --- /dev/null +++ b/static/ao/objectsETL-generator.rq @@ -0,0 +1,158 @@ +prefix skos: +prefix aat: +prefix dct: +prefix crm: +prefix rdfs: +prefix archiveRelated: +prefix la: +construct { + ?objects a crm:E22_Human-Made_Object. + #ObjectNumber + ?objects crm:P1_is_identified_by _:objectNumber. + _:objectNumber a crm:E42_Identifier; + crm:P2_has_type aat:300404626; + rdfs:label "Identification number"; + crm:P190_has_symbolic_content ?objectNumber. + #ObjectID + #Title - check if it is present + ?objects dct:title ?title. + #Medium - check if it is present + ?objects crm:P45_consists_of ?skolemMeduim. + ?skolemMeduim a crm:E57_Material; + rdfs:label "Material"; + crm:P190_has_symbolic_content ?medium. + # Remarks (should only be created when Remarks is not empty) + ?objects crm:P67i_is_referred_to_by ?skolemNodeRemarks. + ?skolemNodeRemarks a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300435415; + rdfs:label "Remarks" ; + crm:P190_has_symbolic_content ?remarks. + #Description - check if it is empty + ?objects crm:P67i_is_referred_to_by ?skolemDescription. + ?skolemDescription a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300435416; + rdfs:label "Description"; + crm:P190_has_symbolic_content ?description. + #Provenance - check if it is empty + ?objects crm:P67i_is_referred_to_by ?skolemProvenance. + ?skolemProvenance a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300444173; + rdfs:label "Provenance"; + crm:P190_has_symbolic_content ?provenance. + #Notes - check if it is empty + ?objects crm:P3_has_note ?notes. + #RelatedWorks - check if it is empty + ?objects crm:P67i_is_referred_to_by ?skolemRelatedWorks. + ?skolemRelatedWorks a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300444120; + rdfs:label "Related works"; + crm:P190_has_symbolic_content ?relatedWorks. + # HistAttributions - check if it is empty + ?objects skos:historyNote ?histAttributions. + #CuratorialRemarks - check if it is empty + ?objects crm:P67i_is_referred_to_by ?skolemCuratorialRemarks. + ?skolemCuratorialRemarks a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300435415; + rdfs:label "Curatorial remarks"; + crm:P190_has_symbolic_content ?curatorialRemarks. + #Dimensions & DimensionRemarks + #Signed + ?objects crm:P128_carries ?hashedSigned. + ?hashedSigned a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300189326; + rdfs:label "Signed"; + crm:P190_has_symbolic_content ?signed. + #Inscribed + ?objects crm:P128_carries ?hashedInscribed. + ?hashedInscribed a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300028702; + rdfs:label "Inscribed"; + crm:P190_has_symbolic_content ?inscribed. + #Markings + ?objects crm:P128_carries ?hashedMarkings. + ?hashedMarkings a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300028744; + rdfs:label "Markings"; + crm:P190_has_symbolic_content ?markings. + #If the object is a member of a Site set ---> this key is not part of Archive-related csv + ?objects la:member_of ?siteID. + #HistEventID & Subevent1 ---> not part of archives, part of Event-related_Objects.csv + ?objects crm:P141i_was_assigned_by ?histEvents. + ?histEvents a crm:E13_Attribute_Assignment; + crm:P177_assigned_property_of_type crm:P12i_was_present_at; + rdfs:label "Relation with the event"; + crm:P141_assigned ?histEventsNode. + ?histEvents crm:P67i_is_referred_to_by ?subEvents. + ?subEvents a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300435415; + crm:P190_has_symbolic_content ?Subevent1. +} +where { + graph { + #objectNumber + $this archiveRelated:ObjectNumber ?objectNumber. + bind(iri(concat(str(), str(?objectNumber))) as ?objects). + #title + optional { + $this ?titlePredicate ?title. + filter(replace(str(?titlePredicate),".*[/]","") = "Title") + } + # Remarks (should only be created when Remarks is not empty) + optional { + filter(?remarks != "\r\n") + bind(bnode() as ?skolemNodeRemarks). + $this archiveRelated:Remarks ?remarks. + } + # Description - check if description is empty or not + optional { + $this archiveRelated:Description ?description. + bind (bnode() as ?skolemDescription). + } + # Medium - check if medium is empty or not + optional { + $this archiveRelated:Medium ?medium. + bind (bnode() as ?skolemMeduim). + } + #Provenance + optional { + $this archiveRelated:Provenance ?provenance. + bind (bnode() as ?skolemProvenance). + } + #Notes + optional { + $this archiveRelated:Notes ?notes. + } + #RelatedWorks + optional { + $this archiveRelated:RelatedWorks ?relatedWorks. + bind (bnode() as ?skolemRelatedWorks). + } + #HistAttributions + optional { + $this archiveRelated:HistAttributions ?histAttributions. + } + #CuratorialRemarks + optional { + $this archiveRelated:CuratorialRemarks ?curatorialRemarks. + bind (bnode() as ?skolemCuratorialRemarks). + } + #Signed + optional { + $this archiveRelated:Signed ?signed. + # specifically used hashedIri in ETL instead of skolemIri + bind(iri(concat(str(), md5(str(?signed)))) as ?hashedSigned). + } + #Inscribed + optional { + $this archiveRelated:Inscribed ?inscribed. + # specifically used hashedIri in ETL instead of skolemIri + bind(iri(concat(str(), md5(str(?inscribed)))) as ?hashedInscribed). + } + #Markings + optional { + $this archiveRelated:Markings ?markings. + # specifically used hashedIri in ETL instead of skolemIri + bind(iri(concat(str(), md5(str(?markings)))) as ?hashedMarkings). + } + } +} \ No newline at end of file diff --git a/static/ao/objectsETL-iterator.rq b/static/ao/objectsETL-iterator.rq new file mode 100644 index 0000000..03ec380 --- /dev/null +++ b/static/ao/objectsETL-iterator.rq @@ -0,0 +1,5 @@ + +prefix archiveRelated: +select * where { + $this archiveRelated:ObjectNumber ?objectNumber. +} \ No newline at end of file diff --git a/static/ao/objectsLocations-generator.rq b/static/ao/objectsLocations-generator.rq new file mode 100644 index 0000000..816bc99 --- /dev/null +++ b/static/ao/objectsLocations-generator.rq @@ -0,0 +1,201 @@ +prefix aat: +prefix dct: +prefix crm: +prefix rdfs: +prefix objectLocations: +prefix skos: +construct { + ?_objectNumber a crm:E22_Human-Made_Object. + #ObjectNumber + ?_objectNumber crm:P1_is_identified_by ?_number. + ?_number a crm:E42_Identifier; + crm:P2_has_type aat:300404626; + rdfs:label "Identification number"; + crm:P190_has_symbolic_content ?objectNumber. + #ObjectID + ?_objectNumber crm:P1_is_identified_by _:objectID. + _:objectID a crm:E42_Identifier; + crm:P2_has_type aat:300445023; + crm:P2_has_type aat:300404664; + rdfs:label "Alias of the identification number"; + crm:P190_has_symbolic_content ?objectID. + # #ObjectName + ?_objectNumber crm:P1_is_identified_by _:objectName. + _:objectName a crm:E55_Type; + rdfs:label "Intended use"; + crm:P190_has_symbolic_content ?objectID. + #Title - check if it is present + ?objects dct:title ?title. + #Medium - check if it is present + ?objects crm:P45_consists_of ?skolemMeduim. + ?skolemMeduim a crm:E57_Material; + rdfs:label "Material"; + crm:P190_has_symbolic_content ?medium. + # Remarks (should only be created when Remarks is not empty) + ?objects crm:P67i_is_referred_to_by ?skolemNodeRemarks. + ?skolemNodeRemarks a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300435415; + rdfs:label "Remarks" ; + crm:P190_has_symbolic_content ?remarks. + #Description - check if it is empty + ?objects crm:P67i_is_referred_to_by ?skolemDescription. + ?skolemDescription a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300435416; + rdfs:label "Description"; + crm:P190_has_symbolic_content ?description. + #Provenance - check if it is empty + ?objects crm:P67i_is_referred_to_by ?skolemProvenance. + ?skolemProvenance a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300444173; + rdfs:label "Provenance"; + crm:P190_has_symbolic_content ?provenance. + #Notes - check if it is empty + ?objects crm:P3_has_note ?notes. + #RelatedWorks - check if it is empty + ?objects crm:P67i_is_referred_to_by ?skolemRelatedWorks. + ?skolemRelatedWorks a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300444120; + rdfs:label "Related works"; + crm:P190_has_symbolic_content ?relatedWorks. + # HistAttributions - check if it is empty + ?objects skos:historyNote ?histAttributions. + #CuratorialRemarks - check if it is empty + ?objects crm:P67i_is_referred_to_by ?skolemCuratorialRemarks. + ?skolemCuratorialRemarks a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300435415; + rdfs:label "Curatorial remarks"; + crm:P190_has_symbolic_content ?curatorialRemarks. + #Dimensions & DimensionRemarks + #Dimensions and Dimesions remarks not empty + ?objects crm:P43_has_dimension ?dimensionsAndRemarks. + ?dimensionsAndRemarks a crm:E54_Dimension; + rdfs:label "Dimesions"; + crm:P3_has_note ?dimesionsRemarks. + #DimensionRemarks is not empty + ?object crm:P43_has_dimension ?onlyDimesionsRemarks. + ?onlyDimesionsRemarks a crm:E54_Dimension; + rdfs:label "DimensionRemarks"; + crm:P3_has_note ?dimesionsRemarks. + #Dimension is not empty + ?object crm:P43_has_dimension ?onlyDimesions. + ?onlyDimesions a crm:E54_Dimension; + rdfs:label "Dimensions"; + crm:P3_has_note ?dimensions. + #Signed + ?objects crm:P128_carries ?hashedSigned. + ?hashedSigned a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300189326; + rdfs:label "Signed"; + crm:P190_has_symbolic_content ?signed. + #Inscribed + ?objects crm:P128_carries ?hashedInscribed. + ?hashedInscribed a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300028702; + rdfs:label "Inscribed"; + crm:P190_has_symbolic_content ?inscribed. + #Markings + ?objects crm:P128_carries ?hashedMarkings. + ?hashedMarkings a crm:E33_Linguistic_Object; + crm:P2_has_type aat:300028744; + rdfs:label "Markings"; + crm:P190_has_symbolic_content ?markings. +} +where { + graph { + #objectNumber + $this objectLocations:ObjectNumber ?objectNumber. + bind(iri(concat(str(), str(?objectNumber))) as ?_objectNumber). + bind(iri(concat(str(), str(?objectNumber))) as ?_number). + optional { + $this objectLocations:ObjectID ?objectID. + } + #Title + optional { + $this objectLocations:Title ?title. + } + # Medium - check if medium is empty or not + optional { + $this objectLocations:Medium ?medium. + bind (bnode() as ?skolemMeduim). + } + # Remarks (should only be created when Remarks is not empty) + optional { + $this objectLocations:Remarks ?remarks. + filter(?remarks != "\r\n") + bind(bnode() as ?skolemNodeRemarks). + } + # Description - check if description is empty or not + optional { + $this objectLocations:Description ?description. + bind (bnode() as ?skolemDescription). + } + #Provenance + optional { + $this objectLocations:Provenance ?provenance. + bind (bnode() as ?skolemProvenance). + } + #Notes + optional { + $this objectLocations:Notes ?notes. + } + #RelatedWorks + optional { + $this objectLocations:RelatedWorks ?relatedWorks. + bind (bnode() as ?skolemRelatedWorks). + } + #HistAttributions + optional { + $this objectLocations:HistAttributions ?histAttributions. + } + #CuratorialRemarks + optional { + $this objectLocations:CuratorialRemarks ?curatorialRemarks. + bind (bnode() as ?skolemCuratorialRemarks). + } + #Dimensions and DimensionRemarks are not empty + optional { + $this objectLocations:Dimensions ?dimesions. + filter (?dimesions != "[N.B.]" && ?dimesions != "[N.I.]") + $this objectLocations:DimensionRemarks ?dimesionsRemarks. + # specifically used hashedIri in ETL instead of skolemIri + bind(iri(concat(str(), md5(str(?dimesions)), md5(str(?dimesionsRemarks)), md5(str(?objectNumber)))) as ?dimensionsAndRemarks). + } + #DimensionRemarks is not empty + optional { + $this objectLocations:DimensionRemarks ?dimesionsRemarks. + filter not exists { + $this objectLocations:Dimensions ?dimesions. + } + # specifically used hashedIri in ETL instead of skolemIri + bind(iri(concat(str(), md5(str(?dimesionsRemarks)), md5(str(?objectNumber)))) as ?onlyDimesionsRemarks). + } + #Dimension is not empty + optional { + $this objectLocations:Dimensions ?dimesions. + filter (?dimesions != "[N.B.]" && ?dimesions != "[N.I.]") + filter not exists { + $this objectLocations:DimensionRemarks ?dimesionsRemarks. + } + # specifically used hashedIri in ETL instead of skolemIri + bind(iri(concat(str(), md5(str(?dimesions)), md5(str(?objectNumber)))) as ?onlyDimesions). + } + #Signed + optional { + $this objectLocations:Signed ?signed. + # specifically used hashedIri in ETL instead of skolemIri + bind(iri(concat(str(), md5(str(?signed)))) as ?hashedSigned). + } + #Inscribed + optional { + $this objectLocations:Inscribed ?inscribed. + # specifically used hashedIri in ETL instead of skolemIri + bind(iri(concat(str(), md5(str(?inscribed)))) as ?hashedInscribed). + } + #Markings + optional { + $this objectLocations:Markings ?markings. + # specifically used hashedIri in ETL instead of skolemIri + bind(iri(concat(str(), md5(str(?markings)))) as ?hashedMarkings). + } + } +} \ No newline at end of file