Published

January 6, 2025

Searching collections of triples

Finding unique values for each field of a DSETriple

The CitablePhysicalText package includes functions for querying a DSECollection. We’ll load a sample dataset from the file test/assets/proclusdse.cex in this github repository.

using CitableBase
using CitablePhysicalText
f = joinpath(root, "test", "assets", "proclusdse.cex")
dsecollectionlist = fromcex(f, DSECollection, FileReader)
1-element Vector{DSECollection}:
 urn:cite2:hmt:dse.v1:vaproclus Collection of DSE records for Venetus text of Proclus, Chrestomathy

The result is a (possibly empty) Vector of DSECollections. This data set has a single collection, which we’ll now work with.

dsecoll = dsecollectionlist[1]
urn:cite2:hmt:dse.v1:vaproclus Collection of DSE records for Venetus text of Proclus, Chrestomathy

You can find the unique list of URNs for each field of the collection’s triples with the functions surfaces, images and texts.

surfaces(dsecoll)
5-element Vector{CitableObject.Cite2Urn}:
 urn:cite2:hmt:msA.v1:1r
 urn:cite2:hmt:msA.v1:1v
 urn:cite2:hmt:msA.v1:6r
 urn:cite2:hmt:msA.v1:6v
 urn:cite2:hmt:msA.v1:4r

The images function has an optional parameter defining whether or not to include subreferences.

images(dsecoll, keepsubref = false)
5-element Vector{CitableObject.Cite2Urn}:
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002
 urn:cite2:hmt:vaimg.2017a:VA001VN_0503
 urn:cite2:hmt:vaimg.2017a:VA006RN_0007
 urn:cite2:hmt:vaimg.2017a:VA006VN_0508
 urn:cite2:hmt:vaimg.2017a:VA004RN_0005

Similarly, the passages function has an optional parameter defining whether or not to include the passage component.

passages(dsecoll, keeppassage = false)
1-element Vector{CitableText.CtsUrn}:
 urn:cts:greekLit:tlg4036.tlg023.va:

Querying by field

The following functions find values for one field of a DSETriple filtered by another field.

Find all text passages on a given surface:

using CitableObject
page = Cite2Urn("urn:cite2:hmt:msA.v1:1r")
textsforsurface(page, dsecoll)
21-element Vector{CitableText.CtsUrn}:
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.title
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.1
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.2
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.3
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.4
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.5
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.6
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.7
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.8
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.9
 ⋮
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.12
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.13
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.14
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.15
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.16
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.17
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.18
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.19
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.20@ἀλλὰ-20@ταῦτα[2]

Find all text passages indexed to a given image:

img = Cite2Urn("urn:cite2:hmt:vaimg.2017a:VA001RN_0002")
textsforimage(img, dsecoll)
21-element Vector{CitableText.CtsUrn}:
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.title
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.1
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.2
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.3
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.4
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.5
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.6
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.7
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.8
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.9
 ⋮
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.12
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.13
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.14
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.15
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.16
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.17
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.18
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.19
 urn:cts:greekLit:tlg4036.tlg023.va:Homer.20@ἀλλὰ-20@ταῦτα[2]

Find what pages a text occurs on:

using CitableText
homer = CtsUrn("urn:cts:greekLit:tlg4036.tlg023.va:Homer")
surfacesfortext(homer, dsecoll)
2-element Vector{Cite2Urn}:
 urn:cite2:hmt:msA.v1:1r
 urn:cite2:hmt:msA.v1:1v

Find what images illustrate a text:

homer = CtsUrn("urn:cts:greekLit:tlg4036.tlg023.va:Homer")
imagesfortext(homer, dsecoll)
[ Info: Txt urn:cts:greekLit:tlg4036.tlg023.va:Homer
[ Info: Look for txturn urn:cts:greekLit:tlg4036.tlg023.va:Homer
41-element Vector{Cite2Urn}:
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1580,0.1633,0.4740,0.05302
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1335,0.2054,0.4637,0.04139
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1553,0.2292,0.4508,0.04678
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1449,0.2620,0.4641,0.05869
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1456,0.3069,0.4667,0.06620
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1462,0.3514,0.4637,0.06904
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1462,0.4002,0.4627,0.05132
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1487,0.4278,0.4627,0.04069
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1464,0.4653,0.4724,0.05217
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1468,0.5138,0.3439,0.02155
 ⋮
 urn:cite2:hmt:vaimg.2017a:VA001VN_0503@0.4219,0.3513,0.4438,0.04122
 urn:cite2:hmt:vaimg.2017a:VA001VN_0503@0.3996,0.3874,0.4818,0.02254
 urn:cite2:hmt:vaimg.2017a:VA001VN_0503@0.4237,0.4058,0.3047,0.01867
 urn:cite2:hmt:vaimg.2017a:VA001VN_0503@0.4237,0.4051,0.4422,0.04965
 urn:cite2:hmt:vaimg.2017a:VA001VN_0503@0.4202,0.4328,0.4388,0.03734
 urn:cite2:hmt:vaimg.2017a:VA001VN_0503@0.4228,0.4506,0.4405,0.03804
 urn:cite2:hmt:vaimg.2017a:VA001VN_0503@0.4245,0.4649,0.4438,0.07344
 urn:cite2:hmt:vaimg.2017a:VA001VN_0503@0.4219,0.5111,0.4525,0.05851
 urn:cite2:hmt:vaimg.2017a:VA001VN_0503@0.4232,0.5426,0.4416,0.04149

Find surfaces illustrated by an image:

surfacesforimage(img, dsecoll)
1-element Vector{Cite2Urn}:
 urn:cite2:hmt:msA.v1:1r

Find images illustrating a surface;

imagesforsurface(page, dsecoll)
20-element Vector{Cite2Urn}:
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1580,0.1633,0.4740,0.05302
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1335,0.2054,0.4637,0.04139
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1553,0.2292,0.4508,0.04678
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1449,0.2620,0.4641,0.05869
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1456,0.3069,0.4667,0.06620
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1462,0.3514,0.4637,0.06904
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1462,0.4002,0.4627,0.05132
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1487,0.4278,0.4627,0.04069
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1464,0.4653,0.4724,0.05217
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1468,0.5138,0.3439,0.02155
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1414,0.5149,0.4675,0.03955
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1456,0.5278,0.4605,0.03884
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1441,0.5447,0.4631,0.03672
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1437,0.5611,0.4654,0.03572
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1468,0.5801,0.4603,0.04820
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1407,0.6104,0.4757,0.05089
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.2964,0.6418,0.3163,0.01744
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1502,0.6574,0.2456,0.02056
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1382,0.6532,0.4703,0.04111
 urn:cite2:hmt:vaimg.2017a:VA001RN_0002@0.1401,0.6741,0.4721,0.1121