Hi Bruce,
The Relax NG schema defines an XML format as serialization of
the data model (by the way the same format could and should also
be defined by an XML Schema document).Yes, except that a) I HATE XSD, and b) CSL is authored in RNG, and so
it’s easy to pull in patterns to avoid duplication.
As far as I can read
http://bitbucket.org/bdarcus/csl-schema/src/tip/csl-data.rnc
http://bitbucket.org/bdarcus/csl-schema/src/tip/csl-types.rnc
http://bitbucket.org/bdarcus/csl-schema/src/tip/csl-variables.rnc
the same structure can also be expressed in XSD so it should be possible
to automatically derive an XSD file from it, for instance
with James Clark’s Trang
http://www.thaiopensource.com/relaxng/trang.html
Having an official XSD for CSL record input format is not Top #1 but
surely necessary for widespread adoption because some people love XSD
(or do not know better ;-). The RNG should be the master of course.
The JSON input format is not explicitely defined by a Schema
because there is no widely adopted schema language for JSON.
I tried some of the JSON schema languages which were mentioned
in this thread but they all seem impractical - either too complex
or you cannot express everything needed and moreover a schema
without validator is of little use. I think it is more practical
to directly implement validators in several programming languages.OK, so you’re suggesting to define the JSON schema in code?
Following the KISS-principle yes: CSL input format is easy enough.
Normally JSON is mapped to a native data structure build of
objects/maps/hashes, arrays/lists/vectors, and strings. Instead of
requiring each application to load an additional library that validates
the JSON, you can write a simple validator in pseudo-code or provide
equivalent snippets of JavaScript PHP, Perl etc. I bet it’s less then 20
lines of readable code (without the predefined tables of allowed
variables and item types).
By the way I would name the JSON format CSL/JSON and the XML
format CSL/XML. Other CSL input formats that could be useful
are CSL/RDF for CSL as Linked Data and CSL/Microformat to embed
CSL data in HTML.Makes sense, except I’m not interested in doing CSL/RDF; that’s what
BIBO is for.
Yes, a mapping from BIBO to CSL/JSON or CSL/XML is more useful to start
with.
Jakob–
Jakob Voß <@Jakob_Voss>, skype: nichtich
Verbundzentrale des GBV (VZG) / Common Library Network
Platz der Goettinger Sieben 1, 37073 Göttingen, Germany
+49 (0)551 39-10242, http://www.gbv.de