Postgres Database Structure¶
Schema capitularia:¶
The teiHeader contains in msDesc/msPart references to capitularies and loci but no reference to chapters. The teiHeader includes capitularies not yet transcribed. This relation is caught in table mss_capitularies. The map client uses this relation.
The body contains finer grained references to chapters and loci in the @corresp and @xml:id, but only for already transcribed material. This relation is caught in table mss_chapters. The collation tool uses this relation.
The mss_chapters_text table contains the chapter’s text preprocessed for the collation tool.
Note that the relation between the mss_chapters and msparts tables was inferred using the loci, because there are no milestones for msParts/msItems in the body.
Note that the mscap_n of the mss_capitularies and mss_chapters tables do not indicate the same concept.
Schema gis:¶
Note: the gis.geonames table and relatives contain standard hierarchies of place names, extracted from the geonames, dnb, and viaf databases.
Note: the gis.geoplaces table and relatives contain a different, custom hierarchy of
place names, which is the one displayed in the manuscript search box. This hierarchy is
extracted from the file mss/lists/capitularia_geo.xml
. Unfortunately it is
linked to manuscripts and not to manuscript parts.
db.py¶
This module contains the sqlalchemy classes that initialize the database structure.
To create a new database: (must be database superuser)
sudo -u postgres psql
CREATE USER capitularia PASSWORD '<password>';
CREATE DATABASE capitularia OWNER capitularia;
\c capitularia
CREATE EXTENSION pg_trgm WITH SCHEMA public;
CREATE EXTENSION postgis WITH SCHEMA public;
CREATE SCHEMA capitularia AUTHORIZATION capitularia;
CREATE SCHEMA gis AUTHORIZATION capitularia;
ALTER DATABASE capitularia SET search_path = capitularia, gis, public;
\q
make rebuild_db
- class Capitularies(**kwargs)¶
All capitularies catalogued according to BK or Mordek.
- cap_id¶
The capitulary number, eg. “BK.42”
- title¶
The capitulary title assigned by BK.
- class Chapters(**kwargs)¶
All chapters catalogued according to BK or Mordek.
- chapter¶
The chapter number from 1 to N. Also: 1_inscription, etc.
- class GeoAreas(**kwargs)¶
Custom defined geographic areas
- class GeoPlaces(**kwargs)¶
Data extracted from capitularia_geo.xml
- class GeoPlacesNames(**kwargs)¶
Data extracted from capitularia_geo.xml
- class Geonames(**kwargs)¶
Data scraped from geonames.org et al. and cached here.
- class Manuscripts(**kwargs)¶
- filename¶
The filename of the TEI file containing the transcription of the manuscript.
- ms_id¶
The manuscript id assigned by the Capitularia project.
- status¶
The Wordpress publication status: either ‘publish’ or ‘private’
- title¶
The official title of the manuscript.
- class MnManuscriptsGeoPlaces(**kwargs)¶
The M:N relationship between manuscripts and geoplaces
- class MnMsPartsGeonames(**kwargs)¶
The M:N relationship between msparts and geonames
- class MsParts(**kwargs)¶
The parts of a manuscript
- date¶
When did the manuscript part originate? Range of years.
- leaf¶
Size of the leaf.
- locus_cooked¶
Ranges of cooked loci.
- msp_part¶
The official designation of the manuscript part.
- written¶
Size of the written area.
- class MssCapitularies(**kwargs)¶
A capitulary in a manuscript according to <msDesc>.
This table also contains capitularies that are not yet transcribed.
A finer granularity (chapters instead of capitularies) can be found in the
MssChapters
table, albeit only already transcribed ones.- locus¶
The locus of this capitulary instance in the ms as recorded by the editor, eg. 42ra-45vb.
- locus_cooked¶
Ranges of cooked loci.
- mscap_n¶
The n_th occurence of the capitulary in the manuscript. Default is 1.
Since msItem does not contain milestones, this value is inferred by counting the number of preceding loci that contain this capitulary.
N.B.: The value in the mss_chapters table is found in a different way.
- msp_part¶
The official designation of the manuscript part.
- class MssChapters(**kwargs)¶
A chapter in a manuscript according to <body>.
This table contains only chapters that were already transcribed.
Note: The table
MssCapitularies
relates manuscripts to capitularies yet untranscribed.- locus¶
The locus of the chapter in the manuscript. As recorded by the editor, eg. 42ra
- locus_cooked¶
The cooked locus. Locus transformed to a sortable integer.
- locus_index¶
The index at the locus, eg. the ‘1’ in 42ra-1
- mscap_n¶
This chapter was found in the n_th occurence of the capitulary in the manuscript. Default is 1.
The value is read from the milestone, eg.:
<milestone unit=’capitulare’ n=’BK.139_2’ />
marks the second occurence of capitulary 139 in this manuscript. All chapters of BK.139 following this milestone get a value of 2 in this field.
N.B.: The value in the mss_capitularies table is found in a different way.
- msp_part¶
The official designation of the manuscript part.
- transcribed¶
Is this chapter already transcribed? 0 == no, 1 == partially, 2 == completed
- xml¶
The XML text of the chapter.
- class MssChaptersText(**kwargs)¶
Various kinds of preprocessed texts extracted from the chapter.
There may be more than one text extracted from the same chapter: the original hand and later corrector hands.
- text¶
The preprocessed plain text of the chapter.
- type_¶
Either ‘original’ or ‘later_hands’. The type of preprocessing applied. Whether the original hand was followed or a later corrector.
- class XML¶
- bind_processor(dialect)¶
Return a conversion function for processing bind values.
Returns a callable which will receive a bind parameter value as the sole positional argument and will return a value to send to the DB-API.
If processing is not necessary, the method should return
None
.Note
This method is only called relative to a dialect specific type object, which is often private to a dialect in use and is not the same type object as the public facing one, which means it’s not feasible to subclass a
types.TypeEngine
class in order to provide an alternate_types.TypeEngine.bind_processor()
method, unless subclassing the_types.UserDefinedType
class explicitly.To provide alternate behavior for
_types.TypeEngine.bind_processor()
, implement a_types.TypeDecorator
class and provide an implementation of_types.TypeDecorator.process_bind_param()
.See also
types_typedecorator
- Parameters:
dialect – Dialect instance in use.
- result_processor(dialect, coltype)¶
Return a conversion function for processing result row values.
Returns a callable which will receive a result row column value as the sole positional argument and will return a value to return to the user.
If processing is not necessary, the method should return
None
.Note
This method is only called relative to a dialect specific type object, which is often private to a dialect in use and is not the same type object as the public facing one, which means it’s not feasible to subclass a
types.TypeEngine
class in order to provide an alternate_types.TypeEngine.result_processor()
method, unless subclassing the_types.UserDefinedType
class explicitly.To provide alternate behavior for
_types.TypeEngine.result_processor()
, implement a_types.TypeDecorator
class and provide an implementation of_types.TypeDecorator.process_result_value()
.See also
types_typedecorator
- Parameters:
dialect – Dialect instance in use.
coltype – DBAPI coltype argument received in cursor.description.