Ver Fonte

add CSV to RDF ASPO

Federica há 1 ano atrás
pai
commit
082acf6932
30 ficheiros alterados com 0 adições e 12076 exclusões
  1. 0 342
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Autori.py
  2. 0 253
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Bibliografia.ipynb
  3. 0 210
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Date_normalizzazione.py
  4. 0 1155
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Datini.py
  5. 0 143
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Luoghi.py
  6. 0 1121
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Martini.py
  7. 0 371
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_OA_BIB.py
  8. 0 452
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_OA_BIB_IMG.py
  9. 0 921
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_OA_BIB_IMG_LICENZA.py
  10. 0 178
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_OA_IMG.py
  11. 0 1119
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Ospedale.py
  12. 0 174
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Ruoli.py
  13. 0 168
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_VIAF_ULAN.py
  14. 0 303
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_cataloghi_OLD.py
  15. 0 1177
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/Martini.ipynb
  16. 0 38
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/for ic in list_icon:.py
  17. 0 246
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_date.ipynb
  18. 0 258
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_edition.ipynb
  19. 0 280
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange.ipynb
  20. 0 272
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange_date.ipynb
  21. 0 330
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange_date_normalization.ipynb
  22. 0 260
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange_place.ipynb
  23. 0 257
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange_receiver.ipynb
  24. 0 256
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange_sender.ipynb
  25. 0 246
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_iperlemmi.ipynb
  26. 0 526
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_lemmi copy.ipynb
  27. 0 538
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_lemmi.ipynb
  28. 0 142
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_toponimi.py
  29. 0 286
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_trascr.ipynb
  30. 0 54
      FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/associate_OVI_URL_TLIO.py

+ 0 - 342
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Autori.py

@@ -1,342 +0,0 @@
-# Utilities to read/write csv files
-import csv
-# Utilities to handle character encodings
-import unicodedata
-# Ordered Dicts
-from collections import OrderedDict
-
-import json
-
-
-# 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:')
-foafCoords = RDFcoords('<http://xmlns.com/foaf/0.1/>', 'foaf:')
-
-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.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 ' + foafCoords.prefix + ' ' + foafCoords.uri + closeLine)
-    output.write('@prefix ' + autCoords.prefix + ' ' + autCoords.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 ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)
-    output.write('@prefix ' + rdfsCoords.prefix + ' ' + rdfsCoords.uri + closeLine)
-
-    output.write('\n')
-
-
-filePrefix = 'AR20AUT_'
-fileType = 'Datini'
-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
-        url = row['URL']
-
-        #placeHolders
-        e21placeHolder = autCoords.prefix + url
-        e62placeHolder = autCoords.prefix + url + '_nota'
-        e41placeHolder = autCoords.prefix + url + '_E41'
-        e42placeHolder = autCoords.prefix + row['AUTH']
-        e67placeHolder = autCoords.prefix + url + '_E67'
-        e69placeHolder = autCoords.prefix + url + '_E69'
-
-        line = triple(e21placeHolder, nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E21_Person') + closeLine
-        output.write(line)
-        
-        line = triple(e21placeHolder,
-                          nsCoords.prefix + 'type',
-                          foafCoords.prefix + 'person') + closeLine
-        output.write(line)
-        
-        if row['AUTN'] != '':
-            line = triple(e21placeHolder,
-                            foafCoords.prefix + 'name',
-                            '\"' + row['AUTN'] + '\"') + closeLine
-            output.write(line)
-
-        if row['AUTC'] != '':
-            line = triple(e21placeHolder,
-                            foafCoords.prefix + 'familyName',
-                            '\"' + row['AUTC'] + '\"') + closeLine
-            output.write(line)
-
-        if row['AUTO'] != '':
-            line = triple(e21placeHolder,
-                            foafCoords.prefix + 'givenName',
-                            '\"' + row['AUTO'] + '\"') + closeLine
-            output.write(line)
-
-        if row['AUTZ'] != '':
-            line = triple(e21placeHolder,
-                            foafCoords.prefix + 'gender',
-                            '\"' + row['AUTZ'] + '\"') + closeLine
-            output.write(line)
-
-        line = triple(e21placeHolder, rdfsCoords.prefix + 'label',
-                      '\"' + row['AUTN'] + ', ' + row['AUTA'] + '\"') + closeLine
-        output.write(line)
-
-        line = triple(e21placeHolder, cidocCoords.prefix + 'P3_has_note',
-                      e62placeHolder) + closeLine
-        output.write(line)
-
-        line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E62_String') + closeLine
-        output.write(line)
-        line = triple(e62placeHolder, rdfsCoords.prefix + 'label',
-                      '\"Fonte: Museo di Palazzo Pretorio - Collezione Datini\"') + closeLine
-        output.write(line)
-
-        #E21 - P1 - E42
-
-        line = triple(e21placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                      e42placeHolder) + closeLine
-        output.write(line)
-        line = triple(e42placeHolder, nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E42_Identifier') + closeLine
-        output.write(line)
-        line = triple(e42placeHolder, rdfsCoords.prefix + 'label',
-                      '\"' + row['AUTH'] + '\"') + closeLine
-        output.write(line)
-
-        #E21 - P1 - E41
-
-        '''line = triple(e21placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                      e41placeHolder) + closeLine
-        output.write(line)
-        line = triple(e41placeHolder, nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E41_Appellation') + closeLine
-        output.write(line)
-        line = triple(e41placeHolder, rdfsCoords.prefix + 'label',
-                      '\"' + row['AUTN'] + '\"') + closeLine
-        output.write(line)'''
-
-        # E21 - P107i - E74
-
-        if row['AUTU'] != '':
-            group = []
-            if '/' in row['AUTU']:
-                group = row['AUTU'].split('/')
-            else:
-                group.append(row['AUTU'])
-
-            for gr in group:
-                gg = gr.replace(' ', '')
-                e74placeHolder = museoCoords.prefix + gg
-                line = triple(e21placeHolder,
-                              cidocCoords.prefix + 'P107i_is_current_or_former_member_of',
-                              e74placeHolder) + closeLine
-                output.write(line)
-                line = triple(e74placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E74_Group') + closeLine
-                output.write(line)
-                line = triple(e74placeHolder,
-                              rdfsCoords.prefix + 'label',
-                              '\"' + row['AUTU'] + '\"') + closeLine
-                output.write(line)
-
-        #E21 - P98i - E67
-
-        line = triple(e21placeHolder,
-                      cidocCoords.prefix + 'P98i_was_born',
-                      e67placeHolder) + closeLine
-        output.write(line)
-        line = triple(e67placeHolder,
-                      nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E67_Birth') + closeLine
-        output.write(line)
-        line = triple(e67placeHolder,
-                      rdfsCoords.prefix + 'label',
-                      '\"Nascita di ' + row['AUTN'] + '\"') + closeLine
-        output.write(line)
-
-        line = triple(e21placeHolder,
-                      cidocCoords.prefix + 'P100i_died_in',
-                      e69placeHolder) + closeLine
-        output.write(line)
-        line = triple(e69placeHolder,
-                      nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E69_Death') + closeLine
-        output.write(line)
-        line = triple(e69placeHolder,
-                      rdfsCoords.prefix + 'label',
-                      '\"Morte di ' + row['AUTN'] + '\"') + closeLine
-        output.write(line)
-
-        #E67 - P7 - E53
-
-        if row['AUTL'] != '':
-            line = triple(e67placeHolder,
-                          cidocCoords.prefix + 'P7_took_place_at',
-                          museoCoords.prefix + row['AUTL']) + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + row['AUTL'],
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E53_Place') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + row['AUTL'],
-                          rdfsCoords.prefix + 'label',
-                          '\"' + row['AUTL'] + '\"') + closeLine
-            output.write(line)
-
-        # E67 - P4 - E52
-
-        if row['AUTD'] != '':
-            tt = row['AUTD'].replace(' ', '')
-            tim = tt.replace('/', '')
-            time = tim.replace('.', '')
-            line = triple(e67placeHolder,
-                          cidocCoords.prefix + 'P4_has_time-span',
-                          museoCoords.prefix + time) + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + time,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E52_Time-Span') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + time,
-                          rdfsCoords.prefix + 'label',
-                          '\"' + row['AUTD'] + '\"') + closeLine
-            output.write(line)
-
-        # E69 - P7 - E53
-
-        if row['AUTX'] != '':
-            line = triple(e69placeHolder,
-                          cidocCoords.prefix + 'P7_took_place_at',
-                          museoCoords.prefix + row['AUTX']) + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + row['AUTX'],
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E53_Place') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + row['AUTX'],
-                          rdfsCoords.prefix + 'label',
-                          '\"' + row['AUTX'] + '\"') + closeLine
-            output.write(line)
-
-        # E69 - P4 - E52
-
-        if row['AUTT'] != '':
-            tt = row['AUTT'].replace(' ', '')
-            tim = tt.replace('/', '')
-            time = tim.replace('.', '')
-            line = triple(e69placeHolder,
-                          cidocCoords.prefix + 'P4_has_time-span',
-                          museoCoords.prefix + time) + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + time,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E52_Time-Span') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + time,
-                          rdfsCoords.prefix + 'label',
-                          '\"' + row['AUTT'] + '\"') + closeLine
-            output.write(line)
-        
-        # E21 - occupation 
-        if row['AUTQ'] != '':
-            line = triple(e21placeHolder,
-                          schemaCoords.prefix + 'hasOccupation',
-                          museoCoords.prefix + row['AUTQ']) + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + row['AUTQ'],
-                          nsCoords.prefix + 'type',
-                          schemaCoords.prefix + 'Occupation') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + row['AUTQ'],
-                          rdfsCoords.prefix + 'label',
-                          '\"' + row['AUTQ'] + '\"') + closeLine
-            output.write(line)
-
-        # E21 - P139 - E41
-        if row['AUTV'] != '':
-            autv = []
-            if '/' in row['AUTV']:
-                autv = row['AUTV'].split('/')
-            else:
-                autv.append(row['AUTV'])
-            autvplaceHolder = museoCoords.prefix + row['AUTV'].replace(' ', '-').replace('\'', '')
-            line = triple(e21placeHolder,
-                          cidocCoords.prefix + 'P139_has_alternative-form',
-                          '\"' + row['AUTV'] + '\"') + closeLine
-            output.write(line)
-
-        # E21 - P139 - E41
-       # if row['AUTP'] != '':
-       #     autv = []
-       #     if '/' in row['AUTP']:
-        #        autv = row['AUTP'].split('/')
-        #    else:
-        #        autv.append(row['AUTP'])
-            
-        #    line = triple(e21placeHolder,
-        #                  schemaCoords.prefix + 'alternateName',
-        #                  '\"' + row['AUTP'] + '\"') + closeLine
-        #output.write(line)
-
-        output.write('\n')
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 253
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Bibliografia.ipynb

@@ -1,253 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 31,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 32,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/corretti/'\n",
-    "export_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/RDF/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 33,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3/CIDOC Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "hasNoteCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3_has_note>', 'no:')\n",
-    "hasTypeNCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3.1_has_type>', 'tn:')\n",
-    "hasLanguageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P72_has_language>', 'hl:')\n",
-    "documentsCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P70_documents>', 'ds:')\n",
-    "hasComponentCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P148_has_component>', 'hc:')\n",
-    "\n",
-    "# CIDOC Objects\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "stringCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E62_String>', 'sr:', 'E62')\n",
-    "linguisticObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E33_Linguistic_Object>', 'lj:', 'E33')\n",
-    "languageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E56_Language>', 'ln:', 'E56')\n",
-    "appellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E41_appellation>', 'ap:', 'E41')\n",
-    "propositionalObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E89_Propositional_Object>', 'pj:', 'E89')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 34,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 35,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasNoteCoords.prefix + ' ' + hasNoteCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeNCoords.prefix + ' ' + hasTypeNCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + stringCoords.prefix + ' ' + stringCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + linguisticObjCoords.prefix + ' ' + linguisticObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + languageCoords.prefix + ' ' + languageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasLanguageCoords.prefix + ' ' + hasLanguageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + documentsCoords.prefix + ' ' + documentsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + appellationCoords.prefix + ' ' + appellationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + propositionalObjCoords.prefix + ' ' + propositionalObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasComponentCoords.prefix + ' ' + hasComponentCoords.uri + closeLine)\n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 36,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'AR20BIB_'\n",
-    "fileType = 'Datini'\n",
-    "max_entries = 10000000000000000\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+0\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        # if(first):\n",
-    "        #     first = False\n",
-    "        #     continue\n",
-    "        \n",
-    "        e73placeHolderED = \"<https://palazzopretorio.prato.it/it/bib/\" + row['BIBH'] + \"/\" + informationObjectCoords.code + \"_ED>\"            \n",
-    "        line = triple(e73placeHolderED, hasTypePCoords.prefix, '\\\"Bibliografia\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(e73placeHolderED, hasTypeCoords.prefix, informationObjectCoords.prefix) + closeLine\n",
-    "        output.write(line)\n",
-    "        if row['BIBC'] != '':\n",
-    "            bibc= \"A cura di \" + row['BIBC'] + '.' \n",
-    "        else:\n",
-    "            bibc= ''\n",
-    "\n",
-    "        if row['BIBV'] != '':\n",
-    "            bibv= \" \" + row['BIBV'] \n",
-    "        else:\n",
-    "            bibv= ''\n",
-    "        if row['BIBP'] != '':\n",
-    "            bibp= \" \" + row['BIBP'] \n",
-    "        else:\n",
-    "            bibp= ''\n",
-    "        if row['BIBE'] != '':\n",
-    "            bibe= \" \" + row['BIBE'] \n",
-    "        else:\n",
-    "            bibe= ''\n",
-    "        if row['BIBA'] != '':\n",
-    "            biba= row['BIBA'] + \", \"\n",
-    "        else:\n",
-    "            biba= ''\n",
-    "        \n",
-    "        bib = biba + row['BIBG'] + \", \"  + row['BIBL'] + \", \"  + row['BIBZ'] + \", \"  + row['BIBD'] + '. ' + bibc + bibv + bibe \n",
-    "        bib = bib.replace(\"  \", \" \").replace(\",,\", \"\").replace(\"..\", \".\").replace(\", ,\",\",\") \n",
-    "\n",
-    "        line = triple(e73placeHolderED, labelCoords.prefix, '\\\"'  + bib + '\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "        # e41placeHolder = e73placeHolderE + \"_\" + appellationCoords.code + \">\"\n",
-    "        # line = triple(e73placeHolderE , identifiedByCoords.prefix, e41placeHolder) + closeLine\n",
-    "        # output.write(line)\n",
-    "        # line = triple(e41placeHolder, hasTypeCoords.prefix, appellationCoords.prefix) + closeLine\n",
-    "        # output.write(line)            \n",
-    "        # line = triple(e41placeHolder, labelCoords.prefix, '\\\"'  + row['edizione'].replace('\\\\','\\\\\\\\').replace('\"','\\\\\"') + '\\\"') + closeLine\n",
-    "        # output.write(line)\n",
-    "\n",
-    "        output.write('\\n')\n",
-    "\n",
-    "\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.10.4"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 210
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Date_normalizzazione.py

@@ -1,210 +0,0 @@
-# Utilities to read/write csv files
-import csv
-# Utilities to handle character encodings
-import unicodedata
-# Ordered Dicts
-from collections import OrderedDict
-
-from urllib.request import urlopen
-from bs4 import BeautifulSoup
-
-import json
-
-# 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/DATE/'
-
-# 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:')
-yearCoords = RDFcoords('<https://www.w3.org/TR/owl-time#year>', 'year:')
-monthCoords = RDFcoords('<https://www.w3.org/TR/owl-time#month>', 'month:')
-dayCoords = RDFcoords('<https://www.w3.org/TR/owl-time#day>', 'day:')
-beginningCoords = RDFcoords('<https://www.w3.org/TR/owl-time#hasBeginning>', 'beg:')
-endCoords = RDFcoords('<https://www.w3.org/TR/owl-time#hasEnd>', 'end:')
-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 ' + nsCoords.prefix + ' ' + nsCoords.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 ' + beginningCoords.prefix + ' ' + beginningCoords.uri + closeLine)
-    output.write('@prefix ' + endCoords.prefix + ' ' + endCoords.uri + closeLine)
-    output.write('@prefix ' + yearCoords.prefix + ' ' + yearCoords.uri + closeLine) 
-    output.write('@prefix ' + monthCoords.prefix + ' ' + monthCoords.uri + closeLine)
-    output.write('@prefix ' + dayCoords.prefix + ' ' + dayCoords.uri + closeLine)
-    output.write('@prefix ' + rdfsCoords.prefix + ' ' + rdfsCoords.uri + closeLine)
-    
-
-    output.write('\n')
-
-
-filePrefix = 'AR20AUT_'
-fileType = 'DATINI'
-max_entries = 1000000000
-
-
-with open(import_dir + filePrefix + fileType + '.csv', newline="") as csv_file, open(export_dir + filePrefix + fileType + '_normalizzate.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
-
-        # if row['RVEL'] == '' or row['RVEL'] == '0':
-            # E12 - P4 - E52
-        # if row['DTSI'] != '':
-        #         line = triple(museoCoords.prefix + row['DTSI'], yearCoords.prefix, '\"'+row['DTSI'] +'\"^^xsd:integer')+ closeLine
-        #         output.write(line)
-        #         # line = triple(museoCoords.prefix + row['DTSI'], monthCoords.prefix, '\"'+ '01' +'\"^^xsd:integer') + closeLine
-        #         # output.write(line)
-        #         # line = triple(museoCoords.prefix + row['DTSI'], dayCoords.prefix, '\"'+ '01' +'\"^^xsd:integer') + closeLine
-        #         # output.write(line)
-        #         line = triple(museoCoords.prefix + row['DTSI'], beginningCoords.prefix, '\"'+row['DTSI']+'0101'+'\"^^xsd:date') + closeLine
-        #         output.write(line)  
-
-        # e12FplaceHolder = ''
-        # if row['DTSI'] != row['DTSF']:
-        #     e12FplaceHolder = museoCoords.prefix + row['URL'] + '_E12F'
-        # if e12FplaceHolder != '':
-        #         line = triple(museoCoords.prefix + row['DTSF'], yearCoords.prefix, '\"'+row['DTSF'] +'\"^^xsd:integer') + closeLine
-        #         output.write(line)
-        #         # line = triple(museoCoords.prefix + row['DTSF'], monthCoords.prefix, '\"'+ '12' +'\"^^xsd:integer') + closeLine
-        #         # output.write(line)
-        #         # line = triple(museoCoords.prefix + row['DTSF'], dayCoords.prefix, '\"'+ '31' +'\"^^xsd:integer') + closeLine
-        #         # output.write(line)
-        #         line = triple(museoCoords.prefix + row['DTSF'], endCoords.prefix, '\"'+row['DTSF']+'1231'+'\"^^xsd:date') + closeLine
-        #         output.write(line)  
-        if row['AUTD'] != '':
-            tt = row['AUTD'].replace(' ', '')
-            tim = tt.replace('/', '')
-            time = tim.replace('.', '')
-            # line = triple(museoCoords.prefix + time, yearCoords.prefix, '\"'+row['AUTD'] +'\"^^xsd:integer') + closeLine
-            # output.write(line)
-            # line = triple(museoCoords.prefix + time, beginningCoords.prefix, '\"'+row['AUTD']+'0101'+'\"^^xsd:date') + closeLine
-            # output.write(line)
-            line = triple(museoCoords.prefix + time, endCoords.prefix, '\"'+row['AUTD']+'1231'+'\"^^xsd:date') + closeLine
-            output.write(line)
-
-        if row['AUTT'] != '':
-            tt = row['AUTT'].replace(' ', '')
-            tim = tt.replace('/', '')
-            time = tim.replace('.', '')
-            # line = triple(museoCoords.prefix + time, yearCoords.prefix, '\"'+row['AUTT'] +'\"^^xsd:integer') + closeLine
-            # output.write(line)
-            # line = triple(museoCoords.prefix + time, endCoords.prefix, '\"'+row['AUTT']+'1231'+'\"^^xsd:date') + closeLine
-            # output.write(line)
-            line = triple(museoCoords.prefix + time, beginningCoords.prefix, '\"'+row['AUTT']+'0101'+'\"^^xsd:date') + closeLine
-            output.write(line)
-        
-        
-
- 
-        output.write('\n')
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if(ii>max_entries):
-            break
-        
-    # if row['PRDI' + f] != '':
-    #                     timespan = row['PRDI' + f]
-
-    #                     tt = timespan.replace(' ', '')
-    #                     tp = tt.replace('.', '')
-    #                     ts = tp.replace('/', '')
-
-    #                     timespanPlaceholder = museoCoords.prefix + '_' + ts
-
-    #                     # E10 P4 E52
-
-    #                     line = triple(newe10placeHolder,
-    #                                   cidocCoords.prefix + 'P4_has_time-span',
-    #                                   timespanPlaceholder) + closeLine
-    #                     output.write(line)
-    #                     line = triple(timespanPlaceholder,
-    #                                   nsCoords.prefix + 'type',
-    #                                   cidocCoords.prefix + 'E52_Time-Span') + closeLine
-    #                     output.write(line)
-    #                     line = triple(timespanPlaceholder,
-    #                                   schemaCoords.prefix + 'label',
-    #                                   '\"' + timespan + '\"') + closeLine
-    #                     output.write(line)
-
-    #         if row['PRDU' + last] != '':
-    #             timespan = row['PRDU' + last]
-
-    #             tt = timespan.replace(' ', '')
-    #             ts = tt.replace('/', '')
-
-    #             timespanPlaceholder = museoCoords.prefix + '_' + ts
-
-    #             # E10 P4 E52
-
-    #             line = triple(e10placeHolder,
-    #                           cidocCoords.prefix + 'P4_has_time-span',
-    #                           timespanPlaceholder) + closeLine
-    #             output.write(line)
-    #             line = triple(timespanPlaceholder,
-    #                           nsCoords.prefix + 'type',
-    #                           cidocCoords.prefix + 'E52_Time-Span') + closeLine
-    #             output.write(line)
-    #             line = triple(timespanPlaceholder,
-    #                           schemaCoords.prefix + 'label',
-    #                           '\"' + timespan + '\"') + closeLine
-    #             output.write(line)

+ 0 - 1155
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Datini.py

@@ -1,1155 +0,0 @@
-# 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:')
-
-
-# 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 ' + nsCoords.prefix + ' ' + nsCoords.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('\n')
-
-
-filePrefix = 'OA_Data_'
-fileType = 'Datini'
-max_entries = 1000000000
-
-def get_aut_url(code):
-    aut_file = open(import_dir + 'AR20AUT_' + fileType + '.csv', newline="")
-    reader = csv.DictReader(aut_file)
-    for row in reader:
-        auth = int(row['AUTH'])
-        cod = int(code)
-        role = ''
-        if row['AUTQ'] != '':
-            role = row['AUTQ']
-        else:
-            role = ''
-        if auth == cod:
-            return [row['URL'], role]
-
-def get_role(role):
-    role_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/AAT_RUOLI.csv', newline="")
-    reader = csv.DictReader(role_file)
-    for row in reader:
-        if row['Label'] == role:
-            return row['AAT']
-
-def get_elem(mtc):
-    mtc_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/AAT_MTC.csv', newline="")
-    reader = csv.DictReader(mtc_file)
-    for row in reader:
-        if row['MTC'] == mtc:
-            return [row['AAT'], row['Type']]
-
-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
-
-        sb = ''
-        subj = ''
-        #pp = row['OGTD'] + ' (' + row['ACC'] + ') '
-        if row['SGTI'] != '':
-            sb = row['SGTI']
-
-        # Triplify the 'codice' -- should exist for every entry
-        codice = ''
-        if (row['NCTR'] != '' and row['NCTN'] != ''):
-            codice = row['NCTR'] + row['NCTN']
-
-        codiceP = ''
-        if (row['AUTH'] != ''):
-            codiceP = row['AUTH']
-
-        place = ''
-        if (row['PRVC'] != ''):
-            place = row['PRVC']
-
-        columnName = list(row)
-        url = row['URL']
-
-        # placeHolders
-        datplaceHolder = museoCoords.prefix + url
-        e1placeHolder = museoCoords.prefix + url + '_E1'
-        e3placeHolder = museoCoords.prefix + url + 'E3'
-        e10placeHolder = museoCoords.prefix + url + '_E10'
-        e12placeHolder = museoCoords.prefix + url + '_E12'
-        e13placeHolder = museoCoords.prefix + url + '_E13'
-        e21placeHolder = museoCoords.prefix + url + '_InE21'
-        e25placeHolder = museoCoords.prefix + url + '_E25'
-        e34placeHolder = museoCoords.prefix + url + '_E34'
-        e35placeHolder1 = museoCoords.prefix + url + '_E35'
-        e42placeHolder = museoCoords.prefix + url + '_E42'
-        e42CplaceHolder = museoCoords.prefix + url + '_E42_MPP'
-        e65placeHolder = museoCoords.prefix + url + '_InE65'
-        e73placeHolder = museoCoords.prefix + url + '_E73'
-        e74placeHolder = museoCoords.prefix + url + '_E74'
-
-        if (codice != ''):
-            line = triple(datplaceHolder, cidocCoords.prefix + 'P1_is_identified_by', e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e42placeHolder, nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-
-            line = triple(e42placeHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"0' + codice + '\"') + closeLine
-            output.write(line)
-            ###
-            line = triple(e42placeHolder,
-                          cidocCoords.prefix + 'P2_has_type',
-                          '\"Codice univoco del bene (NCT)\"') + closeLine
-            output.write(line)
-
-
-        # Write E22 Man Made Object & E73 Information Object -- should exist for every entry?
-        line = triple(datplaceHolder, nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E22_Man-Made_Object') + closeLine
-        output.write(line)
-        line = triple(datplaceHolder, schemaCoords.prefix + 'label', '\"' + sb + '\"') + closeLine
-        output.write(line)
-        line = triple(datplaceHolder, cidocCoords.prefix + 'P128_carries', e73placeHolder) + closeLine
-        output.write(line)
-        line = triple(e73placeHolder, nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        output.write(line)
-
-        ss = ''
-        if row['SGTI'] != '':
-            ss = row['SGTI']
-        else:
-            ss = 'senza titolo'
-
-        line = triple(e73placeHolder, schemaCoords.prefix + 'label',
-                      '\"Opera d\'arte raffigurante ' + ss + '\"') + closeLine
-        output.write(line)
-
-        # E73 - P2 - E55
-
-        tt = ''
-        typeLabel = ''
-
-        if row['OGTD'] == 'dipinto':
-            tt = aatCoords.prefix + "300033618"
-        elif row['OGTD'] == 'rilievo':
-            tt = aatCoords.prefix + "300047230"
-        elif row['OGTD'] == 'polittico':
-            tt = aatCoords.prefix + "300178235"
-        elif row['OGTD'] == 'predella':
-            tt = aatCoords.prefix + "300003745"
-
-        line = triple(e73placeHolder,
-                      cidocCoords.prefix + 'P2_has_type',
-                      tt) + closeLine
-        output.write(line)
-        line = triple(tt, schemaCoords.prefix + 'label',
-                      '\"' + row['OGTD'] + '\"') + closeLine
-        output.write(line)
-
-        # E73 - P1 - E35
-
-        if row['SGTT'] != '':
-            line = triple(e73placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e35placeHolder1) + closeLine
-            output.write(line)
-            line = triple(e35placeHolder1, nsCoords.prefix + 'type', cidocCoords.prefix + 'E35_Title') + closeLine
-            output.write(line)
-            line = triple(e35placeHolder1, schemaCoords.prefix + 'label', '\"' + row['SGTT'] + '\"') + closeLine
-            output.write(line)
-
-        # E22 - P62 - E1
-
-        if row['SGTI'] != '':
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P62_depicts',
-                          e1placeHolder) + closeLine
-            output.write(line)
-            line = triple(e1placeHolder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E1_CRM_Entity') + closeLine
-            output.write(line)
-            line = triple(e1placeHolder,
-                          schemaCoords.prefix + 'label', '\"' +
-                          row['SGTI'] + '\"') + closeLine
-            output.write(line)
-
-            line = triple(e1placeHolder,
-                          cidocCoords.prefix + 'P2_has_type',
-                          '\"Identificazione Iconografica\"') + closeLine
-            output.write(line)
-
-        # Attention: these triples are identified only for C100005 Museo di Palazzo Pretorio
-
-        if row['ESC'] == 'C100005':
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P52_has_current_owner',
-                          '<https://palazzopretorio.prato.it/it/>') + closeLine
-            output.write(line)
-            line = triple('<https://palazzopretorio.prato.it/it/>',
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E74_Group') + closeLine
-            output.write(line)
-            line = triple('<https://palazzopretorio.prato.it/it/>',
-                          schemaCoords.prefix + 'label',
-                          '\"Museo di Palazzo Pretorio\"') + closeLine
-            output.write(line)
-
-        currentLocation = ''
-
-        # E22 - P54 - E53
-        if row['LDCN'] != '':
-            if row['LDCS'] != '':
-                currentLocation = row['LDCS']
-            else:
-                currentLocation = currentLocation
-            if row['LDCM'] != '':
-                currentLocation = currentLocation + ', ' + row['LDCM']
-            else:
-                currentLocation = currentLocation
-            if row['LDCN'] != '':
-                currentLocation = currentLocation + ', ' + row['LDCN']
-            else:
-                currentLocation = currentLocation
-
-            currentLocation = currentLocation + ', ' + row['PVCC'] + ' (' + row['PVCP'] + ')'
-
-            line = triple(datplaceHolder, cidocCoords.prefix + 'P54_has_current_permanent_location',
-                          '\"' + currentLocation + '\"') + closeLine
-            output.write(line)
-
-        e12FplaceHolder = ''
-        if row['DTSI'] != row['DTSF']:
-            e12FplaceHolder = museoCoords.prefix + url + '_E12F'
-
-        # Write E12 Production -- should exist for every entry?
-        # E12 P108 E22
-        line = triple(e12placeHolder, cidocCoords.prefix + 'P108_has_produced', datplaceHolder) + closeLine
-        output.write(line)
-        line = triple(e12placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E12_Production') + closeLine
-        output.write(line)
-        # E73 P108i E12
-        line = triple(e73placeHolder, cidocCoords.prefix + 'P108i_was_produced_by', e12placeHolder) + closeLine
-        output.write(line)
-
-        if e12FplaceHolder != '':
-            line = triple(e12FplaceHolder, cidocCoords.prefix + 'P108_has_produced', datplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e12FplaceHolder, nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E12_Production') + closeLine
-            output.write(line)
-            line = triple(e12FplaceHolder, schemaCoords.prefix + 'label',
-                          '\"Fine produzione di ' + row['SGTI'] + '\"') + closeLine
-            output.write(line)
-            # E73 P108i E12
-            line = triple(e73placeHolder, cidocCoords.prefix + 'P108i_was_produced_by', e12FplaceHolder) + closeLine
-            output.write(line)
-            # E12 P140i E13
-            line = triple(e12FplaceHolder,
-                          cidocCoords.prefix + 'P140i_was_attributed_by',
-                          e13placeHolder) + closeLine
-            output.write(line)
-            # E12 P2
-            line = triple(e12FplaceHolder,
-                          cidocCoords.prefix + 'P2_has_type',
-                          '\"Fine\"^^xsd:string') + closeLine
-            output.write(line)
-            line = triple(e12placeHolder,
-                          cidocCoords.prefix + 'P2_has_type',
-                          '\"Inizio\"^^xsd:string') + closeLine
-            output.write(line)
-            line = triple(e12placeHolder, schemaCoords.prefix + 'label',
-                          '\"Inizio produzione di ' + row['SGTI'] + '\"') + closeLine
-            output.write(line)
-        else:
-            line = triple(e12placeHolder, schemaCoords.prefix + 'label',
-                          '\"Produzione di ' + row['SGTI'] + '\"') + closeLine
-            output.write(line)
-
-        tcl = []
-        for name in columnName:
-            if 'TCL' in name:
-                tcl.append(name)
-
-        # E12 - P7 - E53
-        for el in tcl:
-            i = 0
-            if row[el] == 'luogo di produzione':
-                pl = ''
-                if i == 0:
-                    pl = row['PRVC']
-                else:
-                    pl = row['PRVC' + i]
-                line = triple(e12placeHolder,
-                              cidocCoords.prefix + 'P7_took_place_at',
-                              museoCoords.prefix + pl) + closeLine
-                output.write(line)
-                if e12FplaceHolder != '':
-                    line = triple(e12FplaceHolder,
-                                  cidocCoords.prefix + 'P7_took_place_at',
-                                  museoCoords.prefix + pl) + closeLine
-                    output.write(line)
-            i = i + 1
-
-        # E12 - PC14 - E21
-        if row['AUTH'] != '':
-            aut = get_aut_url(row['AUTH'])
-            aut_url = aut[0]
-            aut_role = aut[1]
-            ll = row['AUTN'] + '_' + aut_role
-            lab = ll.replace(' ', '')
-            label = lab.replace(',', '')
-
-            AuthorPlaceholder = autCoords.prefix + str(aut)
-            line = triple(museoCoords.prefix + '_' + label,
-                          cidocCoords.prefix + 'P01_has_domain',
-                          e12placeHolder) + closeLine
-            output.write(line)
-            if e12FplaceHolder != '':
-                line = triple(museoCoords.prefix + '_' + label,
-                              cidocCoords.prefix + 'P01_has_domain',
-                              e12FplaceHolder) + closeLine
-                output.write(line)
-
-        if 'AUTH1' in columnName:
-            if row['AUTH1'] != '':
-                aut = get_aut_url(row['AUTH1'])
-                aut_url = aut[0]
-                aut_role = aut[1]
-                ll = row['AUTN1'] + '_' + aut_role
-                lab = ll.replace(' ', '')
-                label = lab.replace(',', '')
-
-                AuthorPlaceholder = autCoords.prefix + aut_url
-                line = triple(museoCoords.prefix + '_' + label,
-                              cidocCoords.prefix + 'P01_has_domain',
-                              e12placeHolder) + closeLine
-                output.write(line)
-                if e12FplaceHolder != '':
-                    line = triple(museoCoords.prefix + '_' + label,
-                                  cidocCoords.prefix + 'P01_has_domain',
-                                  e12FplaceHolder) + closeLine
-                    output.write(line)
-
-        # E12 - PC14 - E21
-        if 'CMMN' in columnName:
-            if row['CMMN'] != '':
-                cc = row['CMMN']
-                cm = cc.replace(' ', '')
-                cmmn = cm.replace(',', '')
-
-                cmmPlaceholder = museoCoords.prefix + '_' + cmmn
-                line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                              cidocCoords.prefix + 'P01_has_domain',
-                              e12placeHolder) + closeLine
-                output.write(line)
-                if e12FplaceHolder != '':
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  cidocCoords.prefix + 'P01_has_domain',
-                                  e12FplaceHolder) + closeLine
-                    output.write(line)
-                line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'PC14_carried_out_by') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                              schemaCoords.prefix + 'label',
-                              '\"' + row['CMMN'] + ' nel ruolo di committente\"') + closeLine
-                output.write(line)
-
-                line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                              cidocCoords.prefix + 'P02_has_range',
-                              cmmPlaceholder) + closeLine
-                output.write(line)
-                line = triple(cmmPlaceholder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E39_Actor') + closeLine
-                output.write(line)
-                line = triple(cmmPlaceholder,
-                              schemaCoords.prefix + 'label',
-                              '\"' + row['CMMN'] + '\"') + closeLine
-                output.write(line)
-
-                line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                              cidocCoords.prefix + 'P14.1_in_the_role_of',
-                              museoCoords.prefix + '_client') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + '_client',
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E55_Type') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + '_client',
-                              schemaCoords.prefix + 'label',
-                              '\"Committente\"') + closeLine
-                output.write(line)
-
-        # E12 - P4 - E52
-        if row['DTSI'] != '':
-            line = triple(e12placeHolder,
-                          cidocCoords.prefix + 'P4_has_time-span',
-                          museoCoords.prefix + row['DTSI']) + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + row['DTSI'],
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E52_Time-Span') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + row['DTSI'],
-                          schemaCoords.prefix + 'label',
-                          '\"' + row['DTSI'] + '\"') + closeLine
-            output.write(line)
-
-        if e12FplaceHolder != '':
-            line = triple(e12FplaceHolder,
-                          cidocCoords.prefix + 'P4_has_time-span',
-                          museoCoords.prefix + row['DTSF']) + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + row['DTSF'],
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E52_Time-Span') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + row['DTSF'],
-                          schemaCoords.prefix + 'label',
-                          '\"' + row['DTSF'] + '\"') + closeLine
-            output.write(line)
-
-        tcl = []
-        for name in columnName:
-            if 'TCL' in name:
-                tcl.append(name)
-
-        j = 0
-
-        for el in tcl:
-            if row[el] != '':
-                j = j + 1
-
-        last = str(j - 1)
-
-        n = len(tcl) - 1
-
-        for i in range(n):
-
-            k = str(i + 1)
-
-            if i + 1 == 1:
-                w = ''
-            else:
-                w = i
-
-            f = str(w)
-
-            if row['TCL' + k] != '':
-
-                pastActor = ''
-                newActor = ''
-                pl = ''
-
-                if row['PRCD' + k] != '':
-                    newActor = ' a ' + row['PRCD' + k]
-
-                if row['PRCD' + f] != '':
-                    pastActor = ' da ' + row['PRCD' + f]
-                    pl = row['PRCD' + f].replace(' ', '')
-
-                newe10placeHolder = museoCoords.prefix + url + "_E10_" + k
-
-                line = triple(newe10placeHolder,
-                              cidocCoords.prefix + 'P30_transferred_custody_of',
-                              datplaceHolder) + closeLine
-                output.write(line)
-                line = triple(newe10placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E10_Transfer_of_Custody') + closeLine
-                output.write(line)
-                line = triple(newe10placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"Passaggio di ' + row['SGTI'] + pastActor +
-                              newActor + '\"') + closeLine
-                output.write(line)
-
-                if row['PRDI' + f] != '':
-                    timespan = row['PRDI' + f]
-
-                    tt = timespan.replace(' ', '')
-                    tp = tt.replace('.', '')
-                    ts = tp.replace('/', '')
-
-                    timespanPlaceholder = museoCoords.prefix + '_' + ts
-
-                    # E10 P4 E52
-
-                    line = triple(newe10placeHolder,
-                                  cidocCoords.prefix + 'P4_has_time-span',
-                                  timespanPlaceholder) + closeLine
-                    output.write(line)
-                    line = triple(timespanPlaceholder,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E52_Time-Span') + closeLine
-                    output.write(line)
-                    line = triple(timespanPlaceholder,
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + timespan + '\"') + closeLine
-                    output.write(line)
-
-                pastActorPlaceholder = museoCoords.prefix + '_' + pl
-                newLoc = row['PRCD' + k].replace(' ', '')
-                newActorPlaceholder = museoCoords.prefix + '_' + newLoc
-
-                # E10 P26 E74 (moved to)
-
-                if newActorPlaceholder != '':
-                    line = triple(newe10placeHolder,
-                                  cidocCoords.prefix + 'P29_custody_received_by',
-                                  newActorPlaceholder) + closeLine
-                    output.write(line)
-
-                # E10 P27 E74
-
-                pastActorLabel = row['PRCD' + f]
-
-                line = triple(newe10placeHolder,
-                              cidocCoords.prefix + 'P28_custody_surrendered_by',
-                              pastActorPlaceholder) + closeLine
-                output.write(line)
-                line = triple(pastActorPlaceholder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E39_Actor') + closeLine
-                output.write(line)
-                line = triple(pastActorPlaceholder,
-                              schemaCoords.prefix + 'label',
-                              '\"' + pastActorLabel + '\"') + closeLine
-                output.write(line)
-
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P49_has_former_or_current_keeper',
-                              pastActorPlaceholder) + closeLine
-                output.write(line)
-
-                # E74 P74 E53
-
-                pastResidenceLabel = row['PRVC' + f]
-                pastResidencePlaceHolder = museoCoords.prefix + row['PRVC' + f]
-
-                line = triple(pastActorPlaceholder,
-                              cidocCoords.prefix + 'P74_has_current_or_former_residence',
-                              pastResidencePlaceHolder) + closeLine
-                output.write(line)
-
-        ####
-
-        pastActor = ''
-        newActor = ''
-        pl = ''
-
-        if row['LDCN'] != '':
-            newActor = ' a ' + row['LDCN']
-
-        if row['PRCD' + last] != '':
-            pastActor = ' da ' + row['PRCD' + last]
-            pl = row['PRCD' + last].replace(' ', '')
-
-        line = triple(e10placeHolder,
-                      cidocCoords.prefix + 'P30_transferred_custody_of',
-                      datplaceHolder) + closeLine
-        output.write(line)
-        line = triple(e10placeHolder,
-                      nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E10_Transfer_of_Custody') + closeLine
-        output.write(line)
-        line = triple(e10placeHolder,
-                      schemaCoords.prefix + 'label',
-                      '\"Passaggio di ' + row['SGTI'] + pastActor +
-                      newActor + '\"') + closeLine
-        output.write(line)
-
-        if row['PRDU' + last] != '':
-            timespan = row['PRDU' + last]
-
-            tt = timespan.replace(' ', '')
-            ts = tt.replace('/', '')
-
-            timespanPlaceholder = museoCoords.prefix + '_' + ts
-
-            # E10 P4 E52
-
-            line = triple(e10placeHolder,
-                          cidocCoords.prefix + 'P4_has_time-span',
-                          timespanPlaceholder) + closeLine
-            output.write(line)
-            line = triple(timespanPlaceholder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E52_Time-Span') + closeLine
-            output.write(line)
-            line = triple(timespanPlaceholder,
-                          schemaCoords.prefix + 'label',
-                          '\"' + timespan + '\"') + closeLine
-            output.write(line)
-
-        pastActorPlaceholder = museoCoords.prefix + '_' + pl
-        newLocPlaceholder = e74placeHolder
-
-        # E10 P26 E74 (moved to)
-
-        if newLocPlaceholder != '':
-            line = triple(e10placeHolder,
-                          cidocCoords.prefix + 'P29_custody_received_by',
-                          newLocPlaceholder) + closeLine
-            output.write(line)
-
-        # E10 P27 E74
-
-        pastActorLabel = row['PRCD' + last]
-
-        line = triple(e10placeHolder,
-                      cidocCoords.prefix + 'P28_custody_surrendered_by',
-                      pastActorPlaceholder) + closeLine
-        output.write(line)
-        line = triple(pastActorPlaceholder,
-                      nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E39_Actor') + closeLine
-        output.write(line)
-        line = triple(pastActorPlaceholder,
-                      schemaCoords.prefix + 'label',
-                      '\"' + pastActorLabel + '\"') + closeLine
-        output.write(line)
-
-        line = triple(datplaceHolder,
-                      cidocCoords.prefix + 'P49_has_former_or_current_keeper',
-                      pastActorPlaceholder) + closeLine
-        output.write(line)
-
-        # E74 P74 E53
-
-        pastResidenceLabel = row['PRVC' + last]
-        pastResidencePlaceHolder = museoCoords.prefix + row['PRVC' + last]
-
-        if row['PRVP' + last] != '':
-            pastResidenceLabel = pastResidenceLabel + ' (' + row['PRVP' + last] + ')'
-
-        if row['PRVR' + last] != '':
-            pastResidenceLabel = pastResidenceLabel + ', ' + row['PRVR' + last]
-
-        if row['PRVS' + last] != '':
-            pastResidenceLabel = pastResidenceLabel + ', ' + row['PRVS' + last]
-
-        line = triple(pastActorPlaceholder,
-                      cidocCoords.prefix + 'P74_has_current_or_former_residence',
-                      pastResidencePlaceHolder) + closeLine
-        output.write(line)
-        line = triple(pastResidencePlaceHolder,
-                      nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E53_Place') + closeLine
-        output.write(line)
-
-        # E22 P44 E3
-
-        if row['STCC'] != '':
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P44_has_condition',
-                          e3placeHolder) + closeLine
-            output.write(line)
-            line = triple(e3placeHolder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E3_Condition_State') + closeLine
-            output.write(line)
-            line = triple(e3placeHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"Condizione di: ' + row['SGTI'] + '\"') + closeLine
-            output.write(line)
-
-            line = triple(e3placeHolder,
-                          cidocCoords.prefix + 'P2_has_type',
-                          '\"' + row['STCC'] + '\"') + closeLine
-            output.write(line)
-
-        # E22 P65 E34
-        if (row['ISRI'] != ''):
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P56_bears_feature',
-                          e25placeHolder) + closeLine
-            output.write(line)
-            line = triple(e25placeHolder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E25_Man-Made_Feature') + closeLine
-            output.write(line)
-            line = triple(e25placeHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"Iscrizione su ' + subj + '\"') + closeLine
-            output.write(line)
-
-            line = triple(e25placeHolder,
-                          cidocCoords.prefix + 'P128_carries',
-                          e34placeHolder) + closeLine
-            output.write(line)
-            line = triple(e34placeHolder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E34_Inscription') + closeLine
-            output.write(line)
-            line = triple(e34placeHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"Iscrizione: ' + row['ISRI'] + '\"') + closeLine
-            output.write(line)
-
-            pl = row['ISRI'].replace(' ', '-')
-            pla = pl.replace('.', '')
-            line = triple(e34placeHolder,
-                          cidocCoords.prefix + 'P3_has_note',
-                          '\"' + row['ISRI'] + '\"') + closeLine
-            output.write(line)
-
-            # E34 P2 E55
-
-            if (row['ISRT'] != ''):
-                rr = row['ISRT'].replace(' ', '')
-                line = triple(e34placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"' + row['ISRT'] + '\"') + closeLine
-                output.write(line)
-
-            # E34 P72 E56
-
-            if (row['ISRL'] != ''):
-                line = triple(e34placeHolder,
-                              cidocCoords.prefix + 'P72_has_language',
-                              museoCoords.prefix + '_' + row['ISRL']) + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + '_' + row['ISRL'],
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E56_Language') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + '_' + row['ISRL'],
-                              schemaCoords.prefix + 'label',
-                              '\"' + row['ISRL'] + '\"') + closeLine
-                output.write(line)
-
-            if row['ISRS'] != '':
-                line = triple(e34placeHolder,
-                              cidocCoords.prefix + 'P92i_was_brought_into_existence_by',
-                              e65placeHolder) + closeLine
-                output.write(line)
-                line = triple(e65placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E65_Creation') + closeLine
-                output.write(line)
-                line = triple(e65placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"Creazione dell\'Iscrizione ' + row['ISRI'] + '\"') + closeLine
-                output.write(line)
-
-                if row['ISRS']:
-                    ss = row['ISRS'].replace(' ', '')
-                    tecPlaceholder = museoCoords.prefix + url + '_' + ss
-                    line = triple(e65placeHolder,
-                                  cidocCoords.prefix + 'P32_used_general_technique',
-                                  tecPlaceholder) + closeLine
-                    output.write(line)
-                    line = triple(tecPlaceholder,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E55_Type') + closeLine
-                    output.write(line)
-                    line = triple(tecPlaceholder,
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['ISRS'] + '\"') + closeLine
-                    output.write(line)
-
-            if row['ISRP'] != '':
-                line = triple(e25placeHolder,
-                              cidocCoords.prefix + 'P3_has_note',
-                              '\"' + row['ISRP'] + '\"^^xsd:string') + closeLine
-                output.write(line)
-
-        unit = ''
-        if (row['MISU'] != ''):
-            unit = row['MISU']
-
-        valueA = ''
-        valueL = ''
-
-        if (row['MISA'] != ''):
-            value = row['MISA']
-            valueA = value.replace(',', 'v')
-
-        if (row['MISL'] != ''):
-            value = row['MISL']
-            valueL = value.replace(',', 'v')
-
-        # Altezza
-        # E22 P43 E54
-        if (row['MISA'] != ''):
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P43_has_dimension',
-                          museoCoords.prefix + url + '_Altezza') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + url + '_Altezza',
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E54_Dimension') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + url + '_Altezza',
-                          schemaCoords.prefix + 'label',
-                          '\"Altezza: ' + row['MISA'] + row['MISU'] + '\"') + closeLine
-            output.write(line)
-
-            # E54 P90 E60
-            line = triple(museoCoords.prefix + url + '_Altezza',
-                          cidocCoords.prefix + 'P90_has_value',
-                          '\"' + row['MISA'] + '\"^^xsd:integer') + closeLine
-            output.write(line)
-
-            # E54 P2 E55
-
-            line = triple(museoCoords.prefix + url + '_Altezza',
-                          cidocCoords.prefix + 'P2_has_type',
-                          aatCoords.prefix + '300055644') + closeLine
-            output.write(line)
-            line = triple(aatCoords.prefix + '300055644',
-                          schemaCoords.prefix + 'label',
-                          '\"altezza\"') + closeLine
-            output.write(line)
-
-            # E54 P91 E58
-            if (row['MISU'] != ''):
-                line = triple(museoCoords.prefix + url + '_Altezza',
-                              cidocCoords.prefix + 'P91_has_unit',
-                              aatCoords.prefix + '300379098') + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + '300379098',
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E58_Measurement_Unit') + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + '300379098',
-                              schemaCoords.prefix + 'label',
-                              '\"' + row['MISU'] + '\"') + closeLine
-                output.write(line)
-
-        # Larghezza
-        # E22 P43 E54
-        if (row['MISL'] != ''):
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P43_has_dimension',
-                          museoCoords.prefix + url + '_Larghezza') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + url + '_Larghezza',
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E54_Dimension') + closeLine
-            output.write(line)
-            line = triple(museoCoords.prefix + url + '_Larghezza',
-                          schemaCoords.prefix + 'label',
-                          '\"Larghezza: ' + row['MISL'] + row['MISU'] + '\"') + closeLine
-            output.write(line)
-
-            # E54 P90 E60
-            line = triple(museoCoords.prefix + url + '_Larghezza',
-                          cidocCoords.prefix + 'P90_has_value',
-                          '\"' + row['MISL'] + '\"^^xsd:integer') + closeLine
-            output.write(line)
-
-            # E54 P2 E55
-
-            line = triple(museoCoords.prefix + url + '_Larghezza',
-                          cidocCoords.prefix + 'P2_has_type',
-                          aatCoords.prefix + '300055647') + closeLine
-            output.write(line)
-            line = triple(aatCoords.prefix + '300055647',
-                          schemaCoords.prefix + 'label',
-                          '\"larghezza\"') + closeLine
-            output.write(line)
-
-            # E54 P91 E58
-            if (row['MISU'] != ''):
-                line = triple(museoCoords.prefix + url + '_Larghezza',
-                              cidocCoords.prefix + 'P91_has_unit',
-                              aatCoords.prefix + '300379098') + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + '300379098',
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E58_Measurement_Unit') + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + '300379098',
-                              schemaCoords.prefix + 'label',
-                              '\"' + row['MISU'] + '\"') + closeLine
-                output.write(line)
-
-        # if row['MTC'] != '':
-        #     mtcs = []
-        #     if '/' in row['MTC']:
-        #         mtcs = row['MTC'].split('/')
-        #     else:
-        #         mtcs.append(row['MTC'])
-
-        #     for tc in mtcs:
-        #         mtc = tc.lstrip()
-        #         el = get_elem(mtc)
-        #         if (el[1] == 'MTC/M'):
-        #             line = triple(datplaceHolder,
-        #                           cidocCoords.prefix + 'P45_consists_of',
-        #                           aatCoords.prefix + el[0]) + closeLine
-        #             output.write(line)
-        #             line = triple(aatCoords.prefix + el[0],
-        #                           nsCoords.prefix + 'type',
-        #                           cidocCoords.prefix + 'E57_Material') + closeLine
-        #             output.write(line)
-        #             line = triple(aatCoords.prefix + el[0],
-        #                           schemaCoords.prefix + 'label',
-        #                           '\"' + mtc + '\"') + closeLine
-        #             output.write(line)
-
-        #         else:   #E12 Production - P32 used technique - E55 Type
-        #             line = triple(e12placeHolder,
-        #                           cidocCoords.prefix + 'P32_used_general_technique',
-        #                           aatCoords.prefix + el[0]) + closeLine
-        #             output.write(line)
-        #             if e12FplaceHolder != '':
-        #                 line = triple(e12FplaceHolder,
-        #                               cidocCoords.prefix + 'P32_used_general_technique',
-        #                               aatCoords.prefix + el[0]) + closeLine
-        #                 output.write(line)
-        #             line = triple(aatCoords.prefix + el[0],
-        #                           nsCoords.prefix + 'type',
-        #                           cidocCoords.prefix + 'E55_Type') + closeLine
-        #             output.write(line)
-        #             line = triple(aatCoords.prefix + el[0],
-        #                           schemaCoords.prefix + 'label',
-        #                           '\"' + mtc + '\"') + closeLine
-        #             output.write(line)
-
-        if row['MTC'] != '':
-                mtcs = []
-                if '/' in row['MTC']:
-                    mtcs = row['MTC'].split('/')
-                else:
-                    mtcs.append(row['MTC'])
-
-
-                for tc in mtcs:
-                    mtc = tc.lstrip()
-                    el = get_elem(mtc)
-                    if el[1] == 'MTC/M':
-
-                        line = triple(datplaceHolder,
-                                      cidocCoords.prefix + 'P45_consists_of',
-                                      aatCoords.prefix + el[0]) + closeLine
-                        output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E57_Material') + closeLine
-                        output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + mtc + '\"') + closeLine
-                        output.write(line)
-
-                    else:   #E12 Production - P32 used technique - E55 Type
-                        line = triple(e12placeHolder,
-                                      cidocCoords.prefix + 'P32_used_general_technique',
-                                      aatCoords.prefix + el[0]) + closeLine
-                        output.write(line)
-                        if e12FplaceHolder != '':
-                            line = triple(e12FplaceHolder,
-                                          cidocCoords.prefix + 'P32_used_general_technique',
-                                          aatCoords.prefix + el[0]) + closeLine
-                            output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E55_Type') + closeLine
-                        output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + mtc + '\"') + closeLine
-                        output.write(line)
-
-            
-
-        # E12 P140i E13
-        if row['AUTM'] != '':
-            mot = row['AUTM'].replace(' ', '_')
-            e55placeHolder = museoCoords.prefix + url + '_' + mot
-            line = triple(e12placeHolder,
-                          cidocCoords.prefix + 'P140i_was_attributed_by',
-                          e13placeHolder) + closeLine
-            output.write(line)
-            line = triple(e13placeHolder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E13_Attribute_Assignment') + closeLine
-            output.write(line)
-            line = triple(e13placeHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"Motivazione attribuzione\"') + closeLine
-            output.write(line)
-
-            line = triple(e13placeHolder,
-                          cidocCoords.prefix + 'P2_has_type',
-                          '\"' + row['AUTM'] + '\"') + closeLine
-            output.write(line)
-
-            aut = get_aut_url(row['AUTH'])
-            aut_url = aut[0]
-            AuthorPlaceholder = autCoords.prefix + aut_url
-
-            line = triple(e13placeHolder,
-                          cidocCoords.prefix + 'P141_assigned',
-                          AuthorPlaceholder) + closeLine
-            output.write(line)
-
-        # E22 P44 E62
-
-        if row['NSC'] != '':
-            ph = row['NSC'].replace(' "', ' «')
-            phr = ph.replace('"', '»')
-
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P3_has_note',
-                          '\"' + phr + '\"^^xsd:string') + closeLine
-            output.write(line)
-
-        iconclass = row['DESI']
-        icon = iconclass.replace(' ', '')
-
-        list_icon = []
-
-        if ':' in icon:
-            list_icon = icon.split(':')
-        else:
-            list_icon.append(icon)
- 
-            for ic in list_icon:
-                siglaiconclass = str(ic)
-                #url = 'http://iconclass.org/rdk/' + str(ic)
-                #html = urlopen(url).read()
-                #soup = BeautifulSoup(html, 'html.parser')
-
-                # kill all script and style elements
-                #for script in soup(["script", "style"]):
-                #    script.extract()  # rip it out
-
-                # get text
-                #text = soup.get_text()
-
-                #pretty = soup.prettify()
-
-                #ff = soup.find("div", {"id": "ic_current"})
-                #dd = ff.find("a", {"class", "ic_notation"})
-                #ss = dd.text
-                #x = ss.find(' ')
-
-                #icon_label = ss[x + 1:]
-
-                siglaiconclass = ic.replace("%28", "(",)
-                siglaiconclassok = siglaiconclass.replace("%29", ")")
-                siglaiconclassokplaceHolder = '<https://iconclass.org/' + siglaiconclassok + '>'
-                
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P62_depicts',
-                              siglaiconclassokplaceHolder) + closeLine
-                output.write(line)
-                
-                line = triple(siglaiconclassokplaceHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E1_CRM_Entity') + closeLine
-                output.write(line)
-                
-                line = triple(siglaiconclassokplaceHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"' + siglaiconclassok + '\"' ) + closeLine
-                output.write(line)
-                line = triple(siglaiconclassokplaceHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Sigla Iconclass\"') + closeLine
-                output.write(line)
-        
-        
-        datiniplaceHolder = '<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003-0001806>'
-        line = triple(datplaceHolder,
-                cidocCoords.prefix + 'P62_depicts',
-                datiniplaceHolder) + closeLine
-        output.write(line)
-        
-        # P2 Opera d'arte
-        line = triple(datplaceHolder,
-                cidocCoords.prefix + 'P2_has_type',
-                '\"Opera d\'Arte\"') + closeLine
-        output.write(line)
-
-        output.write('\n')
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 143
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Luoghi.py

@@ -1,143 +0,0 @@
-# Utilities to read/write csv files
-import csv
-# Utilities to handle character encodings
-import unicodedata
-# Ordered Dicts
-from collections import OrderedDict
-
-import json
-
-
-# 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/alessiaspadi/Documents/RESTORE/temp_ovi/prove/toponimi/'
-export_dir = '/Users/alessiaspadi/Documents/RESTORE/temp_ovi/prove/toponimi/'
-
-
-# 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
-aspoCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dat:')
-placeCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/>', 'pl:')
-oviCoords = RDFcoords('<http://www.ovi.cnr.it/>', 'ovi:')
-cidocCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/>', 'crm:')
-tgnCoords = RDFcoords('<http://vocab.getty.edu/tgn/>', 'tgn:')
-nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')
-schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')
-repettiCoords = RDFcoords('<http://193.205.4.99/repetti/tester.php?idx=>', 'rpt:')
-owlCoords = RDFcoords('<http://www.w3.org/2002/07/owl#>', 'owl:')
-devCoords = RDFcoords('<http://dev.restore.ovi.cnr.it/vocabularies/places/>', 'dev:')
-
-
-
-# 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 ' + placeCoords.prefix + ' ' + placeCoords.uri + closeLine)
-    output.write('@prefix ' + aspoCoords.prefix + ' ' + aspoCoords.uri + closeLine)
-    output.write('@prefix ' + cidocCoords.prefix + ' ' + cidocCoords.uri + closeLine)
-    output.write('@prefix ' + tgnCoords.prefix + ' ' + tgnCoords.uri + closeLine)
-    output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)
-    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)
-    output.write('@prefix ' + repettiCoords.prefix + ' ' + repettiCoords.uri + closeLine)
-    output.write('@prefix ' + owlCoords.prefix + ' ' + owlCoords.uri + closeLine)
-    output.write('@prefix ' + devCoords.prefix + ' ' + devCoords.uri + closeLine)
-
-    output.write('\n')
-
-
-file = "Luoghi"
-max_entries = 1000000000
-
-with open(import_dir + file + '.csv', newline="") as csv_file, open(
-        export_dir + file + '.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
-
-        #placeHolders
-        devPlaceHolder = devCoords.prefix + row['id']
-        placePlaceHolder = tgnCoords.prefix + row['tgn']
-
-        line = triple(devPlaceHolder,
-                      nsCoords.prefix + 'type',
-                      cidocCoords.prefix + 'E53_Place') + closeLine
-        output.write(line)
-        line = triple(devPlaceHolder,
-                      schemaCoords.prefix + 'label',
-                      '\"' + row['name_place'] + '\"') + closeLine
-        output.write(line)
-
-        line = triple(devPlaceHolder,
-                      cidocCoords.prefix + 'P1_is_identified_by',
-                      '\"' + row['id'] + '\"') + closeLine
-        output.write(line)
-
-        if row['coordinates'] != '':
-            line = triple(devPlaceHolder,
-                          cidocCoords.prefix + "P168_place_is_defined_by",
-                          '\"' + row['coordinates'] + '\"') + closeLine
-            output.write(line)
-
-        line = triple(devPlaceHolder,
-                      owlCoords.prefix + 'sameAs',
-                      placePlaceHolder) + closeLine
-        output.write(line)
-        line = triple(placePlaceHolder,
-                      owlCoords.prefix + 'sameAs',
-                      devPlaceHolder) + closeLine
-        output.write(line)
-
-        if row['Repetti'] != '':
-            line = triple(devPlaceHolder,
-                          owlCoords.prefix + 'sameAs',
-                          repettiCoords.prefix + row['Repetti']) + closeLine
-            output.write(line)
-            line = triple(repettiCoords.prefix + row['Repetti'],
-                          owlCoords.prefix + 'sameAs',
-                          devPlaceHolder) + closeLine
-            output.write(line)
-
-        output.write('\n')
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 1121
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Martini.py

@@ -1,1121 +0,0 @@
-# Utilities to read/write csv files
-import csv
-# Utilities to handle character encodings
-import unicodedata
-# Ordered Dicts
-from collections import OrderedDict
-
-from urllib.request import urlopen
-#from bs4 import BeautifulSoup
-
-import json
-
-# 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('<https://iconclass.org/>', 'ico:')
-
-
-# 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 ' + nsCoords.prefix + ' ' + nsCoords.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('\n')
-
-
-filePrefix = 'OA_Data_'
-fileType = 'Martini'
-max_entries = 1000000000
-
-
-def get_aut_url(code):
-    aut_file = open(import_dir + 'AR20AUT_' + fileType + '.csv', newline="")
-    reader = csv.DictReader(aut_file)
-    for row in reader:
-        auth = int(row['AUTH'])
-        cod = int(code)
-        role = ''
-        if row['AUTQ'] != '':
-            role = row['AUTQ']
-        else:
-            role = ''
-        if auth == cod:
-            return [row['URL'], role]
-
-def get_role(role):
-    role_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/AAT_RUOLI.csv', newline="")
-    reader = csv.DictReader(role_file)
-    for row in reader:
-        if row['Label'] == role:
-            return row['AAT']
-
-def get_elem(mtc):
-    mtc_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/AAT_MTC.csv', newline="")
-    reader = csv.DictReader(mtc_file)
-    for row in reader:
-        if row['MTC'] == mtc:
-            return [row['AAT'], row['Type']]
-
-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
-
-        if row['RVEL'] == '' or row['RVEL'] == '0':
-
-            sb = ''
-            subj = ''
-            #pp = row['OGTD'] + ' (' + row['ACC'] + ') '
-            if row['SGTI'] != '':
-                sb = row['SGTI']
-
-            # Triplify the 'codice' -- should exist for every entry
-            codice = ''
-            if (row['NCTR'] != '' and row['NCTN'] != ''):
-                codice = row['NCTR'] + row['NCTN']
-
-            codiceP = ''
-            if (row['AUTH'] != ''):
-                codiceP = row['AUTH']
-
-            place = ''
-            if (row['PRVC'] != ''):
-                place = row['PRVC']
-
-            columnName = list(row)
-            url = row['URL']
-
-            # placeHolders
-            datplaceHolder = museoCoords.prefix + url
-            e1placeHolder = museoCoords.prefix + url + '_E1'
-            e3placeHolder = museoCoords.prefix + url + 'E3'
-            e10placeHolder = museoCoords.prefix + url + '_E10'
-            e12placeHolder = museoCoords.prefix + url + '_E12'
-            e13placeHolder = museoCoords.prefix + url + '_E13'
-            e21placeHolder = museoCoords.prefix + url + '_InE21'
-            e25placeHolder = museoCoords.prefix + url + '_E25'
-            e34placeHolder = museoCoords.prefix + url + '_E34'
-            e35placeHolder1 = museoCoords.prefix + url + '_E35'
-            e42placeHolder = museoCoords.prefix + url + '_E42'
-            e42CplaceHolder = museoCoords.prefix + url + '_E42_MPP'
-            e65placeHolder = museoCoords.prefix + url + '_InE65'
-            e73placeHolder = museoCoords.prefix + url + '_E73'
-            e74placeHolder = museoCoords.prefix + url + '_E74'
-
-            if (codice != ''):
-                line = triple(datplaceHolder, cidocCoords.prefix + 'P1_is_identified_by', e42placeHolder) + closeLine
-                output.write(line)
-                line = triple(e42placeHolder, nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E42_Identifier') + closeLine
-                output.write(line)
-
-                line = triple(e42placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"0' + codice + '\"') + closeLine
-                output.write(line)
-                ###
-                line = triple(e42placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Codice univoco del bene (NCT)\"') + closeLine
-                output.write(line)
-
-
-            # Write E22 Man Made Object & E73 Information Object -- should exist for every entry?
-            line = triple(datplaceHolder, nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E22_Man-Made_Object') + closeLine
-            output.write(line)
-            # Added by AS
-            line = triple(datplaceHolder, schemaCoords.prefix + 'label', '\"' + sb + '\"') + closeLine
-            output.write(line)
-            # End AS
-            line = triple(datplaceHolder, cidocCoords.prefix + 'P128_carries', e73placeHolder) + closeLine
-            output.write(line)
-            line = triple(e73placeHolder, nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E73_Information_Object') + closeLine
-            output.write(line)
-
-            # AS
-            ss = ''
-            if row['SGTI'] != '':
-                ss = row['SGTI']
-            else:
-                ss = 'senza titolo'
-
-            line = triple(e73placeHolder, schemaCoords.prefix + 'label',
-                          '\"Opera d\'arte raffigurante ' + ss + '\"') + closeLine
-            output.write(line)
-
-            # E73 - P2 - E55
-
-            tt = ''
-            typeLabel = ''
-
-            if row['OGTD'] == 'dipinto':
-                tt = aatCoords.prefix + "300033618"
-            elif row['OGTD'] == 'rilievo':
-                tt = aatCoords.prefix + "300047230"
-            elif row['OGTD'] == 'polittico':
-                tt = aatCoords.prefix + "300178235"
-            elif row['OGTD'] == 'predella':
-                tt = aatCoords.prefix + "300003745"
-
-            line = triple(e73placeHolder,
-                          cidocCoords.prefix + 'P2_has_type',
-                          tt) + closeLine
-            output.write(line)
-            line = triple(tt, schemaCoords.prefix + 'label',
-                          '\"' + row['OGTD'] + '\"') + closeLine
-            output.write(line)
-
-            # E73 - P1 - E35
-
-            if row['SGTT'] != '':
-                line = triple(e73placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e35placeHolder1) + closeLine
-                output.write(line)
-                line = triple(e35placeHolder1, nsCoords.prefix + 'type', cidocCoords.prefix + 'E35_Title') + closeLine
-                output.write(line)
-                line = triple(e35placeHolder1, schemaCoords.prefix + 'label', '\"' + row['SGTT'] + '\"') + closeLine
-                output.write(line)
-
-            # E22 - P62 - E1
-
-            if row['SGTI'] != '':
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P62_depicts',
-                              e1placeHolder) + closeLine
-                output.write(line)
-                line = triple(e1placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E1_CRM_Entity') + closeLine
-                output.write(line)
-                line = triple(e1placeHolder,
-                              schemaCoords.prefix + 'label', '\"' +
-                              row['SGTI'] + '\"') + closeLine
-                output.write(line)
-
-                line = triple(e1placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Identificazione Iconografica\"') + closeLine
-                output.write(line)
-
-            # Attention: these triples are identified only for C100005 Museo di Palazzo Pretorio
-
-            if row['ESC'] == 'C100005':
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P52_has_current_owner',
-                              '<https://palazzopretorio.prato.it/it/>') + closeLine
-                output.write(line)
-                line = triple('<https://palazzopretorio.prato.it/it/>',
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E74_Group') + closeLine
-                output.write(line)
-                line = triple('<https://palazzopretorio.prato.it/it/>',
-                              schemaCoords.prefix + 'label',
-                              '\"Museo di Palazzo Pretorio\"') + closeLine
-                output.write(line)
-
-            currentLocation = ''
-
-            # E22 - P54 - E53
-            if row['LDCN'] != '':
-                if row['LDCS'] != '':
-                    currentLocation = row['LDCS']
-                else:
-                    currentLocation = currentLocation
-                if row['LDCM'] != '':
-                    currentLocation = currentLocation + ', ' + row['LDCM']
-                else:
-                    currentLocation = currentLocation
-                if row['LDCN'] != '':
-                    currentLocation = currentLocation + ', ' + row['LDCN']
-                else:
-                    currentLocation = currentLocation
-
-                currentLocation = currentLocation + ', ' + row['PVCC'] + ' (' + row['PVCP'] + ')'
-
-                line = triple(datplaceHolder, cidocCoords.prefix + 'P54_has_current_permanent_location',
-                              '\"' + currentLocation + '\"') + closeLine
-                output.write(line)
-
-            e12FplaceHolder = ''
-            if row['DTSI'] != row['DTSF']:
-                e12FplaceHolder = museoCoords.prefix + url + '_E12F'
-
-            # Write E12 Production -- should exist for every entry?
-            # E12 P108 E22
-            line = triple(e12placeHolder, cidocCoords.prefix + 'P108_has_produced', datplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e12placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E12_Production') + closeLine
-            output.write(line)
-            # E73 P108i E12
-            line = triple(e73placeHolder, cidocCoords.prefix + 'P108i_was_produced_by', e12placeHolder) + closeLine
-            output.write(line)
-
-            if e12FplaceHolder != '':
-                line = triple(e12FplaceHolder, cidocCoords.prefix + 'P108_has_produced', datplaceHolder) + closeLine
-                output.write(line)
-                line = triple(e12FplaceHolder, nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E12_Production') + closeLine
-                output.write(line)
-                line = triple(e12FplaceHolder, schemaCoords.prefix + 'label',
-                              '\"Fine produzione di ' + row['SGTI'] + '\"') + closeLine
-                output.write(line)
-                # E73 P108i E12
-                line = triple(e73placeHolder, cidocCoords.prefix + 'P108i_was_produced_by', e12FplaceHolder) + closeLine
-                output.write(line)
-                # E12 P140i E13
-                line = triple(e12FplaceHolder,
-                              cidocCoords.prefix + 'P140i_was_attributed_by',
-                              e13placeHolder) + closeLine
-                output.write(line)
-                # E12 P2
-                line = triple(e12FplaceHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Fine\"^^xsd:string') + closeLine
-                output.write(line)
-                line = triple(e12placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Inizio\"^^xsd:string') + closeLine
-                output.write(line)
-                line = triple(e12placeHolder, schemaCoords.prefix + 'label',
-                              '\"Inizio produzione di ' + row['SGTI'] + '\"') + closeLine
-                output.write(line)
-            else:
-                line = triple(e12placeHolder, schemaCoords.prefix + 'label',
-                              '\"Produzione di ' + row['SGTI'] + '\"') + closeLine
-                output.write(line)
-
-            tcl = []
-            for name in columnName:
-                if 'TCL' in name:
-                    tcl.append(name)
-
-            # E12 - P7 - E53
-            for el in tcl:
-                i = 0
-                if row[el] == 'luogo di produzione':
-                    pl = ''
-                    if i == 0:
-                        pl = row['PRVC']
-                    else:
-                        pl = row['PRVC' + i]
-                    line = triple(e12placeHolder,
-                                  cidocCoords.prefix + 'P7_took_place_at',
-                                  museoCoords.prefix + pl) + closeLine
-                    output.write(line)
-                    if e12FplaceHolder != '':
-                        line = triple(e12FplaceHolder,
-                                      cidocCoords.prefix + 'P7_took_place_at',
-                                      museoCoords.prefix + pl) + closeLine
-                        output.write(line)
-                i = i + 1
-
-            # E12 - PC14 - E21
-            if row['AUTH'] != '':
-                aut = get_aut_url(row['AUTH'])
-                aut_url = aut[0]
-                aut_role = aut[1]
-                ll = row['AUTN'] + '_' + aut_role
-                lab = ll.replace(' ', '')
-                label = lab.replace(',', '')
-
-                AuthorPlaceholder = autCoords.prefix + aut_url
-                line = triple(museoCoords.prefix + '_' + label,
-                              cidocCoords.prefix + 'P01_has_domain',
-                              e12placeHolder) + closeLine
-                output.write(line)
-                if e12FplaceHolder != '':
-                    line = triple(museoCoords.prefix + '_' + label,
-                                  cidocCoords.prefix + 'P01_has_domain',
-                                  e12FplaceHolder) + closeLine
-                    output.write(line)
-
-            if 'AUTH1' in columnName:
-                if row['AUTH1'] != '':
-                    aut = get_aut_url(row['AUTH1'])
-                    aut_url = aut[0]
-                    aut_role = aut[1]
-                    ll = row['AUTN1'] + '_' + aut_role
-                    lab = ll.replace(' ', '')
-                    label = lab.replace(',', '')
-
-                    AuthorPlaceholder = autCoords.prefix + aut_url
-                    line = triple(museoCoords.prefix + '_' + label,
-                                  cidocCoords.prefix + 'P01_has_domain',
-                                  e12placeHolder) + closeLine
-                    output.write(line)
-                    if e12FplaceHolder != '':
-                        line = triple(museoCoords.prefix + '_' + label,
-                                      cidocCoords.prefix + 'P01_has_domain',
-                                      e12FplaceHolder) + closeLine
-                        output.write(line)
-
-            # E12 - PC14 - E21
-            if 'CMMN' in columnName:
-                if row['CMMN'] != '':
-                    cc = row['CMMN']
-                    cm = cc.replace(' ', '')
-                    cmmn = cm.replace(',', '')
-
-                    cmmPlaceholder = museoCoords.prefix + '_' + cmmn
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  cidocCoords.prefix + 'P01_has_domain',
-                                  e12placeHolder) + closeLine
-                    output.write(line)
-                    if e12FplaceHolder != '':
-                        line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                      cidocCoords.prefix + 'P01_has_domain',
-                                      e12FplaceHolder) + closeLine
-                        output.write(line)
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'PC14_carried_out_by') + closeLine
-                    output.write(line)
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['CMMN'] + ' nel ruolo di committente\"') + closeLine
-                    output.write(line)
-
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  cidocCoords.prefix + 'P02_has_range',
-                                  cmmPlaceholder) + closeLine
-                    output.write(line)
-                    line = triple(cmmPlaceholder,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E39_Actor') + closeLine
-                    output.write(line)
-                    line = triple(cmmPlaceholder,
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['CMMN'] + '\"') + closeLine
-                    output.write(line)
-
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  cidocCoords.prefix + 'P14.1_in_the_role_of',
-                                  museoCoords.prefix + '_client') + closeLine
-                    output.write(line)
-                    line = triple(museoCoords.prefix + '_client',
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E55_Type') + closeLine
-                    output.write(line)
-                    line = triple(museoCoords.prefix + '_client',
-                                  schemaCoords.prefix + 'label',
-                                  '\"Committente\"') + closeLine
-                    output.write(line)
-
-            # E12 - P4 - E52
-            if row['DTSI'] != '':
-                line = triple(e12placeHolder,
-                              cidocCoords.prefix + 'P4_has_time-span',
-                              museoCoords.prefix + row['DTSI']) + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + row['DTSI'],
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E52_Time-Span') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + row['DTSI'],
-                              schemaCoords.prefix + 'label',
-                              '\"' + row['DTSI'] + '\"') + closeLine
-                output.write(line)
-
-            if e12FplaceHolder != '':
-                line = triple(e12FplaceHolder,
-                              cidocCoords.prefix + 'P4_has_time-span',
-                              museoCoords.prefix + row['DTSF']) + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + row['DTSF'],
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E52_Time-Span') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + row['DTSF'],
-                              schemaCoords.prefix + 'label',
-                              '\"' + row['DTSF'] + '\"') + closeLine
-                output.write(line)
-
-            tcl = []
-            for name in columnName:
-                if 'TCL' in name:
-                    tcl.append(name)
-
-            j = 0
-
-            for el in tcl:
-                if row[el] != '':
-                    j = j + 1
-
-            last = str(j - 1)
-
-            n = len(tcl) - 1
-
-            for i in range(n):
-
-                k = str(i + 1)
-
-                if i + 1 == 1:
-                    w = ''
-                else:
-                    w = i
-
-                f = str(w)
-
-                if row['TCL' + k] != '':
-
-                    pastActor = ''
-                    newActor = ''
-                    pl = ''
-
-                    if row['PRCD' + k] != '':
-                        newActor = ' a ' + row['PRCD' + k]
-
-                    if row['PRCD' + f] != '':
-                        pastActor = ' da ' + row['PRCD' + f]
-                        pl = row['PRCD' + f].replace(' ', '')
-
-                    newe10placeHolder = museoCoords.prefix + url + "_E10_" + k
-
-                    line = triple(newe10placeHolder,
-                                  cidocCoords.prefix + 'P30_transferred_custody_of',
-                                  datplaceHolder) + closeLine
-                    output.write(line)
-                    line = triple(newe10placeHolder,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E10_Transfer_of_Custody') + closeLine
-                    output.write(line)
-                    line = triple(newe10placeHolder,
-                                  schemaCoords.prefix + 'label',
-                                  '\"Passaggio di ' + row['SGTI'] + pastActor +
-                                  newActor + '\"') + closeLine
-                    output.write(line)
-
-                    if row['PRDI' + f] != '':
-                        timespan = row['PRDI' + f]
-
-                        tt = timespan.replace(' ', '')
-                        tp = tt.replace('.', '')
-                        ts = tp.replace('/', '')
-
-                        timespanPlaceholder = museoCoords.prefix + '_' + ts
-
-                        # E10 P4 E52
-
-                        line = triple(newe10placeHolder,
-                                      cidocCoords.prefix + 'P4_has_time-span',
-                                      timespanPlaceholder) + closeLine
-                        output.write(line)
-                        line = triple(timespanPlaceholder,
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E52_Time-Span') + closeLine
-                        output.write(line)
-                        line = triple(timespanPlaceholder,
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + timespan + '\"') + closeLine
-                        output.write(line)
-
-                    pastActorPlaceholder = museoCoords.prefix + '_' + pl
-                    newLoc = row['PRCD' + k].replace(' ', '')
-                    newActorPlaceholder = museoCoords.prefix + '_' + newLoc
-
-                    # E10 P26 E74 (moved to)
-
-                    if newActorPlaceholder != '':
-                        line = triple(newe10placeHolder,
-                                      cidocCoords.prefix + 'P29_custody_received_by',
-                                      newActorPlaceholder) + closeLine
-                        output.write(line)
-
-                    # E10 P27 E74
-
-                    pastActorLabel = row['PRCD' + f]
-
-                    line = triple(newe10placeHolder,
-                                  cidocCoords.prefix + 'P28_custody_surrendered_by',
-                                  pastActorPlaceholder) + closeLine
-                    output.write(line)
-                    line = triple(pastActorPlaceholder,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E39_Actor') + closeLine
-                    output.write(line)
-                    line = triple(pastActorPlaceholder,
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + pastActorLabel + '\"') + closeLine
-                    output.write(line)
-
-                    line = triple(datplaceHolder,
-                                  cidocCoords.prefix + 'P49_has_former_or_current_keeper',
-                                  pastActorPlaceholder) + closeLine
-                    output.write(line)
-
-                    # E74 P74 E53
-
-                    pastResidenceLabel = row['PRVC' + f]
-                    pastResidencePlaceHolder = museoCoords.prefix + row['PRVC' + f]
-
-                    line = triple(pastActorPlaceholder,
-                                  cidocCoords.prefix + 'P74_has_current_or_former_residence',
-                                  pastResidencePlaceHolder) + closeLine
-                    output.write(line)
-
-            ####
-
-            pastActor = ''
-            newActor = ''
-            pl = ''
-
-            if row['LDCN'] != '':
-                newActor = ' a ' + row['LDCN']
-
-            if row['PRCD' + last] != '':
-                pastActor = ' da ' + row['PRCD' + last]
-                pl = row['PRCD' + last].replace(' ', '')
-
-            line = triple(e10placeHolder,
-                          cidocCoords.prefix + 'P30_transferred_custody_of',
-                          datplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e10placeHolder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E10_Transfer_of_Custody') + closeLine
-            output.write(line)
-            line = triple(e10placeHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"Passaggio di ' + row['SGTI'] + pastActor +
-                          newActor + '\"') + closeLine
-            output.write(line)
-
-            if row['PRDU' + last] != '':
-                timespan = row['PRDU' + last]
-
-                tt = timespan.replace(' ', '')
-                ts = tt.replace('/', '')
-
-                timespanPlaceholder = museoCoords.prefix + '_' + ts
-
-                # E10 P4 E52
-
-                line = triple(e10placeHolder,
-                              cidocCoords.prefix + 'P4_has_time-span',
-                              timespanPlaceholder) + closeLine
-                output.write(line)
-                line = triple(timespanPlaceholder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E52_Time-Span') + closeLine
-                output.write(line)
-                line = triple(timespanPlaceholder,
-                              schemaCoords.prefix + 'label',
-                              '\"' + timespan + '\"') + closeLine
-                output.write(line)
-
-            pastActorPlaceholder = museoCoords.prefix + '_' + pl
-            newLocPlaceholder = e74placeHolder
-
-            # E10 P26 E74 (moved to)
-
-            if newLocPlaceholder != '':
-                line = triple(e10placeHolder,
-                              cidocCoords.prefix + 'P29_custody_received_by',
-                              newLocPlaceholder) + closeLine
-                output.write(line)
-
-            # E10 P27 E74
-
-            pastActorLabel = row['PRCD' + last]
-
-            line = triple(e10placeHolder,
-                          cidocCoords.prefix + 'P28_custody_surrendered_by',
-                          pastActorPlaceholder) + closeLine
-            output.write(line)
-            line = triple(pastActorPlaceholder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E39_Actor') + closeLine
-            output.write(line)
-            line = triple(pastActorPlaceholder,
-                          schemaCoords.prefix + 'label',
-                          '\"' + pastActorLabel + '\"') + closeLine
-            output.write(line)
-
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P49_has_former_or_current_keeper',
-                          pastActorPlaceholder) + closeLine
-            output.write(line)
-
-            # E74 P74 E53
-
-            pastResidenceLabel = row['PRVC' + last]
-            pastResidencePlaceHolder = museoCoords.prefix + row['PRVC' + last]
-
-            if row['PRVP' + last] != '':
-                pastResidenceLabel = pastResidenceLabel + ' (' + row['PRVP' + last] + ')'
-
-            if row['PRVR' + last] != '':
-                pastResidenceLabel = pastResidenceLabel + ', ' + row['PRVR' + last]
-
-            if row['PRVS' + last] != '':
-                pastResidenceLabel = pastResidenceLabel + ', ' + row['PRVS' + last]
-
-            line = triple(pastActorPlaceholder,
-                          cidocCoords.prefix + 'P74_has_current_or_former_residence',
-                          pastResidencePlaceHolder) + closeLine
-            output.write(line)
-            line = triple(pastResidencePlaceHolder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E53_Place') + closeLine
-            output.write(line)
-
-            # E22 P44 E3
-
-            if row['STCC'] != '':
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P44_has_condition',
-                              e3placeHolder) + closeLine
-                output.write(line)
-                line = triple(e3placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E3_Condition_State') + closeLine
-                output.write(line)
-                line = triple(e3placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"Condizione di: ' + row['SGTI'] + '\"') + closeLine
-                output.write(line)
-
-                line = triple(e3placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"' + row['STCC'] + '\"') + closeLine
-                output.write(line)
-
-            # E22 P65 E34
-            if (row['ISRI'] != ''):
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P56_bears_feature',
-                              e25placeHolder) + closeLine
-                output.write(line)
-                line = triple(e25placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E25_Man-Made_Feature') + closeLine
-                output.write(line)
-                line = triple(e25placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"Iscrizione su ' + subj + '\"') + closeLine
-                output.write(line)
-
-                line = triple(e25placeHolder,
-                              cidocCoords.prefix + 'P128_carries',
-                              e34placeHolder) + closeLine
-                output.write(line)
-                line = triple(e34placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E34_Inscription') + closeLine
-                output.write(line)
-                line = triple(e34placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"Iscrizione: ' + row['ISRI'] + '\"') + closeLine
-                output.write(line)
-
-                pl = row['ISRI'].replace(' ', '-')
-                pla = pl.replace('.', '')
-                line = triple(e34placeHolder,
-                              cidocCoords.prefix + 'P3_has_note',
-                              '\"' + row['ISRI'] + '\"') + closeLine
-                output.write(line)
-
-                # E34 P2 E55
-
-                if (row['ISRT'] != ''):
-                    rr = row['ISRT'].replace(' ', '')
-                    line = triple(e34placeHolder,
-                                  cidocCoords.prefix + 'P2_has_type',
-                                  '\"' + row['ISRT'] + '\"') + closeLine
-                    output.write(line)
-
-                # E34 P72 E56
-
-                if (row['ISRL'] != ''):
-                    line = triple(e34placeHolder,
-                                  cidocCoords.prefix + 'P72_has_language',
-                                  museoCoords.prefix + '_' + row['ISRL']) + closeLine
-                    output.write(line)
-                    line = triple(museoCoords.prefix + '_' + row['ISRL'],
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E56_Language') + closeLine
-                    output.write(line)
-                    line = triple(museoCoords.prefix + '_' + row['ISRL'],
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['ISRL'] + '\"') + closeLine
-                    output.write(line)
-
-                if (row['ISRA'] != '') or (row['ISRS'] != ''):
-                    line = triple(e34placeHolder,
-                                  cidocCoords.prefix + 'P92i_was_brought_into_existence_by',
-                                  e65placeHolder) + closeLine
-                    output.write(line)
-                    line = triple(e65placeHolder,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E65_Creation') + closeLine
-                    output.write(line)
-                    line = triple(e65placeHolder,
-                                  schemaCoords.prefix + 'label',
-                                  '\"Creazione dell\'Iscrizione ' + row['ISRI'] + '\"') + closeLine
-                    output.write(line)
-
-                    if row['ISRA'] != '':
-                        line = triple(e65placeHolder,
-                                      cidocCoords.prefix + 'P14_carried_out_by',
-                                      e21placeHolder) + closeLine
-                        output.write(line)
-                        line = triple(e21placeHolder,
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E21_Person') + closeLine
-                        output.write(line)
-                        line = triple(e21placeHolder,
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + row['ISRA'] + '\"') + closeLine
-                        output.write(line)
-
-                    if row['ISRS']:
-                        ss = row['ISRS'].replace(' ', '')
-                        tecPlaceholder = museoCoords.prefix + url + '_' + ss
-                        line = triple(e65placeHolder,
-                                      cidocCoords.prefix + 'P32_used_general_technique',
-                                      tecPlaceholder) + closeLine
-                        output.write(line)
-                        line = triple(tecPlaceholder,
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E55_Type') + closeLine
-                        output.write(line)
-                        line = triple(tecPlaceholder,
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + row['ISRS'] + '\"') + closeLine
-                        output.write(line)
-
-                if row['ISRP'] != '':
-                    line = triple(e25placeHolder,
-                                  cidocCoords.prefix + 'P3_has_note',
-                                  '\"' + row['ISRP'] + '\"^^xsd:string') + closeLine
-                    output.write(line)
-
-            unit = ''
-            if (row['MISU'] != ''):
-                unit = row['MISU']
-
-            valueA = ''
-            valueL = ''
-
-            if (row['MISA'] != ''):
-                value = row['MISA']
-                valueA = value.replace(',', 'v')
-
-            if (row['MISL'] != ''):
-                value = row['MISL']
-                valueL = value.replace(',', 'v')
-
-            # Altezza
-            # E22 P43 E54
-            if (row['MISA'] != ''):
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P43_has_dimension',
-                              museoCoords.prefix + url + '_Altezza') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + url + '_Altezza',
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E54_Dimension') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + url + '_Altezza',
-                              schemaCoords.prefix + 'label',
-                              '\"Altezza: ' + row['MISA'] + row['MISU'] + '\"') + closeLine
-                output.write(line)
-
-                # E54 P90 E60
-                line = triple(museoCoords.prefix + url + '_Altezza',
-                              cidocCoords.prefix + 'P90_has_value',
-                              '\"' + row['MISA'] + '\"^^xsd:integer') + closeLine
-                output.write(line)
-
-                # E54 P2 E55
-
-                line = triple(museoCoords.prefix + url + '_Altezza',
-                              cidocCoords.prefix + 'P2_has_type',
-                              aatCoords.prefix + '300055644') + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + '300055644',
-                              schemaCoords.prefix + 'label',
-                              '\"altezza\"') + closeLine
-                output.write(line)
-
-                # E54 P91 E58
-                if (row['MISU'] != ''):
-                    line = triple(museoCoords.prefix + url + '_Altezza',
-                                  cidocCoords.prefix + 'P91_has_unit',
-                                  aatCoords.prefix + '300379098') + closeLine
-                    output.write(line)
-                    line = triple(aatCoords.prefix + '300379098',
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E58_Measurement_Unit') + closeLine
-                    output.write(line)
-                    line = triple(aatCoords.prefix + '300379098',
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['MISU'] + '\"') + closeLine
-                    output.write(line)
-
-            # Larghezza
-            # E22 P43 E54
-            if (row['MISL'] != ''):
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P43_has_dimension',
-                              museoCoords.prefix + url + '_Larghezza') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + url + '_Larghezza',
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E54_Dimension') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + url + '_Larghezza',
-                              schemaCoords.prefix + 'label',
-                              '\"Larghezza: ' + row['MISL'] + row['MISU'] + '\"') + closeLine
-                output.write(line)
-
-                # E54 P90 E60
-                line = triple(museoCoords.prefix + url + '_Larghezza',
-                              cidocCoords.prefix + 'P90_has_value',
-                              '\"' + row['MISL'] + '\"^^xsd:integer') + closeLine
-                output.write(line)
-
-                # E54 P2 E55
-
-                line = triple(museoCoords.prefix + url + '_Larghezza',
-                              cidocCoords.prefix + 'P2_has_type',
-                              aatCoords.prefix + '300055647') + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + '300055647',
-                              schemaCoords.prefix + 'label',
-                              '\"larghezza\"') + closeLine
-                output.write(line)
-
-                # E54 P91 E58
-                if (row['MISU'] != ''):
-                    line = triple(museoCoords.prefix + url + '_Larghezza',
-                                  cidocCoords.prefix + 'P91_has_unit',
-                                  aatCoords.prefix + '300379098') + closeLine
-                    output.write(line)
-                    line = triple(aatCoords.prefix + '300379098',
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E58_Measurement_Unit') + closeLine
-                    output.write(line)
-                    line = triple(aatCoords.prefix + '300379098',
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['MISU'] + '\"') + closeLine
-                    output.write(line)
-
-            if row['MTC'] != '':
-                mtcs = []
-                if '/' in row['MTC']:
-                    mtcs = row['MTC'].split('/')
-                else:
-                    mtcs.append(row['MTC'])
-
-
-                for tc in mtcs:
-                    mtc = tc.lstrip()
-                    el = get_elem(mtc)
-                    if el[1] == 'MTC/M':
-
-                        line = triple(datplaceHolder,
-                                      cidocCoords.prefix + 'P45_consists_of',
-                                      aatCoords.prefix + el[0]) + closeLine
-                        output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E57_Material') + closeLine
-                        output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + mtc + '\"') + closeLine
-                        output.write(line)
-
-                    else:   #E12 Production - P32 used technique - E55 Type
-                        line = triple(e12placeHolder,
-                                      cidocCoords.prefix + 'P32_used_general_technique',
-                                      aatCoords.prefix + el[0]) + closeLine
-                        output.write(line)
-                        if e12FplaceHolder != '':
-                            line = triple(e12FplaceHolder,
-                                          cidocCoords.prefix + 'P32_used_general_technique',
-                                          aatCoords.prefix + el[0]) + closeLine
-                            output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E55_Type') + closeLine
-                        output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + mtc + '\"') + closeLine
-                        output.write(line)
-
-            # E12 P140i E13
-            if row['AUTM'] != '':
-                mot = row['AUTM'].replace(' ', '_')
-                e55placeHolder = museoCoords.prefix + url + '_' + mot
-                line = triple(e12placeHolder,
-                              cidocCoords.prefix + 'P140i_was_attributed_by',
-                              e13placeHolder) + closeLine
-                output.write(line)
-                line = triple(e13placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E13_Attribute_Assignment') + closeLine
-                output.write(line)
-                line = triple(e13placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"Motivazione attribuzione\"') + closeLine
-                output.write(line)
-
-                line = triple(e13placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"' + row['AUTM'] + '\"') + closeLine
-                output.write(line)
-
-                aut = get_aut_url(row['AUTH'])
-                aut_url = aut[0]
-                AuthorPlaceholder = autCoords.prefix + aut_url
-
-                line = triple(e13placeHolder,
-                              cidocCoords.prefix + 'P141_assigned',
-                              AuthorPlaceholder) + closeLine
-                output.write(line)
-
-            # E22 P44 E62
-
-            if row['NSC'] != '':
-                ph = row['NSC'].replace(' "', ' «')
-                phr = ph.replace('"', '»')
-
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P3_has_note',
-                              '\"' + phr + '\"^^xsd:string') + closeLine
-                output.write(line)
-
-            iconclass = row['DESI']
-            icon = iconclass.replace(' ', '')
-
-            list_icon = []
-
-            if ':' in icon:
-                list_icon = icon.split(':')
-            else:
-                list_icon.append(icon)
-
-            for ic in list_icon:
-                siglaiconclass = str(ic)
-                #url = 'http://iconclass.org/rdk/' + str(ic)
-                #html = urlopen(url).read()
-                #soup = BeautifulSoup(html, 'html.parser')
-
-                # kill all script and style elements
-                #for script in soup(["script", "style"]):
-                #    script.extract()  # rip it out
-
-                # get text
-                #text = soup.get_text()
-
-                #pretty = soup.prettify()
-
-                #ff = soup.find("div", {"id": "ic_current"})
-                #dd = ff.find("a", {"class", "ic_notation"})
-                #ss = dd.text
-                #x = ss.find(' ')
-
-                #icon_label = ss[x + 1:]
-
-                siglaiconclass = ic.replace("%28", "(",)
-                siglaiconclassok = siglaiconclass.replace("%29", ")")
-                siglaiconclassokplaceHolder = '<https://iconclass.org/' + siglaiconclassok + '>'
-                
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P62_depicts',
-                              siglaiconclassokplaceHolder) + closeLine
-                output.write(line)
-                
-                line = triple(siglaiconclassokplaceHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E1_CRM_Entity') + closeLine
-                output.write(line)
-                
-                line = triple(siglaiconclassokplaceHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"' + siglaiconclassok + '\"' ) + closeLine
-                output.write(line)
-                line = triple(siglaiconclassokplaceHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Sigla Iconclass\"') + closeLine
-                output.write(line)
-
-            # P2 Opera d'arte
-            line = triple(datplaceHolder,
-            cidocCoords.prefix + 'P2_has_type',
-            '\"Opera d\'Arte\"') + closeLine
-            output.write(line)
-
-            output.write('\n')
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 371
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_OA_BIB.py

@@ -1,371 +0,0 @@
-# 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:')
-
-
-# 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 ' + nsCoords.prefix + ' ' + nsCoords.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_Data_'
-fileType = 'Datini'
-max_entries = 1000000000
-
-with open(import_dir + filePrefix + fileType + '.csv', newline="") as csv_file, open(
-        export_dir + filePrefix + fileType + '_BIB.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)
-        
-        url = row['URL']
-        pp = row['NCTN']
-        # placeHolders
-        # if row['BIBH']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        
-        # if row['BIBH1']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH1'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH1'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN1'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH2']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH2'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH2'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN2'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH3']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH3'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH3'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN3'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH4']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH4'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH4'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN4'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH5']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH5'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH5'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN5'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH6']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH6'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH6'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN6'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type', cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH7']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH7'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH7'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN7'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type', cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-
-        # if row['BIBH8']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH8'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH8'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN8'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH9']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH9'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH9'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN9'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH10']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH10'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH10'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN10'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH11']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH11'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH11'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN11'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH12']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH12'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH12'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN12'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH13']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH13'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH13'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN13'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        # if row['BIBH14']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH14'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH14'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN14'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        #     output.write('\n')
-        # #
-        if row['FTAN']!= '':
-        #     e73placeHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/" + url + "_E73>"
-        #     e73placeHolderED = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED>" 
-        #     e73placeHolderEDPP = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + pp + ">"
-        #     line = triple(e73placeHolderEDPP, documentsCoords.prefix, e73placeHolder) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderED, cidocCoords.prefix + "P46_is_composed_of", e73placeHolderEDPP) + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, cidocCoords.prefix + 'P3_has_note', '\"' + row['BIBN'] + '\"') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP, nsCoords.prefix + 'type',cidocCoords.prefix + 'E73_Information_Object') + closeLine
-        #     output.write(line)
-        #     line = triple(e73placeHolderEDPP,
-        #                         rdfsCoords.prefix + 'label',
-        #                         '\"Bibliografia specifica\"') + closeLine
-        #     output.write(line)
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 452
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_OA_BIB_IMG.py

@@ -1,452 +0,0 @@
-# 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

+ 0 - 921
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_OA_BIB_IMG_LICENZA.py

@@ -1,921 +0,0 @@
-# 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
-aspoCoords = RDFcoords('<http://www.archiviodistato.prato.it/>', 'aspo:')
-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:')
-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:')
-rdfCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdf:')
-nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')
-schemaCoords = RDFcoords('<http://www.schema.org/>', 'schema:')
-
-# 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 ' + rdfCoords.prefix + ' ' + rdfCoords.uri + closeLine)
-    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)
-    output.write('@prefix ' + aspoCoords.prefix + ' ' + aspoCoords.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 + '_LICENZA.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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Archivio di Stato di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        aspoCoords.prefix) + closeLine
-            output.write(line)
-
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Archivio di Stato di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        aspoCoords.prefix) + closeLine
-            output.write(line)
-
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Archivio di Stato di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        aspoCoords.prefix) + closeLine
-            output.write(line)
-
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>'
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>"
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        museoCoords.prefix) + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + 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>"
-            e62placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E36_E62>"
-            e62e42placeHolder = "<https://palazzopretorio.prato.it/it/bib/" + row['BIBH'] + "/E73" + "_ED_" + id + "_E62_E42>"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, rdfCoords.prefix + 'label',
-                        '\"Archivio di Stato di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        aspoCoords.prefix) + closeLine
-            output.write(line)
-
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, rdfCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-
-        output.write('\n')
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 178
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_OA_IMG.py

@@ -1,178 +0,0 @@
-    # 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:')
-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:')
-schemaCoords = RDFcoords('<http://www.schema.org/>', 'schema:')
-rdfCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdf:')
-hasNoteCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3_has_note>', 'no:')
-
-    # 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 ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)
-    output.write('@prefix ' + hasNoteCoords.prefix + ' ' + hasNoteCoords.uri + closeLine)
-
-    output.write('\n')
-
-
-filePrefix = 'AR20IMR'
-fileType = '_Datini'
-max_entries = 1000000000
-
-with open(import_dir + filePrefix + fileType + '.csv', newline="") as csv_file, open(
-        export_dir + filePrefix + fileType + '_LICENZA.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)
-            
-            url = row['URL']
-            # placeHolders
-            
-            # if row['FTA0']!= '': 
-            #     datplaceHolder = museoCoords.prefix + url
-            id = row['FTA0'].replace(".jpeg","")
-            e36placeHolder = museoCoords.prefix + url + "_" + id
-            #     e36e42placeHolder = museoCoords.prefix + url + "_"  + id + "_E36_E42"
-            #     line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', datplaceHolder) + 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', '\"Tavola\"') + closeLine
-            #     output.write(line)
-                
-            #     line = triple(e36placeHolder, cidocCoords.prefix + 'P2_has_type', '\"Tavola\"') + 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['FTA0']+ '\"') + closeLine
-            #     output.write(line)
-            #     if row['NOTE']!= '':
-            #         line = triple(e36placeHolder, hasNoteCoords.prefix, '\"'+ row['NOTE']+'"') + closeLine
-            #         output.write(line)
-
-            e62placeHolder = museoCoords.prefix + url + "_" + id + "_E36_E62"
-            e62e42placeHolder = museoCoords.prefix + url + "_" + id + "_E62_E42"
-            e36e30placeHolder = "<https://creativecommons.org/licenses/by-nc-sa/4.0/deed.it>"
-            e36e30e42placeHolder = "<https://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png>"
-
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P3_has_note',
-                        e62placeHolder) + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E62_String') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, nsCoords.prefix + 'label',
-                        '\"Museo di Palazzo Pretorio di Prato\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P2_has_type',
-                        '\"Provenienza immagine\"') + closeLine
-            output.write(line)
-            line = triple(e62placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                        "<https://palazzopretorio.prato.it/>") + closeLine
-            output.write(line)
-            line = triple(e62e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder, cidocCoords.prefix + 'P104_is_subject_to',
-                        e36e30placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E30_Right') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, nsCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-            line = triple(e36e30placeHolder, cidocCoords.prefix + 'P1_is_identified_by',
-                       e36e30e42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'type',
-                        cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e30e42placeHolder, nsCoords.prefix + 'label',
-                        '\"CC BY NC SA\"') + closeLine
-            output.write(line)
-
-            output.write('\n')
-            #
-            #
-            # Limit number of entries processed (if desired)
-            if (ii > max_entries):
-                break

+ 0 - 1119
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Ospedale.py

@@ -1,1119 +0,0 @@
-# Utilities to read/write csv files
-import csv
-# Utilities to handle character encodings
-import unicodedata
-# Ordered Dicts
-from collections import OrderedDict
-
-from urllib.request import urlopen
-from bs4 import BeautifulSoup
-
-import json
-
-# 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('<https://iconclass.org/>', 'ico:')
-
-
-# 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 ' + nsCoords.prefix + ' ' + nsCoords.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('\n')
-
-
-filePrefix = 'OA_Data'
-fileType = '_Ospedale'
-max_entries = 1000000000
-
-def get_aut_url(code):
-    aut_file = open(import_dir + 'AR20AUT' + fileType + '.csv', newline="")
-    reader = csv.DictReader(aut_file)
-    for row in reader:
-        auth = int(row['AUTH'])
-        cod = int(code)
-        role = ''
-        if row['AUTQ'] != '':
-            role = row['AUTQ']
-        else:
-            role = ''
-        if auth == cod:
-            return [row['URL'], role]
-
-def get_role(role):
-    role_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/AAT_RUOLI.csv', newline="")
-    reader = csv.DictReader(role_file)
-    for row in reader:
-        if row['Label'] == role:
-            return row['AAT']
-
-def get_elem(mtc):
-    mtc_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/AAT_MTC.csv', newline="")
-    reader = csv.DictReader(mtc_file)
-    for row in reader:
-        if row['MTC'] == mtc:
-            return [row['AAT'], row['Type']]
-
-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
-
-        if row['RVEL'] == '' or row['RVEL'] == '0':
-
-            sb = ''
-            subj = ''
-            #pp = row['OGTD'] + ' (' + row['ACC'] + ') '
-            if row['SGTI'] != '':
-                sb =  row['SGTI']
-
-            # Triplify the 'codice' -- should exist for every entry
-            codice = ''
-            if (row['NCTR'] != '' and row['NCTN'] != ''):
-                codice = row['NCTR'] + '0000' + row['NCTN']
-
-            codiceP = ''
-            if (row['AUTH'] != ''):
-                codiceP = row['AUTH']
-
-            place = ''
-            if (row['PRVC'] != ''):
-                place = row['PRVC']
-
-            columnName = list(row)
-            url = row['URL']
-
-            # placeHolders
-            datplaceHolder = museoCoords.prefix + url
-            e1placeHolder = museoCoords.prefix + url + '_E1'
-            e3placeHolder = museoCoords.prefix + url + 'E3'
-            e10placeHolder = museoCoords.prefix + url + '_E10'
-            e12placeHolder = museoCoords.prefix + url + '_E12'
-            e13placeHolder = museoCoords.prefix + url + '_E13'
-            e21placeHolder = museoCoords.prefix + url + '_InE21'
-            e25placeHolder = museoCoords.prefix + url + '_E25'
-            e34placeHolder = museoCoords.prefix + url + '_E34'
-            e35placeHolder1 = museoCoords.prefix + url + '_E35'
-            e42placeHolder = museoCoords.prefix + url + '_E42'
-            e42CplaceHolder = museoCoords.prefix + url + '_E42_MPP'
-            e65placeHolder = museoCoords.prefix + url + '_InE65'
-            e73placeHolder = museoCoords.prefix + url + '_E73'
-            e74placeHolder = museoCoords.prefix + url + '_E74'
-
-            if (codice != ''):
-                line = triple(datplaceHolder, cidocCoords.prefix + 'P1_is_identified_by', e42placeHolder) + closeLine
-                output.write(line)
-                line = triple(e42placeHolder, nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E42_Identifier') + closeLine
-                output.write(line)
-
-                line = triple(e42placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"0' + codice + '\"') + closeLine
-                output.write(line)
-                ###
-                line = triple(e42placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Codice univoco del bene (NCT)\"') + closeLine
-                output.write(line)
-
-
-            # Write E22 Man Made Object & E73 Information Object -- should exist for every entry?
-            line = triple(datplaceHolder, nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E22_Man-Made_Object') + closeLine
-            output.write(line)
-            # Added by AS
-            line = triple(datplaceHolder, schemaCoords.prefix + 'label', '\"' + sb + '\"') + closeLine
-            output.write(line)
-            # End AS
-            line = triple(datplaceHolder, cidocCoords.prefix + 'P128_carries', e73placeHolder) + closeLine
-            output.write(line)
-            line = triple(e73placeHolder, nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E73_Information_Object') + closeLine
-            output.write(line)
-
-            # AS
-            ss = ''
-            if row['SGTI'] != '':
-                ss = row['SGTI']
-            else:
-                ss = 'senza titolo'
-
-            line = triple(e73placeHolder, schemaCoords.prefix + 'label',
-                          '\"Opera d\'arte raffigurante ' + ss + '\"') + closeLine
-            output.write(line)
-
-            # E73 - P2 - E55
-
-            tt = ''
-            typeLabel = ''
-
-            if row['OGTD'] == 'dipinto':
-                tt = aatCoords.prefix + "300033618"
-            elif row['OGTD'] == 'rilievo':
-                tt = aatCoords.prefix + "300047230"
-            elif row['OGTD'] == 'polittico':
-                tt = aatCoords.prefix + "300178235"
-            elif row['OGTD'] == 'predella':
-                tt = aatCoords.prefix + "300003745"
-
-            line = triple(e73placeHolder,
-                          cidocCoords.prefix + 'P2_has_type',
-                          tt) + closeLine
-            output.write(line)
-            line = triple(tt, schemaCoords.prefix + 'label',
-                          '\"' + row['OGTD'] + '\"') + closeLine
-            output.write(line)
-
-            # E73 - P1 - E35
-
-            if row['SGTT'] != '':
-                line = triple(e73placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e35placeHolder1) + closeLine
-                output.write(line)
-                line = triple(e35placeHolder1, nsCoords.prefix + 'type', cidocCoords.prefix + 'E35_Title') + closeLine
-                output.write(line)
-                line = triple(e35placeHolder1, schemaCoords.prefix + 'label', '\"' + row['SGTT'] + '\"') + closeLine
-                output.write(line)
-
-            # E22 - P62 - E1
-
-            if row['SGTI'] != '':
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P62_depicts',
-                              e1placeHolder) + closeLine
-                output.write(line)
-                line = triple(e1placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E1_CRM_Entity') + closeLine
-                output.write(line)
-                line = triple(e1placeHolder,
-                              schemaCoords.prefix + 'label', '\"' +
-                              row['SGTI'] + '\"') + closeLine
-                output.write(line)
-
-                line = triple(e1placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Identificazione Iconografica\"') + closeLine
-                output.write(line)
-
-            # Attention: these triples are identified only for C100005 Museo di Palazzo Pretorio
-
-            if row['ESC'] == 'C100005':
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P52_has_current_owner',
-                              '<https://palazzopretorio.prato.it/it/>') + closeLine
-                output.write(line)
-                line = triple('<https://palazzopretorio.prato.it/it/>',
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E74_Group') + closeLine
-                output.write(line)
-                line = triple('<https://palazzopretorio.prato.it/it/>',
-                              schemaCoords.prefix + 'label',
-                              '\"Museo di Palazzo Pretorio\"') + closeLine
-                output.write(line)
-
-            currentLocation = ''
-
-            # E22 - P54 - E53
-            if row['LDCN'] != '':
-                if row['LDCS'] != '':
-                    currentLocation = row['LDCS']
-                else:
-                    currentLocation = currentLocation
-                if row['LDCM'] != '':
-                    currentLocation = currentLocation + ', ' + row['LDCM']
-                else:
-                    currentLocation = currentLocation
-                if row['LDCN'] != '':
-                    currentLocation = currentLocation + ', ' + row['LDCN']
-                else:
-                    currentLocation = currentLocation
-
-                currentLocation = currentLocation + ', ' + row['PVCC'] + ' (' + row['PVCP'] + ')'
-
-                line = triple(datplaceHolder, cidocCoords.prefix + 'P54_has_current_permanent_location',
-                              '\"' + currentLocation + '\"') + closeLine
-                output.write(line)
-
-            e12FplaceHolder = ''
-            if row['DTSI'] != row['DTSF']:
-                e12FplaceHolder = museoCoords.prefix + url + '_E12F'
-
-            # Write E12 Production -- should exist for every entry?
-            # E12 P108 E22
-            line = triple(e12placeHolder, cidocCoords.prefix + 'P108_has_produced', datplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e12placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E12_Production') + closeLine
-            output.write(line)
-            # E73 P108i E12
-            line = triple(e73placeHolder, cidocCoords.prefix + 'P108i_was_produced_by', e12placeHolder) + closeLine
-            output.write(line)
-
-            if e12FplaceHolder != '':
-                line = triple(e12FplaceHolder, cidocCoords.prefix + 'P108_has_produced', datplaceHolder) + closeLine
-                output.write(line)
-                line = triple(e12FplaceHolder, nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E12_Production') + closeLine
-                output.write(line)
-                line = triple(e12FplaceHolder, schemaCoords.prefix + 'label',
-                              '\"Fine produzione di ' + row['SGTI'] + '\"') + closeLine
-                output.write(line)
-                # E73 P108i E12
-                line = triple(e73placeHolder, cidocCoords.prefix + 'P108i_was_produced_by', e12FplaceHolder) + closeLine
-                output.write(line)
-                # E12 P140i E13
-                line = triple(e12FplaceHolder,
-                              cidocCoords.prefix + 'P140i_was_attributed_by',
-                              e13placeHolder) + closeLine
-                output.write(line)
-                # E12 P2
-                line = triple(e12FplaceHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Fine\"^^xsd:string') + closeLine
-                output.write(line)
-                line = triple(e12placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Inizio\"^^xsd:string') + closeLine
-                output.write(line)
-                line = triple(e12placeHolder, schemaCoords.prefix + 'label',
-                              '\"Inizio produzione di ' + row['SGTI'] + '\"') + closeLine
-                output.write(line)
-            else:
-                line = triple(e12placeHolder, schemaCoords.prefix + 'label',
-                              '\"Produzione di ' + row['SGTI'] + '\"') + closeLine
-                output.write(line)
-
-            tcl = []
-            for name in columnName:
-                if 'TCL' in name:
-                    tcl.append(name)
-
-            # E12 - P7 - E53
-            for el in tcl:
-                i = 0
-                if row[el] == 'luogo di produzione':
-                    pl = ''
-                    if i == 0:
-                        pl = row['PRVC']
-                    else:
-                        pl = row['PRVC' + i]
-                    line = triple(e12placeHolder,
-                                  cidocCoords.prefix + 'P7_took_place_at',
-                                  museoCoords.prefix + pl) + closeLine
-                    output.write(line)
-                    if e12FplaceHolder != '':
-                        line = triple(e12FplaceHolder,
-                                      cidocCoords.prefix + 'P7_took_place_at',
-                                      museoCoords.prefix + pl) + closeLine
-                        output.write(line)
-                i = i + 1
-
-            # E12 - PC14 - E21
-            if row['AUTH'] != '':
-                aut = get_aut_url(row['AUTH'])
-                aut_url = aut[0]
-                aut_role = aut[1]
-                if row['AUTN'] != '':
-                    ll = row['AUTH'] + '_' + aut_role
-                    lab = ll.replace(' ', '')
-                    label = lab.replace(',', '')
-
-                    AuthorPlaceholder = autCoords.prefix + aut_url
-                    line = triple(museoCoords.prefix + '_' + label,
-                                cidocCoords.prefix + 'P01_has_domain',
-                                e12placeHolder) + closeLine
-                    output.write(line)
-                    if e12FplaceHolder != '':
-                        line = triple(museoCoords.prefix + '_' + label,
-                                    cidocCoords.prefix + 'P01_has_domain',
-                                    e12FplaceHolder) + closeLine
-                        output.write(line)
-
-            if 'AUTH1' in columnName:
-                if row['AUTH1'] != '':
-                    aut = get_aut_url(row['AUTH1'])
-                    aut_url = aut[0]
-                    aut_role = aut[1]
-                    ll = row['AUTN1'] + '_' + aut_role
-                    lab = ll.replace(' ', '')
-                    label = lab.replace(',', '')
-
-                    AuthorPlaceholder = autCoords.prefix + aut_url
-                    line = triple(museoCoords.prefix + '_' + label,
-                                  cidocCoords.prefix + 'P01_has_domain',
-                                  e12placeHolder) + closeLine
-                    output.write(line)
-                    if e12FplaceHolder != '':
-                        line = triple(museoCoords.prefix + '_' + label,
-                                      cidocCoords.prefix + 'P01_has_domain',
-                                      e12FplaceHolder) + closeLine
-                        output.write(line)
-
-            # E12 - PC14 - E21
-            if 'CMMN' in columnName:
-                if row['CMMN'] != '':
-                    cc = row['CMMN']
-                    cm = cc.replace(' ', '')
-                    cmmn = cm.replace(',', '')
-
-                    cmmPlaceholder = museoCoords.prefix + '_' + cmmn
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  cidocCoords.prefix + 'P01_has_domain',
-                                  e12placeHolder) + closeLine
-                    output.write(line)
-                    if e12FplaceHolder != '':
-                        line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                      cidocCoords.prefix + 'P01_has_domain',
-                                      e12FplaceHolder) + closeLine
-                        output.write(line)
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'PC14_carried_out_by') + closeLine
-                    output.write(line)
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['CMMN'] + ' nel ruolo di committente\"') + closeLine
-                    output.write(line)
-
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  cidocCoords.prefix + 'P02_has_range',
-                                  cmmPlaceholder) + closeLine
-                    output.write(line)
-                    line = triple(cmmPlaceholder,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E39_Actor') + closeLine
-                    output.write(line)
-                    line = triple(cmmPlaceholder,
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['CMMN'] + '\"') + closeLine
-                    output.write(line)
-
-                    line = triple(museoCoords.prefix + '_commit_' + cmmn,
-                                  cidocCoords.prefix + 'P14.1_in_the_role_of',
-                                  museoCoords.prefix + '_client') + closeLine
-                    output.write(line)
-                    line = triple(museoCoords.prefix + '_client',
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E55_Type') + closeLine
-                    output.write(line)
-                    line = triple(museoCoords.prefix + '_client',
-                                  schemaCoords.prefix + 'label',
-                                  '\"Committente\"') + closeLine
-                    output.write(line)
-
-            # E12 - P4 - E52
-            if row['DTSI'] != '':
-                line = triple(e12placeHolder,
-                              cidocCoords.prefix + 'P4_has_time-span',
-                              museoCoords.prefix + row['DTSI']) + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + row['DTSI'],
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E52_Time-Span') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + row['DTSI'],
-                              schemaCoords.prefix + 'label',
-                              '\"' + row['DTSI'] + '\"') + closeLine
-                output.write(line)
-
-            if e12FplaceHolder != '':
-                line = triple(e12FplaceHolder,
-                              cidocCoords.prefix + 'P4_has_time-span',
-                              museoCoords.prefix + row['DTSF']) + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + row['DTSF'],
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E52_Time-Span') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + row['DTSF'],
-                              schemaCoords.prefix + 'label',
-                              '\"' + row['DTSF'] + '\"') + closeLine
-                output.write(line)
-
-            tcl = []
-            for name in columnName:
-                if 'TCL' in name:
-                    tcl.append(name)
-
-            j = 0
-
-            for el in tcl:
-                if row[el] != '':
-                    j = j + 1
-
-            last = str(j - 1)
-
-            n = len(tcl) - 1
-
-            for i in range(n):
-
-                k = str(i + 1)
-
-                if i + 1 == 1:
-                    w = ''
-                else:
-                    w = i
-
-                f = str(w)
-
-                if row['TCL' + k] != '':
-
-                    pastActor = ''
-                    newActor = ''
-                    pl = ''
-
-                    if row['PRCD' + k] != '':
-                        newActor = ' a ' + row['PRCD' + k]
-
-                    if row['PRCD' + f] != '':
-                        pastActor = ' da ' + row['PRCD' + f]
-                        pl = row['PRCD' + f].replace(' ', '')
-
-                    newe10placeHolder = museoCoords.prefix + url + "_E10_" + k
-
-                    line = triple(newe10placeHolder,
-                                  cidocCoords.prefix + 'P30_transferred_custody_of',
-                                  datplaceHolder) + closeLine
-                    output.write(line)
-                    line = triple(newe10placeHolder,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E10_Transfer_of_Custody') + closeLine
-                    output.write(line)
-                    line = triple(newe10placeHolder,
-                                  schemaCoords.prefix + 'label',
-                                  '\"Passaggio di ' + row['SGTI'] + pastActor +
-                                  newActor + '\"') + closeLine
-                    output.write(line)
-
-                    if row['PRDI' + f] != '':
-                        timespan = row['PRDI' + f]
-
-                        tt = timespan.replace(' ', '')
-                        tp = tt.replace('.', '')
-                        ts = tp.replace('/', '')
-
-                        timespanPlaceholder = museoCoords.prefix + '_' + ts
-
-                        # E10 P4 E52
-
-                        line = triple(newe10placeHolder,
-                                      cidocCoords.prefix + 'P4_has_time-span',
-                                      timespanPlaceholder) + closeLine
-                        output.write(line)
-                        line = triple(timespanPlaceholder,
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E52_Time-Span') + closeLine
-                        output.write(line)
-                        line = triple(timespanPlaceholder,
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + timespan + '\"') + closeLine
-                        output.write(line)
-
-                    pastActorPlaceholder = museoCoords.prefix + '_' + pl
-                    newLoc = row['PRCD' + k].replace(' ', '')
-                    newActorPlaceholder = museoCoords.prefix + '_' + newLoc
-
-                    # E10 P26 E74 (moved to)
-
-                    if newActorPlaceholder != '':
-                        line = triple(newe10placeHolder,
-                                      cidocCoords.prefix + 'P29_custody_received_by',
-                                      newActorPlaceholder) + closeLine
-                        output.write(line)
-
-                    # E10 P27 E74
-
-                    pastActorLabel = row['PRCD' + f]
-
-                    line = triple(newe10placeHolder,
-                                  cidocCoords.prefix + 'P28_custody_surrendered_by',
-                                  pastActorPlaceholder) + closeLine
-                    output.write(line)
-                    line = triple(pastActorPlaceholder,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E39_Actor') + closeLine
-                    output.write(line)
-                    line = triple(pastActorPlaceholder,
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + pastActorLabel + '\"') + closeLine
-                    output.write(line)
-
-                    line = triple(datplaceHolder,
-                                  cidocCoords.prefix + 'P49_has_former_or_current_keeper',
-                                  pastActorPlaceholder) + closeLine
-                    output.write(line)
-
-                    # E74 P74 E53
-
-                    pastResidenceLabel = row['PRVC' + f]
-                    pastResidencePlaceHolder = museoCoords.prefix + row['PRVC' + f]
-
-                    line = triple(pastActorPlaceholder,
-                                  cidocCoords.prefix + 'P74_has_current_or_former_residence',
-                                  pastResidencePlaceHolder) + closeLine
-                    output.write(line)
-
-            ####
-
-            pastActor = ''
-            newActor = ''
-            pl = ''
-
-            if row['LDCN'] != '':
-                newActor = ' a ' + row['LDCN']
-
-            if row['PRCD' + last] != '':
-                pastActor = ' da ' + row['PRCD' + last]
-                pl = row['PRCD' + last].replace(' ', '')
-
-            line = triple(e10placeHolder,
-                          cidocCoords.prefix + 'P30_transferred_custody_of',
-                          datplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e10placeHolder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E10_Transfer_of_Custody') + closeLine
-            output.write(line)
-            line = triple(e10placeHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"Passaggio di ' + row['SGTI'] + pastActor +
-                          newActor + '\"') + closeLine
-            output.write(line)
-
-            if row['PRDU' + last] != '':
-                timespan = row['PRDU' + last]
-
-                tt = timespan.replace(' ', '')
-                ts = tt.replace('/', '')
-
-                timespanPlaceholder = museoCoords.prefix + '_' + ts
-
-                # E10 P4 E52
-
-                line = triple(e10placeHolder,
-                              cidocCoords.prefix + 'P4_has_time-span',
-                              timespanPlaceholder) + closeLine
-                output.write(line)
-                line = triple(timespanPlaceholder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E52_Time-Span') + closeLine
-                output.write(line)
-                line = triple(timespanPlaceholder,
-                              schemaCoords.prefix + 'label',
-                              '\"' + timespan + '\"') + closeLine
-                output.write(line)
-
-            pastActorPlaceholder = museoCoords.prefix + '_' + pl
-            newLocPlaceholder = e74placeHolder
-
-            # E10 P26 E74 (moved to)
-
-            if newLocPlaceholder != '':
-                line = triple(e10placeHolder,
-                              cidocCoords.prefix + 'P29_custody_received_by',
-                              newLocPlaceholder) + closeLine
-                output.write(line)
-
-            # E10 P27 E74
-
-            pastActorLabel = row['PRCD' + last]
-
-            line = triple(e10placeHolder,
-                          cidocCoords.prefix + 'P28_custody_surrendered_by',
-                          pastActorPlaceholder) + closeLine
-            output.write(line)
-            line = triple(pastActorPlaceholder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E39_Actor') + closeLine
-            output.write(line)
-            line = triple(pastActorPlaceholder,
-                          schemaCoords.prefix + 'label',
-                          '\"' + pastActorLabel + '\"') + closeLine
-            output.write(line)
-
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P49_has_former_or_current_keeper',
-                          pastActorPlaceholder) + closeLine
-            output.write(line)
-
-            # E74 P74 E53
-
-            pastResidenceLabel = row['PRVC' + last]
-            pastResidencePlaceHolder = museoCoords.prefix + row['PRVC' + last]
-
-            if row['PRVP' + last] != '':
-                pastResidenceLabel = pastResidenceLabel + ' (' + row['PRVP' + last] + ')'
-
-            if row['PRVR' + last] != '':
-                pastResidenceLabel = pastResidenceLabel + ', ' + row['PRVR' + last]
-
-            if row['PRVS' + last] != '':
-                pastResidenceLabel = pastResidenceLabel + ', ' + row['PRVS' + last]
-
-            line = triple(pastActorPlaceholder,
-                          cidocCoords.prefix + 'P74_has_current_or_former_residence',
-                          pastResidencePlaceHolder) + closeLine
-            output.write(line)
-            line = triple(pastResidencePlaceHolder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E53_Place') + closeLine
-            output.write(line)
-
-            # E22 P44 E3
-
-            if row['STCC'] != '':
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P44_has_condition',
-                              e3placeHolder) + closeLine
-                output.write(line)
-                line = triple(e3placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E3_Condition_State') + closeLine
-                output.write(line)
-                line = triple(e3placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"Condizione di: ' + row['SGTI'] + '\"') + closeLine
-                output.write(line)
-
-                line = triple(e3placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"' + row['STCC'] + '\"') + closeLine
-                output.write(line)
-
-            # E22 P65 E34
-            if (row['ISRI'] != ''):
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P56_bears_feature',
-                              e25placeHolder) + closeLine
-                output.write(line)
-                line = triple(e25placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E25_Man-Made_Feature') + closeLine
-                output.write(line)
-                line = triple(e25placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"Iscrizione su ' + subj + '\"') + closeLine
-                output.write(line)
-
-                line = triple(e25placeHolder,
-                              cidocCoords.prefix + 'P128_carries',
-                              e34placeHolder) + closeLine
-                output.write(line)
-                line = triple(e34placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E34_Inscription') + closeLine
-                output.write(line)
-                line = triple(e34placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"Iscrizione: ' + row['ISRI'] + '\"') + closeLine
-                output.write(line)
-
-                pl = row['ISRI'].replace(' ', '-')
-                pla = pl.replace('.', '')
-                line = triple(e34placeHolder,
-                              cidocCoords.prefix + 'P3_has_note',
-                              '\"' + row['ISRI'] + '\"') + closeLine
-                output.write(line)
-
-                # E34 P2 E55
-
-                if (row['ISRT'] != ''):
-                    rr = row['ISRT'].replace(' ', '')
-                    line = triple(e34placeHolder,
-                                  cidocCoords.prefix + 'P2_has_type',
-                                  '\"' + row['ISRT'] + '\"') + closeLine
-                    output.write(line)
-
-                # E34 P72 E56
-
-                if (row['ISRL'] != ''):
-                    line = triple(e34placeHolder,
-                                  cidocCoords.prefix + 'P72_has_language',
-                                  museoCoords.prefix + '_' + row['ISRL']) + closeLine
-                    output.write(line)
-                    line = triple(museoCoords.prefix + '_' + row['ISRL'],
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E56_Language') + closeLine
-                    output.write(line)
-                    line = triple(museoCoords.prefix + '_' + row['ISRL'],
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['ISRL'] + '\"') + closeLine
-                    output.write(line)
-
-                if (row['ISRA'] != '') or (row['ISRS'] != ''):
-                    line = triple(e34placeHolder,
-                                  cidocCoords.prefix + 'P92i_was_brought_into_existence_by',
-                                  e65placeHolder) + closeLine
-                    output.write(line)
-                    line = triple(e65placeHolder,
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E65_Creation') + closeLine
-                    output.write(line)
-                    line = triple(e65placeHolder,
-                                  schemaCoords.prefix + 'label',
-                                  '\"Creazione dell\'Iscrizione ' + row['ISRI'] + '\"') + closeLine
-                    output.write(line)
-
-                    if row['ISRA'] != '':
-                        line = triple(e65placeHolder,
-                                      cidocCoords.prefix + 'P14_carried_out_by',
-                                      e21placeHolder) + closeLine
-                        output.write(line)
-                        line = triple(e21placeHolder,
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E21_Person') + closeLine
-                        output.write(line)
-                        line = triple(e21placeHolder,
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + row['ISRA'] + '\"') + closeLine
-                        output.write(line)
-
-                    if row['ISRS']:
-                        ss = row['ISRS'].replace(' ', '')
-                        tecPlaceholder = museoCoords.prefix + url + '_' + ss
-                        line = triple(e65placeHolder,
-                                      cidocCoords.prefix + 'P32_used_general_technique',
-                                      tecPlaceholder) + closeLine
-                        output.write(line)
-                        line = triple(tecPlaceholder,
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E55_Type') + closeLine
-                        output.write(line)
-                        line = triple(tecPlaceholder,
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + row['ISRS'] + '\"') + closeLine
-                        output.write(line)
-
-                if row['ISRP'] != '':
-                    line = triple(e25placeHolder,
-                                  cidocCoords.prefix + 'P3_has_note',
-                                  '\"' + row['ISRP'] + '\"^^xsd:string') + closeLine
-                    output.write(line)
-
-            unit = ''
-            if (row['MISU'] != ''):
-                unit = row['MISU']
-
-            valueA = ''
-            valueL = ''
-
-            if (row['MISA'] != ''):
-                value = row['MISA']
-                valueA = value.replace(',', 'v')
-
-            if (row['MISL'] != ''):
-                value = row['MISL']
-                valueL = value.replace(',', 'v')
-
-            # Altezza
-            # E22 P43 E54
-            if (row['MISA'] != ''):
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P43_has_dimension',
-                              museoCoords.prefix + url + '_Altezza') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + url + '_Altezza',
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E54_Dimension') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + url + '_Altezza',
-                              schemaCoords.prefix + 'label',
-                              '\"Altezza: ' + row['MISA'] + row['MISU'] + '\"') + closeLine
-                output.write(line)
-
-                # E54 P90 E60
-                line = triple(museoCoords.prefix + url + '_Altezza',
-                              cidocCoords.prefix + 'P90_has_value',
-                              '\"' + row['MISA'] + '\"^^xsd:integer') + closeLine
-                output.write(line)
-
-                # E54 P2 E55
-
-                line = triple(museoCoords.prefix + url + '_Altezza',
-                              cidocCoords.prefix + 'P2_has_type',
-                              aatCoords.prefix + '300055644') + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + '300055644',
-                              schemaCoords.prefix + 'label',
-                              '\"altezza\"') + closeLine
-                output.write(line)
-
-                # E54 P91 E58
-                if (row['MISU'] != ''):
-                    line = triple(museoCoords.prefix + url + '_Altezza',
-                                  cidocCoords.prefix + 'P91_has_unit',
-                                  aatCoords.prefix + '300379098') + closeLine
-                    output.write(line)
-                    line = triple(aatCoords.prefix + '300379098',
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E58_Measurement_Unit') + closeLine
-                    output.write(line)
-                    line = triple(aatCoords.prefix + '300379098',
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['MISU'] + '\"') + closeLine
-                    output.write(line)
-
-            # Larghezza
-            # E22 P43 E54
-            if (row['MISL'] != ''):
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P43_has_dimension',
-                              museoCoords.prefix + url + '_Larghezza') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + url + '_Larghezza',
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E54_Dimension') + closeLine
-                output.write(line)
-                line = triple(museoCoords.prefix + url + '_Larghezza',
-                              schemaCoords.prefix + 'label',
-                              '\"Larghezza: ' + row['MISL'] + row['MISU'] + '\"') + closeLine
-                output.write(line)
-
-                # E54 P90 E60
-                line = triple(museoCoords.prefix + url + '_Larghezza',
-                              cidocCoords.prefix + 'P90_has_value',
-                              '\"' + row['MISL'] + '\"^^xsd:integer') + closeLine
-                output.write(line)
-
-                # E54 P2 E55
-
-                line = triple(museoCoords.prefix + url + '_Larghezza',
-                              cidocCoords.prefix + 'P2_has_type',
-                              aatCoords.prefix + '300055647') + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + '300055647',
-                              schemaCoords.prefix + 'label',
-                              '\"larghezza\"') + closeLine
-                output.write(line)
-
-                # E54 P91 E58
-                if (row['MISU'] != ''):
-                    line = triple(museoCoords.prefix + url + '_Larghezza',
-                                  cidocCoords.prefix + 'P91_has_unit',
-                                  aatCoords.prefix + '300379098') + closeLine
-                    output.write(line)
-                    line = triple(aatCoords.prefix + '300379098',
-                                  nsCoords.prefix + 'type',
-                                  cidocCoords.prefix + 'E58_Measurement_Unit') + closeLine
-                    output.write(line)
-                    line = triple(aatCoords.prefix + '300379098',
-                                  schemaCoords.prefix + 'label',
-                                  '\"' + row['MISU'] + '\"') + closeLine
-                    output.write(line)
-
-            if row['MTC'] != '':
-                mtcs = []
-                if '/' in row['MTC']:
-                    mtcs = row['MTC'].split('/')
-                else:
-                    mtcs.append(row['MTC'])
-
-                for tc in mtcs:
-                    mtc = tc.lstrip()
-                    el = get_elem(mtc)
-                    if el[1] == 'MTC/M':
-
-                        line = triple(datplaceHolder,
-                                      cidocCoords.prefix + 'P45_consists_of',
-                                      aatCoords.prefix + el[0]) + closeLine
-                        output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E57_Material') + closeLine
-                        output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + mtc + '\"') + closeLine
-                        output.write(line)
-
-                    else:   #E12 Production - P32 used technique - E55 Type
-                        line = triple(e12placeHolder,
-                                      cidocCoords.prefix + 'P32_used_general_technique',
-                                      aatCoords.prefix + el[0]) + closeLine
-                        output.write(line)
-                        if e12FplaceHolder != '':
-                            line = triple(e12FplaceHolder,
-                                          cidocCoords.prefix + 'P32_used_general_technique',
-                                          aatCoords.prefix + el[0]) + closeLine
-                            output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      nsCoords.prefix + 'type',
-                                      cidocCoords.prefix + 'E55_Type') + closeLine
-                        output.write(line)
-                        line = triple(aatCoords.prefix + el[0],
-                                      schemaCoords.prefix + 'label',
-                                      '\"' + mtc + '\"') + closeLine
-                        output.write(line)
-
-            # E12 P140i E13
-            if row['AUTM'] != '':
-                mot = row['AUTM'].replace(' ', '_')
-                e55placeHolder = museoCoords.prefix + url + '_' + mot
-                line = triple(e12placeHolder,
-                              cidocCoords.prefix + 'P140i_was_attributed_by',
-                              e13placeHolder) + closeLine
-                output.write(line)
-                line = triple(e13placeHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E13_Attribute_Assignment') + closeLine
-                output.write(line)
-                line = triple(e13placeHolder,
-                              schemaCoords.prefix + 'label',
-                              '\"Motivazione attribuzione\"') + closeLine
-                output.write(line)
-
-                line = triple(e13placeHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"' + row['AUTM'] + '\"') + closeLine
-                output.write(line)
-
-                aut = get_aut_url(row['AUTH'])
-                aut_url = aut[0]
-                AuthorPlaceholder = autCoords.prefix + aut_url
-
-                line = triple(e13placeHolder,
-                              cidocCoords.prefix + 'P141_assigned',
-                              AuthorPlaceholder) + closeLine
-                output.write(line)
-
-            # E22 P44 E62
-
-            if row['NSC'] != '':
-                ph = row['NSC'].replace(' "', ' «')
-                phr = ph.replace('"', '»')
-
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P3_has_note',
-                              '\"' + phr + '\"^^xsd:string') + closeLine
-                output.write(line)
-
-            iconclass = row['DESI']
-            icon = iconclass.replace(' ', '')
-
-            list_icon = []
-
-            if ':' in icon:
-                list_icon = icon.split(':')
-            else:
-                list_icon.append(icon)
-
-            for ic in list_icon:
-                siglaiconclass = str(ic)
-                #url = 'http://iconclass.org/rdk/' + str(ic)
-                #html = urlopen(url).read()
-                #soup = BeautifulSoup(html, 'html.parser')
-
-                # kill all script and style elements
-                #for script in soup(["script", "style"]):
-                #    script.extract()  # rip it out
-
-                # get text
-                #text = soup.get_text()
-
-                #pretty = soup.prettify()
-
-                #ff = soup.find("div", {"id": "ic_current"})
-                #dd = ff.find("a", {"class", "ic_notation"})
-                #ss = dd.text
-                #x = ss.find(' ')
-
-                #icon_label = ss[x + 1:]
-
-                siglaiconclass = ic.replace("%28", "(",)
-                siglaiconclassok = siglaiconclass.replace("%29", ")")
-                siglaiconclassokplaceHolder = '<https://iconclass.org/' + siglaiconclassok + '>'
-                
-                line = triple(datplaceHolder,
-                              cidocCoords.prefix + 'P62_depicts',
-                              siglaiconclassokplaceHolder) + closeLine
-                output.write(line)
-                
-                line = triple(siglaiconclassokplaceHolder,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E1_CRM_Entity') + closeLine
-                output.write(line)
-                
-                line = triple(siglaiconclassokplaceHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"' + siglaiconclassok + '\"' ) + closeLine
-                output.write(line)
-                line = triple(siglaiconclassokplaceHolder,
-                              cidocCoords.prefix + 'P2_has_type',
-                              '\"Sigla Iconclass\"') + closeLine
-                output.write(line)
-            
-            # P2 Opera d'arte
-            line = triple(datplaceHolder,
-                cidocCoords.prefix + 'P2_has_type',
-                '\"Opera d\'Arte\"') + closeLine
-            output.write(line)
-
-            output.write('\n')
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 174
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_Ruoli.py

@@ -1,174 +0,0 @@
-# Utilities to read/write csv files
-import csv
-# Utilities to handle character encodings
-import unicodedata
-# Ordered Dicts
-from collections import OrderedDict
-
-import json
-
-# 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:')
-
-
-# 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 ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)
-    output.write('@prefix ' + autCoords.prefix + ' ' + autCoords.uri + closeLine)
-
-    output.write('\n')
-
-
-filePrefix = 'AR20AUT_'
-fileType = 'Ospedale'
-max_entries = 1000000000
-
-
-def get_role(role):
-    role_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/AAT_RUOLI.csv', newline="")
-    reader = csv.DictReader(role_file)
-    for row in reader:
-        if row['Label'] == role:
-            return row['AAT']
-
-
-with open(import_dir + filePrefix + fileType + '.csv', newline="") as csv_file, open(
-        export_dir + filePrefix + fileType + '_roles.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
-
-        url = row['URL']
-
-        # placeHolders
-        datplaceHolder = museoCoords.prefix + url
-
-        # E12 - PC14 - E21
-        if row['AUTH'] != '':
-            aut_role = ''
-            if row['AUTQ'] != '':
-                aut_role = row['AUTQ']
-                ll = row['AUTN'] + '_' + aut_role
-                lab = ll.replace(' ', '')
-                label = lab.replace(',', '')
-                line = triple(museoCoords.prefix + '_' + label,
-                          schemaCoords.prefix + 'label',
-                          '\"' + row['AUTN'] + ' nel ruolo di artista' + '\"') + closeLine
-                output.write(line)
-            else:
-                aut_role = 'artista'
-                ll = row['AUTN'] + '_' + 'artista'
-                lab = ll.replace(' ', '')
-                label = lab.replace(',', '')
-                line = triple(museoCoords.prefix + '_' + label,
-                          schemaCoords.prefix + 'label',
-                          '\"' + row['AUTN'] + ' nel ruolo di artista' + '\"') + closeLine
-                output.write(line)
-
-            AuthorPlaceholder = autCoords.prefix + row['URL']
-
-            line = triple(museoCoords.prefix + '_' + label,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'PC14_carried_out_by') + closeLine
-            output.write(line)
-
-            line = triple(museoCoords.prefix + '_' + label,
-                          cidocCoords.prefix + 'P02_has_range',
-                          AuthorPlaceholder) + closeLine
-            output.write(line)
-
-            if aut_role != '' and aut_role != 'artista':
-                role = get_role(aut_role)
-                line = triple(museoCoords.prefix + '_' + label,
-                              cidocCoords.prefix + 'P14.1_in_the_role_of',
-                              aatCoords.prefix + role) + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + role,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E55_Type') + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + role,
-                              schemaCoords.prefix + 'label',
-                              '\"' + aut_role + '\"') + closeLine
-                output.write(line)
-
-            else:
-                role = 'artista'
-                line = triple(museoCoords.prefix + '_' + label,
-                              cidocCoords.prefix + 'P14.1_in_the_role_of',
-                              aatCoords.prefix + role) + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + role,
-                              nsCoords.prefix + 'type',
-                              cidocCoords.prefix + 'E55_Type') + closeLine
-                output.write(line)
-                line = triple(aatCoords.prefix + role,
-                              schemaCoords.prefix + 'label',
-                              '\"' + aut_role + '\"') + closeLine
-                output.write(line)
-
-
-        output.write('\n')
-
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 168
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_VIAF_ULAN.py

@@ -1,168 +0,0 @@
-# Utilities to read/write csv files
-import csv
-# Utilities to handle character encodings
-import unicodedata
-# Ordered Dicts
-from collections import OrderedDict
-
-from urllib.request import urlopen
-from bs4 import BeautifulSoup
-
-import json
-
-# 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/'
-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:')
-foafCoords = RDFcoords('<http://xmlns.com/foaf/0.1/>', 'foaf:')
-owlCoords = RDFcoords('<http://www.w3.org/2002/07/owl#>', 'owl:')
-
-
-# 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 ' + nsCoords.prefix + ' ' + nsCoords.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 ' + owlCoords.prefix + ' ' + owlCoords.uri + closeLine)
-    output.write('@prefix ' + foafCoords.prefix + ' ' + foafCoords.uri + closeLine)
-
-    output.write('\n')
-
-
-filePrefix = 'PEOPLE'
-fileType = ''
-max_entries = 1000000000
-
-def get_aut_url(code):
-    aut_file = open(import_dir + 'AR20AUT_' + fileType + '.csv', newline="")
-    reader = csv.DictReader(aut_file)
-    for row in reader:
-        auth = int(row['AUTH'])
-        cod = int(code)
-        role = ''
-        if row['AUTQ'] != '':
-            role = row['AUTQ']
-        else:
-            role = ''
-        if auth == cod:
-            return [row['URL'], role]
-
-def get_role(role):
-    role_file = open('/Users/federicaspinelli/Google Drive/OVI-CNR/CSV/MPP/AAT_RUOLI.csv', newline="")
-    reader = csv.DictReader(role_file)
-    for row in reader:
-        if row['Label'] == role:
-            return row['AAT']
-
-def get_elem(mtc):
-    mtc_file = open('/Users/federicaspinelli/Google Drive/OVI-CNR/CSV/MPP/AAT_MTC.csv', newline="")
-    reader = csv.DictReader(mtc_file)
-    for row in reader:
-        if row['MTC'] == mtc:
-            return [row['AAT'], row['Type']]
-
-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
-
-        # placeHolders
-        urlplaceHolder = '<' + row['URL'] + '>'
-        e36placeHolder = '<' + row['URL'] + '_E36>'
-        e36e42placeHolder = '<' + row['URL'] + '_E36_E42>'
-        e36placeHolder2 = '<' + row['URL'] + '_E36_2>'
-        e36e42placeHolder2 = '<' + row['URL'] + '_E36_2_E42>'
-        e36placeHolder3 = '<' + row['URL'] + '_E36_3>'
-        e36e42placeHolder3 = '<' + row['URL'] + '_E36_3_E42>'
-        e31placeHolder = '<' + row['URL'] + '_E31>'
-        e3142placeHolder = '<' + row['URL'] + '_E31_E42>'
-        e31e36rplaceHolder = '<' + row['URL'] + '_E31_E36_r>'
-        e31e36re42placeHolder = '<' + row['URL'] + '_E31_E36_r_E42>'
-        e31e36vplaceHolder = '<' + row['URL'] + '_E31_E36_v>'
-        e31e36ve42placeHolder = '<' + row['URL'] + '_E31_E36_v_E42>'
-        # e31AplaceHolder = '<' + row['LINK ARCHIVE.org'] + '>'
-        # e31Ae42placeHolder = '<' + row['LINK ARCHIVE.org'] + '_E42>'
-        e13placeHolder = '<' + row['URL'] + '_E13_FA>'
-        # e31Ae55placeHolder = '<' + row['AAT (Attribution)'] + '_E31_E55>'
-        e12placeHolder = '<' + row['URL'] + '_E12>'
-        e12FplaceHolder = '<' + row['URL'] + '_E12F>'
-        
-        
-        if (row['URL']!= ''):
-            e21AUTplaceHolder = '<'+row['URL']+'>'
-            if (row['ULAN']!= ''):
-                e21ULANplaceHolder = '<https://vocab.getty.edu/page/ulan/'+row['ULAN']+'>'
-                line = triple(e21AUTplaceHolder, owlCoords.prefix + 'sameAs', e21ULANplaceHolder) + closeLine
-                output.write(line)
-            if (row['VIAF']!= ''):
-                e21VIAFplaceHolder = '<https://viaf.org/viaf/'+row['VIAF']+'>'
-                line = triple(e21AUTplaceHolder, owlCoords.prefix + 'sameAs', e21VIAFplaceHolder) + closeLine
-                output.write(line)
-            
-        output.write('\n')
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 303
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/CSV_to_RDF_cataloghi_OLD.py

@@ -1,303 +0,0 @@
-# Utilities to read/write csv files
-import csv
-# Utilities to handle character encodings
-import unicodedata
-# Ordered Dicts
-from collections import OrderedDict
-
-from urllib.request import urlopen
-from bs4 import BeautifulSoup
-
-import json
-
-# 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/'
-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:')
-foafCoords = RDFcoords('<http://xmlns.com/foaf/0.1/>', 'foaf:')
-owlCoords = RDFcoords('<http://www.w3.org/2002/07/owl#>', 'owl:')
-
-
-# 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 ' + nsCoords.prefix + ' ' + nsCoords.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 ' + owlCoords.prefix + ' ' + owlCoords.uri + closeLine)
-    output.write('@prefix ' + foafCoords.prefix + ' ' + foafCoords.uri + closeLine)
-
-    output.write('\n')
-
-
-filePrefix = 'OA'
-fileType = '_catalogo'
-max_entries = 1000000000
-
-def get_aut_url(code):
-    aut_file = open(import_dir + 'AR20AUT_' + fileType + '.csv', newline="")
-    reader = csv.DictReader(aut_file)
-    for row in reader:
-        auth = int(row['AUTH'])
-        cod = int(code)
-        role = ''
-        if row['AUTQ'] != '':
-            role = row['AUTQ']
-        else:
-            role = ''
-        if auth == cod:
-            return [row['URL'], role]
-
-def get_role(role):
-    role_file = open('/Users/federicaspinelli/Google Drive/OVI-CNR/CSV/MPP/AAT_RUOLI.csv', newline="")
-    reader = csv.DictReader(role_file)
-    for row in reader:
-        if row['Label'] == role:
-            return row['AAT']
-
-def get_elem(mtc):
-    mtc_file = open('/Users/federicaspinelli/Google Drive/OVI-CNR/CSV/MPP/AAT_MTC.csv', newline="")
-    reader = csv.DictReader(mtc_file)
-    for row in reader:
-        if row['MTC'] == mtc:
-            return [row['AAT'], row['Type']]
-
-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
-    e55invplaceHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/INV1979>"
-    line = triple(e55invplaceHolder, schemaCoords.prefix + 'label', '\"Inventario 1970\"') + closeLine
-    output.write(line)
-    e55AplaceHolder = "<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/ARCHIVE>"
-    line = triple(e55AplaceHolder, schemaCoords.prefix + 'label', '\"Riferimento bibliografico\"') + closeLine
-    output.write(line)
-    for row in reader:
-        # The index ii is used to process a limited number of entries for testing purposes
-        ii = ii + 1
-
-        # placeHolders
-        urlplaceHolder = '<' + row['Url OPERA'] + '>'
-        e36placeHolder = '<' + row['Url OPERA'] + '_E36>'
-        e36e42placeHolder = '<' + row['Url OPERA'] + '_E36_E42>'
-        e36placeHolder2 = '<' + row['Url OPERA'] + '_E36_2>'
-        e36e42placeHolder2 = '<' + row['Url OPERA'] + '_E36_2_E42>'
-        e36placeHolder3 = '<' + row['Url OPERA'] + '_E36_3>'
-        e36e42placeHolder3 = '<' + row['Url OPERA'] + '_E36_3_E42>'
-        e31placeHolder = '<' + row['Url OPERA'] + '_E31>'
-        e3142placeHolder = '<' + row['Url OPERA'] + '_E31_E42>'
-        e31e36rplaceHolder = '<' + row['Url OPERA'] + '_E31_E36_r>'
-        e31e36re42placeHolder = '<' + row['Url OPERA'] + '_E31_E36_r_E42>'
-        e31e36vplaceHolder = '<' + row['Url OPERA'] + '_E31_E36_v>'
-        e31e36ve42placeHolder = '<' + row['Url OPERA'] + '_E31_E36_v_E42>'
-        e31AplaceHolder = '<' + row['LINK ARCHIVE.org'] + '>'
-        e31Ae42placeHolder = '<' + row['LINK ARCHIVE.org'] + '_E42>'
-        e13placeHolder = '<' + row['Url OPERA'] + '_E13_FA>'
-        e31Ae55placeHolder = '<' + row['AAT (Attribution)'] + '_E31_E55>'
-        e12placeHolder = '<' + row['Url OPERA'] + '_E12>'
-        e12FplaceHolder = '<' + row['Url OPERA'] + '_E12F>'
-        
-        line = triple(e36placeHolder, cidocCoords.prefix + 'P138_represents', urlplaceHolder) + closeLine
-        output.write(line)
-        line = triple(e36placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
-        output.write(line)
-        line = triple(e36placeHolder, schemaCoords.prefix + 'label', '\"Immagine digitale dell\'Opera ' + '\'' + row['NOME OPERA'] + '\''+'\"') + 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, schemaCoords.prefix + 'label', '\"'+row['ID Immagine opera 1']+ '\"') + closeLine
-        output.write(line)
-        
-        if (row['ID Immagine opera 2']!= ''):
-            line = triple(e36placeHolder2, cidocCoords.prefix + 'P138_represents', urlplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e36placeHolder2, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder2, schemaCoords.prefix + 'label', '\"Immagine digitale dell\'Opera ' + '\'' + row['NOME OPERA'] + '\''+'\"') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder2, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder2) + closeLine
-            output.write(line)
-            line = triple(e36e42placeHolder2, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e42placeHolder2, schemaCoords.prefix + 'label', '\"'+row['ID Immagine opera 2']+ '\"') + closeLine
-            output.write(line)
-
-        if (row['ID Immagine opera 3']!= ''):
-            line = triple(e36placeHolder3, cidocCoords.prefix + 'P138_represents', urlplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e36placeHolder3, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder3, schemaCoords.prefix + 'label', '\"Immagine digitale dell\'Opera ' + '\'' + row['NOME OPERA'] + '\''+'\"') + closeLine
-            output.write(line)
-            line = triple(e36placeHolder3, cidocCoords.prefix + 'P1_is_identified_by', e36e42placeHolder3) + closeLine
-            output.write(line)
-            line = triple(e36e42placeHolder3, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e36e42placeHolder3, schemaCoords.prefix + 'label', '\"'+row['ID Immagine opera 3']+ '\"') + closeLine
-            output.write(line)
-        
-        if (row['ID Inventario 1970']!= ''):
-            line = triple(e31placeHolder, cidocCoords.prefix + 'P70_documents', urlplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e31placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E31_Document') + closeLine
-            output.write(line)
-            line = triple(e31placeHolder, schemaCoords.prefix + 'label', '\"Inventario 1970\"') + closeLine
-            output.write(line)
-            line = triple(e31placeHolder, cidocCoords.prefix + 'P2_has_type', e55invplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e31placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e3142placeHolder) + closeLine
-            output.write(line)
-            line = triple(e3142placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e3142placeHolder, schemaCoords.prefix + 'label', '\"'+row['ID Inventario 1970']+ '\"') + closeLine
-            output.write(line)
-
-        if (row['ID Immagine Inventario 1970 recto']!= ''):
-            line = triple(e31e36rplaceHolder, cidocCoords.prefix + 'P138_represents', e31placeHolder) + closeLine
-            output.write(line)
-            line = triple(e31e36rplaceHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
-            output.write(line)
-            line = triple(e31e36rplaceHolder, schemaCoords.prefix + 'label', '\"Rappresentazione digitale della scheda opera d\'arte su ' + "\'Inventario 1970\' - recto" + '\"' ) + closeLine
-            output.write(line)
-            line = triple(e31e36rplaceHolder, cidocCoords.prefix + 'P1_is_identified_by', e31e36re42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e31e36re42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e31e36re42placeHolder, schemaCoords.prefix + 'label', '\"'+row['ID Immagine Inventario 1970 recto']+ '\"') + closeLine
-            output.write(line)
-
-        if (row['ID Immagine Inventario 1970 verso']!= ''):
-            line = triple(e31e36vplaceHolder, cidocCoords.prefix + 'P138_represents', e31placeHolder) + closeLine
-            output.write(line)
-            line = triple(e31e36vplaceHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E36_Visual_Item') + closeLine
-            output.write(line)
-            line = triple(e31e36vplaceHolder, schemaCoords.prefix + 'label', '\"Rappresentazione digitale della scheda opera d\'arte su ' + "\'Inventario 1970\' - verso" + '\"' ) + closeLine
-            output.write(line)
-            line = triple(e31e36vplaceHolder, cidocCoords.prefix + 'P1_is_identified_by', e31e36ve42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e31e36ve42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e31e36ve42placeHolder, schemaCoords.prefix + 'label', '\"'+row['ID Immagine Inventario 1970 verso']+ '\"') + closeLine
-            output.write(line)
-        
-        if (row['LINK ARCHIVE.org']!= ''):
-            line = triple(e31AplaceHolder, cidocCoords.prefix + 'P70_documents', urlplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e31AplaceHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E31_Document') + closeLine
-            output.write(line)
-            line = triple(e31AplaceHolder, schemaCoords.prefix + 'label', '\"Riferimento bibliografico della scheda opera d\'arte su ARCHIVE.org\"') + closeLine
-            output.write(line)
-            line = triple(e31AplaceHolder, cidocCoords.prefix + 'P2_has_type', e55AplaceHolder) + closeLine
-            output.write(line)
-            line = triple(e31AplaceHolder, cidocCoords.prefix + 'P1_is_identified_by', e31Ae42placeHolder) + closeLine
-            output.write(line)
-            line = triple(e31Ae42placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E42_Identifier') + closeLine
-            output.write(line)
-            line = triple(e31Ae42placeHolder, schemaCoords.prefix + 'label', '\"'+row['BIBH']+ '\"') + closeLine
-            output.write(line)
-
-        if (row['FORMER ATTRIBUTION']!= '' and row['FORMER ATTRIBUTION']!= ' ' and row['FORMER ATTRIBUTION'] is not None):
-            line = triple(e12placeHolder, cidocCoords.prefix + 'P141_assigned', e13placeHolder) + closeLine
-            output.write(line)
-            line = triple(e12FplaceHolder, cidocCoords.prefix + 'P141_assigned', e13placeHolder) + closeLine
-            output.write(line)
-            if (row['LINK ARCHIVE.org']!= ''):
-                line = triple(e13placeHolder, cidocCoords.prefix + 'P42_assigned', e31AplaceHolder) + closeLine
-                output.write(line)
-            line = triple(e13placeHolder, cidocCoords.prefix + 'P2_has_type', e31Ae55placeHolder) + closeLine
-            output.write(line)
-            line = triple(e31Ae55placeHolder, schemaCoords.prefix + 'label', '\"AAT Attribution\"') + closeLine
-            output.write(line)
-            line = triple(e13placeHolder, schemaCoords.prefix + 'label', '\"Former Attribution dell\'Opera ' + '\'' + row['NOME OPERA'] + '\''+'\"') + closeLine
-            output.write(line)
-            e21ULANplaceHolder = '<'+row['ULAN']+'>'
-            if (row['LINK SCHEDA AUT']!= ''):
-                e21AUTplaceHolder = '<'+row['LINK SCHEDA AUT']+'>'
-                line = triple(e13placeHolder, cidocCoords.prefix + 'P141_assigned', e21AUTplaceHolder) + closeLine
-                output.write(line)
-                if (row['ULAN']!= ''):
-                    line = triple(e21AUTplaceHolder, owlCoords.prefix + 'sameAs', e21ULANplaceHolder) + closeLine
-                    output.write(line)
-                if (row['VIAF']!= ''):
-                    e21VIAFplaceHolder = '<'+row['VIAF']+'>'
-                    line = triple(e21AUTplaceHolder, owlCoords.prefix + 'sameAs', e21VIAFplaceHolder) + closeLine
-                    output.write(line)
-            else:
-                line = triple(e13placeHolder, cidocCoords.prefix + 'P141_assigned', e21ULANplaceHolder) + closeLine
-                output.write(line)
-                line = triple(e21ULANplaceHolder, schemaCoords.prefix + 'label', '\"' + row['FORMER ATTRIBUTION']+ '\"') + closeLine
-                output.write(line)
-                line = triple(e21ULANplaceHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E21_Person') + closeLine
-                output.write(line)
-                line = triple(e21ULANplaceHolder, nsCoords.prefix + 'type', foafCoords.prefix + 'person') + closeLine
-                output.write(line)
-                if (row['VIAF']!= ''):
-                    e21VIAFplaceHolder = '<'+row['VIAF']+'>'
-                    line = triple(e21ULANplaceHolder, owlCoords.prefix + 'sameAs', e21VIAFplaceHolder) + closeLine
-                    output.write(line)
-            
-        output.write('\n')
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 1177
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/Martini.ipynb

@@ -1,1177 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "metadata": {},
-   "outputs": [
-    {
-     "ename": "URLError",
-     "evalue": "<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)>",
-     "output_type": "error",
-     "traceback": [
-      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
-      "\u001b[0;31mSSLCertVerificationError\u001b[0m                  Traceback (most recent call last)",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py\u001b[0m in \u001b[0;36mdo_open\u001b[0;34m(self, http_class, req, **http_conn_args)\u001b[0m\n\u001b[1;32m   1341\u001b[0m             \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1342\u001b[0;31m                 h.request(req.get_method(), req.selector, req.data, headers,\n\u001b[0m\u001b[1;32m   1343\u001b[0m                           encode_chunked=req.has_header('Transfer-encoding'))\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py\u001b[0m in \u001b[0;36mrequest\u001b[0;34m(self, method, url, body, headers, encode_chunked)\u001b[0m\n\u001b[1;32m   1254\u001b[0m         \u001b[0;34m\"\"\"Send a complete request to the server.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1255\u001b[0;31m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_send_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbody\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mheaders\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mencode_chunked\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1256\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py\u001b[0m in \u001b[0;36m_send_request\u001b[0;34m(self, method, url, body, headers, encode_chunked)\u001b[0m\n\u001b[1;32m   1300\u001b[0m             \u001b[0mbody\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_encode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbody\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'body'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1301\u001b[0;31m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mendheaders\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbody\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mencode_chunked\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mencode_chunked\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1302\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py\u001b[0m in \u001b[0;36mendheaders\u001b[0;34m(self, message_body, encode_chunked)\u001b[0m\n\u001b[1;32m   1249\u001b[0m             \u001b[0;32mraise\u001b[0m \u001b[0mCannotSendHeader\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1250\u001b[0;31m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_send_output\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage_body\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mencode_chunked\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mencode_chunked\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1251\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py\u001b[0m in \u001b[0;36m_send_output\u001b[0;34m(self, message_body, encode_chunked)\u001b[0m\n\u001b[1;32m   1009\u001b[0m         \u001b[0;32mdel\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_buffer\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1010\u001b[0;31m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1011\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, data)\u001b[0m\n\u001b[1;32m    949\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mauto_open\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 950\u001b[0;31m                 \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    951\u001b[0m             \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py\u001b[0m in \u001b[0;36mconnect\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m   1423\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1424\u001b[0;31m             self.sock = self._context.wrap_socket(self.sock,\n\u001b[0m\u001b[1;32m   1425\u001b[0m                                                   server_hostname=server_hostname)\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py\u001b[0m in \u001b[0;36mwrap_socket\u001b[0;34m(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)\u001b[0m\n\u001b[1;32m    499\u001b[0m         \u001b[0;31m# ctx._wrap_socket()\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 500\u001b[0;31m         return self.sslsocket_class._create(\n\u001b[0m\u001b[1;32m    501\u001b[0m             \u001b[0msock\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msock\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py\u001b[0m in \u001b[0;36m_create\u001b[0;34m(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)\u001b[0m\n\u001b[1;32m   1039\u001b[0m                         \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"do_handshake_on_connect should not be specified for non-blocking sockets\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1040\u001b[0;31m                     \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdo_handshake\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1041\u001b[0m             \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mOSError\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py\u001b[0m in \u001b[0;36mdo_handshake\u001b[0;34m(self, block)\u001b[0m\n\u001b[1;32m   1308\u001b[0m                 \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msettimeout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1309\u001b[0;31m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sslobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdo_handshake\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1310\u001b[0m         \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;31mSSLCertVerificationError\u001b[0m: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)",
-      "\nDuring handling of the above exception, another exception occurred:\n",
-      "\u001b[0;31mURLError\u001b[0m                                  Traceback (most recent call last)",
-      "\u001b[0;32m/var/folders/_n/1ldwyw1s547dcpvn3485fr7r0000gn/T/ipykernel_10523/3987068014.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m   1065\u001b[0m             \u001b[0;32mfor\u001b[0m \u001b[0mic\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mlist_icon\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1066\u001b[0m                 \u001b[0murl\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'https://iconclass.org/rdk/'\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mic\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1067\u001b[0;31m                 \u001b[0mhtml\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0murlopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1068\u001b[0m                 \u001b[0msoup\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mBeautifulSoup\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhtml\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'html.parser'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1069\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py\u001b[0m in \u001b[0;36murlopen\u001b[0;34m(url, data, timeout, cafile, capath, cadefault, context)\u001b[0m\n\u001b[1;32m    212\u001b[0m     \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    213\u001b[0m         \u001b[0mopener\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_opener\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 214\u001b[0;31m     \u001b[0;32mreturn\u001b[0m \u001b[0mopener\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    215\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    216\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0minstall_opener\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mopener\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py\u001b[0m in \u001b[0;36mopen\u001b[0;34m(self, fullurl, data, timeout)\u001b[0m\n\u001b[1;32m    515\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    516\u001b[0m         \u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maudit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'urllib.Request'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreq\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfull_url\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreq\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreq\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mheaders\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreq\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_method\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 517\u001b[0;31m         \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_open\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreq\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    518\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    519\u001b[0m         \u001b[0;31m# post-process response\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py\u001b[0m in \u001b[0;36m_open\u001b[0;34m(self, req, data)\u001b[0m\n\u001b[1;32m    532\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    533\u001b[0m         \u001b[0mprotocol\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mreq\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtype\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 534\u001b[0;31m         result = self._call_chain(self.handle_open, protocol, protocol +\n\u001b[0m\u001b[1;32m    535\u001b[0m                                   '_open', req)\n\u001b[1;32m    536\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py\u001b[0m in \u001b[0;36m_call_chain\u001b[0;34m(self, chain, kind, meth_name, *args)\u001b[0m\n\u001b[1;32m    492\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0mhandler\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mhandlers\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    493\u001b[0m             \u001b[0mfunc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhandler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmeth_name\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 494\u001b[0;31m             \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    495\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    496\u001b[0m                 \u001b[0;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py\u001b[0m in \u001b[0;36mhttps_open\u001b[0;34m(self, req)\u001b[0m\n\u001b[1;32m   1383\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1384\u001b[0m         \u001b[0;32mdef\u001b[0m \u001b[0mhttps_open\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreq\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1385\u001b[0;31m             return self.do_open(http.client.HTTPSConnection, req,\n\u001b[0m\u001b[1;32m   1386\u001b[0m                 context=self._context, check_hostname=self._check_hostname)\n\u001b[1;32m   1387\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py\u001b[0m in \u001b[0;36mdo_open\u001b[0;34m(self, http_class, req, **http_conn_args)\u001b[0m\n\u001b[1;32m   1343\u001b[0m                           encode_chunked=req.has_header('Transfer-encoding'))\n\u001b[1;32m   1344\u001b[0m             \u001b[0;32mexcept\u001b[0m \u001b[0mOSError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# timeout error\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1345\u001b[0;31m                 \u001b[0;32mraise\u001b[0m \u001b[0mURLError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0merr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1346\u001b[0m             \u001b[0mr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mh\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetresponse\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1347\u001b[0m         \u001b[0;32mexcept\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;31mURLError\u001b[0m: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)>"
-     ]
-    }
-   ],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "# Utilities to handle character encodings\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "\n",
-    "from urllib.request import urlopen\n",
-    "from bs4 import BeautifulSoup\n",
-    "\n",
-    "import json\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json\n",
-    "\n",
-    "import_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/corretti/'\n",
-    "export_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/RDF/'\n",
-    "\n",
-    "\n",
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code=None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "\n",
-    "# Repositories\n",
-    "museoCoords = RDFcoords('<https://palazzopretorio.prato.it/it/le-opere/alcuni-capolavori/>', 'mpp:')\n",
-    "autCoords = RDFcoords('<https://palazzopretorio.prato.it/it/opere/autori/>', 'aut:')\n",
-    "cidocCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/>', 'crm:')\n",
-    "aatCoords = RDFcoords('<http://vocab.getty.edu/aat/>', 'aat:')\n",
-    "nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')\n",
-    "schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')\n",
-    "xsdCoords = RDFcoords('<http://www.w3.org/2001/XMLSchema#>', 'xsd:')\n",
-    "iconCoords = RDFcoords('<http://iconclass.org/>', 'ico:')\n",
-    "\n",
-    "\n",
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'\n",
-    "\n",
-    "\n",
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + museoCoords.prefix + ' ' + museoCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + cidocCoords.prefix + ' ' + cidocCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + aatCoords.prefix + ' ' + aatCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + autCoords.prefix + ' ' + autCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + xsdCoords.prefix + ' ' + xsdCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + iconCoords.prefix + ' ' + iconCoords.uri + closeLine)\n",
-    "\n",
-    "    output.write('\\n')\n",
-    "\n",
-    "\n",
-    "filePrefix = '00_SR20OA_'\n",
-    "fileType = 'Martini'\n",
-    "max_entries = 1000000000\n",
-    "\n",
-    "\n",
-    "def get_aut_url(code):\n",
-    "    aut_file = open(import_dir + 'AR20AUT_' + fileType + '.csv', newline=\"\")\n",
-    "    reader = csv.DictReader(aut_file)\n",
-    "    for row in reader:\n",
-    "        auth = int(row['AUTH'])\n",
-    "        cod = int(code)\n",
-    "        role = ''\n",
-    "        if row['AUTQ'] != '':\n",
-    "            role = row['AUTQ']\n",
-    "        else:\n",
-    "            role = ''\n",
-    "        if auth == cod:\n",
-    "            return [row['URL'], role]\n",
-    "\n",
-    "def get_role(role):\n",
-    "    role_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/AAT_RUOLI.csv', newline=\"\")\n",
-    "    reader = csv.DictReader(role_file)\n",
-    "    for row in reader:\n",
-    "        if row['Label'] == role:\n",
-    "            return row['AAT']\n",
-    "\n",
-    "def get_elem(mtc):\n",
-    "    mtc_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/MPP/CSV/AAT_MTC.csv', newline=\"\")\n",
-    "    reader = csv.DictReader(mtc_file)\n",
-    "    for row in reader:\n",
-    "        if row['MTC'] == mtc:\n",
-    "            return [row['AAT'], row['Type']]\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '.csv', newline=\"\") as csv_file, open(\n",
-    "        export_dir + filePrefix + fileType + '.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii + 1\n",
-    "\n",
-    "        if row['RVEL'] == '' or row['RVEL'] == '0':\n",
-    "\n",
-    "            sb = ''\n",
-    "            subj = ''\n",
-    "            #pp = row['OGTD'] + ' (' + row['ACC'] + ') '\n",
-    "            if row['SGTI'] != '':\n",
-    "                sb = row['SGTI']\n",
-    "\n",
-    "            # Triplify the 'codice' -- should exist for every entry\n",
-    "            codice = ''\n",
-    "            if (row['NCTR'] != '' and row['NCTN'] != ''):\n",
-    "                codice = row['NCTR'] + row['NCTN']\n",
-    "\n",
-    "            codiceP = ''\n",
-    "            if (row['AUTH'] != ''):\n",
-    "                codiceP = row['AUTH']\n",
-    "\n",
-    "            place = ''\n",
-    "            if (row['PRVC'] != ''):\n",
-    "                place = row['PRVC']\n",
-    "\n",
-    "            columnName = list(row)\n",
-    "            url = row['URL']\n",
-    "\n",
-    "            # placeHolders\n",
-    "            datplaceHolder = museoCoords.prefix + url\n",
-    "            e1placeHolder = museoCoords.prefix + url + '_E1'\n",
-    "            e3placeHolder = museoCoords.prefix + url + 'E3'\n",
-    "            e10placeHolder = museoCoords.prefix + url + '_E10'\n",
-    "            e12placeHolder = museoCoords.prefix + url + '_E12'\n",
-    "            e13placeHolder = museoCoords.prefix + url + '_E13'\n",
-    "            e21placeHolder = museoCoords.prefix + url + '_InE21'\n",
-    "            e25placeHolder = museoCoords.prefix + url + '_E25'\n",
-    "            e34placeHolder = museoCoords.prefix + url + '_E34'\n",
-    "            e35placeHolder1 = museoCoords.prefix + url + '_E35'\n",
-    "            e42placeHolder = museoCoords.prefix + url + '_E42'\n",
-    "            e42CplaceHolder = museoCoords.prefix + url + '_E42_MPP'\n",
-    "            e65placeHolder = museoCoords.prefix + url + '_InE65'\n",
-    "            e73placeHolder = museoCoords.prefix + url + '_E73'\n",
-    "            e74placeHolder = museoCoords.prefix + url + '_E74'\n",
-    "\n",
-    "            if (codice != ''):\n",
-    "                line = triple(datplaceHolder, cidocCoords.prefix + 'P1_is_identified_by', e42placeHolder) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e42placeHolder, nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E42_Identifier') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                line = triple(e42placeHolder,\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"0' + codice + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "                ###\n",
-    "                line = triple(e42placeHolder,\n",
-    "                              cidocCoords.prefix + 'P2_has_type',\n",
-    "                              '\\\"Codice univoco del bene (NCT)\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "\n",
-    "            # Write E22 Man Made Object & E73 Information Object -- should exist for every entry?\n",
-    "            line = triple(datplaceHolder, nsCoords.prefix + 'type',\n",
-    "                          cidocCoords.prefix + 'E22_Man-Made_Object') + closeLine\n",
-    "            output.write(line)\n",
-    "            # Added by AS\n",
-    "            line = triple(datplaceHolder, schemaCoords.prefix + 'label', '\\\"' + sb + '\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "            # End AS\n",
-    "            line = triple(datplaceHolder, cidocCoords.prefix + 'P128_carries', e73placeHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(e73placeHolder, nsCoords.prefix + 'type',\n",
-    "                          cidocCoords.prefix + 'E73_Information_Object') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "            # AS\n",
-    "            ss = ''\n",
-    "            if row['SGTI'] != '':\n",
-    "                ss = row['SGTI']\n",
-    "            else:\n",
-    "                ss = 'senza titolo'\n",
-    "\n",
-    "            line = triple(e73placeHolder, schemaCoords.prefix + 'label',\n",
-    "                          '\\\"Opera d\\'arte raffigurante ' + ss + '\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "            # E73 - P2 - E55\n",
-    "\n",
-    "            tt = ''\n",
-    "            typeLabel = ''\n",
-    "\n",
-    "            if row['OGTD'] == 'dipinto':\n",
-    "                tt = aatCoords.prefix + \"300033618\"\n",
-    "            elif row['OGTD'] == 'rilievo':\n",
-    "                tt = aatCoords.prefix + \"300047230\"\n",
-    "            elif row['OGTD'] == 'polittico':\n",
-    "                tt = aatCoords.prefix + \"300178235\"\n",
-    "            elif row['OGTD'] == 'predella':\n",
-    "                tt = aatCoords.prefix + \"300003745\"\n",
-    "\n",
-    "            line = triple(e73placeHolder,\n",
-    "                          cidocCoords.prefix + 'P2_has_type',\n",
-    "                          tt) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(tt, schemaCoords.prefix + 'label',\n",
-    "                          '\\\"' + row['OGTD'] + '\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "            # E73 - P1 - E35\n",
-    "\n",
-    "            if row['SGTT'] != '':\n",
-    "                line = triple(e73placeHolder, cidocCoords.prefix + 'P1_is_identified_by', e35placeHolder1) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e35placeHolder1, nsCoords.prefix + 'type', cidocCoords.prefix + 'E35_Title') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e35placeHolder1, schemaCoords.prefix + 'label', '\\\"' + row['SGTT'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            # E22 - P62 - E1\n",
-    "\n",
-    "            if row['SGTI'] != '':\n",
-    "                line = triple(datplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P62_depicts',\n",
-    "                              e1placeHolder) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e1placeHolder,\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E1_CRM_Entity') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e1placeHolder,\n",
-    "                              schemaCoords.prefix + 'label', '\\\"' +\n",
-    "                              row['SGTI'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                line = triple(e1placeHolder,\n",
-    "                              cidocCoords.prefix + 'P2_has_type',\n",
-    "                              '\\\"Identificazione Iconografica\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            # Attention: these triples are identified only for C100005 Museo di Palazzo Pretorio\n",
-    "\n",
-    "            if row['ESC'] == 'C100005':\n",
-    "                line = triple(datplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P52_has_current_owner',\n",
-    "                              '<https://palazzopretorio.prato.it/it/>') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple('<https://palazzopretorio.prato.it/it/>',\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E74_Group') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple('<https://palazzopretorio.prato.it/it/>',\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"Museo di Palazzo Pretorio\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            currentLocation = ''\n",
-    "\n",
-    "            # E22 - P54 - E53\n",
-    "            if row['LDCN'] != '':\n",
-    "                if row['LDCS'] != '':\n",
-    "                    currentLocation = row['LDCS']\n",
-    "                else:\n",
-    "                    currentLocation = currentLocation\n",
-    "                if row['LDCM'] != '':\n",
-    "                    currentLocation = currentLocation + ', ' + row['LDCM']\n",
-    "                else:\n",
-    "                    currentLocation = currentLocation\n",
-    "                if row['LDCN'] != '':\n",
-    "                    currentLocation = currentLocation + ', ' + row['LDCN']\n",
-    "                else:\n",
-    "                    currentLocation = currentLocation\n",
-    "\n",
-    "                currentLocation = currentLocation + ', ' + row['PVCC'] + ' (' + row['PVCP'] + ')'\n",
-    "\n",
-    "                line = triple(datplaceHolder, cidocCoords.prefix + 'P54_has_current_permanent_location',\n",
-    "                              '\\\"' + currentLocation + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            e12FplaceHolder = ''\n",
-    "            if row['DTSI'] != row['DTSF']:\n",
-    "                e12FplaceHolder = museoCoords.prefix + url + '_E12F'\n",
-    "\n",
-    "            # Write E12 Production -- should exist for every entry?\n",
-    "            # E12 P108 E22\n",
-    "            line = triple(e12placeHolder, cidocCoords.prefix + 'P108_has_produced', datplaceHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(e12placeHolder, nsCoords.prefix + 'type', cidocCoords.prefix + 'E12_Production') + closeLine\n",
-    "            output.write(line)\n",
-    "            # E73 P108i E12\n",
-    "            line = triple(e73placeHolder, cidocCoords.prefix + 'P108i_was_produced_by', e12placeHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "            if e12FplaceHolder != '':\n",
-    "                line = triple(e12FplaceHolder, cidocCoords.prefix + 'P108_has_produced', datplaceHolder) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e12FplaceHolder, nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E12_Production') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e12FplaceHolder, schemaCoords.prefix + 'label',\n",
-    "                              '\\\"Fine produzione di ' + row['SGTI'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "                # E73 P108i E12\n",
-    "                line = triple(e73placeHolder, cidocCoords.prefix + 'P108i_was_produced_by', e12FplaceHolder) + closeLine\n",
-    "                output.write(line)\n",
-    "                # E12 P140i E13\n",
-    "                line = triple(e12FplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P140i_was_attributed_by',\n",
-    "                              e13placeHolder) + closeLine\n",
-    "                output.write(line)\n",
-    "                # E12 P2\n",
-    "                line = triple(e12FplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P2_has_type',\n",
-    "                              '\\\"Fine\\\"^^xsd:string') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e12placeHolder,\n",
-    "                              cidocCoords.prefix + 'P2_has_type',\n",
-    "                              '\\\"Inizio\\\"^^xsd:string') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e12placeHolder, schemaCoords.prefix + 'label',\n",
-    "                              '\\\"Inizio produzione di ' + row['SGTI'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "            else:\n",
-    "                line = triple(e12placeHolder, schemaCoords.prefix + 'label',\n",
-    "                              '\\\"Produzione di ' + row['SGTI'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            tcl = []\n",
-    "            for name in columnName:\n",
-    "                if 'TCL' in name:\n",
-    "                    tcl.append(name)\n",
-    "\n",
-    "            # E12 - P7 - E53\n",
-    "            for el in tcl:\n",
-    "                i = 0\n",
-    "                if row[el] == 'luogo di produzione':\n",
-    "                    pl = ''\n",
-    "                    if i == 0:\n",
-    "                        pl = row['PRVC']\n",
-    "                    else:\n",
-    "                        pl = row['PRVC' + i]\n",
-    "                    line = triple(e12placeHolder,\n",
-    "                                  cidocCoords.prefix + 'P7_took_place_at',\n",
-    "                                  museoCoords.prefix + pl) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if e12FplaceHolder != '':\n",
-    "                        line = triple(e12FplaceHolder,\n",
-    "                                      cidocCoords.prefix + 'P7_took_place_at',\n",
-    "                                      museoCoords.prefix + pl) + closeLine\n",
-    "                        output.write(line)\n",
-    "                i = i + 1\n",
-    "\n",
-    "            # E12 - PC14 - E21\n",
-    "            if row['AUTH'] != '':\n",
-    "                aut = get_aut_url(row['AUTH'])\n",
-    "                aut_url = aut[0]\n",
-    "                aut_role = aut[1]\n",
-    "                ll = row['AUTN'] + '_' + aut_role\n",
-    "                lab = ll.replace(' ', '')\n",
-    "                label = lab.replace(',', '')\n",
-    "\n",
-    "                AuthorPlaceholder = autCoords.prefix + aut_url\n",
-    "                line = triple(museoCoords.prefix + '_' + label,\n",
-    "                              cidocCoords.prefix + 'P01_has_domain',\n",
-    "                              e12placeHolder) + closeLine\n",
-    "                output.write(line)\n",
-    "                if e12FplaceHolder != '':\n",
-    "                    line = triple(museoCoords.prefix + '_' + label,\n",
-    "                                  cidocCoords.prefix + 'P01_has_domain',\n",
-    "                                  e12FplaceHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "            if 'AUTH1' in columnName:\n",
-    "                if row['AUTH1'] != '':\n",
-    "                    aut = get_aut_url(row['AUTH1'])\n",
-    "                    aut_url = aut[0]\n",
-    "                    aut_role = aut[1]\n",
-    "                    ll = row['AUTN1'] + '_' + aut_role\n",
-    "                    lab = ll.replace(' ', '')\n",
-    "                    label = lab.replace(',', '')\n",
-    "\n",
-    "                    AuthorPlaceholder = autCoords.prefix + aut_url\n",
-    "                    line = triple(museoCoords.prefix + '_' + label,\n",
-    "                                  cidocCoords.prefix + 'P01_has_domain',\n",
-    "                                  e12placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if e12FplaceHolder != '':\n",
-    "                        line = triple(museoCoords.prefix + '_' + label,\n",
-    "                                      cidocCoords.prefix + 'P01_has_domain',\n",
-    "                                      e12FplaceHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "\n",
-    "            # E12 - PC14 - E21\n",
-    "            if 'CMMN' in columnName:\n",
-    "                if row['CMMN'] != '':\n",
-    "                    cc = row['CMMN']\n",
-    "                    cm = cc.replace(' ', '')\n",
-    "                    cmmn = cm.replace(',', '')\n",
-    "\n",
-    "                    cmmPlaceholder = museoCoords.prefix + '_' + cmmn\n",
-    "                    line = triple(museoCoords.prefix + '_commit_' + cmmn,\n",
-    "                                  cidocCoords.prefix + 'P01_has_domain',\n",
-    "                                  e12placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if e12FplaceHolder != '':\n",
-    "                        line = triple(museoCoords.prefix + '_commit_' + cmmn,\n",
-    "                                      cidocCoords.prefix + 'P01_has_domain',\n",
-    "                                      e12FplaceHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    line = triple(museoCoords.prefix + '_commit_' + cmmn,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'PC14_carried_out_by') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(museoCoords.prefix + '_commit_' + cmmn,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['CMMN'] + ' nel ruolo di committente\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "                    line = triple(museoCoords.prefix + '_commit_' + cmmn,\n",
-    "                                  cidocCoords.prefix + 'P02_has_range',\n",
-    "                                  cmmPlaceholder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(cmmPlaceholder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E39_Actor') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(cmmPlaceholder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['CMMN'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "                    line = triple(museoCoords.prefix + '_commit_' + cmmn,\n",
-    "                                  cidocCoords.prefix + 'P14.1_in_the_role_of',\n",
-    "                                  museoCoords.prefix + '_client') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(museoCoords.prefix + '_client',\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E55_Type') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(museoCoords.prefix + '_client',\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"Committente\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "            # E12 - P4 - E52\n",
-    "            if row['DTSI'] != '':\n",
-    "                line = triple(e12placeHolder,\n",
-    "                              cidocCoords.prefix + 'P4_has_time-span',\n",
-    "                              museoCoords.prefix + row['DTSI']) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(museoCoords.prefix + row['DTSI'],\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E52_Time-Span') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(museoCoords.prefix + row['DTSI'],\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"' + row['DTSI'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            if e12FplaceHolder != '':\n",
-    "                line = triple(e12FplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P4_has_time-span',\n",
-    "                              museoCoords.prefix + row['DTSF']) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(museoCoords.prefix + row['DTSF'],\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E52_Time-Span') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(museoCoords.prefix + row['DTSF'],\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"' + row['DTSF'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            tcl = []\n",
-    "            for name in columnName:\n",
-    "                if 'TCL' in name:\n",
-    "                    tcl.append(name)\n",
-    "\n",
-    "            j = 0\n",
-    "\n",
-    "            for el in tcl:\n",
-    "                if row[el] != '':\n",
-    "                    j = j + 1\n",
-    "\n",
-    "            last = str(j - 1)\n",
-    "\n",
-    "            n = len(tcl) - 1\n",
-    "\n",
-    "            for i in range(n):\n",
-    "\n",
-    "                k = str(i + 1)\n",
-    "\n",
-    "                if i + 1 == 1:\n",
-    "                    w = ''\n",
-    "                else:\n",
-    "                    w = i\n",
-    "\n",
-    "                f = str(w)\n",
-    "\n",
-    "                if row['TCL' + k] != '':\n",
-    "\n",
-    "                    pastActor = ''\n",
-    "                    newActor = ''\n",
-    "                    pl = ''\n",
-    "\n",
-    "                    if row['PRCD' + k] != '':\n",
-    "                        newActor = ' a ' + row['PRCD' + k]\n",
-    "\n",
-    "                    if row['PRCD' + f] != '':\n",
-    "                        pastActor = ' da ' + row['PRCD' + f]\n",
-    "                        pl = row['PRCD' + f].replace(' ', '')\n",
-    "\n",
-    "                    newe10placeHolder = museoCoords.prefix + url + \"_E10_\" + k\n",
-    "\n",
-    "                    line = triple(newe10placeHolder,\n",
-    "                                  cidocCoords.prefix + 'P30_transferred_custody_of',\n",
-    "                                  datplaceHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(newe10placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E10_Transfer_of_Custody') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(newe10placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"Passaggio di ' + row['SGTI'] + pastActor +\n",
-    "                                  newActor + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "                    if row['PRDI' + f] != '':\n",
-    "                        timespan = row['PRDI' + f]\n",
-    "\n",
-    "                        tt = timespan.replace(' ', '')\n",
-    "                        tp = tt.replace('.', '')\n",
-    "                        ts = tp.replace('/', '')\n",
-    "\n",
-    "                        timespanPlaceholder = museoCoords.prefix + '_' + ts\n",
-    "\n",
-    "                        # E10 P4 E52\n",
-    "\n",
-    "                        line = triple(newe10placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P4_has_time-span',\n",
-    "                                      timespanPlaceholder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(timespanPlaceholder,\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      cidocCoords.prefix + 'E52_Time-Span') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(timespanPlaceholder,\n",
-    "                                      schemaCoords.prefix + 'label',\n",
-    "                                      '\\\"' + timespan + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "\n",
-    "                    pastActorPlaceholder = museoCoords.prefix + '_' + pl\n",
-    "                    newLoc = row['PRCD' + k].replace(' ', '')\n",
-    "                    newActorPlaceholder = museoCoords.prefix + '_' + newLoc\n",
-    "\n",
-    "                    # E10 P26 E74 (moved to)\n",
-    "\n",
-    "                    if newActorPlaceholder != '':\n",
-    "                        line = triple(newe10placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P29_custody_received_by',\n",
-    "                                      newActorPlaceholder) + closeLine\n",
-    "                        output.write(line)\n",
-    "\n",
-    "                    # E10 P27 E74\n",
-    "\n",
-    "                    pastActorLabel = row['PRCD' + f]\n",
-    "\n",
-    "                    line = triple(newe10placeHolder,\n",
-    "                                  cidocCoords.prefix + 'P28_custody_surrendered_by',\n",
-    "                                  pastActorPlaceholder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(pastActorPlaceholder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E39_Actor') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(pastActorPlaceholder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + pastActorLabel + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "                    line = triple(datplaceHolder,\n",
-    "                                  cidocCoords.prefix + 'P49_has_former_or_current_keeper',\n",
-    "                                  pastActorPlaceholder) + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "                    # E74 P74 E53\n",
-    "\n",
-    "                    pastResidenceLabel = row['PRVC' + f]\n",
-    "                    pastResidencePlaceHolder = museoCoords.prefix + row['PRVC' + f]\n",
-    "\n",
-    "                    line = triple(pastActorPlaceholder,\n",
-    "                                  cidocCoords.prefix + 'P74_has_current_or_former_residence',\n",
-    "                                  pastResidencePlaceHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "            ####\n",
-    "\n",
-    "            pastActor = ''\n",
-    "            newActor = ''\n",
-    "            pl = ''\n",
-    "\n",
-    "            if row['LDCN'] != '':\n",
-    "                newActor = ' a ' + row['LDCN']\n",
-    "\n",
-    "            if row['PRCD' + last] != '':\n",
-    "                pastActor = ' da ' + row['PRCD' + last]\n",
-    "                pl = row['PRCD' + last].replace(' ', '')\n",
-    "\n",
-    "            line = triple(e10placeHolder,\n",
-    "                          cidocCoords.prefix + 'P30_transferred_custody_of',\n",
-    "                          datplaceHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(e10placeHolder,\n",
-    "                          nsCoords.prefix + 'type',\n",
-    "                          cidocCoords.prefix + 'E10_Transfer_of_Custody') + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(e10placeHolder,\n",
-    "                          schemaCoords.prefix + 'label',\n",
-    "                          '\\\"Passaggio di ' + row['SGTI'] + pastActor +\n",
-    "                          newActor + '\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "            if row['PRDU' + last] != '':\n",
-    "                timespan = row['PRDU' + last]\n",
-    "\n",
-    "                tt = timespan.replace(' ', '')\n",
-    "                ts = tt.replace('/', '')\n",
-    "\n",
-    "                timespanPlaceholder = museoCoords.prefix + '_' + ts\n",
-    "\n",
-    "                # E10 P4 E52\n",
-    "\n",
-    "                line = triple(e10placeHolder,\n",
-    "                              cidocCoords.prefix + 'P4_has_time-span',\n",
-    "                              timespanPlaceholder) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(timespanPlaceholder,\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E52_Time-Span') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(timespanPlaceholder,\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"' + timespan + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            pastActorPlaceholder = museoCoords.prefix + '_' + pl\n",
-    "            newLocPlaceholder = e74placeHolder\n",
-    "\n",
-    "            # E10 P26 E74 (moved to)\n",
-    "\n",
-    "            if newLocPlaceholder != '':\n",
-    "                line = triple(e10placeHolder,\n",
-    "                              cidocCoords.prefix + 'P29_custody_received_by',\n",
-    "                              newLocPlaceholder) + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            # E10 P27 E74\n",
-    "\n",
-    "            pastActorLabel = row['PRCD' + last]\n",
-    "\n",
-    "            line = triple(e10placeHolder,\n",
-    "                          cidocCoords.prefix + 'P28_custody_surrendered_by',\n",
-    "                          pastActorPlaceholder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(pastActorPlaceholder,\n",
-    "                          nsCoords.prefix + 'type',\n",
-    "                          cidocCoords.prefix + 'E39_Actor') + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(pastActorPlaceholder,\n",
-    "                          schemaCoords.prefix + 'label',\n",
-    "                          '\\\"' + pastActorLabel + '\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "            line = triple(datplaceHolder,\n",
-    "                          cidocCoords.prefix + 'P49_has_former_or_current_keeper',\n",
-    "                          pastActorPlaceholder) + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "            # E74 P74 E53\n",
-    "\n",
-    "            pastResidenceLabel = row['PRVC' + last]\n",
-    "            pastResidencePlaceHolder = museoCoords.prefix + row['PRVC' + last]\n",
-    "\n",
-    "            if row['PRVP' + last] != '':\n",
-    "                pastResidenceLabel = pastResidenceLabel + ' (' + row['PRVP' + last] + ')'\n",
-    "\n",
-    "            if row['PRVR' + last] != '':\n",
-    "                pastResidenceLabel = pastResidenceLabel + ', ' + row['PRVR' + last]\n",
-    "\n",
-    "            if row['PRVS' + last] != '':\n",
-    "                pastResidenceLabel = pastResidenceLabel + ', ' + row['PRVS' + last]\n",
-    "\n",
-    "            line = triple(pastActorPlaceholder,\n",
-    "                          cidocCoords.prefix + 'P74_has_current_or_former_residence',\n",
-    "                          pastResidencePlaceHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(pastResidencePlaceHolder,\n",
-    "                          nsCoords.prefix + 'type',\n",
-    "                          cidocCoords.prefix + 'E53_Place') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "            # E22 P44 E3\n",
-    "\n",
-    "            if row['STCC'] != '':\n",
-    "                line = triple(datplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P44_has_condition',\n",
-    "                              e3placeHolder) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e3placeHolder,\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E3_Condition_State') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e3placeHolder,\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"Condizione di: ' + row['SGTI'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                line = triple(e3placeHolder,\n",
-    "                              cidocCoords.prefix + 'P2_has_type',\n",
-    "                              '\\\"' + row['STCC'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            # E22 P65 E34\n",
-    "            if (row['ISRI'] != ''):\n",
-    "                line = triple(datplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P56_bears_feature',\n",
-    "                              e25placeHolder) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e25placeHolder,\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E25_Man-Made_Feature') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e25placeHolder,\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"Iscrizione su ' + subj + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                line = triple(e25placeHolder,\n",
-    "                              cidocCoords.prefix + 'P128_carries',\n",
-    "                              e34placeHolder) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e34placeHolder,\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E34_Inscription') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e34placeHolder,\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"Iscrizione: ' + row['ISRI'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                pl = row['ISRI'].replace(' ', '-')\n",
-    "                pla = pl.replace('.', '')\n",
-    "                line = triple(e34placeHolder,\n",
-    "                              cidocCoords.prefix + 'P3_has_note',\n",
-    "                              '\\\"' + row['ISRI'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                # E34 P2 E55\n",
-    "\n",
-    "                if (row['ISRT'] != ''):\n",
-    "                    rr = row['ISRT'].replace(' ', '')\n",
-    "                    line = triple(e34placeHolder,\n",
-    "                                  cidocCoords.prefix + 'P2_has_type',\n",
-    "                                  '\\\"' + row['ISRT'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "                # E34 P72 E56\n",
-    "\n",
-    "                if (row['ISRL'] != ''):\n",
-    "                    line = triple(e34placeHolder,\n",
-    "                                  cidocCoords.prefix + 'P72_has_language',\n",
-    "                                  museoCoords.prefix + '_' + row['ISRL']) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(museoCoords.prefix + '_' + row['ISRL'],\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E56_Language') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(museoCoords.prefix + '_' + row['ISRL'],\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['ISRL'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "                if (row['ISRA'] != '') or (row['ISRS'] != ''):\n",
-    "                    line = triple(e34placeHolder,\n",
-    "                                  cidocCoords.prefix + 'P92i_was_brought_into_existence_by',\n",
-    "                                  e65placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e65placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E65_Creation') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e65placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"Creazione dell\\'Iscrizione ' + row['ISRI'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "                    if row['ISRA'] != '':\n",
-    "                        line = triple(e65placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P14_carried_out_by',\n",
-    "                                      e21placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e21placeHolder,\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      cidocCoords.prefix + 'E21_Person') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e21placeHolder,\n",
-    "                                      schemaCoords.prefix + 'label',\n",
-    "                                      '\\\"' + row['ISRA'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "\n",
-    "                    if row['ISRS']:\n",
-    "                        ss = row['ISRS'].replace(' ', '')\n",
-    "                        tecPlaceholder = museoCoords.prefix + url + '_' + ss\n",
-    "                        line = triple(e65placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P32_used_general_technique',\n",
-    "                                      tecPlaceholder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(tecPlaceholder,\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      cidocCoords.prefix + 'E55_Type') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(tecPlaceholder,\n",
-    "                                      schemaCoords.prefix + 'label',\n",
-    "                                      '\\\"' + row['ISRS'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "\n",
-    "                if row['ISRP'] != '':\n",
-    "                    line = triple(e25placeHolder,\n",
-    "                                  cidocCoords.prefix + 'P3_has_note',\n",
-    "                                  '\\\"' + row['ISRP'] + '\\\"^^xsd:string') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "            unit = ''\n",
-    "            if (row['MISU'] != ''):\n",
-    "                unit = row['MISU']\n",
-    "\n",
-    "            valueA = ''\n",
-    "            valueL = ''\n",
-    "\n",
-    "            if (row['MISA'] != ''):\n",
-    "                value = row['MISA']\n",
-    "                valueA = value.replace(',', 'v')\n",
-    "\n",
-    "            if (row['MISL'] != ''):\n",
-    "                value = row['MISL']\n",
-    "                valueL = value.replace(',', 'v')\n",
-    "\n",
-    "            # Altezza\n",
-    "            # E22 P43 E54\n",
-    "            if (row['MISA'] != ''):\n",
-    "                line = triple(datplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P43_has_dimension',\n",
-    "                              museoCoords.prefix + url + '_Altezza') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(museoCoords.prefix + url + '_Altezza',\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E54_Dimension') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(museoCoords.prefix + url + '_Altezza',\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"Altezza: ' + row['MISA'] + row['MISU'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                # E54 P90 E60\n",
-    "                line = triple(museoCoords.prefix + url + '_Altezza',\n",
-    "                              cidocCoords.prefix + 'P90_has_value',\n",
-    "                              '\\\"' + row['MISA'] + '\\\"^^xsd:integer') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                # E54 P2 E55\n",
-    "\n",
-    "                line = triple(museoCoords.prefix + url + '_Altezza',\n",
-    "                              cidocCoords.prefix + 'P2_has_type',\n",
-    "                              aatCoords.prefix + '300055644') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(aatCoords.prefix + '300055644',\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"altezza\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                # E54 P91 E58\n",
-    "                if (row['MISU'] != ''):\n",
-    "                    line = triple(museoCoords.prefix + url + '_Altezza',\n",
-    "                                  cidocCoords.prefix + 'P91_has_unit',\n",
-    "                                  aatCoords.prefix + '300379098') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(aatCoords.prefix + '300379098',\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E58_Measurement_Unit') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(aatCoords.prefix + '300379098',\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['MISU'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "            # Larghezza\n",
-    "            # E22 P43 E54\n",
-    "            if (row['MISL'] != ''):\n",
-    "                line = triple(datplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P43_has_dimension',\n",
-    "                              museoCoords.prefix + url + '_Larghezza') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(museoCoords.prefix + url + '_Larghezza',\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E54_Dimension') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(museoCoords.prefix + url + '_Larghezza',\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"Larghezza: ' + row['MISL'] + row['MISU'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                # E54 P90 E60\n",
-    "                line = triple(museoCoords.prefix + url + '_Larghezza',\n",
-    "                              cidocCoords.prefix + 'P90_has_value',\n",
-    "                              '\\\"' + row['MISL'] + '\\\"^^xsd:integer') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                # E54 P2 E55\n",
-    "\n",
-    "                line = triple(museoCoords.prefix + url + '_Larghezza',\n",
-    "                              cidocCoords.prefix + 'P2_has_type',\n",
-    "                              aatCoords.prefix + '300055647') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(aatCoords.prefix + '300055647',\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"larghezza\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                # E54 P91 E58\n",
-    "                if (row['MISU'] != ''):\n",
-    "                    line = triple(museoCoords.prefix + url + '_Larghezza',\n",
-    "                                  cidocCoords.prefix + 'P91_has_unit',\n",
-    "                                  aatCoords.prefix + '300379098') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(aatCoords.prefix + '300379098',\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E58_Measurement_Unit') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(aatCoords.prefix + '300379098',\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['MISU'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "\n",
-    "            if row['MTC'] != '':\n",
-    "                mtcs = []\n",
-    "                if '/' in row['MTC']:\n",
-    "                    mtcs = row['MTC'].split('/')\n",
-    "                else:\n",
-    "                    mtcs.append(row['MTC'])\n",
-    "\n",
-    "\n",
-    "                for tc in mtcs:\n",
-    "                    mtc = tc.lstrip()\n",
-    "                    el = get_elem(mtc)\n",
-    "                    if el[1] == 'MTC/M':\n",
-    "\n",
-    "                        line = triple(datplaceHolder,\n",
-    "                                      cidocCoords.prefix + 'P45_consists_of',\n",
-    "                                      aatCoords.prefix + el[0]) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(aatCoords.prefix + el[0],\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      cidocCoords.prefix + 'E57_Material') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(aatCoords.prefix + el[0],\n",
-    "                                      schemaCoords.prefix + 'label',\n",
-    "                                      '\\\"' + mtc + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "\n",
-    "                    else:   #E12 Production - P32 used technique - E55 Type\n",
-    "                        line = triple(e12placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P32_used_general_technique',\n",
-    "                                      aatCoords.prefix + el[0]) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        if e12FplaceHolder != '':\n",
-    "                            line = triple(e12FplaceHolder,\n",
-    "                                          cidocCoords.prefix + 'P32_used_general_technique',\n",
-    "                                          aatCoords.prefix + el[0]) + closeLine\n",
-    "                            output.write(line)\n",
-    "                        line = triple(aatCoords.prefix + el[0],\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      cidocCoords.prefix + 'E55_Type') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(aatCoords.prefix + el[0],\n",
-    "                                      schemaCoords.prefix + 'label',\n",
-    "                                      '\\\"' + mtc + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "\n",
-    "            # E12 P140i E13\n",
-    "            if row['AUTM'] != '':\n",
-    "                mot = row['AUTM'].replace(' ', '_')\n",
-    "                e55placeHolder = museoCoords.prefix + url + '_' + mot\n",
-    "                line = triple(e12placeHolder,\n",
-    "                              cidocCoords.prefix + 'P140i_was_attributed_by',\n",
-    "                              e13placeHolder) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e13placeHolder,\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E13_Attribute_Assignment') + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(e13placeHolder,\n",
-    "                              schemaCoords.prefix + 'label',\n",
-    "                              '\\\"Motivazione attribuzione\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                line = triple(e13placeHolder,\n",
-    "                              cidocCoords.prefix + 'P2_has_type',\n",
-    "                              '\\\"' + row['AUTM'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "                aut = get_aut_url(row['AUTH'])\n",
-    "                aut_url = aut[0]\n",
-    "                AuthorPlaceholder = autCoords.prefix + aut_url\n",
-    "\n",
-    "                line = triple(e13placeHolder,\n",
-    "                              cidocCoords.prefix + 'P141_assigned',\n",
-    "                              AuthorPlaceholder) + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            # E22 P44 E62\n",
-    "\n",
-    "            if row['NSC'] != '':\n",
-    "                ph = row['NSC'].replace(' \"', ' «')\n",
-    "                phr = ph.replace('\"', '»')\n",
-    "\n",
-    "                line = triple(datplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P3_has_note',\n",
-    "                              '\\\"' + phr + '\\\"^^xsd:string') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            iconclass = row['DESI']\n",
-    "            icon = iconclass.replace(' ', '')\n",
-    "\n",
-    "            list_icon = []\n",
-    "\n",
-    "            if ':' in icon:\n",
-    "                list_icon = icon.split(':')\n",
-    "            else:\n",
-    "                list_icon.append(icon)\n",
-    "\n",
-    "            for ic in list_icon:\n",
-    "                url = 'https://iconclass.org/rdk/' + str(ic)\n",
-    "                html = urlopen(url).read()\n",
-    "                soup = BeautifulSoup(html, 'html.parser')\n",
-    "\n",
-    "                # kill all script and style elements\n",
-    "                for script in soup([\"script\", \"style\"]):\n",
-    "                    script.extract()  # rip it out\n",
-    "\n",
-    "                # get text\n",
-    "                text = soup.get_text()\n",
-    "\n",
-    "                pretty = soup.prettify()\n",
-    "\n",
-    "                ff = soup.find(\"div\", {\"id\": \"ic_current\"})\n",
-    "                dd = ff.find(\"a\", {\"class\", \"ic_notation\"})\n",
-    "                ss = dd.text\n",
-    "                x = ss.find(' ')\n",
-    "\n",
-    "                icon_label = ss[x + 1:]\n",
-    "\n",
-    "                ur = ic.replace(\"(\", \"%28\")\n",
-    "                urr = ur.replace(\")\", \"%29\")\n",
-    "\n",
-    "                line = triple(datplaceHolder,\n",
-    "                              cidocCoords.prefix + 'P62_depicts',\n",
-    "                              iconCoords.prefix + urr) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(iconCoords.prefix + urr,\n",
-    "                              nsCoords.prefix + 'type',\n",
-    "                              cidocCoords.prefix + 'E1_CRM_Entity') + closeLine\n",
-    "                output.write(line)\n",
-    "\n",
-    "            # P2 Opera d'arte\n",
-    "            line = triple(datplaceHolder,\n",
-    "            cidocCoords.prefix + 'P2_has_type',\n",
-    "            '\\\"Opera d\\'Arte\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "            output.write('\\n')\n",
-    "        #\n",
-    "        #\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if (ii > max_entries):\n",
-    "            break"
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "language": "python",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.10.4"
-  },
-  "orig_nbformat": 4
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 38
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_MPP/for ic in list_icon:.py

@@ -1,38 +0,0 @@
-for ic in list_icon:
-            url = 'http://iconclass.org/rdk/' + str(ic)
-            html = urlopen(url).read()
-            soup = BeautifulSoup(html, 'html.parser')
-
-            # kill all script and style elements
-            for script in soup(["script", "style"]):
-                script.extract()  # rip it out
-
-            # get text
-            text = soup.get_text()
-
-            pretty = soup.prettify()
-
-            ff = soup.find("div", {"id": "ic_current"})
-            dd = ff.find("a", {"class", "ic_notation"})
-            ss = dd.text
-            x = ss.find(' ')
-
-            icon_label = ss[x + 1:]
-
-            ur = ic.replace("(", "%28")
-            urr = ur.replace(")", "%29")
-
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P62_depicts',
-                          iconCoords.prefix + urr) + closeLine
-            output.write(line)
-            line = triple(iconCoords.prefix + urr,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E1_CRM_Entity') + closeLine
-            output.write(line)
-
-            # P2 Opera d'arte
-            line = triple(datplaceHolder,
-                          cidocCoords.prefix + 'P2_has_type',
-                          '\"Opera d\'Arte\"') + closeLine
-            output.write(line)

+ 0 - 246
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_date.ipynb

@@ -1,246 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json\n",
-    "import re"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 14,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/CSV/OVI/'\n",
-    "export_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/RDF/OVI/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3 Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "# CIDOC Predicates\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "hasTimeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P4_has_time-span>', 'hs:')\n",
-    "tookPlaceCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P7_took_place_at>', 'tk:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "movedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P25i_moved_by>', 'mb:')\n",
-    "movedToCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P26_moved_to>', 'mt:')\n",
-    "movedFromCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P27_moved_from>', 'mf:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "hasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108_has_produced>', 'hp:')\n",
-    "wasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108i_was_produced_by>', 'wp:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "onGoingTCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P81_ongoing_throughout>', 'gt:')\n",
-    "nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')\n",
-    "schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')\n",
-    "# CIDOC Objects\n",
-    "moveCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E9_Move>', 'mv:', 'E9')\n",
-    "productionCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E12_Production>', 'pr:', 'E12')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "#placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "timeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E52_Time-Span>', 'ts:', 'E52')\n",
-    "placeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E53_Place>', 'pl:', 'E53')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "# New classes (subclasses of E7 Activity) - Exchange, Sending, Recive Letters\n",
-    "exchangeLettersCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL1_Exchange_Letters>', 'el:', 'EL1')\n",
-    "sendLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL2_Send_Letter>', 'sl:', 'EL2')\n",
-    "receiveLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL3_Receive_Letter>', 'rl:', 'EL3')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 16,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 17,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTimeSpanCoords.prefix + ' ' + hasTimeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + tookPlaceCoords.prefix + ' ' + tookPlaceCoords.uri + closeLine)        \n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedByCoords.prefix + ' ' + movedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedToCoords.prefix + ' ' + movedToCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedFromCoords.prefix + ' ' + movedFromCoords.uri + closeLine)     \n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasProducedCoords.prefix + ' ' + hasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasProducedCoords.prefix + ' ' + wasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + moveCoords.prefix + ' ' + moveCoords.uri + closeLine) \n",
-    "    output.write('@prefix ' + productionCoords.prefix + ' ' + productionCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + timeSpanCoords.prefix + ' ' + timeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + placeCoords.prefix + ' ' + placeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + creationCoords.prefix + ' ' + creationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + exchangeLettersCoords.prefix + ' ' + exchangeLettersCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + sendLetterCoords.prefix + ' ' + sendLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + receiveLetterCoords.prefix + ' ' + receiveLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + onGoingTCoords.prefix + ' ' + onGoingTCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)\n",
-    "\n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 18,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'Biblio'\n",
-    "fileType = 'Datini'\n",
-    "max_entries = 1000000000\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '_IDAspo.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_date.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+1\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        \n",
-    "        #Evento send letter\n",
-    "        el2placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_OVI>\"\n",
-    "        el3placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_OVI>\"\n",
-    "\n",
-    "        # Data invio\n",
-    "        if(row['data_partenza'] != ''):\n",
-    "            e52PplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + timeSpanCoords.code + \"_OVI>\"\n",
-    "            line = triple(el2placeHolder, e52PplaceHolder, '\\\"'+ row['data_partenza'] + '\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "        if(row['data_arrivo'] != ''):\n",
-    "            e52AplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + timeSpanCoords.code + \"_OVI>\"\n",
-    "            line = triple(el3placeHolder, e52AplaceHolder, '\\\"' + row['data_arrivo'] + '\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "        output.write('\\n')\n",
-    "        #\n",
-    "        #\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.0"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 258
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_edition.ipynb

@@ -1,258 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 14,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '.../TEAMOVI/Parser/DATA/OVI/CSV/'\n",
-    "export_dir = '.../TEAMOVI/Parser/DATA/OVI/RDF/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3/CIDOC Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "hasNoteCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3_has_note>', 'no:')\n",
-    "hasTypeNCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3.1_has_type>', 'tn:')\n",
-    "hasLanguageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P72_has_language>', 'hl:')\n",
-    "documentsCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P70_documents>', 'ds:')\n",
-    "hasComponentCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P148_has_component>', 'hc:')\n",
-    "\n",
-    "# CIDOC Objects\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "stringCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E62_String>', 'sr:', 'E62')\n",
-    "linguisticObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E33_Linguistic_Object>', 'lj:', 'E33')\n",
-    "languageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E56_Language>', 'ln:', 'E56')\n",
-    "appellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E41_appellation>', 'ap:', 'E41')\n",
-    "propositionalObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E89_Propositional_Object>', 'pj:', 'E89')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 16,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 17,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasNoteCoords.prefix + ' ' + hasNoteCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeNCoords.prefix + ' ' + hasTypeNCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + stringCoords.prefix + ' ' + stringCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + linguisticObjCoords.prefix + ' ' + linguisticObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + languageCoords.prefix + ' ' + languageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasLanguageCoords.prefix + ' ' + hasLanguageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + documentsCoords.prefix + ' ' + documentsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + appellationCoords.prefix + ' ' + appellationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + propositionalObjCoords.prefix + ' ' + propositionalObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasComponentCoords.prefix + ' ' + hasComponentCoords.uri + closeLine)\n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 18,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'Biblio'\n",
-    "fileType = 'Datini'\n",
-    "max_entries = 10000\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '_IDAspo.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_edition.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+0\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        \n",
-    "        if(row['num_ovi'] != '2'):\n",
-    "            e73placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + informationObjectCoords.code + \"_OVI\"\n",
-    "        else: \n",
-    "            e73placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + informationObjectCoords.code + \"_OVI_2\"\n",
-    "\n",
-    "        #edizione\n",
-    "        e73placeHolderE = e73placeHolder + \"_ED>\"            \n",
-    "        line = triple(e73placeHolderE, documentsCoords.prefix, e73placeHolder + \">\") + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(e73placeHolderE, labelCoords.prefix, '\\\"Edizione\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "        e41placeHolder = e73placeHolder + \"_ED\" + \"_\" + appellationCoords.code + \">\"\n",
-    "        line = triple(e73placeHolderE , identifiedByCoords.prefix, e41placeHolder) + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(e41placeHolder, hasTypeCoords.prefix, appellationCoords.prefix) + closeLine\n",
-    "        output.write(line)            \n",
-    "        line = triple(e41placeHolder, labelCoords.prefix, '\\\"'  + row['edizione'].replace('\\\\','\\\\\\\\').replace('\"','\\\\\"') + '\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "\n",
-    "        #edizione abbreviata\n",
-    "        e41placeHolder2 = e73placeHolder + \"_ED_AB>\"\n",
-    "        line = triple(e41placeHolder, hasAlternativeFormCoords.prefix, e41placeHolder2) + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(e41placeHolder2, labelCoords.prefix, '\\\"' + row['edizione_abbr'].replace('\\\\','\\\\\\\\').replace('\"','\\\\\"') + '\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "        e41e55placeHolder2 = e73placeHolder + \"_ED_AB_E55>\"\n",
-    "        line = triple(e41placeHolder2, hasTypePCoords.prefix, e41e55placeHolder2) + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(e41e55placeHolder2, labelCoords.prefix, '\\\"Edizione abbreviata\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "\n",
-    "        #raccolta\n",
-    "        e89placeHolder = e73placeHolder + \"_\" + propositionalObjCoords.code + \">\"\n",
-    "        line = triple(e89placeHolder, hasComponentCoords.prefix, e73placeHolder+ \">\") + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(e89placeHolder, hasTypeCoords.prefix, propositionalObjCoords.prefix) + closeLine\n",
-    "        output.write(line)  \n",
-    "        line = triple(e89placeHolder, labelCoords.prefix, '\\\"' + row['raccolta'].replace('\\\\','\\\\\\\\').replace('\"','\\\\\"') + '\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "        e89e55placeHolder = e73placeHolder + \"_\" + propositionalObjCoords.code + \"_E55>\"\n",
-    "        line = triple(e89placeHolder, hasTypePCoords.prefix, e89e55placeHolder) + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(e89e55placeHolder, labelCoords.prefix, '\\\"Raccolta\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "\n",
-    "        output.write('\\n')\n",
-    "\n",
-    "\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.10.4"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 280
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange.ipynb

@@ -1,280 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json\n",
-    "import re"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/CSV/OVI/'\n",
-    "export_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/RDF/OVI/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3 Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "subClassOfCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#subClassOf>', 'so:')\n",
-    "# CIDOC Predicates\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "hasTimeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P4_has_time-span>', 'hs:')\n",
-    "tookPlaceCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P7_took_place_at>', 'tk:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "movedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P25i_moved_by>', 'mb:')\n",
-    "movedToCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P26_moved_to>', 'mt:')\n",
-    "movedFromCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P27_moved_from>', 'mf:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "hasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108_has_produced>', 'hp:')\n",
-    "wasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108i_was_produced_by>', 'wp:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "noteCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3_has_note>', 'nt:')\n",
-    "roleOfCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14.1_in_the_role_of>', 'ro:')\n",
-    "hasDomainCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P01_has_domain>', 'hd:')\n",
-    "hasRangeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P02_has_range>', 'hr:')\n",
-    "\n",
-    "# CIDOC Objects\n",
-    "moveCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E9_Move>', 'mv:', 'E9')\n",
-    "productionCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E12_Production>', 'pr:', 'E12')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "#placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "timeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E52_Time-Span>', 'ts:', 'E52')\n",
-    "placeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E53_Place>', 'pl:', 'E53')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "pcarriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/PC14_carried_out_by>', 'cy:')\n",
-    "\n",
-    "# New classes (subclasses of E7 Activity) - Exchange, Sending, Recive Letters\n",
-    "exchangeLettersCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL1_Exchange_Letters>', 'el:', 'EL1')\n",
-    "sendLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL2_Send_Letter>', 'sl:', 'EL2')\n",
-    "receiveLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL3_Receive_Letter>', 'rl:', 'EL3')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 4,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTimeSpanCoords.prefix + ' ' + hasTimeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + tookPlaceCoords.prefix + ' ' + tookPlaceCoords.uri + closeLine)        \n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedByCoords.prefix + ' ' + movedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedToCoords.prefix + ' ' + movedToCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedFromCoords.prefix + ' ' + movedFromCoords.uri + closeLine)     \n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasProducedCoords.prefix + ' ' + hasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasProducedCoords.prefix + ' ' + wasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + moveCoords.prefix + ' ' + moveCoords.uri + closeLine) \n",
-    "    output.write('@prefix ' + productionCoords.prefix + ' ' + productionCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + timeSpanCoords.prefix + ' ' + timeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + placeCoords.prefix + ' ' + placeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + creationCoords.prefix + ' ' + creationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + exchangeLettersCoords.prefix + ' ' + exchangeLettersCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + sendLetterCoords.prefix + ' ' + sendLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + receiveLetterCoords.prefix + ' ' + receiveLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + subClassOfCoords.prefix + ' ' + subClassOfCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + noteCoords.prefix + ' ' + noteCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + roleOfCoords.prefix + ' ' + roleOfCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasDomainCoords.prefix + ' ' + hasDomainCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasRangeCoords.prefix + ' ' + hasRangeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + pcarriedByCoords.prefix + ' ' + pcarriedByCoords.uri + closeLine)\n",
-    "    \n",
-    "    \n",
-    "    \n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 6,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'Biblio'\n",
-    "fileType = 'Datini'\n",
-    "max_entries = 1000000000\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '_IDAspo.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_event_exchange.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+1\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue   \n",
-    "\n",
-    "        el1placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + exchangeLettersCoords.code + \"_OVI>\"\n",
-    "        el2placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_OVI>\"\n",
-    "        el3placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_OVI>\"\n",
-    "        #PC14splaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + pcarriedByCoords.code + \"_OVI>\"   \n",
-    "        #PC14rplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + pcarriedByCoords.code + \"_OVI>\"   \n",
-    "        #E55splaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + typeCoords.code + \"_OVI>\"       \n",
-    "        #E55rplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + typeCoords.code + \"_OVI>\"\n",
-    "    \n",
-    "        if(row['luogo_emissione'] != '' and row['luogo_arrivo'] != ''):\n",
-    "            line = triple(exchangeLettersCoords.prefix, labelCoords.prefix, '\\\"Exchange of letters\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(sendLetterCoords.prefix, labelCoords.prefix, '\\\"Send letter\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(receiveLetterCoords.prefix, labelCoords.prefix, '\\\"Receive letter\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(el2placeHolder, subClassOfCoords.prefix, el1placeHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(el3placeHolder, subClassOfCoords.prefix, el1placeHolder) + closeLine\n",
-    "            output.write(line)    \n",
-    "            line = triple(datiniCoords.prefix + row['id'], movedByCoords.prefix, el1placeHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(el1placeHolder, labelCoords.prefix, '\\\"' + row['tipologia'] + ': ' + row['titolo'] + '\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(el1placeHolder, hasTypeCoords.prefix, exchangeLettersCoords.prefix) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(el2placeHolder, labelCoords.prefix, '\\\"Invio\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(el2placeHolder, hasTypeCoords.prefix, sendLetterCoords.prefix) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(el3placeHolder, labelCoords.prefix, '\\\"Ricezione\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(el3placeHolder, hasTypeCoords.prefix, receiveLetterCoords.prefix) + closeLine\n",
-    "            output.write(line)\n",
-    "            e62placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + exchangeLettersCoords.code + \"_OVI_E62>\" \n",
-    "            line = triple(el1placeHolder, noteCoords.prefix, e62placeHolder) +  closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(e62placeHolder, labelCoords.prefix, '\\\"Fonte: Istituto Opera del Vocavolario Italiano\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "        output.write('\\n')\n",
-    "        #\n",
-    "        #\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.10.4"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 272
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange_date.ipynb

@@ -1,272 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json\n",
-    "import re"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/CSV/'\n",
-    "export_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/RDF/OVI/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3 Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "# CIDOC Predicates\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "hasTimeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P4_has_time-span>', 'hs:')\n",
-    "tookPlaceCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P7_took_place_at>', 'tk:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "movedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P25i_moved_by>', 'mb:')\n",
-    "movedToCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P26_moved_to>', 'mt:')\n",
-    "movedFromCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P27_moved_from>', 'mf:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "hasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108_has_produced>', 'hp:')\n",
-    "wasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108i_was_produced_by>', 'wp:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "onGoingTCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P81_ongoing_throughout>', 'gt:')\n",
-    "nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')\n",
-    "schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')\n",
-    "# CIDOC Objects\n",
-    "moveCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E9_Move>', 'mv:', 'E9')\n",
-    "productionCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E12_Production>', 'pr:', 'E12')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "#placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "timeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E52_Time-Span>', 'ts:', 'E52')\n",
-    "placeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E53_Place>', 'pl:', 'E53')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "# New classes (subclasses of E7 Activity) - Exchange, Sending, Recive Letters\n",
-    "exchangeLettersCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL1_Exchange_Letters>', 'el:', 'EL1')\n",
-    "sendLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL2_Send_Letter>', 'sl:', 'EL2')\n",
-    "receiveLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL3_Receive_Letter>', 'rl:', 'EL3')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 4,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTimeSpanCoords.prefix + ' ' + hasTimeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + tookPlaceCoords.prefix + ' ' + tookPlaceCoords.uri + closeLine)        \n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedByCoords.prefix + ' ' + movedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedToCoords.prefix + ' ' + movedToCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedFromCoords.prefix + ' ' + movedFromCoords.uri + closeLine)     \n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasProducedCoords.prefix + ' ' + hasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasProducedCoords.prefix + ' ' + wasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + moveCoords.prefix + ' ' + moveCoords.uri + closeLine) \n",
-    "    output.write('@prefix ' + productionCoords.prefix + ' ' + productionCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + timeSpanCoords.prefix + ' ' + timeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + placeCoords.prefix + ' ' + placeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + creationCoords.prefix + ' ' + creationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + exchangeLettersCoords.prefix + ' ' + exchangeLettersCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + sendLetterCoords.prefix + ' ' + sendLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + receiveLetterCoords.prefix + ' ' + receiveLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + onGoingTCoords.prefix + ' ' + onGoingTCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)\n",
-    "\n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 6,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'Biblio'\n",
-    "fileType = 'Datini'\n",
-    "max_entries = 1000000000\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '_IDAspo.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_event_exchange_date.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+1\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        \n",
-    "        #Evento send letter\n",
-    "        el2placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_OVI>\"\n",
-    "        el3placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_OVI>\"\n",
-    "\n",
-    "        # Data invio\n",
-    "        if(row['data_partenza'] != ''):\n",
-    "            e52PplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + timeSpanCoords.code + \"_OVI>\"\n",
-    "            line = triple(el2placeHolder, hasTimeSpanCoords.prefix, e52PplaceHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(e52PplaceHolder, hasTypeCoords.prefix, timeSpanCoords.prefix) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(e52PplaceHolder, labelCoords.prefix, '\\\"'+ row['data_partenza'] + '\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "            #e55placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + timeSpanCoords.code + \"/ETI>\"\n",
-    "            #line = triple(e52PplaceHolder, hasTypePCoords.prefix, e55placeHolder) + closeLine\n",
-    "            #output.write(line)\n",
-    "            #line = triple(e55placeHolder, hasTypeCoords.prefix, typeCoords.prefix) + closeLine\n",
-    "            #output.write(line)\n",
-    "            #line = triple(e52PplaceHolder, onGoingTCoords.prefix, '\\\"'+row['data_inizio'] +'\\\"^^rdfs:Literal') + closeLine\n",
-    "            #output.write(line)\n",
-    "            #line = triple(e55placeHolder, labelCoords.prefix, '\\\"Estremo temporale inferiore\\\"') + closeLine\n",
-    "            #output.write(line)\n",
-    "\n",
-    "        if(row['data_arrivo'] != ''):\n",
-    "            e52AplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + timeSpanCoords.code + \"_OVI>\"\n",
-    "            line = triple(el3placeHolder, hasTimeSpanCoords.prefix, e52AplaceHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(e52AplaceHolder, hasTypeCoords.prefix, timeSpanCoords.prefix) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(e52AplaceHolder, labelCoords.prefix, '\\\"' + row['data_arrivo'] + '\\\"') + closeLine\n",
-    "            output.write(line)\n",
-    "            #e55placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + timeSpanCoords.code + \"/ETS>\"\n",
-    "            #line = triple(e52AplaceHolder, hasTypePCoords.prefix, e55placeHolder) + closeLine\n",
-    "            #output.write(line)\n",
-    "            #line = triple(e55placeHolder, hasTypeCoords.prefix, typeCoords.prefix) + closeLine\n",
-    "            #output.write(line)\n",
-    "            #line = triple(e52AplaceHolder, onGoingTCoords.prefix, '\\\"'+row['data_fine'] +'\\\"^^rdfs:Literal') + closeLine\n",
-    "            #output.write(line)\n",
-    "            #line = triple(e55placeHolder, labelCoords.prefix, '\\\"Estremo temporale superiore\\\"') + closeLine\n",
-    "            #output.write(line)\n",
-    "\n",
-    "        output.write('\\n')\n",
-    "        #\n",
-    "        #\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.10.4"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 330
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange_date_normalization.ipynb

@@ -1,330 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 7,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json\n",
-    "import re"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 8,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/'\n",
-    "export_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/DATE/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 9,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3 Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "# CIDOC Predicates\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "hasTimeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P4_has_time-span>', 'hs:')\n",
-    "tookPlaceCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P7_took_place_at>', 'tk:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "movedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P25i_moved_by>', 'mb:')\n",
-    "movedToCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P26_moved_to>', 'mt:')\n",
-    "movedFromCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P27_moved_from>', 'mf:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "hasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108_has_produced>', 'hp:')\n",
-    "wasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108i_was_produced_by>', 'wp:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "onGoingTCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P81_ongoing_throughout>', 'gt:')\n",
-    "nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')\n",
-    "schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')\n",
-    "# CIDOC Objects\n",
-    "moveCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E9_Move>', 'mv:', 'E9')\n",
-    "productionCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E12_Production>', 'pr:', 'E12')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "#placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "timeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E52_Time-Span>', 'ts:', 'E52')\n",
-    "placeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E53_Place>', 'pl:', 'E53')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "# New classes (subclasses of E7 Activity) - Exchange, Sending, Recive Letters\n",
-    "exchangeLettersCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL1_Exchange_Letters>', 'el:', 'EL1')\n",
-    "sendLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL2_Send_Letter>', 'sl:', 'EL2')\n",
-    "receiveLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL3_Receive_Letter>', 'rl:', 'EL3')\n",
-    "xsdCoords = RDFcoords('<http://www.w3.org/2001/XMLSchema#>', 'xsd:')\n",
-    "cidocCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/>', 'crm:')\n",
-    "yearCoords = RDFcoords('<https://www.w3.org/TR/owl-time#year>', 'year:')\n",
-    "monthCoords = RDFcoords('<https://www.w3.org/TR/owl-time#month>', 'month:')\n",
-    "dayCoords = RDFcoords('<https://www.w3.org/TR/owl-time#day>', 'day:')\n",
-    "beginningCoords = RDFcoords('<https://www.w3.org/TR/owl-time#hasBeginning>', 'beg:')\n",
-    "endCoords = RDFcoords('<https://www.w3.org/TR/owl-time#hasEnd>', 'end:')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 10,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTimeSpanCoords.prefix + ' ' + hasTimeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + tookPlaceCoords.prefix + ' ' + tookPlaceCoords.uri + closeLine)        \n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedByCoords.prefix + ' ' + movedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedToCoords.prefix + ' ' + movedToCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedFromCoords.prefix + ' ' + movedFromCoords.uri + closeLine)     \n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasProducedCoords.prefix + ' ' + hasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasProducedCoords.prefix + ' ' + wasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + moveCoords.prefix + ' ' + moveCoords.uri + closeLine) \n",
-    "    output.write('@prefix ' + productionCoords.prefix + ' ' + productionCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + timeSpanCoords.prefix + ' ' + timeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + placeCoords.prefix + ' ' + placeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + creationCoords.prefix + ' ' + creationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + exchangeLettersCoords.prefix + ' ' + exchangeLettersCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + sendLetterCoords.prefix + ' ' + sendLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + receiveLetterCoords.prefix + ' ' + receiveLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + onGoingTCoords.prefix + ' ' + onGoingTCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + xsdCoords.prefix + ' ' + xsdCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + cidocCoords.prefix + ' ' + cidocCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + beginningCoords.prefix + ' ' + beginningCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + endCoords.prefix + ' ' + endCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + yearCoords.prefix + ' ' + yearCoords.uri + closeLine) \n",
-    "    output.write('@prefix ' + monthCoords.prefix + ' ' + monthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + dayCoords.prefix + ' ' + dayCoords.uri + closeLine)\n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 12,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'Biblio'\n",
-    "fileType = 'Datini'\n",
-    "max_entries = 1000000000\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '_Date.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_event_exchange_date_normalization.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+1\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        \n",
-    "        #Evento send letter\n",
-    "        el2placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_OVI>\"\n",
-    "        el3placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_OVI>\"\n",
-    "\n",
-    "        \n",
-    "        e52PplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + timeSpanCoords.code + \"_OVI>\"\n",
-    "        e52AplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + timeSpanCoords.code + \"_OVI>\"\n",
-    "        \n",
-    "        # Data invio      \n",
-    "        # if(row['anno_inizio'] != '' and len(row['anno_inizio'])== 4 and row['anno_inizio'] != '****'):\n",
-    "        #     line = triple(e52PplaceHolder, yearCoords.prefix, '\\\"'+row['anno_inizio'] +'\\\"^^xsd:integer') + closeLine\n",
-    "        #     output.write(line)\n",
-    "        #     if (len(row['data_partenza_mese']) == 2 and row['data_partenza_mese'] != '**'):\n",
-    "        #         mese = row['data_partenza_mese']\n",
-    "        #         line = triple(e52PplaceHolder, monthCoords.prefix, '\\\"'+row['data_partenza_mese'] + '\\\"^^xsd:integer') + closeLine\n",
-    "        #         output.write(line)\n",
-    "        #     else:\n",
-    "        #         mese = '01'\n",
-    "        #         line = triple(e52PplaceHolder, monthCoords.prefix, '\\\"01\\\"^^xsd:integer') + closeLine\n",
-    "        #         output.write(line)\n",
-    "        #     if (len(row['data_partenza_giorno']) == 2 and row['data_partenza_giorno']  != '**'):\n",
-    "        #         giorno = row['data_partenza_giorno']\n",
-    "        #         line = triple(e52PplaceHolder, dayCoords.prefix, '\\\"'+row['data_partenza_giorno'] + '\\\"^^xsd:integer') + closeLine\n",
-    "        #         output.write(line)\n",
-    "        #     else:\n",
-    "        #         giorno = '01'\n",
-    "        #         line = triple(e52PplaceHolder, dayCoords.prefix, '\\\"01\\\"^^xsd:integer') + closeLine\n",
-    "        #         output.write(line)   \n",
-    "        # else:\n",
-    "        #     line = triple(e52PplaceHolder, cidocCoords.prefix + 'P3_has_note', '\\\"Data incompleta\\\"') + closeLine\n",
-    "        #     output.write(line)\n",
-    "        \n",
-    "        if(row['anno_inizio'] != '' and len(row['anno_inizio'])== 4 and row['anno_inizio'] != '****'):    \n",
-    "            anno = row['anno_inizio'] \n",
-    "            # if (len(row['data_partenza_mese']) == 2 and row['data_partenza_mese'] != '**' and row['data_partenza_mese'] != ''):\n",
-    "            #     mese = row['data_partenza_mese']\n",
-    "            # else:\n",
-    "            #     mese = '01'\n",
-    "            # if (len(row['data_partenza_giorno']) == 2 and row['data_partenza_giorno']  != '**' and row['data_partenza_giorno']  != ''):\n",
-    "            #     giorno = row['data_partenza_giorno']\n",
-    "            # else:\n",
-    "            #     giorno = '01'\n",
-    "\n",
-    "            # line = triple(e52PplaceHolder, beginningCoords.prefix, '\\\"'+anno+mese+giorno+'\\\"^^xsd:date') + closeLine\n",
-    "            # output.write(line)\n",
-    "            line = triple(e52PplaceHolder, endCoords.prefix, '\\\"'+anno+'12'+'31'+'\\\"^^xsd:date') + closeLine\n",
-    "            output.write(line) \n",
-    "        \n",
-    "        # Data arrivo\n",
-    "        # if(row['anno_fine'] != '' and len(row['anno_fine'])== 4 and row['anno_fine'] != '****'):\n",
-    "        #     line = triple(e52AplaceHolder, yearCoords.prefix, '\\\"'+row['anno_fine'] +'\\\"^^xsd:integer') + closeLine\n",
-    "        #     output.write(line)\n",
-    "        #     if (len(row['data_arrivo_mese']) == 2 and row['data_arrivo_mese'] != '**' and row['data_arrivo_mese'] != ''):\n",
-    "        #         line = triple(e52AplaceHolder, monthCoords.prefix, '\\\"'+row['data_arrivo_mese'] + '\\\"^^xsd:integer') + closeLine\n",
-    "        #         output.write(line)\n",
-    "        #     else:\n",
-    "        #         mese = '12'\n",
-    "        #         line = triple(e52AplaceHolder, monthCoords.prefix, '\\\"12\\\"^^xsd:integer') + closeLine\n",
-    "        #         output.write(line)\n",
-    "        #     if (len(row['data_arrivo_giorno']) == 2 and row['data_arrivo_giorno']  != '**' and row['data_arrivo_giorno']  != ''):\n",
-    "        #         line = triple(e52AplaceHolder, dayCoords.prefix, '\\\"'+row['data_arrivo_giorno'] + '\\\"^^xsd:integer') + closeLine\n",
-    "        #         output.write(line)\n",
-    "        #     else:\n",
-    "        #         giorno = '31'\n",
-    "        #         line = triple(e52AplaceHolder, dayCoords.prefix, '\\\"31\\\"^^xsd:integer') + closeLine\n",
-    "        #         output.write(line)\n",
-    "        # else:\n",
-    "        #     line = triple(e52AplaceHolder, cidocCoords.prefix + 'P3_has_note', '\\\"Data incompleta\\\"') + closeLine\n",
-    "        #     output.write(line)\n",
-    "\n",
-    "        if(row['anno_fine'] != '' and len(row['anno_fine'])== 4 and row['anno_fine'] != '****'):    \n",
-    "            anno = row['anno_inizio'] \n",
-    "            # if (len(row['data_arrivo_mese']) == 2 and row['data_arrivo_mese'] != '**' and row['data_arrivo_mese'] != ''):\n",
-    "            #     mese = row['data_arrivo_mese']\n",
-    "            # else:\n",
-    "            #     mese = '12'\n",
-    "            # if (len(row['data_arrivo_giorno']) == 2 and row['data_arrivo_giorno'] != '**' and row['data_arrivo_giorno'] != ''):\n",
-    "            #     giorno = row['data_arrivo_giorno']\n",
-    "            # else:\n",
-    "            #     giorno = '31'    \n",
-    "    \n",
-    "            # line = triple(e52AplaceHolder, endCoords.prefix, '\\\"'+anno+mese+giorno+'\\\"^^xsd:date') + closeLine\n",
-    "            # output.write(line)\n",
-    "            line = triple(e52AplaceHolder, beginningCoords.prefix, '\\\"'+anno+'01'+'01'+'\\\"^^xsd:date') + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "        output.write('\\n')\n",
-    "        #\n",
-    "        #\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.10.4"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 260
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange_place.ipynb

@@ -1,260 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json\n",
-    "import re"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 14,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/'\n",
-    "export_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/RDF/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3 Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "subClassOfCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#subClassOf>', 'so:')\n",
-    "# CIDOC Predicates\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "hasTimeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P4_has_time-span>', 'hs:')\n",
-    "tookPlaceCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P7_took_place_at>', 'tk:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "hasDomainCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P01_has_domain>', 'hd:')\n",
-    "hasRangeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P02_has_range>', 'hr:')\n",
-    "movedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P25i_moved_by>', 'mb:')\n",
-    "movedToCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P26_moved_to>', 'mt:')\n",
-    "movedFromCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P27_moved_from>', 'mf:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "hasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108_has_produced>', 'hp:')\n",
-    "wasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108i_was_produced_by>', 'wp:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "# CIDOC Objects\n",
-    "moveCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E9_Move>', 'mv:', 'E9')\n",
-    "productionCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E12_Production>', 'pr:', 'E12')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "#placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "timeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E52_Time-Span>', 'ts:', 'E52')\n",
-    "placeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E53_Place>', 'pl:', 'E53')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "pcarriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/PC14_carried_out_by>', 'cy:', 'PC14')\n",
-    "devCoords = RDFcoords('<http://dev.restore.ovi.cnr.it/vocabularies/places/>', 'dev:')\n",
-    "# New classes (subclasses of E7 Activity) - Exchange, Sending, Recive Letters\n",
-    "exchangeLettersCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL1_Exchange_Letters>', 'el:', 'EL1')\n",
-    "sendLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL2_Send_Letter>', 'sl:', 'EL2')\n",
-    "receiveLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL3_Receive_Letter>', 'rl:', 'EL3')\n",
-    "oviCoords = RDFcoords('<http://www.ovi.cnr.it/>', 'ovi:')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 16,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 17,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTimeSpanCoords.prefix + ' ' + hasTimeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + tookPlaceCoords.prefix + ' ' + tookPlaceCoords.uri + closeLine)        \n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedByCoords.prefix + ' ' + movedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedToCoords.prefix + ' ' + movedToCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedFromCoords.prefix + ' ' + movedFromCoords.uri + closeLine)     \n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasProducedCoords.prefix + ' ' + hasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasProducedCoords.prefix + ' ' + wasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + moveCoords.prefix + ' ' + moveCoords.uri + closeLine) \n",
-    "    output.write('@prefix ' + productionCoords.prefix + ' ' + productionCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + timeSpanCoords.prefix + ' ' + timeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + placeCoords.prefix + ' ' + placeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + creationCoords.prefix + ' ' + creationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + exchangeLettersCoords.prefix + ' ' + exchangeLettersCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + sendLetterCoords.prefix + ' ' + sendLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + receiveLetterCoords.prefix + ' ' + receiveLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + oviCoords.prefix + ' ' + oviCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + devCoords.prefix + ' ' + devCoords.uri + closeLine)\n",
-    "    \n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 18,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'Biblio'\n",
-    "fileType = 'Datini'\n",
-    "max_entries = 1000000000\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '_IDAspo.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_event_exchange_place.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+1\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        \n",
-    "        #Evento exchange letters\n",
-    "        el1placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + exchangeLettersCoords.code + \"_OVI>\"\n",
-    "        el2placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_OVI>\"\n",
-    "        el3placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_OVI>\"\n",
-    "          \n",
-    "        if(row['luogo_emissione'] != '' and row['luogo_arrivo'] != ''):\n",
-    "            if(row['luogo_emissione'].lower()  != '[senza luogo]'):\n",
-    "                oviPlaceHolder_emissione = oviCoords.prefix + row['luogo_emissione'].lower().replace(\"/\",\"\").replace(\" \",\"\").replace(\"(\",\"\").replace(\")\",\"\").replace(\"[\",\"\").replace(\"]\",\"\").replace(\"\\'\",\"\").replace(\"?\",\"\") + \"_\" + placeCoords.code +  \"_OVI\"\n",
-    "                #Luogo partenza\n",
-    "                #e53placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + placeCoords.code +  \"_OVI>\"\n",
-    "                line = triple(el2placeHolder, movedFromCoords.prefix, oviPlaceHolder_emissione) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(oviPlaceHolder_emissione, hasTypeCoords.prefix, placeCoords.prefix) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(oviPlaceHolder_emissione, labelCoords.prefix, '\\\"' + row['luogo_emissione'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "            #Luogo arrivo\n",
-    "            if(row['luogo_arrivo'].lower() != '[senza luogo]'):\n",
-    "                oviPlaceHolder_arrivo = oviCoords.prefix + row['luogo_arrivo'].lower().replace(\"/\",\"\").replace(\" \",\"\").replace(\"(\",\"\").replace(\")\",\"\").replace(\"[\",\"\").replace(\"]\",\"\").replace(\"\\'\",\"\").replace(\"?\",\"\") + \"_\" + placeCoords.code +  \"_OVI\"\n",
-    "                #e53placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + placeCoords.code +  \"_OVI>\"\n",
-    "                line = triple(el3placeHolder, movedToCoords.prefix, oviPlaceHolder_arrivo) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(oviPlaceHolder_arrivo, hasTypeCoords.prefix, placeCoords.prefix) + closeLine\n",
-    "                output.write(line)\n",
-    "                line = triple(oviPlaceHolder_arrivo, labelCoords.prefix, '\\\"' + row['luogo_arrivo'] + '\\\"') + closeLine\n",
-    "                output.write(line)\n",
-    "            \n",
-    "        output.write('\\n')\n",
-    "        #\n",
-    "        #\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.10.4"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 257
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange_receiver.ipynb

@@ -1,257 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json\n",
-    "import re"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 14,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/CSV/OVI/'\n",
-    "export_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/RDF/OVI/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3 Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "subClassOfCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#subClassOf>', 'so:')\n",
-    "# CIDOC Predicates\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "hasTimeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P4_has_time-span>', 'hs:')\n",
-    "tookPlaceCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P7_took_place_at>', 'tk:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "roleOfCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14.1_in_the_role_of>', 'ro:')\n",
-    "hasDomainCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P01_has_domain>', 'hd:')\n",
-    "hasRangeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P02_has_range>', 'hr:')\n",
-    "movedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P25i_moved_by>', 'mb:')\n",
-    "movedToCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P26_moved_to>', 'mt:')\n",
-    "movedFromCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P27_moved_from>', 'mf:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "hasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108_has_produced>', 'hp:')\n",
-    "wasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108i_was_produced_by>', 'wp:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "# CIDOC Objects\n",
-    "moveCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E9_Move>', 'mv:', 'E9')\n",
-    "productionCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E12_Production>', 'pr:', 'E12')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "actorCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E39_Actor>', 'ac:', 'E39')\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "#placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "timeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E52_Time-Span>', 'ts:', 'E52')\n",
-    "placeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E53_Place>', 'pl:', 'E53')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "pcarriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/PC14_carried_out_by>', 'cy:', 'PC14')\n",
-    "\n",
-    "# New classes (subclasses of E7 Activity) - Exchange, Sending, Recive Letters\n",
-    "exchangeLettersCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL1_Exchange_Letters>', 'el:', 'EL1')\n",
-    "sendLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL2_Send_Letter>', 'sl:', 'EL2')\n",
-    "receiveLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL3_Receive_Letter>', 'rl:', 'EL3')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 16,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 17,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTimeSpanCoords.prefix + ' ' + hasTimeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + tookPlaceCoords.prefix + ' ' + tookPlaceCoords.uri + closeLine)        \n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedByCoords.prefix + ' ' + movedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedToCoords.prefix + ' ' + movedToCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedFromCoords.prefix + ' ' + movedFromCoords.uri + closeLine)     \n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasProducedCoords.prefix + ' ' + hasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasProducedCoords.prefix + ' ' + wasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + moveCoords.prefix + ' ' + moveCoords.uri + closeLine) \n",
-    "    output.write('@prefix ' + productionCoords.prefix + ' ' + productionCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + timeSpanCoords.prefix + ' ' + timeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + placeCoords.prefix + ' ' + placeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + creationCoords.prefix + ' ' + creationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + exchangeLettersCoords.prefix + ' ' + exchangeLettersCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + sendLetterCoords.prefix + ' ' + sendLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + receiveLetterCoords.prefix + ' ' + receiveLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + roleOfCoords.prefix + ' ' + roleOfCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasDomainCoords.prefix + ' ' + hasDomainCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + pcarriedByCoords.prefix + ' ' + pcarriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasRangeCoords.prefix + ' ' + hasRangeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + actorCoords.prefix + ' ' + actorCoords.uri + closeLine)\n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 18,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'Biblio'\n",
-    "fileType = 'Datini'\n",
-    "max_entries = 1000000000\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '_IDAspo.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_event_exchange_receiver.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+1\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        \n",
-    "        #Evento exchange letters\n",
-    "        el1placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + exchangeLettersCoords.code + \"_OVI>\"\n",
-    "        el2placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_OVI>\"\n",
-    "        el3placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_OVI>\"\n",
-    "        PC14splaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + pcarriedByCoords.code + \"_OVI>\"   \n",
-    "        PC14rplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + pcarriedByCoords.code + \"_OVI>\"   \n",
-    "        E55splaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + typeCoords.code + \"_OVI>\"       \n",
-    "        E55rplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + typeCoords.code + \"_OVI>\"\n",
-    "    \n",
-    "        if(row['destinatario'] != ''):\n",
-    "            line = triple(el3placeHolder, hasDomainCoords.prefix, PC14rplaceHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(PC14rplaceHolder, hasTypeCoords.prefix, pcarriedByCoords.prefix) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(PC14rplaceHolder, labelCoords.prefix, \"\\\"\" + row['destinatario'] + \" nel ruolo di destinatario\" + \"\\\"\" ) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(PC14rplaceHolder, roleOfCoords.prefix, E55rplaceHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(E55rplaceHolder, labelCoords.prefix, \"\\\"Destinatario\\\"\" ) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(PC14rplaceHolder, hasRangeCoords.prefix, \"\\\"\" + row['destinatario'] + \"\\\"\") + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "        #\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.0"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 256
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_event_exchange_sender.ipynb

@@ -1,256 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json\n",
-    "import re"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 14,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/CSV/OVI/'\n",
-    "export_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/RDF/OVI/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3 Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "subClassOfCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#subClassOf>', 'so:')\n",
-    "# CIDOC Predicates\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "hasTimeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P4_has_time-span>', 'hs:')\n",
-    "tookPlaceCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P7_took_place_at>', 'tk:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "roleOfCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14.1_in_the_role_of>', 'ro:')\n",
-    "hasDomainCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P01_has_domain>', 'hd:')\n",
-    "hasRangeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P02_has_range>', 'hr:')\n",
-    "movedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P25i_moved_by>', 'mb:')\n",
-    "movedToCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P26_moved_to>', 'mt:')\n",
-    "movedFromCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P27_moved_from>', 'mf:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "hasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108_has_produced>', 'hp:')\n",
-    "wasProducedCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P108i_was_produced_by>', 'wp:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "# CIDOC Objects\n",
-    "moveCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E9_Move>', 'mv:', 'E9')\n",
-    "productionCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E12_Production>', 'pr:', 'E12')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "#placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "timeSpanCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E52_Time-Span>', 'ts:', 'E52')\n",
-    "placeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E53_Place>', 'pl:', 'E53')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "pcarriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/PC14_carried_out_by>', 'cy:', 'PC14')\n",
-    "\n",
-    "# New classes (subclasses of E7 Activity) - Exchange, Sending, Recive Letters\n",
-    "exchangeLettersCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL1_Exchange_Letters>', 'el:', 'EL1')\n",
-    "sendLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL2_Send_Letter>', 'sl:', 'EL2')\n",
-    "receiveLetterCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/EL3_Receive_Letter>', 'rl:', 'EL3')"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 16,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 17,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTimeSpanCoords.prefix + ' ' + hasTimeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + tookPlaceCoords.prefix + ' ' + tookPlaceCoords.uri + closeLine)        \n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedByCoords.prefix + ' ' + movedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedToCoords.prefix + ' ' + movedToCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + movedFromCoords.prefix + ' ' + movedFromCoords.uri + closeLine)     \n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasProducedCoords.prefix + ' ' + hasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasProducedCoords.prefix + ' ' + wasProducedCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + moveCoords.prefix + ' ' + moveCoords.uri + closeLine) \n",
-    "    output.write('@prefix ' + productionCoords.prefix + ' ' + productionCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + timeSpanCoords.prefix + ' ' + timeSpanCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + placeCoords.prefix + ' ' + placeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + creationCoords.prefix + ' ' + creationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + exchangeLettersCoords.prefix + ' ' + exchangeLettersCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + sendLetterCoords.prefix + ' ' + sendLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + receiveLetterCoords.prefix + ' ' + receiveLetterCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + roleOfCoords.prefix + ' ' + roleOfCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasDomainCoords.prefix + ' ' + hasDomainCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + pcarriedByCoords.prefix + ' ' + pcarriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasRangeCoords.prefix + ' ' + hasRangeCoords.uri + closeLine)\n",
-    "    \n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 18,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'Biblio'\n",
-    "fileType = 'Datini'\n",
-    "max_entries = 1000000000\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '_IDAspo.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_event_exchange_sender.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+1\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        \n",
-    "        #Evento exchange letters\n",
-    "        el1placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + exchangeLettersCoords.code + \"_OVI>\"\n",
-    "        el2placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_OVI>\"\n",
-    "        el3placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_OVI>\"\n",
-    "        PC14splaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + pcarriedByCoords.code + \"_OVI>\"   \n",
-    "        PC14rplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + pcarriedByCoords.code + \"_OVI>\"   \n",
-    "        E55splaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + sendLetterCoords.code + \"_\" + typeCoords.code + \"_OVI>\"       \n",
-    "        E55rplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + receiveLetterCoords.code + \"_\" + typeCoords.code + \"_OVI>\"\n",
-    "    \n",
-    "        if(row['mittente'] != '' ):     \n",
-    "            line = triple(el2placeHolder, hasDomainCoords.prefix, PC14splaceHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(PC14splaceHolder, hasTypeCoords.prefix, pcarriedByCoords.prefix) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(PC14splaceHolder, labelCoords.prefix, \"\\\"\" + row['mittente'] + \" nel ruolo di mittente\" + \"\\\"\" ) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(PC14splaceHolder, roleOfCoords.prefix, E55splaceHolder) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(E55splaceHolder, labelCoords.prefix, \"\\\"Mittente\\\"\" ) + closeLine\n",
-    "            output.write(line)\n",
-    "            line = triple(PC14splaceHolder, hasRangeCoords.prefix, \"\\\"\" + row['mittente'] + \"\\\"\") + closeLine\n",
-    "            output.write(line)\n",
-    "\n",
-    "        #\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.0"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 246
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_iperlemmi.ipynb

@@ -1,246 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 19,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 20,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/'\n",
-    "export_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/RDF/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 21,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "# Repositories\n",
-    "museoCoords = RDFcoords('<http://palazzopretorio.comune.prato.it/it/le-opere/alcuni-capolavori/>', 'mpp:')\n",
-    "autCoords = RDFcoords('<http://palazzopretorio.comune.prato.it/it/opere/autori/>', 'aut:')\n",
-    "cidocCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/>', 'crm:')\n",
-    "aatCoords = RDFcoords('<http://vocab.getty.edu/aat/>', 'aat:')\n",
-    "nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')\n",
-    "schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3/CIDOC Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "hasNoteCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3_has_note>', 'no:')\n",
-    "hasTypeNCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3.1_has_type>', 'tn:')\n",
-    "hasLanguageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P72_has_language>', 'hl:')\n",
-    "documentsCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P70_documents>', 'ds:')\n",
-    "hasComponentCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P148_has_component>', 'hc:')\n",
-    "\n",
-    "# CIDOC Objects\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "stringCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E62_String>', 'sr:', 'E62')\n",
-    "linguisticObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E33_Linguistic_Object>', 'lj:', 'E33')\n",
-    "languageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E56_Language>', 'ln:', 'E56')\n",
-    "appellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E41_appellation>', 'ap:', 'E41')\n",
-    "propositionalObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E89_Propositional_Object>', 'pj:', 'E89')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 22,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 23,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasNoteCoords.prefix + ' ' + hasNoteCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeNCoords.prefix + ' ' + hasTypeNCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + stringCoords.prefix + ' ' + stringCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + linguisticObjCoords.prefix + ' ' + linguisticObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + languageCoords.prefix + ' ' + languageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasLanguageCoords.prefix + ' ' + hasLanguageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + documentsCoords.prefix + ' ' + documentsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + appellationCoords.prefix + ' ' + appellationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + propositionalObjCoords.prefix + ' ' + propositionalObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasComponentCoords.prefix + ' ' + hasComponentCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + museoCoords.prefix + ' ' + museoCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + cidocCoords.prefix + ' ' + cidocCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + aatCoords.prefix + ' ' + aatCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + autCoords.prefix + ' ' + autCoords.uri + closeLine)\n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 24,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'data_'\n",
-    "fileType = 'iperlemmi'\n",
-    "max_entries = 10000000000000000\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    e55placeHolder = '<http://www.archiviodistato.prato.it/IPERLEMMA>'\n",
-    "    line = triple(e55placeHolder, schemaCoords.prefix + 'label', '\\\"Iperlemma\\\"') + closeLine\n",
-    "    output.write(line)\n",
-    "    line = triple(e55placeHolder, nsCoords.prefix + 'type', '\\\"Iperlemma\\\"') + closeLine\n",
-    "    output.write(line)\n",
-    "    \n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+0\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        \n",
-    "        e28placeHolder = '<http://www.archiviodistato.prato.it/' + row['iperlemma'].replace(\" \",\"\").replace(\" \",\"_\") + '_IP>'\n",
-    "        #E28\n",
-    "        line = triple(e28placeHolder,\n",
-    "                      nsCoords.prefix + 'type',\n",
-    "                      cidocCoords.prefix + 'E28_Conceptual_Object') + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(e28placeHolder,\n",
-    "                      schemaCoords.prefix + 'label',\n",
-    "                      '\\\"' + row['iperlemma'] + '\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(e28placeHolder,\n",
-    "                      nsCoords.prefix + 'type',\n",
-    "                      e55placeHolder) + closeLine\n",
-    "        output.write(line)\n",
-    "        output.write('\\n')\n",
-    "\n",
-    "\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.0"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 526
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_lemmi copy.ipynb

@@ -1,526 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 74,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 75,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/'\n",
-    "export_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/RDF/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 76,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "# Repositories\n",
-    "museoCoords = RDFcoords('<http://palazzopretorio.comune.prato.it/it/le-opere/alcuni-capolavori/>', 'mpp:')\n",
-    "autCoords = RDFcoords('<http://palazzopretorio.comune.prato.it/it/opere/autori/>', 'aut:')\n",
-    "cidocCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/>', 'crm:')\n",
-    "aatCoords = RDFcoords('<http://vocab.getty.edu/aat/>', 'aat:')\n",
-    "nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')\n",
-    "schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')\n",
-    "subClassOfCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#subClassOf>', 'so:')\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "\n",
-    "# W3/CIDOC Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "hasNoteCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3_has_note>', 'no:')\n",
-    "hasTypeNCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3.1_has_type>', 'tn:')\n",
-    "hasLanguageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P72_has_language>', 'hl:')\n",
-    "documentsCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P70_documents>', 'ds:')\n",
-    "hasComponentCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P148_has_component>', 'hc:')\n",
-    "\n",
-    "# CIDOC Objects\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "stringCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E62_String>', 'sr:', 'E62')\n",
-    "linguisticObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E33_Linguistic_Object>', 'lj:', 'E33')\n",
-    "languageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E56_Language>', 'ln:', 'E56')\n",
-    "appellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E41_appellation>', 'ap:', 'E41')\n",
-    "propositionalObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E89_Propositional_Object>', 'pj:', 'E89')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 77,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 78,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasNoteCoords.prefix + ' ' + hasNoteCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeNCoords.prefix + ' ' + hasTypeNCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + stringCoords.prefix + ' ' + stringCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + linguisticObjCoords.prefix + ' ' + linguisticObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + languageCoords.prefix + ' ' + languageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasLanguageCoords.prefix + ' ' + hasLanguageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + documentsCoords.prefix + ' ' + documentsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + appellationCoords.prefix + ' ' + appellationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + propositionalObjCoords.prefix + ' ' + propositionalObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasComponentCoords.prefix + ' ' + hasComponentCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + museoCoords.prefix + ' ' + museoCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + cidocCoords.prefix + ' ' + cidocCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + aatCoords.prefix + ' ' + aatCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + autCoords.prefix + ' ' + autCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + subClassOfCoords.prefix + ' ' + subClassOfCoords.uri + closeLine)\n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 89,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [
-    {
-     "ename": "KeyboardInterrupt",
-     "evalue": "",
-     "output_type": "error",
-     "traceback": [
-      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
-      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
-      "\u001b[0;32m/var/folders/_n/1ldwyw1s547dcpvn3485fr7r0000gn/T/ipykernel_1726/101792726.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m     40\u001b[0m         \u001b[0mlemma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mrow\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'lemma'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     41\u001b[0m         \u001b[0miperlemma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mrow\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'iperlemma'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 42\u001b[0;31m         \u001b[0mmerci\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_merce\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlemma\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0miperlemma\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     43\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     44\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mrow\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'thing'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'TRUE'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/var/folders/_n/1ldwyw1s547dcpvn3485fr7r0000gn/T/ipykernel_1726/101792726.py\u001b[0m in \u001b[0;36mget_merce\u001b[0;34m(lemma, iperlemma)\u001b[0m\n\u001b[1;32m      9\u001b[0m     \u001b[0mreader\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcsv\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDictReader\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmerci_file\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     10\u001b[0m     \u001b[0;32mfor\u001b[0m \u001b[0mrow\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mreader\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m         \u001b[0;32mif\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mrow\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'lemma'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mlemma\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mrow\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'iperlemma'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0miperlemma\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     12\u001b[0m             \u001b[0;32mreturn\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mrow\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'merce'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     13\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
-     ]
-    }
-   ],
-   "source": [
-    "filePrefix = 'data_'\n",
-    "fileType = 'lemmi_iperlemmi_thing_id'\n",
-    "max_entries = 10000000000000000\n",
-    "\n",
-    "\n",
-    "def get_merce(lemma, iperlemma):\n",
-    "    merci_file = open(\n",
-    "        '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/OVI_lemmi_iperlemmi_OLD - Lemmi con Merce.csv', newline=\"\")\n",
-    "    reader = csv.DictReader(merci_file)\n",
-    "    for row in reader:\n",
-    "        if (row['lemma'] == lemma and row['iperlemma'] == iperlemma):\n",
-    "            return [row['merce']]\n",
-    "\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    e55placeHolder = '<http://www.archiviodistato.prato.it/LEMMA>'\n",
-    "    line = triple(e55placeHolder, schemaCoords.prefix +\n",
-    "                  'label', '\\\"Lemma\\\"') + closeLine\n",
-    "    output.write(line)\n",
-    "    line = triple(e55placeHolder, nsCoords.prefix +\n",
-    "                  'type', '\\\"Lemma\\\"') + closeLine\n",
-    "    output.write(line)\n",
-    "\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+0\n",
-    "        e33POSplaceHolder = '<http://www.archiviodistato.prato.it/' + row['pos'].replace(\" \", \"\").replace( \".\", \"\").replace(\"/\", \"_\") + '_POS>'\n",
-    "        e28placeHolder = '<http://www.archiviodistato.prato.it/' + \\\n",
-    "            row['iperlemma'].replace(\" \", \"\").replace(\" \", \"_\") + '_IP>'\n",
-    "        e33placeHolder = '<http://www.archiviodistato.prato.it/' + row['lemma'].replace(\n",
-    "            \" \", \"\").replace(\" \", \"_\") + '_' + row['iperlemma'].replace(\" \", \"\") + 'LEM>'\n",
-    "        e28oplaceHolder = '<http://www.archiviodistato.prato.it/' + row['lemma'].replace(\n",
-    "            \" \", \"\").replace(\" \", \"_\") + '_' + row['iperlemma'].replace(\" \", \"\") + 'E28>'\n",
-    "        lemma = row['lemma']\n",
-    "        iperlemma = row['iperlemma']\n",
-    "        merci = get_merce(lemma, iperlemma)\n",
-    "\n",
-    "        if (row['thing'] == 'TRUE'):\n",
-    "            if (merci is not None):\n",
-    "                if (row['id'] is not None and row['id'] != '' and row['id'] != ' '):\n",
-    "                    e70placeHolder = '<http://www.archiviodistato.prato.it/' + row['lemma'].replace( \" \", \"\").replace(\" \", \"_\") + '_' + row['iperlemma'].replace(\" \", \"\") + 'E70>'\n",
-    "                    e73ASPOplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + informationObjectCoords.code + \">\"\n",
-    "                    line = triple(e73ASPOplaceHolder, cidocCoords.prefix + 'P67_refers_to', e70placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                else:\n",
-    "                    e70placeHolder = '<http://www.archiviodistato.prato.it/' + row['lemma'].replace( \" \", \"\").replace(\" \", \"_\") + '_' + row['iperlemma'].replace(\" \", \"\") + 'E70>'\n",
-    "            elif (merci is None):\n",
-    "                e70placeHolder = '<http://www.archiviodistato.prato.it/' + row['lemma'].replace( \" \", \"\").replace(\" \", \"_\") + '_' + row['iperlemma'].replace(\" \", \"\") + 'E70>'\n",
-    "                \n",
-    "            if (row['pos'] != 'antr.' and row['pos'] != 'n.g.'):\n",
-    "                if (row['id'] is not None and row['id'] != '' and row['id'] != ' '):\n",
-    "                    e73OVIplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + informationObjectCoords.code + \"_OVI>\"\n",
-    "                    line = triple(e73OVIplaceHolder, cidocCoords.prefix +\n",
-    "                                  'P67_refers_to', e70placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e70placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E70_Thing') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e70placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e70placeHolder, cidocCoords.prefix +\n",
-    "                                  'P128_carries', e33placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    # E33\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E33_Linguistic_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  e55placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if (row['iperlemma'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      subClassOfCoords.prefix,\n",
-    "                                      e28placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['pos'] != ''):\n",
-    "                        e33POS55placeHolder = '<http://www.archiviodistato.prato.it/' + row['pos'].replace(\" \", \"\").replace( \".\", \"\").replace(\"/\", \"_\") + '_POS_E55>'\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                                      e33POSplaceHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder,\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      e33POS55placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POS55placeHolder,\n",
-    "                                      schemaCoords.prefix + 'label',\n",
-    "                                      '\\\"' + row['pos'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['commento'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P3_has_note',\n",
-    "                                      '\\\"' + row['commento'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                elif (row['id'] is None or row['id'] == ''):\n",
-    "                    line = triple(e70placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E70_Thing') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e70placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e70placeHolder, cidocCoords.prefix +\n",
-    "                                  'P128_carries', e33placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    # E33\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E33_Linguistic_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  e55placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if (row['iperlemma'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      subClassOfCoords.prefix,\n",
-    "                                      e28placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['pos'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                                      e33POSplaceHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder,\n",
-    "                                      schemaCoords.prefix + 'label',\n",
-    "                                      '\\\"' + row['pos'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder,\n",
-    "                                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                                      '\\\"Part of Speech\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['commento'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P3_has_note',\n",
-    "                                      '\\\"' + row['commento'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "        if (row['thing'] == 'FALSE'):\n",
-    "            if (row['pos'] != 'antr.' and row['pos'] != 'n.g.'):\n",
-    "                if (row['id'] is not None and row['id'] != ''):\n",
-    "                    e73OVIplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + \\\n",
-    "                        row['id'] + \"/\" + informationObjectCoords.code + \"_OVI>\"\n",
-    "                    line = triple(e73OVIplaceHolder, cidocCoords.prefix +\n",
-    "                                  'P67_refers_to', e28oplaceHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e28oplaceHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E28_Conceptual_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e28oplaceHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e28oplaceHolder, cidocCoords.prefix +\n",
-    "                                  'P128_carries', e33placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    # E33\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E33_Linguistic_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  e55placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if (row['iperlemma'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      subClassOfCoords.prefix,\n",
-    "                                      e28placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['pos'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                                      e33POSplaceHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder,\n",
-    "                                      schemaCoords.prefix + 'label',\n",
-    "                                      '\\\"' + row['pos'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder,\n",
-    "                                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                                      '\\\"Part of Speech\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['commento'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P3_has_note',\n",
-    "                                      '\\\"' + row['commento'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                elif (row['id'] is None or row['id'] == ''):\n",
-    "                    line = triple(e28oplaceHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E28_Conceptual_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e28oplaceHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e28oplaceHolder, cidocCoords.prefix +\n",
-    "                                  'P128_carries', e33placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    # E33\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E33_Linguistic_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  e55placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if (row['iperlemma'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      subClassOfCoords.prefix,\n",
-    "                                      e28placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['pos'] != ''):\n",
-    "                        e33POS55placeHolder = '<http://www.archiviodistato.prato.it/' + row['pos'].replace(\" \", \"\").replace(\".\", \"\").replace(\"/\", \"_\") + '_POS_E55>'\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                                      e33POSplaceHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder, schemaCoords.prefix + 'label', '\\\"' + row['pos'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder,\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      e33POS55placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POS55placeHolder,\n",
-    "                                      schemaCoords.prefix + 'label',\n",
-    "                                      '\\\"Part of Speech\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['commento'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P3_has_note',\n",
-    "                                      '\\\"' + row['commento'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "\n",
-    "        output.write('\\n')\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii > max_entries):\n",
-    "            break\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 88,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "filePrefix = 'data_'\n",
-    "fileType = 'lemmi_iperlemmi_thing_id'\n",
-    "max_entries = 10000000000000000\n",
-    "\n",
-    "def get_merce(lemma, iperlemma):\n",
-    "    merci_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/OVI_lemmi_iperlemmi_OLD - Lemmi con Merce.csv', newline=\"\")\n",
-    "    reader = csv.DictReader(merci_file)\n",
-    "    for row in reader:\n",
-    "        if (row['lemma'] == lemma and row['iperlemma'] == iperlemma):\n",
-    "            return [row['merce']]\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_merci.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    e55placeHolder = '<http://www.archiviodistato.prato.it/merce_E55>'\n",
-    "    line = triple(e55placeHolder, hasTypeCoords.prefix, typeCoords.prefix) + closeLine\n",
-    "    output.write(line)\n",
-    "    line = triple(e55placeHolder, labelCoords.prefix, '\\\"Merce\\\"') + closeLine\n",
-    "    output.write(line)\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+0\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        lemma = row['lemma']\n",
-    "        iperlemma = row['iperlemma']\n",
-    "        merci = get_merce(lemma, iperlemma)\n",
-    "        if (row['thing'] == 'TRUE'):\n",
-    "            if (merci is not None):\n",
-    "                e70placeHolder = '<http://www.archiviodistato.prato.it/' + row['lemma'].replace(\" \", \"\").replace(\" \", \"_\") + '_' + row['iperlemma'].replace(\" \", \"\") + 'E70>'\n",
-    "                line = triple(e70placeHolder, hasTypePCoords.prefix, e55placeHolder) + closeLine\n",
-    "                output.write(line)\n"
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.9.0"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 538
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_lemmi.ipynb

@@ -1,538 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 10,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/'\n",
-    "export_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/RDF/'"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 12,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "# Repositories\n",
-    "museoCoords = RDFcoords('<http://palazzopretorio.comune.prato.it/it/le-opere/alcuni-capolavori/>', 'mpp:')\n",
-    "autCoords = RDFcoords('<http://palazzopretorio.comune.prato.it/it/opere/autori/>', 'aut:')\n",
-    "cidocCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/>', 'crm:')\n",
-    "aatCoords = RDFcoords('<http://vocab.getty.edu/aat/>', 'aat:')\n",
-    "nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')\n",
-    "schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')\n",
-    "subClassOfCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#subClassOf>', 'so:')\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "\n",
-    "# W3/CIDOC Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "hasNoteCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3_has_note>', 'no:')\n",
-    "hasTypeNCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3.1_has_type>', 'tn:')\n",
-    "hasLanguageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P72_has_language>', 'hl:')\n",
-    "documentsCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P70_documents>', 'ds:')\n",
-    "hasComponentCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P148_has_component>', 'hc:')\n",
-    "\n",
-    "# CIDOC Objects\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "stringCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E62_String>', 'sr:', 'E62')\n",
-    "linguisticObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E33_Linguistic_Object>', 'lj:', 'E33')\n",
-    "languageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E56_Language>', 'ln:', 'E56')\n",
-    "appellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E41_appellation>', 'ap:', 'E41')\n",
-    "propositionalObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E89_Propositional_Object>', 'pj:', 'E89')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 14,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasNoteCoords.prefix + ' ' + hasNoteCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeNCoords.prefix + ' ' + hasTypeNCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + stringCoords.prefix + ' ' + stringCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + linguisticObjCoords.prefix + ' ' + linguisticObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + languageCoords.prefix + ' ' + languageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasLanguageCoords.prefix + ' ' + hasLanguageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + documentsCoords.prefix + ' ' + documentsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + appellationCoords.prefix + ' ' + appellationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + propositionalObjCoords.prefix + ' ' + propositionalObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasComponentCoords.prefix + ' ' + hasComponentCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + museoCoords.prefix + ' ' + museoCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + cidocCoords.prefix + ' ' + cidocCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + aatCoords.prefix + ' ' + aatCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + autCoords.prefix + ' ' + autCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + subClassOfCoords.prefix + ' ' + subClassOfCoords.uri + closeLine)\n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'merge'\n",
-    "fileType = 'OVI-TLIO'\n",
-    "max_entries = 10000000000000000\n",
-    "\n",
-    "def get_merce(lemma, iperlemma):\n",
-    "    merci_file = open(\n",
-    "        '/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/OVI_lemmi_iperlemmi_OLD - Lemmi con Merce.csv', newline=\"\")\n",
-    "    reader = csv.DictReader(merci_file)\n",
-    "    for row in reader:\n",
-    "        if (row['lemma'] == lemma and row['iperlemma'] == iperlemma):\n",
-    "            return [row['merce']]\n",
-    "\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    e55placeHolder = '<http://www.archiviodistato.prato.it/LEMMA>'\n",
-    "    line = triple(e55placeHolder, schemaCoords.prefix +\n",
-    "                  'label', '\\\"Lemma\\\"') + closeLine\n",
-    "    output.write(line)\n",
-    "    line = triple(e55placeHolder, nsCoords.prefix +\n",
-    "                  'type', '\\\"Lemma\\\"') + closeLine\n",
-    "    output.write(line)\n",
-    "    e33POS55placeHolder = '<http://www.archiviodistato.prato.it/' + 'POS>'\n",
-    "    line = triple(e33POS55placeHolder, schemaCoords.prefix + 'label', '\\\"Part of Speech\\\"') + closeLine\n",
-    "    output.write(line)\n",
-    "    line = triple(e33POS55placeHolder, nsCoords.prefix + 'type', '\\\"Part of Speech\\\"') + closeLine\n",
-    "    output.write(line)\n",
-    "\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+0\n",
-    "        e33POSplaceHolder = '<http://www.archiviodistato.prato.it/' + row['pos'].replace(\" \", \"\").replace( \".\", \"\").replace(\"/\", \"_\") + '_POS>'\n",
-    "        \n",
-    "        e28placeHolder = '<http://www.archiviodistato.prato.it/' + row['iperlemma'].replace(\" \", \"\").replace(\" \", \"_\") + '_IP>'\n",
-    "        \n",
-    "        if (row['link_tlio']!='' and row['link_tlio'] is not None):\n",
-    "            e33placeHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['link_tlio'] + '>'\n",
-    "        elif (row['link_tlio']==''):\n",
-    "            e33placeHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['iperlemma'].replace(\" \", \"\") + row['lemma'].replace(\" \", \"\") +'>'\n",
-    "        else:\n",
-    "            e33placeHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['iperlemma'].replace(\" \", \"\") + row['lemma'].replace(\" \", \"\") +'>'\n",
-    "        if (row['link_tlio']!='' and row['link_tlio'] is not None):\n",
-    "            e28oplaceHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['link_tlio'] + 'E28>'\n",
-    "        elif (row['link_tlio']==''):\n",
-    "            e28oplaceHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['iperlemma'].replace(\" \", \"\") + row['lemma'].replace(\" \", \"\") + 'E28>'\n",
-    "        else:\n",
-    "            e28oplaceHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['iperlemma'].replace(\" \", \"\") + row['lemma'].replace(\" \", \"\") + 'E28>'\n",
-    "        if (row['link_tlio']!='' and row['link_tlio'] is not None and row['link_tlio']!=' ' and row['link_tlio'] != 'None'):\n",
-    "            e70placeHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['link_tlio'] + 'E70>'\n",
-    "        elif (row['link_tlio']== ' '):\n",
-    "            e70placeHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['iperlemma'].replace(\" \", \"\") + row['lemma'].replace(\" \", \"\") + 'E70>'\n",
-    "        elif (row['link_tlio']== ''):\n",
-    "            e70placeHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['iperlemma'].replace(\" \", \"\") + row['lemma'].replace(\" \", \"\") + 'E70>'\n",
-    "        else:\n",
-    "            e70placeHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['iperlemma'].replace(\" \", \"\") + row['lemma'].replace(\" \", \"\") + 'E70>'\n",
-    "\n",
-    "        lemma = row['lemma']\n",
-    "        iperlemma = row['iperlemma']\n",
-    "        merci = get_merce(lemma, iperlemma)\n",
-    "        if (row['thing'] == 'TRUE'):\n",
-    "            if (merci is not None):\n",
-    "                if (row['id'] is not None and row['id'] != '' and row['id'] != ' '): \n",
-    "                    e73ASPOplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + informationObjectCoords.code + \">\"\n",
-    "                    line = triple(e73ASPOplaceHolder, cidocCoords.prefix + 'P67_refers_to', e70placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "            if (row['pos'] != 'antr.' and row['pos'] != 'n.g.'):\n",
-    "                if (row['id'] is not None and row['id'] != '' and row['id'] != ' '):\n",
-    "                    e73OVIplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + informationObjectCoords.code + \"_OVI>\"\n",
-    "                    line = triple(e73OVIplaceHolder, cidocCoords.prefix +\n",
-    "                                  'P67_refers_to', e70placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e70placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E70_Thing') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e70placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e70placeHolder, cidocCoords.prefix +\n",
-    "                                  'P128_carries', e33placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    # E33\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E33_Linguistic_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  e55placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if (row['iperlemma'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      subClassOfCoords.prefix,\n",
-    "                                      e28placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['pos'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                                      e33POSplaceHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder, schemaCoords.prefix + 'label', '\\\"' + row['pos'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder,\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      e33POS55placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['commento'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P3_has_note',\n",
-    "                                      '\\\"' + row['commento'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                elif (row['id'] is None or row['id'] == ''):\n",
-    "                    line = triple(e70placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E70_Thing') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e70placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e70placeHolder, cidocCoords.prefix +\n",
-    "                                  'P128_carries', e33placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    # E33\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E33_Linguistic_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  e55placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if (row['iperlemma'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      subClassOfCoords.prefix,\n",
-    "                                      e28placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['pos'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                                      e33POSplaceHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder, schemaCoords.prefix + 'label', '\\\"' + row['pos'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder,\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      e33POS55placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['commento'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P3_has_note',\n",
-    "                                      '\\\"' + row['commento'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "        if (row['thing'] == 'FALSE'):\n",
-    "            if (row['pos'] != 'antr.' and row['pos'] != 'n.g.'):\n",
-    "                if (row['id'] is not None and row['id'] != ''):\n",
-    "                    e73OVIplaceHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + \\\n",
-    "                        row['id'] + \"/\" + informationObjectCoords.code + \"_OVI>\"\n",
-    "                    line = triple(e73OVIplaceHolder, cidocCoords.prefix +\n",
-    "                                  'P67_refers_to', e28oplaceHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e28oplaceHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E28_Conceptual_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e28oplaceHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e28oplaceHolder, cidocCoords.prefix +\n",
-    "                                  'P128_carries', e33placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    # E33\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E33_Linguistic_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  e55placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if (row['iperlemma'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      subClassOfCoords.prefix,\n",
-    "                                      e28placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['pos'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                                      e33POSplaceHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder, schemaCoords.prefix + 'label', '\\\"' + row['pos'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder,\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      e33POS55placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['commento'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P3_has_note',\n",
-    "                                      '\\\"' + row['commento'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                elif (row['id'] is None or row['id'] == ''):\n",
-    "                    line = triple(e28oplaceHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E28_Conceptual_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e28oplaceHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e28oplaceHolder, cidocCoords.prefix +\n",
-    "                                  'P128_carries', e33placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    # E33\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  cidocCoords.prefix + 'E33_Linguistic_Object') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  schemaCoords.prefix + 'label',\n",
-    "                                  '\\\"' + row['lemma'] + '\\\"') + closeLine\n",
-    "                    output.write(line)\n",
-    "                    line = triple(e33placeHolder,\n",
-    "                                  nsCoords.prefix + 'type',\n",
-    "                                  e55placeHolder) + closeLine\n",
-    "                    output.write(line)\n",
-    "                    if (row['iperlemma'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      subClassOfCoords.prefix,\n",
-    "                                      e28placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['pos'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                                      e33POSplaceHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder, schemaCoords.prefix + 'label', '\\\"' + row['pos'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "                        line = triple(e33POSplaceHolder,\n",
-    "                                      nsCoords.prefix + 'type',\n",
-    "                                      e33POS55placeHolder) + closeLine\n",
-    "                        output.write(line)\n",
-    "                    if (row['commento'] != ''):\n",
-    "                        line = triple(e33placeHolder,\n",
-    "                                      cidocCoords.prefix + 'P3_has_note',\n",
-    "                                      '\\\"' + row['commento'] + '\\\"') + closeLine\n",
-    "                        output.write(line)\n",
-    "\n",
-    "        output.write('\\n')\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii > max_entries):\n",
-    "            break\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 16,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stderr",
-     "output_type": "stream",
-     "text": [
-      "<>:32: SyntaxWarning: \"is not\" with a literal. Did you mean \"!=\"?\n",
-      "<>:32: SyntaxWarning: \"is not\" with a literal. Did you mean \"!=\"?\n",
-      "/var/folders/_n/1ldwyw1s547dcpvn3485fr7r0000gn/T/ipykernel_7536/1610792216.py:32: SyntaxWarning: \"is not\" with a literal. Did you mean \"!=\"?\n",
-      "  if (row['link_tlio']!= '' and row['link_tlio']!= '' is not None):\n"
-     ]
-    }
-   ],
-   "source": [
-    "filePrefix = 'merge'\n",
-    "fileType = 'OVI-TLIO'\n",
-    "max_entries = 10000000000000000\n",
-    "\n",
-    "def get_merce(lemma, iperlemma):\n",
-    "    merci_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/OVI_lemmi_iperlemmi_OLD - Lemmi con Merce.csv', newline=\"\")\n",
-    "    reader = csv.DictReader(merci_file)\n",
-    "    for row in reader:\n",
-    "        if (row['lemma'] == lemma and row['iperlemma'] == iperlemma):\n",
-    "            return [row['merce']]\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_merci.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    e55placeHolder = '<http://www.archiviodistato.prato.it/merce_E55>'\n",
-    "    line = triple(e55placeHolder, hasTypeCoords.prefix, typeCoords.prefix) + closeLine\n",
-    "    output.write(line)\n",
-    "    line = triple(e55placeHolder, labelCoords.prefix, '\\\"Merce\\\"') + closeLine\n",
-    "    output.write(line)\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+0\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        lemma = row['lemma']\n",
-    "        iperlemma = row['iperlemma']\n",
-    "        merci = get_merce(lemma, iperlemma)\n",
-    "        if (row['link_tlio']!= '' and row['link_tlio']!= '' is not None):\n",
-    "            e70placeHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['link_tlio'] + 'E70>'\n",
-    "        elif (row['link_tlio']== ''):\n",
-    "            e70placeHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['iperlemma'].replace(\" \", \"\") + row['lemma'].replace(\" \", \"\") + 'E70>'\n",
-    "        else:\n",
-    "            e70placeHolder = '<http://tlio.ovi.cnr.it/TLIO/index.php?vox=' + row['iperlemma'].replace(\" \", \"\") + row['lemma'].replace(\" \", \"\") + 'E70>'\n",
-    "\n",
-    "        if (row['thing'] == 'TRUE'):\n",
-    "            if (merci is not None):\n",
-    "                line = triple(e70placeHolder, hasTypePCoords.prefix, e55placeHolder) + closeLine\n",
-    "                output.write(line)\n"
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.10.4"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 142
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_toponimi.py

@@ -1,142 +0,0 @@
-# Utilities to read/write csv files
-import csv
-# Utilities to handle character encodings
-import unicodedata
-# Ordered Dicts
-from collections import OrderedDict
-
-import json
-
-
-# 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 csv
-# Utilities to handle character encodings
-import unicodedata
-# Ordered Dicts
-from collections import OrderedDict
-
-import json
-
-import string
-
-import_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/TOPONIMI/CSV/'
-export_dir = '/Users/federicaspinelli/TEAMOVI/Parser/DATA/TOPONIMI/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
-aspoCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dat:')
-placeCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/>', 'pl:')
-oviCoords = RDFcoords('<http://www.ovi.cnr.it/>', 'ovi:')
-cidocCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/>', 'crm:')
-tgnCoords = RDFcoords('<http://vocab.getty.edu/tgn/>', 'tgn:')
-nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')
-schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')
-devCoords = RDFcoords('<http://dev.restore.ovi.cnr.it/vocabularies/places/>', 'dev:')
-owlCoords = RDFcoords('<http://www.w3.org/2002/07/owl#>', 'owl:')
-
-
-# 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 ' + placeCoords.prefix + ' ' + placeCoords.uri + closeLine)
-    output.write('@prefix ' + aspoCoords.prefix + ' ' + aspoCoords.uri + closeLine)
-    output.write('@prefix ' + oviCoords.prefix + ' ' + oviCoords.uri + closeLine)
-    output.write('@prefix ' + cidocCoords.prefix + ' ' + cidocCoords.uri + closeLine)
-    output.write('@prefix ' + tgnCoords.prefix + ' ' + tgnCoords.uri + closeLine)
-    output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)
-    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)
-    output.write('@prefix ' + devCoords.prefix + ' ' + devCoords.uri + closeLine)
-    output.write('@prefix ' + owlCoords.prefix + ' ' + owlCoords.uri + closeLine)
-
-    output.write('\n')
-
-
-filePrefix = 'toponimi_'
-fileType = 'OVI_ASPO'
-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
-
-        if row['ID ASPO'] != "":
-            #placeHolders
-            top = row['toponimo'].replace(" ", "_")
-            toponimo = top.translate(str.maketrans('', '', string.punctuation))
-            E73placeHolder = '<http://datini.archiviodistato.prato.it/la-ricerca/scheda/' + row['ID ASPO'] + '/E73_OVI>'
-            topPlaceHolder = oviCoords.prefix + toponimo
-            placePlaceHolder = devCoords.prefix + row['ID RESTORE']
-
-            line = triple(E73placeHolder,
-                          cidocCoords.prefix + 'P67_refers_to',
-                          topPlaceHolder) + closeLine
-            output.write(line)
-
-            line = triple(topPlaceHolder,
-                          nsCoords.prefix + 'type',
-                          cidocCoords.prefix + 'E41_Appellation') + closeLine
-            output.write(line)
-
-            label = string.capwords(row['toponimo'])
-            line = triple(topPlaceHolder,
-                          schemaCoords.prefix + 'label',
-                          '\"' + label + '\"') + closeLine
-            output.write(line)
-
-            line = triple(topPlaceHolder,
-                          cidocCoords.prefix + 'P2_has_type',
-                          '\"Toponimo\"') + closeLine
-            output.write(line)
-
-            line = triple(placePlaceHolder,
-                          cidocCoords.prefix + 'P1_is_identified_by',
-                          topPlaceHolder) + closeLine
-            output.write(line)
-
-            output.write('\n')
-        #
-        #
-        # Limit number of entries processed (if desired)
-        if (ii > max_entries):
-            break

+ 0 - 286
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/CSV_to_RDF_ovi_trascr.ipynb

@@ -1,286 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Utilities to read/write csv files\n",
-    "import csv\n",
-    "import unicodedata\n",
-    "# Ordered Dicts\n",
-    "from collections import OrderedDict\n",
-    "import json\n",
-    "\n",
-    "\n",
-    "# OPZIONAL IMPORTS\n",
-    "\n",
-    "# For timestamping/simple speed tests\n",
-    "from datetime import datetime\n",
-    "# Random number generator\n",
-    "from random import *\n",
-    "# System & command line utilities\n",
-    "import sys\n",
-    "# Json for the dictionary\n",
-    "import json"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 14,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/CSV/OVI/'\n",
-    "export_dir = '/Users/federicaspinelli/Google Drive/OVI-CNR/RDF/OVI/'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Custom class to store URIs + related infos for the ontologies/repositories\n",
-    "\n",
-    "class RDFcoords:\n",
-    "    def __init__(self, uri, prefix, code = None):\n",
-    "        self.uri = uri\n",
-    "        self.prefix = prefix\n",
-    "        self.code = code\n",
-    "\n",
-    "# Repositories\n",
-    "museoCoords = RDFcoords('<http://palazzopretorio.comune.prato.it/it/le-opere/alcuni-capolavori/>', 'mpp:')\n",
-    "autCoords = RDFcoords('<http://palazzopretorio.comune.prato.it/it/opere/autori/>', 'aut:')\n",
-    "cidocCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/>', 'crm:')\n",
-    "aatCoords = RDFcoords('<http://vocab.getty.edu/aat/>', 'aat:')\n",
-    "nsCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf:')\n",
-    "schemaCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#>', 'rdfs:')\n",
-    "\n",
-    "# Repositories\n",
-    "datiniCoords = RDFcoords('<http://datini.archiviodistato.prato.it/la-ricerca/scheda/>', 'dt:')\n",
-    "personAuthCoords = RDFcoords('<http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003->', 'pa:')\n",
-    "# W3/CIDOC Predicates\n",
-    "hasTypeCoords = RDFcoords('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', 'tp:')\n",
-    "hasTypePCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P2_has_type>', 'te:')\n",
-    "carriesCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P128_carries>', 'ca:')\n",
-    "identifiedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P1_is_identified_by>', 'ib:')\n",
-    "labelCoords = RDFcoords('<http://www.w3.org/2000/01/rdf-schema#label>', 'lb:')\n",
-    "wasBroughtCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P92i_was_brought_into_existence_by>', 'wb:')\n",
-    "carriedByCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P14_carried_out_by>', 'cb:')\n",
-    "hasAlternativeFormCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P139_has_alternative_form>', 'af:')\n",
-    "hasNoteCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3_has_note>', 'no:')\n",
-    "hasTypeNCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P3.1_has_type>', 'tn:')\n",
-    "hasLanguageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P72_has_language>', 'hl:')\n",
-    "documentsCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P70_documents>', 'ds:')\n",
-    "hasComponentCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/P148_has_component>', 'hc:')\n",
-    "\n",
-    "# CIDOC Objects\n",
-    "manMadeObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object>', 'mo:', 'E22')\n",
-    "informationObjectCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E73_Information_Object>', 'io:', 'E73')\n",
-    "titleCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E35_Title>', 'ti:' ,'E35')\n",
-    "placeAppellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E44_Place_appellation>', 'pa:', 'E44')\n",
-    "identifierCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E42_Identifier>', 'id:', 'E42')\n",
-    "typeCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E55_Type>', 'ty:', 'E55')\n",
-    "creationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E65_Creation>', 'cr:', 'E65')\n",
-    "personCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E21_Person>', 'ps:', 'E21')\n",
-    "stringCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E62_String>', 'sr:', 'E62')\n",
-    "linguisticObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E33_Linguistic_Object>', 'lj:', 'E33')\n",
-    "languageCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E56_Language>', 'ln:', 'E56')\n",
-    "appellationCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E41_appellation>', 'ap:', 'E41')\n",
-    "propositionalObjCoords = RDFcoords('<http://www.cidoc-crm.org/cidoc-crm/E89_Propositional_Object>', 'pj:', 'E89')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 16,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Basic functions for triples / shortened triples in TTL format\n",
-    "\n",
-    "def triple(subject, predicate, object1):\n",
-    "    line = subject + ' ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def doublet(predicate, object1):\n",
-    "    line = '    ' + predicate + ' ' + object1\n",
-    "    return line\n",
-    "\n",
-    "def singlet(object1):\n",
-    "    line = '        ' + object1\n",
-    "    return line\n",
-    "\n",
-    "# Line endings in TTL format\n",
-    "continueLine1 = ' ;\\n'\n",
-    "continueLine2 = ' ,\\n'\n",
-    "closeLine = ' .\\n'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 17,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "def writeTTLHeader(output):\n",
-    "    output.write('@prefix ' + datiniCoords.prefix + ' ' + datiniCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personAuthCoords.prefix + ' ' + personAuthCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeCoords.prefix + ' ' + hasTypeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypePCoords.prefix + ' ' + hasTypePCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + manMadeObjectCoords.prefix + ' ' + manMadeObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriesCoords.prefix + ' ' + carriesCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + informationObjectCoords.prefix + ' ' + informationObjectCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifiedByCoords.prefix + ' ' + identifiedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + titleCoords.prefix + ' ' + titleCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + labelCoords.prefix + ' ' + labelCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + identifierCoords.prefix + ' ' + identifierCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + wasBroughtCoords.prefix + ' ' + wasBroughtCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + typeCoords.prefix + ' ' + typeCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + carriedByCoords.prefix + ' ' + carriedByCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + personCoords.prefix + ' ' + personCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasAlternativeFormCoords.prefix + ' ' + hasAlternativeFormCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasNoteCoords.prefix + ' ' + hasNoteCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasTypeNCoords.prefix + ' ' + hasTypeNCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + stringCoords.prefix + ' ' + stringCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + linguisticObjCoords.prefix + ' ' + linguisticObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + languageCoords.prefix + ' ' + languageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasLanguageCoords.prefix + ' ' + hasLanguageCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + documentsCoords.prefix + ' ' + documentsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + appellationCoords.prefix + ' ' + appellationCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + propositionalObjCoords.prefix + ' ' + propositionalObjCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + hasComponentCoords.prefix + ' ' + hasComponentCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + museoCoords.prefix + ' ' + museoCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + cidocCoords.prefix + ' ' + cidocCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + aatCoords.prefix + ' ' + aatCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + schemaCoords.prefix + ' ' + schemaCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + nsCoords.prefix + ' ' + nsCoords.uri + closeLine)\n",
-    "    output.write('@prefix ' + autCoords.prefix + ' ' + autCoords.uri + closeLine)\n",
-    "\n",
-    "    output.write('\\n')\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 18,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "filePrefix = 'Biblio'\n",
-    "fileType = 'Datini'\n",
-    "max_entries = 10000000000000000\n",
-    "\n",
-    "def get_text(sigla):\n",
-    "    text_file = open('/Users/federicaspinelli/Google Drive/OVI-CNR/CSV/OVI/testi_ovi.csv', newline=\"\")\n",
-    "    reader = csv.DictReader(text_file)\n",
-    "    for row in reader:\n",
-    "        if row['sigla'] == sigla:\n",
-    "            return [row['testo'], row['testo_lemmatizzato']]\n",
-    "\n",
-    "with open(import_dir + filePrefix + fileType + '.csv', newline=\"\") as csv_file, open(export_dir + filePrefix + fileType + '_lemmi.ttl', 'w') as output:\n",
-    "    reader = csv.DictReader(csv_file)\n",
-    "    writeTTLHeader(output)\n",
-    "    first = True\n",
-    "    ii = 0\n",
-    "    for row in reader:\n",
-    "        # The index ii is used to process a limited number of entries for testing purposes\n",
-    "        ii = ii+0\n",
-    "        # Skip the first line as it carries info we don't want to triplify\n",
-    "        if(first):\n",
-    "            first = False\n",
-    "            continue\n",
-    "        \n",
-    "        if(row['num_ovi'] != '2'):\n",
-    "            E73placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + informationObjectCoords.code + \"_OVI\"\n",
-    "            E33placeHolder = '<http://datini.archiviodistato.prato.it/la-ricerca/scheda/' + row['id'] + '/E33_OVI>'\n",
-    "\n",
-    "        else: \n",
-    "            E73placeHolder = \"<http://datini.archiviodistato.prato.it/la-ricerca/scheda/\" + row['id'] + \"/\" + informationObjectCoords.code + \"_OVI_2\"\n",
-    "            E33placeHolder = '<http://datini.archiviodistato.prato.it/la-ricerca/scheda/' + row['id'] + '/E33_OVI_2>'\n",
-    "\n",
-    "        datplaceHolder = '<http://datini.archiviodistato.prato.it/la-ricerca/scheda/' + row['id'] + '>'\n",
-    "        sigla = row['sigla']\n",
-    "\n",
-    "        #E22 P128 E73\n",
-    "        line = triple(datplaceHolder,\n",
-    "                      cidocCoords.prefix + 'P128_carries',\n",
-    "                      E73placeHolder + '>') + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(E73placeHolder + '>',\n",
-    "                      nsCoords.prefix + 'type',\n",
-    "                      cidocCoords.prefix + 'E73_Information_Object') + closeLine\n",
-    "        output.write(line)\n",
-    "\n",
-    "        #E22 P128 E33\n",
-    "        line = triple(datplaceHolder,\n",
-    "                      cidocCoords.prefix + 'P128_carries',\n",
-    "                      E33placeHolder + '>') + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(E33placeHolder + '>',\n",
-    "                      nsCoords.prefix + 'type',\n",
-    "                      cidocCoords.prefix + 'E33_Linguistic_Object') + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(E33placeHolder + '>',\n",
-    "                      schemaCoords.prefix + 'label',\n",
-    "                      '\\\"Trascrizione di ' + row['titolo'] + '\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "        line = triple(E33placeHolder + '>',\n",
-    "                      cidocCoords.prefix + 'P2_has_type',\n",
-    "                      '\\\"Trascrizione\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "\n",
-    "        testo = get_text(sigla)\n",
-    "        testo_lem = testo[1].replace('\"', \"'\")\n",
-    "        line = triple(E73placeHolder + '>',\n",
-    "                      cidocCoords.prefix + 'P190_has_symbolic_content',\n",
-    "                      '\\\"' + testo_lem + '\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "\n",
-    "        trascrizione = testo[0].replace('\"', \"'\")\n",
-    "        line = triple(E33placeHolder + '>',\n",
-    "                      cidocCoords.prefix + 'P190_has_symbolic_content',\n",
-    "                      '\\\"' + trascrizione + '\\\"') + closeLine\n",
-    "        output.write(line)\n",
-    "\n",
-    "        output.write('\\n')\n",
-    "\n",
-    "\n",
-    "        # Limit number of entries processed (if desired)\n",
-    "        if(ii>max_entries):\n",
-    "            break\n",
-    "        "
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
-  },
-  "kernelspec": {
-   "display_name": "Python 3.9.0 64-bit",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.10.4"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}

+ 0 - 54
FORMS/parsers/prebuilt_parsers/CSV_to_RDF_OVI/associate_OVI_URL_TLIO.py

@@ -1,54 +0,0 @@
-import csv
-import codecs
-#import pandas as pd
-import re
-import os
-import io
-import tokenize
-
-merged_data = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/mergeOVI-TLIO.csv', 'w')
-csvwriter = csv.writer(merged_data)
-
-params = ['sigla', 'n_lemma', 'lemma', 'n_iperlemma', 'iperlemma', 'pos', 'commento', 'id', 'thing', 'link_tlio']
-csvwriter.writerow(params)
-
-def get_link_ovi (lemma):
-    link_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/OVI_lemmi_clean.csv')
-    reader = csv.DictReader(link_file)
-    for row in reader:
-        sLemma = row['sLemma']
-        if (sLemma == lemma):
-            return (row['FileHTM'])
-
-
-merge_file = open('/Users/federicaspinelli/TEAMOVI/Parser/DATA/OVI/CSV/data_lemmi_iperlemmi_thing_id.csv')
-reader = csv.DictReader(merge_file)
-for row in reader:
-    line = []
-    sigla = row['sigla']
-    n_lemma = row['n_lemma']
-    lemma = row['lemma']
-    n_iperlemma = row['n_iperlemma']
-    iperlemma = row['iperlemma']
-    pos = row['pos']
-    commento = row['commento']
-    id = row['id']
-    thing = row['thing']
-    link_ovi = get_link_ovi(lemma)
-    line.append (sigla)
-    line.append (n_lemma)
-    line.append (lemma)
-    line.append (n_iperlemma)
-    line.append (iperlemma)
-    line.append (pos)
-    line.append (commento)
-    line.append (id)
-    line.append (thing)
-    if link_ovi is not None:
-        line.append(link_ovi)
-    else:
-        line.append("")
-
-    csvwriter.writerow(line)
-    #print (line)
-merged_data.close()