Version 26 (modified by luciano.ramalho, 10 years ago)

--

ISIS-JSON schema

Representing ISIS records as JSON

Each ISIS record can be trivially represented as a JSON object. From the JSON standard RFC-627:

An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.

Each ISIS numeric field tag is converted to string to become an JSON object key (a name, in an name/value pair).

Because ISIS allows a tag to repeat, and ISIS databases are schemaless, we must assume that all fields are repeatable. But a key name can only appear once in a JSON object. Therefore, we must use JSON arrays to represent the field values. Each ISIS field occurrence becomes an item in the value array.

By convention, leading zeroes are not used when generating keys from tags. The format described here is called ISIS-JSON.

Example

ISIS record:

  6 «978-0-393-04847-6»
 10 «Lewis Carroll^y1832-1898^rauthor»
 10 «John Tenniel^y1820-1914^rillustrator»
 10 «Martin Gardner^y1914-2010^reditor»
 12 «The Annotated Alice^sThe Definitive Edition»

ISIS-JSON:

 { "6" : ["978-0-393-04847-6"],
  "10" : ["Lewis Carroll^y1832-1898^rauthor", 
          "John Tenniel^y1820-1914^rillustrator", 
          "Martin Gardner^y1914-2010^reditor"],
  "12" : ["The Annotated Alice^sThe Definitive Edition"]
 }

Representing multiple records

A complete ISIS database can be represented in JSON as an array of objects. For example, here is a database with three records:

  [
    {"10" : ["Lewis Carroll^y1832-1898^rauthor", 
             "John Tenniel^y1820-1914^rillustrator", 
             "Martin Gardner^y1914-2010^reditor"],
     "12" : ["The Annotated Alice^sThe Definitive Edition"],
     "6"  : ["978-0-393-04847-6"],
    },
    {"10" : ["Machado de Assis^y1839-1908^rauthor"],
     "12" : ["O Alienista"]
    }, 
    {"10" : ["Peter Morville^rauthor", 
             "Louis Rosenfeld^rauthor"],
     "12" : ["Information Architecture for the World Wide Web^sDesigning Large-Scale Web Sites"],
     "6"  : ["978-0596527341"],
    }
  ]

Field ordering

The ordering of ISIS tags in a record is only relevant when there are multiple occurrences of the same field. For example, field 10 is "Author" in analytic-level LILACS records, it can be repeated, and the ordering is important. Although the keys for the fields are unordered, within each field the occurrences are represented as items in an array, therefore, the ordering of the occurrences in repeating fields is preserved.

Expanded ISIS-JSON

An alternative record representation explodes each field occurrence into an object with subfield markers as keys, and "_" denoting the field contents outside of subfields.

Although subfield repetition within a field occurrence is rare, and not supported by the ISIS Formatting Language, it does occur. Therefore, individual subfields must be represented by arrays to prevent data loss.

Expanded ISIS-JSON:

 {"10" : [{"_" : "Lewis Carroll", "r" : ["author"], "y" : ["1832-1898"]}, 
          {"_" : "John Tenniel", "r" : ["illustrator"], "y" : ["1820-1914"]}, 
          {"_" : "Martin Gardner", "r" : ["editor"], "y" : ["1914-2010"]}],
  "12" : [{"_" : "The Annotated Alice", "s" : ["The Definitive Edition"]}],
  "6"  : [{"_" : "978-0-393-04847-6"}]
 }

Subfield ordering

According to the JSON standard quoted above, a JSON object is "an unordered collection of zero or more name/value pairs", therefore in the expanded representation the ordering of subfields within a field occurrence is not preserved. This is not considered a problem because the expanded representation is usually transformed into HTML or XML before display to end users, and the transformation can order the subfields as needed.

Repeating subfields

The ISIS formatting language can only retrieve the first occurrence of a subfield code in a single field occurrence. For example, if the field content is "aaa^xbbb^yccc^xddd" only the "bbb" contents of the first ^x subfield can be independently retrieved for indexing or display.

Nevertheless, there are examples of repeated subfield codes in real ISIS data.

References

For a survey of alternative ISIS-JSON representations, see ISIS-JSON types