Skip to content

Commit

Permalink
Merge pull request #41 from cite-architecture/dev
Browse files Browse the repository at this point in the history
Support new versions of `CitableText` and `CitableObject`
  • Loading branch information
neelsmith authored Dec 23, 2021
2 parents da72b61 + b16f055 commit f7c5552
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 29 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CiteEXchange"
uuid = "e2e9ead3-1b6c-4e96-b95f-43e6ab899178"
authors = ["Neel Smith <dnsmith.neel@gmail.com>"]
version = "0.6.0"
version = "0.6.1"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand All @@ -18,8 +18,8 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
CSV = "0.9"
CitableBase = "7"
CitableLibrary = "0.4"
CitableObject = "0.9"
CitableText = "0.12"
CitableObject = "0.10"
CitableText = "0.13"
DocStringExtensions = "0.8"
Documenter = "0.27"
HTTP = "0.9"
Expand Down
45 changes: 19 additions & 26 deletions docs/src/collections.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@


```@setup library
collectioncex = """#!datamodels
Collection|Model|Label|Description
urn:cite2:hmt:va_signs.v1:|urn:cite2:demo:datamodels.v1:annotationmodel|Annotation model|Model of critical sign annotating text
#!citecollections
URN|Description|Labelling property|Ordering property|License
urn:cite2:hmt:va_signs.v1:|Occurrences of Aristarchan critical signs in the Veentus A manuscript|urn:cite2:hmt:va_signs.v1.label:|urn:cite2:hmt:va_signs.v1.sequence:|CC-attribution-share-alike
#!citeproperties
Property|Label|Type|Authority list
urn:cite2:hmt:va_signs.v1.urn:|URN|Cite2Urn|
urn:cite2:hmt:va_signs.v1.label:|Name|String|
urn:cite2:hmt:va_signs.v1.passage:|Iliad line|CtsUrn|
urn:cite2:hmt:va_signs.v1.critsign:|Critical sign|Cite2Urn|
urn:cite2:hmt:va_signs.v1.sequence:|Sequence|Number|
#!citedata
urn|label|passage|critsign|sequence
urn:cite2:hmt:va_signs.v1:cs0|diple on Iliad 1.2|urn:cts:greekLit:tlg0012.tlg001.msA:1.2|urn:cite2:hmt:critsigns.v1:diple|0
"""
root = pwd() |> dirname |> dirname
f = joinpath(root, "test", "assets", "critsigns.cex")
collectioncex = read(f, String)
```


Expand All @@ -34,18 +17,27 @@ There are two ways to map a CITE collection to a Julia type:
1. directly map a collection by its URN (possibly using URN containment)
1. map the datamodel defined for the collection in the source CEX data

Use the required libraries:

```@example library
using CiteEXchange
using CitableLibrary
```



!!! note

In the following example, we've predefined a CEX string `collectioncex`. It contains the contents of the file `test/assets/critsigns.cex` in this repository.




## Define the custom types

```@example library
using CitableObject
using CiteEXchange
using CitableLibrary
using CitableObject, CitableBase
struct TerribleTuples
urn::Cite2Urn
Expand Down Expand Up @@ -104,7 +96,7 @@ end

Now we can build a library by mapping specific CITE collections to our new class.

## Mapping content with a containing URN
### Mapping content with a containing URN

In this example, we map a collection-level URN to our type.

Expand All @@ -114,8 +106,9 @@ tdict1 = Dict(signcollection => TerribleTuples)
lib1 = citelibrary(collectioncex, tdict1, strict = false)
```

### Mapping content with a data model

Since the one collection in this sample is mapped to a data model, we can create a library with equivalent contents using the library as the key to the Julia type.
Since the one collection in this sample is mapped to a data model, we can create a library with equivalent contents using the data model's URN as the key to the Julia type.

```@example library
annotationmodel = Cite2Urn("urn:cite2:demo:datamodels.v1:annotationmodel")
Expand Down
19 changes: 19 additions & 0 deletions test/assets/critsigns.cex
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!datamodels
Collection|Model|Label|Description
urn:cite2:hmt:va_signs.v1:|urn:cite2:demo:datamodels.v1:annotationmodel|Annotation model|Model of critical sign annotating text

#!citecollections
URN|Description|Labelling property|Ordering property|License
urn:cite2:hmt:va_signs.v1:|Occurrences of Aristarchan critical signs in the Veentus A manuscript|urn:cite2:hmt:va_signs.v1.label:|urn:cite2:hmt:va_signs.v1.sequence:|CC-attribution-share-alike

#!citeproperties
Property|Label|Type|Authority list
urn:cite2:hmt:va_signs.v1.urn:|URN|Cite2Urn|
urn:cite2:hmt:va_signs.v1.label:|Name|String|
urn:cite2:hmt:va_signs.v1.passage:|Iliad line|CtsUrn|
urn:cite2:hmt:va_signs.v1.critsign:|Critical sign|Cite2Urn|
urn:cite2:hmt:va_signs.v1.sequence:|Sequence|Number|

#!citedata
urn|label|passage|critsign|sequence
urn:cite2:hmt:va_signs.v1:cs0|diple on Iliad 1.2|urn:cts:greekLit:tlg0012.tlg001.msA:1.2|urn:cite2:hmt:critsigns.v1:diple|0

0 comments on commit f7c5552

Please sign in to comment.