Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

Datum des CBS-Abzugs: 20242025-1007-01

Dieser Bericht wurde automatisiert mit R Markdown erstellt. Der pica-rs-Code für die Abfrage aller Tc-Sätze und der R-Code für die Berechnung der Ausgabetabelle können durch Aufklappen der Codeblöcke eingesehen werden.

Von allen Datensätzen mit 002@.0 == 'Tc' ohne 050C.a =^ 'GND-kein-Schlagwort' werden die Unterfelder $2 und $4 der PICA+-Felder 022P, 028P, 029P, 030P, 041P und 065P ausgelesen und die IDN-Anzahlen für alle Kombinationen der Werte {‘agrovoc’, ‘lcsh’, ‘ram’, ‘mesh’, ‘stw’, ‘thesoz’, ‘embne’, ‘nsbncf’, ‘tpro’, ‘etiras’} in $2 und {‘ftaa’, ‘ftae’, ‘ftai’, ‘ftao’, ‘ftau’, ‘ftob’, ‘ftub’, ‘ftvb’, ‘ftnu’} in $4 berechnet.

...

Codeblock
languagebash
collapsetrue
#!/bin/bash

set -euo pipefail
# set -x

# Datenformat GND - Crosskonkordanzen zu externen Vokabularen/Thesauri:
# https://wiki.dnb.de/pages/viewpage.action?pageId=263851158x/lgy6Dw

dnb_dump=/srv/aen-data/pica/T.dat

# Tc-Sätze "f bbg Tc NOT rdb GND-kein-Schlagwort*"
pica filter -s "002@.0 == 'Tc'" --not "050C.a =^ 'GND-kein-Schlagwort'" $dnb_dump -o Tc.dat

# 028P (700) - "p" - Person
# 029P (710) - "b" - Körperschaft
# 030P (711) - "f" - Konferenz
# 022P (730) - "u" - Einheitstitel
# 041P (750) - "s" - Sachbegriff
# 065P (751) - "g" - Geografikum

pica select -H "IDN, Feld, Thesaurus, Relation" "003@.0, '028P', 028P{2, 4}" \
--where "028P.4?" Tc.dat -o Tc.csv

# ohne Header anhängen
pica select "003@.0, '029P', 029P{2, 4}" --where "029P.4?" Tc.dat --append -o Tc.csv
pica select "003@.0, '030P', 030P{2, 4}" --where "030P.4?" Tc.dat --append -o Tc.csv
pica select "003@.0, '022P', 022P{2, 4}" --where "022P.4?" Tc.dat --append -o Tc.csv
pica select "003@.0, '041P', 041P{2, 4}" --where "041P.4?" Tc.dat --append -o Tc.csv
pica select "003@.0, '065P', 065P{2, 4}" --where "065P.4?" Tc.dat --append -o Tc.csv

...

Codeblock
languagenone
collapsetrue
# Crosskonkordanzen einlesen
ck <- read_csv('Tc.csv', col_types = 'cccc')

# Wertebereiche gemäß Wiki-Seiten definieren
thesauri <- read_csv('Thesauri.csv', col_types = 'cc')
relationen <- read_csv('Relationen.csv', col_types = 'cc')

# Crosskonkordanzen filtern und zählen
rslt1rslt <- ck %>%
  filter(Thesaurus %in% thesauri$Code & Relation %in% relationen$Code) %>%
  mutate(
    Thesaurus = factor(Thesaurus, 
                       levels = thesauri$Code, labels = thesauri$Thesaurus),
    Relation  = factor(Relation,
                       levels = relationen$Code, labels = relationen$Relation)
  ) %>%
  # GESAMT als Summe über alle Relationen
  rbind((.) %>% mutate(Relation = factor('GESAMT'))) %>%
  # auch alle leeren Levels jeweils mit Anzahl 0 anzeigen
  group_by(Thesaurus, Relation, .drop = FALSE) %>% 
  # jede Kombination (Thesaurus, Relation) je IDN nur einmal zählen
  summarise(n = n_distinct(IDN)) %>%
  pivot_wider(id_cols = Relation, names_from = Thesaurus, values_from = n)

# Summe
rslt2 <- data.frame(Relation = factor('GESAMT'), 
                    rslt1 %>% select(-Relation) %>% summarise_all(.funs = sum))
colnames(rslt2) <- colnames(rslt1)

# Formatierte Ausgabetabelle
rbind(rslt1, rslt2) %>% rslt %>%
  mutate_at(.vars = setdiff(colnames(.), 'Relation'), .funs = ~ formatC(
    ., format = 'd', big.mark = '.', decimal.mark = ',')) %>%
  knitr::kable(align = c('l', rep('r', ncol(.)-1)))
RelationAGROVOCLCSHRAMEAUMeSHSTWTheSozEMBNENSoggT-PROET
Äquivalenz (ftaa)90
46
48.
721
726
45
47.
386
262
40
56010213.0408.
616
6172669
exakte Äquivalenz (ftae)5.490
720
1.225
673
7996.
201
4045.
755
8357.
336
3351722363.512
inexakte Äquivalenz (ftai)5
501
717
419
745
365
3920
197
1985504292.365
ODER-Äquivalenz (ftao)4
131
142
58
6665006081.411
UND-Äquivalenz (ftau)1.2932.
305
3154.
662
666
116
118
416
4151.6161000
Oberbegriff-Relation (ftob)2.12700557.
903
9272.9340000
Unterbegriff-Relation (ftub)1830012
374
3823930000
Verwandter-Begriff-Relation (ftvb)76900113.
753
7729290000
Null-Relation (ftnu)168
18
19.
459
088
19
20.
982
9410
506
5038972100
GESAMT10.129
68
72.
837
213
71
74.
180
479
6
7.
865
11318.
707
83414.40413.6168.
643
644757.957