The CiteLibrary: a citable object

Once we have a list of citable collections, we can build a library as easily as passing the list to the library function.

citelib = library([rl])
Automatically assembled citable library <"urn:uuid:4f0a9772-6409-11ec-1a7e-43a2532b2fa8">
Citable library with 1 collection

The library is itself a citable object!

citable(citelib)
true

Finding out about the library

Since the library is a citable object, it implements the urn and label functions.

urn(citelib)
"urn:uuid:4f0a9772-6409-11ec-1a7e-43a2532b2fa8"
label(citelib)
"Automatically assembled citable library"

These values were generated automatically, but you can supply your own values with optional parameters. (See the API documentation for full details.)

labelledlib = library([rl], libname = "Library id'ed by automatically generated URN, but manually supplied label")

label(labelledlib)
"Library id'ed by automatically generated URN, but manually supplied label"

Default values for other data you can optionally define manually:

license(citelib)
"Creative Commons Attribution, Non-Commercial 4.0 License <https://creativecommons.org/licenses/by-nc/4.0/>"
cexversion(citelib)
v"3.0.2"

Find out about the library' collections

A single library might include collections of multiple types. You find out what types of collecetions appear in your library.

collectiontypes(citelib)
1-element Vector{Any}:
 Main.ReadingList

Of course you can also get a list of the colletions themselves.

collections(citelib)
1-element Vector{Main.ReadingList}:
 Main.ReadingList(Main.Isbn10Urn[Main.Isbn10Urn("urn:isbn:022661283X"), Main.Isbn10Urn("urn:isbn:022656875X"), Main.Isbn10Urn("urn:isbn:022656875X"), Main.Isbn10Urn("urn:isbn:1108922036"), Main.Isbn10Urn("urn:isbn:0141395203")])

You can include a second parameter to limit the returned list to collections of a particular type. This example finds all collections of type ReadingList.

collections(citelib, ReadingList)
1-element Vector{Main.ReadingList}:
 Main.ReadingList(Main.Isbn10Urn[Main.Isbn10Urn("urn:isbn:022661283X"), Main.Isbn10Urn("urn:isbn:022656875X"), Main.Isbn10Urn("urn:isbn:022656875X"), Main.Isbn10Urn("urn:isbn:1108922036"), Main.Isbn10Urn("urn:isbn:0141395203")])

Serializing to CEX

A citable library is serializable to and from CEX.

cexserializable(citelib)
true

Therefore we can use the cex function to generate a plain-text representation of the library's contents.

cexview = cex(citelib)
println(cexview)
#!cexversion
3.0.2

#!citelibrary
name|Automatically assembled citable library
urn|"urn:uuid:4f0a9772-6409-11ec-1a7e-43a2532b2fa8"
license|Creative Commons Attribution, Non-Commercial 4.0 License <https://creativecommons.org/licenses/by-nc/4.0/>

#!citecollection
urn:isbn:022661283X
urn:isbn:022656875X
urn:isbn:022656875X
urn:isbn:1108922036
urn:isbn:0141395203

Instantiating a whole library from CEX

For citable objects and citable collections, the inverse function of cex is fromcex. In each case, the fromcex function instantiates objects of a single type.

Citable libraries, however, need to be able to instantiate many types of citable collections, and therefore cannot be built directly from CEX source with the fromcex function. You can instead use the CiteEXchange.citelibrary function as the inverse of cex for citable libraries. See the documentation of the CiteEXchange package for full information about how to use citelibrary to create a CiteLibrary.

Warning

If you do try to create a CiteLibrary with fromcex, you will receive a warning, and the function will return nothing.

fromcex(cexview, CiteLibrary)