Overview

These are notes on creating a DTS (Distributed Text Services) API for TEI/XML files published by the Koui Genji Monogatari Text DB.

Background

The Koui Genji Monogatari Text DB is available at:

https://kouigenjimonogatari.github.io/

It publishes TEI/XML files.

Developed DTS

The developed DTS is available at:

https://dts-typescript.vercel.app/api/dts

It uses Express.js deployed on Vercel.

For more information about DTS, please refer to:

MyCapytain Library

In the following article, I introduced a library for using DTS from Python:

Let’s use this library to access the developed DTS.

Create the resolver

With the following line we create the resolver :

frreosmolMvyeCrap=ytHatitnp.DrtessRoelsvoelrvse.rd(t"sh.tatppis_:v/1/ditmsp-otrytpeHstctrpiDptts.Rveesroclevle.rapp/api/dts")

Require metadata : let’s visit the catalog

The following code is gonna find each text that is readable by Alpheios

#r##rpoerWoTiaiethtdneatg=ndb(eol"trweeWees_etschornofeleolovttlurerenorihcdo.eattgvvi%eeeosctnoMdsscleyeoltne=leaanlcdmretaiaocitcnotoaaytin(l.o)lmrnyiessaasdtliahlnbaglttehtDceeeaxsnrtceseba:neddabapbenaltrecssDaeerdse"cfeu%nldlawenintt(shre:tahdiiatsblboern_oecwosolenleahcuuttgioeomnarste)ip)coasliltyortiheesAPIuntil
Wefound54collectionsthatcanbeparsed

Printing the full tree

##dpserhNIfioofnwtsft_eyho(toorrrtuwoeh_spsoeaaturht(trrbio.reecnwioweot_doen(l(t)toclcr)ctoeheolcaeufltr(laei_sdmconuitnubali_mclioibosandelor,,rl*eswcs"ceihu-tetab-ihrc"oa_onnrnl+,deulcme"cmubcharet"aksrirei=o+_v1nnai)sut:iumtynbbr,ceecoretol+hll1oele)fecncttetihxioetonn.cl.iaicdtnh)aeilslodgmr.iegnh.titbeemsa()b:itcomplicated
defauurlnuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuut:rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrknnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnno::::::::::::::::::::::::::::::::::::::::::::::::::::::ukkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkiooooooooooooooooooooooooooooooooooooooooooooooooooooooguuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuueiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinggggggggggggggggggggggggggggggggggggggggggggggggggggggjeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnmjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjoiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmooooooooooooooooooooooooooooooooooooooooooooooooooooooognnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnaooooooooooooooooooooooooooooooooooooooooooooooooooooootggggggggggggggggggggggggggggggggggggggggggggggggggggggaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarttttttttttttttttttttttttttttttttttttttttttttttttttttttiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii......................................................123456789111111111122222222223333333333444444444455555012345678901234567890123456789012345678901234

Printing details about a specific one

#f#rc#ltpraoaerLoTnlNbxiemhdloetnte_ewl_t'rici(saintl=d"nndieTgddeotc=reoexn'oetmxslca==loiainpelnmerrrclgrpeaeiteaodnanic`nrsddtot"dtiani+otnbi.olmrotlngnaa(efe.bonb0_otiende,cr_dleioml+nbllaa"!teeltb`tneiew(colwertn(ieei)tnao?hdn0asib[dalrnea"d_ncd+to_hlitelneedxncetutx_mi]iboden)rs)o)fcollections
Treaing``withidurn:kouigenjimonogatari.47

What about more detailed informations ? Like the citation scheme ?

dpprerrefiicnnurfttreo((scr""iuMCvrspraiesurext_ibiciapvcnumtreitruii_t(smonpacintrthvciiiaeiSnnor_tygtn_pas_inrttcniuiieignmnomt_btn"accei)tiirnditt*geoaa"_pntt-ct_ii-ihsoo"tcnna:h_.+tesci"mch"o,ehin(el"_ccmdsooer+cll(ehllcnseeei:umcctbettac(iitisooitunnoab..ntccc,iiiiotttcnaaah.tttaniiiraooo_mnnnne,.)u)dmcebhpeatrrh=_)1n)u:mber+1)
MCaixtialmtiuinmoenciStyasttieomndepth:1

Let’s get some references !

rp#erfiNfnistc(e=re!rfefsso)lver.getReffs(collection.id)
#r##rpoerWoTiaiethtdneatg=ndb(eol"trweeWees_etschornofeleolovttlurerenorihcdo.eattgvvi%eeeosctnoMdsscleyeoltne=leaanlcdmretaiaocitcnotoaaytin(l.o)lmrnyiessaasdtliahlnbaglttehtDceeeaxsnrtceseba:neddabapbenaltrecssDaeerdse"cfeu%nldlawenintt(shre:tahdiiatsblboern_oecwosolenleahcuuttgioeomnarste)ip)coasliltyortiheesAPIuntil

0

Let’s get some random passage !

#r##rpoerWoTiaiethtdneatg=ndb(eol"trweeWees_etschornofeleolovttlurerenorihcdo.eattgvvi%eeeosctnoMdsscleyeoltne=leaanlcdmretaiaocitcnotoaaytin(l.o)lmrnyiessaasdtliahlnbaglttehtDceeeaxsnrtceseba:neddabapbenaltrecssDaeerdse"cfeu%nldlawenintt(shre:tahdiiatsblboern_oecwosolenleahcuuttgioeomnarste)ip)coasliltyortiheesAPIuntil

1

#r##rpoerWoTiaiethtdneatg=ndb(eol"trweeWees_etschornofeleolovttlurerenorihcdo.eattgvvi%eeeosctnoMdsscleyeoltne=leaanlcdmretaiaocitcnotoaaytin(l.o)lmrnyiessaasdtliahlnbaglttehtDceeeaxsnrtceseba:neddabapbenaltrecssDaeerdse"cfeu%nldlawenintt(shre:tahdiiatsblboern_oecwosolenleahcuuttgioeomnarste)ip)coasliltyortiheesAPIuntil

2

Discussion

As shown above, I was able to build a DTS that supports the basic operations of the MyCapytain library.

While the above example uses Python, it can also be accessed from a browser. For example, the following retrieves the first line of Kiritsubo:

https://dts-typescript.vercel.app/api/dts/document?id=urn:kouigenjimonogatari.1&ref=https://w3id.org/kouigenjimonogatari/api/items/0005-01.json

Notes

This was developed referencing the following API:

https://texts.alpheios.net/api/dts

However, it has not been confirmed whether the above API conforms to the latest guidelines:

https://distributed-text-services.github.io/specifications/

Therefore, please note that the DTS API developed here may have parts that do not conform to the above guidelines.

Summary

I hope this serves as a useful reference for understanding DTS.