VIII · 49

How to Read a ContextObject String

Catalogues, reference sites and citation tools often show strings like “Context object: ctx_ver=Z39.88-2004&rft_val_fmt=…”. They are machine-readable citations. Here is how to read one.

A string that starts with ctx_ver=Z39.88-2004 (or contains rft_val_fmt=, rft.btitle=, rft.atitle=) is an OpenURL ContextObject in KEV form: a citation written as URL parameters. Library systems show it in "staff view" or export screens, put it in COinS spans for Zotero, and send it to link resolvers. The quickest way to read one is to paste it into the OpenURL parser, which accepts the bare string, a full URL, or text that starts with "Context object:".

Step by step

  1. Split on &. Each piece is one key=value pair.
  2. URL-decode each value. + and %20 are spaces; %3A is :, %2F is /, %2C is a comma, %26 is &; multi-byte sequences such as %C3%A9 are UTF-8 characters (é).
  3. Read the format. rft_val_fmt tells you which vocabulary the rft. keys use: …mtx:book, …mtx:journal, …mtx:dissertation, …mtx:patent, or …mtx:dc (Dublin Core).
  4. Read the item. Keys starting rft. describe the cited item: titles, authors, dates, numbers.
  5. Note the source. rfr_id=info:sid/… names the system that produced the string.

Worked example

A typical string from a library catalogue:

ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3AUTF-8&rfr_id=info%3Asid%2Fexample.org%3Acatalogue&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Les+jardins+%3A+de+la+Gr%C3%A8ce+antique+%C3%A0+l%27%C3%A9poque+moderne&rft.date=2016&rft.language=fran%C3%A7ais

Decoded:

KeyDecoded valueMeaning
ctx_verZ39.88-2004OpenURL 1.0 ContextObject
ctx_encinfo:ofi/enc:UTF-8Values are UTF-8
rfr_idinfo:sid/example.org:catalogueProduced by a catalogue at example.org
rft_val_fmtinfo:ofi/fmt:kev:mtx:bookThe item is described with the Book format
rft.genrebookA whole book
rft.btitleLes jardins : de la Grèce antique à l'époque moderneBook title
rft.date2016Publication year
rft.languagefrançaisNot a key of the Book format: a local extra that resolvers may ignore

Things you will meet in real strings

Empty values (rft.au=, rft.isbn=)
The source had no data for that field. Harmless, but they add length.
Keys that are not in the format (rft.language, rft.externalDocID, rft.source)
Vendor or local additions. A resolver may ignore them.
Dublin Core strings (rft_val_fmt=info:ofi/fmt:kev:mtx:dc)
Keys such as rft.title, rft.creator, rft.type and rft.date come from the Dublin Core format, used by VuFind and Blacklight for records that do not fit the book or journal formats. See Dublin Core (KEV).
Doubled encoding (%253A)
The value was encoded twice, either deliberately (By-Value transport) or by mistake. Decode twice.
0.1-style keys without prefixes (genre=, title=, sid=)
Older OpenURL 0.1 syntax, sometimes mixed with 1.0 keys. See OpenURL 0.1 vs 1.0.

Turning it into something useful

  • A citation: take rft.au/rft.aulast, rft.date, rft.btitle or rft.atitle + rft.jtitle, rft.pub, volume and pages.
  • A link to full text: put your library's resolver base URL and a ? in front of the string. See How to find your library's OpenURL resolver.
  • A check: paste it into the validator to spot missing or malformed fields.

Sources