Skip to content

Commit

Permalink
new queries
Browse files Browse the repository at this point in the history
  • Loading branch information
ivaDimitrova07 committed Jan 15, 2024
1 parent a3bea31 commit d46102d
Show file tree
Hide file tree
Showing 8 changed files with 543 additions and 0 deletions.
4 changes: 4 additions & 0 deletions static/ao/objectImagesURLS-iterator.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prefix objectImageURLs: <https://test.triply.cc/colonialHeritage-test/graph/Object_image_URIs_00.csv/def/>
select * where {
$this objectImageURLs:ObjectNumber ?object.
}
69 changes: 69 additions & 0 deletions static/ao/objectImagesURLs-generator.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
prefix aat: <http://vocab.getty.edu/aat/>
prefix crm: <http://www.cidoc-crm.org/cidoc-crm/>
prefix crmdig: <http://www.ics.forth.gr/isl/CRMdig/>
prefix la: <https://linked.art/ns/terms/>
prefix objectImageURLs: <https://test.triply.cc/colonialHeritage-test/graph/Object_image_URIs_00.csv/def/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

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 <https://creativecommons.org/licenses/by-sa/4.0/>.

_:digitalObject crm:P67i_is_referred_to_by ?_DEEDlicenseLabel.
?_DEEDlicenseLabel a crm:E33_E41_Linguistic_Appellation;
crm:P2_has_type aat:300435434;
rdfs:label <https://creativecommons.org/publicdomain/mark/1.0/deed.en>;
crm:P190_has_symbolic_content ?authValue.

_:digitalObject crm:P104_is_subject_to ?_NDlicense.
?_license a crm:E30_Right;
crm:P2_has_type <https://creativecommons.org/licenses/by-nc-nd/4.0/>.


_: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 <https://test.triply.cc/colonialHeritage-test/graph/graphs/objectImages> {
$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(<https://colonial-heritage.triply.cc/nmvw/id/site/>), 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)
}
}
}
4 changes: 4 additions & 0 deletions static/ao/objectLocations-iterator.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prefix objectLocations: <https://test.triply.cc/colonialHeritage-test/graph/Location-related_Object_Term_IRIs_00.csv/def/>
select * where {
$this objectLocations:ObjectNumber ?objectNumber.
}
98 changes: 98 additions & 0 deletions static/ao/objectsETL-dates-generator.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
prefix aat: <http://vocab.getty.edu/aat/>
prefix archiveRelated: <https://test.triply.cc/colonialHeritage-test/graph/Archive-related_Objects.csv/def/>
prefix dct: <http://purl.org/dc/terms/>
prefix crm: <http://www.cidoc-crm.org/cidoc-crm/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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 <https://test.triply.cc/colonialHeritage-test/graph/graphs/objects> {
?subject archiveRelated:ObjectNumber ?objectNumber.
# ?subject ?objectNumberPredicate ?objectNumber.
# filter(replace(str(?objectNumberPredicate),".*[/]","") = "ObjectNumber")
bind(iri(concat(str(<https://colonial-heritage.triply.cc/nmvw/.well-known/genid/>), 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).
}
}
}
4 changes: 4 additions & 0 deletions static/ao/objectsETL-dates-iterator.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prefix archiveRelated: <https://test.triply.cc/colonialHeritage-test/graph/Archive-related_Objects.csv/def/>
select * where {
$this archiveRelated:ObjectNumber ?objectNumber.
}
158 changes: 158 additions & 0 deletions static/ao/objectsETL-generator.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix aat: <http://vocab.getty.edu/aat/>
prefix dct: <http://purl.org/dc/terms/>
prefix crm: <http://www.cidoc-crm.org/cidoc-crm/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix archiveRelated: <https://test.triply.cc/colonialHeritage-test/graph/Archive-related_Objects.csv/def/>
prefix la: <https://linked.art/ns/terms/>
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 <https://test.triply.cc/colonialHeritage-test/graph/graphs/objects> {
#objectNumber
$this archiveRelated:ObjectNumber ?objectNumber.
bind(iri(concat(str(<https://colonial-heritage.triply.cc/nmvw/.well-known/genid/>), 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(<https://colonial-heritage.triply.cc/nmvw/.well-known/genid/>), md5(str(?signed)))) as ?hashedSigned).
}
#Inscribed
optional {
$this archiveRelated:Inscribed ?inscribed.
# specifically used hashedIri in ETL instead of skolemIri
bind(iri(concat(str(<https://colonial-heritage.triply.cc/nmvw/.well-known/genid/>), md5(str(?inscribed)))) as ?hashedInscribed).
}
#Markings
optional {
$this archiveRelated:Markings ?markings.
# specifically used hashedIri in ETL instead of skolemIri
bind(iri(concat(str(<https://colonial-heritage.triply.cc/nmvw/.well-known/genid/>), md5(str(?markings)))) as ?hashedMarkings).
}
}
}
5 changes: 5 additions & 0 deletions static/ao/objectsETL-iterator.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

prefix archiveRelated: <https://test.triply.cc/colonialHeritage-test/graph/Archive-related_Objects.csv/def/>
select * where {
$this archiveRelated:ObjectNumber ?objectNumber.
}
Loading

0 comments on commit d46102d

Please sign in to comment.