A text catalog entry
A CatalogedText identifies a concrete version of a text by CTS URN, and records labels for its citation pattern and work hierarchy. You can create a CatalogedText with the entry function.
using CitableCorpus
using CitableText
hay_urn = CtsUrn("urn:cts:citedemo:gburg.hay.v2:")
catentry = entry(hay_urn, "section", "Gettysburg Address", "Text of John Hay", "second HC digital edition")<urn:cts:citedemo:gburg.hay.v2:> Gettysburg Address, Text of John Hay, second HC digital editionNotice that the entry function has supplied default values for the exemplar, online and lang fields. You can override those defaults with optional parameters.
Access values of the cataloged entry with these functions:
citation(catentry)"section"textgroup(catentry)"Gettysburg Address"work(catentry)"Text of John Hay"version(catentry)"second HC digital edition"exemplar(catentry) |> isnothingtruelang(catentry)"eng"A citable object
A CatalogedText follows CtsBase's definition of a citable object. It therefore implements three traits defining behavior for (1) citation, (2) comparison based on URN logic, and (3) serialization to/from CEX format. You can verify that with the following functions from CitableBase.
using CitableBase
citable(catentry)trueurncomparable(catentry)truecexserializable(catentry)trueCitation
The urntype, label and urn functions are available for citable objects.
urntype(catentry)CitableText.CtsUrnlabel(catentry)"<urn:cts:citedemo:gburg.hay.v2:> Gettysburg Address, Text of John Hay, second HC digital edition"urn(catentry)urn:cts:citedemo:gburg.hay.v2:URN comparison
CatalogedTexts can be compared to URNs using URN logic for equality, containment and similarity. Note that in each function, the first parameter is the catalog entry, and the second a URN to compare the text to.
urnequals(catentry, hay_urn)trueallgburg = CtsUrn("urn:cts:citedemo:gburg:")
urncontains(catentry, allgburg)trueurnsimilar(catentry, allgburg)trueCEX serialization
CitablePassages can be lossly roundtripped to and from objects and delimited-text strings in CEX format using the cex and fromcex functions of CitableBase.
cex(catentry)"urn:cts:citedemo:gburg.hay.v2:|section|Gettysburg Address|Text of John Hay|second HC digital edition|nothing|true|eng"fromcex(cex(catentry), CatalogedText) == catentrytrue