2 Bibliographic Information
This section documents an API for accessing bibliographic information about instances. An instance is an abstraction for the most specific level of bibliographic information with which Digital Ricœur is concerned. The term “instance” is drawn from the BibFrame model for bibliographic data.
Concretely, Ricœur’s publications exist as particular physical objects, such as a specific copy of a book, housed on a particular shelf in a particular library. The “instance” abstraction refers to all concrete copies that are “the same” for Digital Ricœur’s purposes: that is, they are bibliographically identical, even to the extent of having exactly the same pagination. Digital Ricœur aims to prepare one TEI XML file for each instance.
An instance is an abstraction, not a kind of Racket value, but many kinds of Racket values (particularly TEI document values) are assosciated with an instance. Racket values that encapsulate bibliographic information about a particular instance are refered to as instance info values. This library defines a common interface for working with instance info values, and clients can implement additional types of instance info values that will support the same interface.
In the medium to long term, Digital Ricœur plans to transition to managing the corpus-level bibliographic data about instances in a database, rather than the TEI XML files. That transition will likely result in changes to this interface.
procedure
(instance-info? v) → any/c
v : any/c
All instance info values support the same high-level API, and new kinds of values (including class-based objects) can implement the instance info interface. (See prop:instance-info and instance-info-mixin.)
match expander
(instance-info kw-pat ...)
kw-pat = #:title title-pat | #:title/symbol title/symbol-pat | #:citation citation-pat | #:orig-publication-date orig-publication-date-pat | #:publication-date publication-date-pat | #:publication-original? publication-original?-pat | #:language language-pat | #:book/article book/article-pat
Each keyword may appear at most once.
procedure
info : instance-info?
In addition to being needed with prop:instance-info to implement the instance info interface for new kinds of values, get-plain-instance-info can be useful to keep only a minimal representation of the instance info reachable, rather than, say, an entire TEI document value.
procedure
(instance-title info) → string-immutable/c
info : instance-info?
See also title<?.
procedure
(instance-title/symbol info) → symbol?
info : instance-info?
procedure
(instance-citation info) → string-immutable/c
info : instance-info?
procedure
(instance-publication-date info) → date?
info : instance-info?
procedure
(instance-orig-publication-date info) → date?
info : instance-info?
procedure
(instance-publication-original? info) → boolean?
info : instance-info?
(equal? (instance-publication-date info) (instance-orig-publication-date info))
procedure
(instance-language info) → language-symbol/c
info : instance-info?
value
language-symbol/c : flat-contract? = (or/c 'en 'fr 'de)
The contract language-symbol/c recognizes symbols that identify one of the supported languages. The symbols are chosen from the IANA Language Subtag Registry, as specified by BCP 47.
procedure
(instance-book/article info) → (or/c 'book 'article)
info : instance-info?
procedure
(instance-get-resp-string info resp) → string-immutable/c
info : instance-info? resp : symbol?
This is a fairly low-level function: for most purposes, segment-resp-string is preferred.
2.1 Instance Sets
procedure
(instance-set? v) → any/c
v : any/c
An instance set is an immutable set, in the sense of racket/set, of values which support the instance info interface (i.e. values for which instance-info? returns #true). All members of an instance set will be distinct in terms of instance-title/symbol.
procedure
(instance-set [init]) → (instance-set/c)
init : (stream/c instance-info?) = '()
procedure
(instance-set* info ...) → (instance-set/c)
info : instance-info?
syntax
(for/instance-set (for-clause ...) body-or-break ... body)
syntax
(for*/instance-set (for-clause ...) body-or-break ... body)
procedure
(instance-set->plain st) → (instance-set/c)
st : (instance-set/c)
procedure
(instance-set-ref st title/symbol) → instance-info?
st : (instance-set/c) title/symbol : symbol?
procedure
(instance-set-try-ref st title/symbol)
→ (or/c #f instance-info?) st : (instance-set/c) title/symbol : symbol?
procedure
(instance-set/c elem/c) → chaperone-contract?
elem/c : chaperone-contract? (instance-set/c) → flat-contract?
The contract produced by (instance-set/c) accepts all instance sets. Using (instance-set/c) may provide better error reporting than using instance-set? as a contract, and it may be checked more efficiently than (instance-set/c any/c) or (instance-set/c instance-info?), but any of those variants would accept the same values.
procedure
(in-instance-set st) → sequence?
st : (instance-set/c)
2.2 Derived Instance Info
Special support is provided for using class-based objects as instance info values via instance-info-mixin.
procedure
(plain-instance-info? v) → any/c
v : any/c
2.2.1 Class-based Objects
| ||
|
constructor
(new instance-info-mixin [instance-info instance-info] ...superclass-args...) → (is-a?/c instance-info-mixin) instance-info : instance-info? The instance-info initialization argument determines the behavior of an-instance-info when used as an instance info value.Specifically, (get-plain-instance-info an-instance-info) will return the same plain instance info value as (get-plain-instance-info instance-info).
|
method
(send an-instance-info get-title) → string-immutable/c
method
(send an-instance-info get-title/symbol) → symbol?
method
(send an-instance-info get-citation) → string-immutable/c
method
(send an-instance-info get-orig-publication-date) → date?
method
(send an-instance-info get-publication-date) → date?
method
(send an-instance-info get-publication-original?) → boolean?
method
(send an-instance-info get-language) → (or/c 'en 'fr 'de)
method
(send an-instance-info get-book/article)
→ (or/c 'book 'article)
method
(send an-instance-info get-resp-string resp)
→ string-immutable/c resp : symbol?