123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452 |
- # Utilities to read/write csv files
- import csv
- # Utilities to handle character encodings
- import unicodedata
- # Ordered Dicts
- from collections import OrderedDict
- from http.cookiejar import CookieJar
- from urllib.request import urlopen
- #from bs4 import BeautifulSoup
- import urllib
- import json
- from socket import error as SocketError
- import html.parser
- # OPZIONAL IMPORTS
- # For timestamping/simple speed tests
- from datetime import datetime
- # Random number generator
- from random import *
- # System & command line utilities
- import sys
- # Json for the dictionary
- import json
- import_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/corretti/'
- export_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/RDF/'
- # Custom class to store URIs + related infos for the ontologies/repositories
- class RDFcoords:
- def __init__(self, uri, prefix, code=None):
- self.uri = uri
- self.prefix = prefix
- self.code = code
- # Repositories
- museoCoords = RDFcoords('<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/>', 'mpp:')
- autCoords = RDFcoords('<https://palazzopretorio.prato.it/it/opere/autori/>', 'aut:')
- cidocCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/>', 'crm:')
- aatCoords = RDFcoords('<http://vocab.getty.edu/aat/>', 'aat:')
- nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')
- schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')
- xsdCoords = RDFcoords('<http://www.w3.org/2001/XMLSchema#>', 'xsd:')
- iconCoords = RDFcoords('<http://iconclass.org/>', 'ico:')
- documentsCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P70_documents>', 'ds:')
- rdfsCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')
- nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')
- schemaCoords = RDFcoords('<http://www.schema.org/>', 'schema:')
- rdfsCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')
- # Basic functions for triples / shortened triples in TTL format
- def triple(subject, predicate, object1):
- line = subject + ' ' + predicate + ' ' + object1
- return line
- def doublet(predicate, object1):
- line = ' ' + predicate + ' ' + object1
- return line
- def singlet(object1):
- line = ' ' + object1
- return line
- # Line endings in TTL format
- continueLine1 = ' ;\n'
- continueLine2 = ' ,\n'
- closeLine = ' .\n'
- def writeTTLHeader(output):
- output.write('@prefix ' + museoCoords.prefix + ' ' + museoCoords.uri + closeLine)
- output.write('@prefix ' + cidocCoords.prefix + ' ' + cidocCoords.uri + closeLine)
- output.write('@prefix ' + aatCoords.prefix + ' ' + aatCoords.uri + closeLine)
- output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)
- output.write('@prefix ' + autCoords.prefix + ' ' + autCoords.uri + closeLine)
- output.write('@prefix ' + xsdCoords.prefix + ' ' + xsdCoords.uri + closeLine)
- output.write('@prefix ' + iconCoords.prefix + ' ' + iconCoords.uri + closeLine)
- output.write('@prefix ' + documentsCoords.prefix + ' ' + documentsCoords.uri + closeLine)
- output.write('@prefix ' + rdfsCoords.prefix + ' ' + rdfsCoords.uri + closeLine)
-
- output.write('\n')
- filePrefix = 'OA_BIB_'
- fileType = 'IMG'
- max_entries = 1000000000
- with open(import_dir + filePrefix + fileType + '.csv', newline="") as csv_file, open(
- export_dir + filePrefix + fileType + '.ttl', 'w') as output:
- reader = csv.DictReader(csv_file)
- writeTTLHeader(output)
- first = True
- ii = 0
- for row in reader:
- # The index ii is used to process a limited number of entries for testing purposes
- ii = ii + 1
- # columnName = list(row)
- # placeHolders
- pp = row['NCT']
- if row['Marchini-1958-1']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Marchini-1958-1'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Marchini 1958\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Marchini-1958-1']+ '\"') + closeLine
- output.write(line)
-
- if row['Marchini-1958-2']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Marchini-1958-2'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Marchini 1958\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Marchini-1958-2']+ '\"') + closeLine
- output.write(line)
-
- if row['Marchini-1958-3']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Marchini-1958-3'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Marchini 1958\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Marchini-1958-3']+ '\"') + closeLine
- output.write(line)
- if row['Guasti-1858-1']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Guasti-1858-1'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Guasti 1858\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Guasti-1858-1']+ '\"') + closeLine
- output.write(line)
-
- if row['Guasti-1858-2']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Guasti-1858-2'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Guasti 1858\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Guasti-1858-2']+ '\"') + closeLine
- output.write(line)
-
- if row['Guasti-1858-3']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Guasti-1858-3'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Guasti 1858\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Guasti-1858-3']+ '\"') + closeLine
- output.write(line)
-
- if row['Guasti-1888-1']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Guasti-1888-1'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Guasti 1888\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Guasti-1888-1']+ '\"') + closeLine
- output.write(line)
-
- if row['Guasti-1888-2']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Guasti-1888-2'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Guasti 1888\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Guasti-1888-2']+ '\"') + closeLine
- output.write(line)
-
- if row['Guasti-1888-3']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Guasti-1888-3'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Guasti 1888\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Guasti-1888-3']+ '\"') + closeLine
- output.write(line)
-
- if row['Guasti-1888-4']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Guasti-1888-4'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Guasti 1888\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Guasti-1888-4']+ '\"') + closeLine
- output.write(line)
-
- if row['Guasti-1888-5']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Guasti-1888-5'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Guasti 1888\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Guasti-1888-5']+ '\"') + closeLine
- output.write(line)
-
- if row['Guasti-1888-6']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Guasti-1888-6'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Guida Guasti 1888\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Guasti-1888-6']+ '\"') + closeLine
- output.write(line)
-
- if row['Papini-1912-1']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Papini-1912-1'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Catalogo Papini 1912\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Papini-1912-1']+ '\"') + closeLine
- output.write(line)
-
- if row['Papini-1912-2']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Papini-1912-2'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Catalogo Papini 1912\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Papini-1912-2']+ '\"') + closeLine
- output.write(line)
-
- if row['Papini-1912-3']!= '':
- e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
- id = row['Papini-1912-3'].replace(".jpg", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + '_E36_E42>'
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolderEDPP) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Opera\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Catalogo Papini 1912\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['Papini-1912-3']+ '\"') + closeLine
- output.write(line)
- if row['FNTI-SS']!= '':
- e73placeHolder = "<"+ row['ID OPERA'].replace(" ","")+ "_E73>"
- id = row['FNTI-SS'].replace(".pdf", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E42>"
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolder) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Storica\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Scheda Storica\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['FNTI-SS'].replace("pdf","jpg")+ '\"') + closeLine
- output.write(line)
- if row['SS-1956-Marchini']!= '':
- e73placeHolder = "<"+ row['ID OPERA'].replace(" ","")+ "_E73>"
- id = row['SS-1956-Marchini'].replace(".pdf", "")
- e36placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + ">"
- e36e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E42>"
- line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', e73placeHolder) + closeLine
- output.write(line)
- line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
- output.write(line)
- line = triple(e36placeHolder, rdfsCoords.prefix + 'label', '\"Scheda Storica\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Marchini 1956\"') + closeLine
- output.write(line)
- line = triple(e36placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder) + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
- output.write(line)
- line = triple(e36e42placeHolder, rdfsCoords.prefix + 'label', '\"'+row['SS-1956-Marchini'].replace("pdf","jpg")+ '\"') + closeLine
- output.write(line)
- output.write('\n')
- #
- #
- # Limit number of entries processed (if desired)
- if (ii > max_entries):
- break
|