This commit is contained in:
Roger Rutishauser 2024-10-14 17:45:42 +02:00
parent 2c04626b66
commit 3a0c619e37
6 changed files with 349 additions and 0 deletions

View File

@ -3,3 +3,13 @@
[AtoM CLI](atom-cli.md)
[PHP Settings](atom-settings.md)
[Sessions](atom-sessions.md)
[SQl-Queries](atom-sql-queries.md)
[Tools and Scripts](atom-tools-scripts.md)
[Upgrade](atom-upgrade.md)
[Zugriffspunkte](atom-zugriffspunkte.md)

10
atom/atom-sessions.md Executable file
View File

@ -0,0 +1,10 @@
---
gitea: none
include_toc: true
---
# AtoM Sessions
Sessions are stored in `/var/lib/php/sessions/`, e.g. `/var/lib/php/sessions/sess_9bm7jtfoe6bfrmm06vkc52vvn6`
The ID is in the browser cookie called "symfony".

215
atom/atom-sql-queries.md Executable file
View File

@ -0,0 +1,215 @@
---
gitea: none
include_toc: true
---
# AtoM SQL Queries
See also here: [https://www.accesstomemory.org/en/docs/2.6/admin-manual/maintenance/common-atom-queries/](Common AtoM database queries)
## recreate DB
```
php symfony propel:insert-sql
/* or */
DROP database atom25dbtest;
CREATE DATABASE `my-db` CHARACTER SET utf8 COLLATE utf8_unicode_ci;
```
dann webinstaller machen. evtl. noch config/config.php löschen.
## delete all archival descriptions
``` sql
DELETE FROM information_object WHERE id <> 1;
```
## get Repository ID by slug
``` sql
select a.id, a.parent_id, a.repository_id, b.title
from information_object a
left join information_object_i18n b on a.id = b.id
where a.id = (
select object_id from slug
where slug = 'historische-glasdias-2'
);
```
## Get all descriptions recursively (parent --> children)
```
WITH RECURSIVE cte (id, identifier, parent_id) AS (
SELECT io.id, io.identifier, io.parent_id
FROM information_object io
WHERE io.parent_id = 505795
UNION ALL
SELECT io2.id, io2.identifier, io2.parent_id
FROM information_object io2
INNER JOIN cte
ON io2.parent_id = cte.id
)
SELECT cte.id, cte.parent_id, cte.identifier, io18.title, p18.value AS PID, s.slug
FROM cte
LEFT JOIN information_object_i18n io18
ON io18.id = cte.id
LEFT JOIN property as p1
ON p1.object_id = cte.id
LEFT JOIN property_i18n as p18
ON p18.id = p1.id
LEFT JOIN slug AS s
ON s.object_id = cte.id
WHERE p1.name LIKE 'PID';
```
## Get all descriptions by alternative identifier
replace `SRG-Test:%`
```
mysql -u root -p -e "use atom; select io.title, s.slug, p2.value from property as p1 left join property_i18n p2 on p1.id = p2.id left join slug s on s.object_id = p1.object_id left join information_object_i18n io on io.id = p1.object_id where p1.name like 'PID' and p2.value like 'SRG-Test:%';" > pid_with_SRG-Test.csv
# readable query:
SELECT io.title, s.slug, p2.value
FROM property as p1
LEFT JOIN property_i18n p2
ON p1.id = p2.id
LEFT JOIN slug s
ON s.object_id = p1.object_id
LEFT JOIN information_object_i18n io
ON io.id = p1.object_id
WHERE p1.name LIKE 'PID'
AND p2.value LIKE 'SRG-Test:%';
```
## Get all authority records
```
mysql -e "USE atom25db; SELECT a.*, b.* FROM actor LEFT JOIN actor_i18n B ON A.ID = B.ID;" > /home/docuteam/authorityrecords.csv
```
Then open CSV, remove 2nd "id"-column.
Entity types:
- 131: Corporate body
- 132: Person
Description status:
- 221: Final
- 222: Revised
- 223: Draft
Level of detail:
- 224: Full
- 225: Partial
- 226: Minimal
## get all authority records
``` sql
select distinct /* with or without distinct? */
actor_i18n.authorized_form_of_name,
actor.entity_type_id
from actor_i18n
join actor on actor.id = actor_i18n.id
join object on object.id = actor.id
join event on event.actor_id = actor.id
where object.class_name = "QubitActor"
and actor_i18n.culture = "en";
/* query to test on BIS: */
SELECT
actor_i18n.id AS actor_i18n__id,
actor_i18n.authorized_form_of_name AS actor_i18n__authorized_form_of_name,
actor_i18n.dates_of_existence AS actor_i18n__dates_of_existence,
actor_i18n.history AS actor_i18n__history,
actor_i18n.places AS actor_i18n__places,
actor_i18n.legal_status AS actor_i18n__legal_status,
actor_i18n.functions AS actor_i18n__functions,
actor_i18n.mandates AS actor_i18n__mandates,
actor_i18n.internal_structures AS actor_i18n__internal_structures,
actor_i18n.general_context AS actor_i18n__general_context,
actor_i18n.institution_responsible_identifier AS actor_i18n__institution_responsible_identifier,
actor_i18n.rules AS actor_i18n__rules,
actor_i18n.sources AS actor_i18n__sources,
actor_i18n.culture AS actor_i18n__culture,
actor.id AS actor__id,
actor.entity_type_id AS actor__entity_type_id,
actor.corporate_body_identifiers AS actor__corporate_body_identifiers,
actor.description_status_id AS actor__description_status_id,
actor.description_detail_id AS actor__description_detail_id,
actor.description_identifier AS actor__description_identifier,
actor.source_standard AS actor__source_standard,
actor.parent_id AS actor__parent_id,
actor.lft AS actor__lft,
actor.rgt AS actor__rgt,
actor.source_culture AS actor__source_culture
FROM actor_i18n
JOIN actor ON actor.id = actor_i18n.id
JOIN object ON object.id = actor.id
WHERE object.class_name = "QubitActor";
```
## get all places
Taxonomy_id of subjects is *42*
```
mysql -e "USE atom25db; SELECT a.id, a.taxonomy_id, a.code, a.parent_id, a.source_culture, b.name, b.culture FROM term a LEFT JOIN term_i18n b ON a.id = b.id WHERE a.taxonomy_id = 42 ORDER BY a.id ASC;" > /home/docuteam/places.csv
```
## delete places
### only places containing "Bahnhof"
```
DELETE FROM term
WHERE term.taxonomy_id = 42
AND term.id = (SELECT term_i18n.id FROM term_i18n WHERE term_i18n.name LIKE '%Bahnhof%');
```
### all places
```
DELETE FROM term WHERE term.taxonomy_id = 42;
```
Anschliessend build nested set und search index!
## count all archival descriptions
``` sql
SELECT COUNT(*) FROM information_object WHERE id <> 1;
```
## get all subjects
Taxonomy_id of subjects is *35*
```
mysql -e "USE atom25db; SELECT a.id, a.taxonomy_id, a.code, a.parent_id, a.source_culture, b.name, b.culture FROM term a LEFT JOIN term_i18n b ON a.id = b.id WHERE a.taxonomy_id = 35 ORDER BY a.id ASC;" > /home/docuteam/subjects.csv
```
## Get all Identifiers
``` sql
select identifier, id, parent_id
from information_object
where identifier IS NOT NULL
and identifier not like '#%'
and identifier != '?'
order by cast(identifier as unsigned) asc;
```
## Update information_object_i18n based on joined data
``` sql
UPDATE information_object_i18n AS io
LEFT JOIN property p1
ON p1.object_id = io.id
LEFT JOIN property_i18n p2
ON p1.id = p2.id
SET io.title = CONCAT('recovery_failed_', io.title)
WHERE p1.name LIKE 'PID'
AND p2.value = 'CH-000-0:1234';
```

42
atom/atom-tools-scripts.md Executable file
View File

@ -0,0 +1,42 @@
---
gitea: none
include_toc: true
---
# AtoM Tools and Scripts
## Corrupt DB
Database Integrity Tool. If AtoM DB is corrputed, use this php tool, provided by Artefactual (worked well for BIS)
- https://groups.google.com/g/ica-atom-users/c/mWPG763-seQ/m/ecTLNBT7AwAJ
- https://gist.githubusercontent.com/jraddaoui/1dd64ce1e2fa23d2be121522bac4c096/raw/6c6f427c9a0927b7432c9ce98dfa2ffe091cc491/01_wip_atom_integrity_tool.php
## Powershell Script Refcode to ID,ParentID
```
$counter = 0
$refcode_delimiter = '.'
$list = [Ordered]@{}
Import-Csv -Path .\997-ordnungssystem.csv -Delimiter "," | sort n | ForEach-Object {
$arr_id_parentid = @()
$counter++
$arr_id_parentid += $counter
$list.add($_.n, $arr_id_parentid)
}
foreach ($h in $list.GetEnumerator() ) {
$key = $h.Name
#Write-Host "key: "$key
if ($key -like '*.*') {
$s = $key.Substring(0, $key.lastIndexOf('.'))
$h.Value += $list[$s][0]
} else {
$h.Value += 'fribourg-archives-numeriques' # slug of existing place in AtoM for the top level descriptions.
}
$a = $h.Value
Write-Host ($a -join ",")
}
```

19
atom/atom-upgrade.md Executable file
View File

@ -0,0 +1,19 @@
---
gitea: none
include_toc: true
---
# AtoM Upgrade
Siehe auch https://www.accesstomemory.org/de/docs/2.7/admin-manual/installation/upgrading/#installation-upgrading
- backup Data and DB
- get new AtoM-Version and save to `/usr/share/nginx/atom[version number]` [https://www.accesstomemory.org/de/docs/2.6/admin-manual/installation/linux/ubuntu-bionic/#option-1-download-the-tarball|link](download tarball)
- create new DB named `atom[version number]`
- grant access to the DB for the already existing mysql user `atomuser`
- run Webinstaller. in case of 504 error, increase timeout. see https://groups.google.com/g/ica-atom-users/c/LKVkkvT1DkY/m/nVuzUQKJCwAJ
- import old DB (only tables, not DB itself)
- run upgrade task: `php -d memory_limit=-1 symfony tools:upgrade-sql`
- regenerate digiteal object reference and thumbnail: `php symfony digitalobject:regen-derivatives`
- restart services, clear cache
- repopulate search

53
atom/atom-zugriffspunkte.md Executable file
View File

@ -0,0 +1,53 @@
---
gitea: none
include_toc: true
---
# AtoM Zugriffspunkte und Taxonomie
In AtoM können Namen (Authority Records nach ISAAR-CPF) sowie Subjects/Themen und Places/Orte als Zugriffspunkte verwendet werden.
Während Subjects und Places dem Aufbau von SKOS folgen und in der Taxonomie-Verwaltung angepasst werden können, werden Namen (Personen, Körperschaften, Familien) separat über die Normdaten verwaltet.
## Namenszugriffspunkte, engl. Authority Records
Namenszugriffspunkte (auch: Authority Records) bieten einen verknüpften Zugriff auf Informationen über Akteure (z. B. Personen, Familien oder Körperschaften), die mit einer archivischen Beschreibung verbunden sind - entweder als Urheber oder als Subjekt oder über andere Arten von Beziehungen (einschließlich Mitwirkende, Herausgeber, Sammler, Verteiler usw.).
Die zur Verfügung stehenden Felder für die Beschreibung der Namenszugrisspunkte entsprechen dem ISAAR-CPF Standard.
Konkret ist die Eingabemaske in AtoM folgendermassen aufgegliedert:
- Identitiy area: ISAAR 5.1.1 bis 5.1.6
- Description area: ISAAR 5.2.1 bis 5.2.8
- Relationships area: ISAAR 5.3.1 bis 5.3.4 (Verbindungen zu anderen Namenszugriffspunkten) und ISAAR 6.1 bis 6.4 (Verbindungen zu Archivischen Beschreibungen)
- Access points: Verbindungen zu
- "Subjects"-Taxonomie (Themen-Zugriffspunkte).
- "Places"-Taxonomie (Orte-Zugriffspunkte).
- Control area: ISAAR 5.4.1 bis 5.4.9
Für die recherchierende Person erschliessen sich Namen über die Archivischen Beschreibungen (Beschreibung(en) X ist mit Name(n) Y verknüpft), und umgekehrt können Beschreibungen über die Normdaten gefunden werden (Name Y ist mit Beschreibung(en) X verknüpft).
## Themen, und Ort-Zugriffspunkte, engl. Subject-/Places Access Points
Diese werden in AtoM über eine separate "Subjects"- und "Places"-Taxonomie verwaltet. Hierarchien können abgebildet werden. SKOS wird als Import-Format unterstützt.
## Taxonomien
In AtoM sind Taxonomien Gruppierungen von Begriffen des kontrollierten Vokabulars.
In AtoM haben diese kontrollierten Vokabulare folgende Anwendungszwecke:
## Wertelisten
Begriffe und Werte, die in Dropdown-Menüs erscheinen. Diese Dropdown-Menüs bieten Wertelisten, die die Dateneingabe in bestimmten Feldern auf bestimmte Werte (d.h. die kontrollierten Werte in der Taxonomie) beschränken. AtoM speichert diese Werte in der Regel als Termdatensätze in der Datenbank und ordnet sie Taxonomien zu - so kann beispielsweise das Feld "Art der Einheit" eines Behördendatensatzes standardmäßig nur einen der drei Werte "Körperschaft", "Person" oder "Familie" annehmen. Jeder dieser Werte ist ein Begriff, der der Taxonomie "Actor entity types" zugeordnet ist.
AtoM wird mit einer festen Anzahl von Taxonomien ausgeliefert, die Standardwerte (Begriffe) enthalten. Einige Begriffe sind gesperrt, d. h. sie können nicht bearbeitet oder gelöscht werden, da sie vom zugrunde liegenden Code der Anwendung verwendet werden. Die meisten Begriffe können jedoch bearbeitet oder gelöscht werden, und allen Taxonomien können zusätzlich zu den gesperrten Werten neue Begriffe zugewiesen werden.
## Zugriffspunkte
Für Themen/Subjects und Orte/Places. Mit diesen beiden Taxonomien wird man am meisten in Berührung kommen.
## Links
- https://www.ica.org/sites/default/files/CBPS_Guidelines_ISAAR_Second-edition_EN.pdf
- https://www.ica.org/sites/default/files/CBPS_Guidelines_ISAAR_Second-edition_DE.pdf
- https://www.accesstomemory.org/de/docs/2.7/user-manual/add-edit-content/terms/#term-name-vs-subject
- https://www.accesstomemory.org/de/docs/2.7/user-manual/add-edit-content/authority-records/