Overview
This is a memo about updating the DTS (Distributed Text Services) API for the Koui Genji Monogatari Text DB.
Background
The DTS (Distributed Text Services) API is described at the following link.
https://distributed-text-services.github.io/specifications/
The following article introduced the creation of the DTS API.
However, the following was noted as a remaining issue.
Please note that the DTS API developed this time may have areas that do not comply with the above guidelines.
Therefore, the previously created API was designated as v1, and this time a v2 API was created following dtsVersion 1-alpha.
API
The following is the Entry Endpoint. The differences between v1 and v2 are as follows.
- v1
https://dts-typescript.vercel.app/api/v1/dts
- v2
https://dts-typescript.vercel.app/api/v2/dts
Similarly, the descriptions of various endpoints have been updated.
Viewer Improvements
The following article introduced the development of a DTS viewer.
The following was noted as a remaining issue, and improvements were made to address it.
The Navigation Endpoint is used, but multi-level hierarchy is not currently supported.
For example, the Navigation Endpoint is described as follows.
https://dts-typescript.vercel.app/api/v2/dts/navigation?resource=urn:kouigenjimonogatari.1&down=1
In particular, CitationTree is used to describe the hierarchy. By modifying the viewer to process this information, navigation buttons for each level are now displayed as follows.

For example, selecting navigation level 1 with citation type page for “Kiritsubo” navigates to a page where text can be downloaded for each page.

The result of downloading the first page (page 5) is as follows.
https://dts-typescript.vercel.app/api/v2/dts/document?resource=urn:kouigenjimonogatari.1&ref=5

An example of the XML without the stylesheet is as follows. It returns TEI/XML composed of partial texts using dts:wrapper.
Similarly, a download example for navigation level 2 with citation type line is as follows.

An example of the XML without the stylesheet is as follows. It returns TEI/XML composed of partial texts using dts:wrapper.
References
xml-formatter
When formatting XML with Node.js, the following library was useful.
https://www.npmjs.com/package/xml-formatter
DeepWiki
Automatic documentation generation was performed using DeepWiki.
https://deepwiki.com/nakamura196/dts-typescript
While not the latest version, endpoint lists and other documentation were generated.

Summary
There may be some points where my understanding is incorrect, but we hope this serves as a useful reference.
Note that there are still unsupported features such as the nav variable for the Collection Endpoint and the start/end variables for Navigation/Document Endpoints, which I would like to address in the future.