Discussion List Archives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Draft JSON specification for CIF

On Wed, Apr 12, 2017 at 2:34 AM, James Hester <jamesrhester@gmail.com> wrote:

5. Datavalues are converted as follows:

   1. CIF string values are represented as JSON string values. The
  code-point sequence obtained *after* the text prefix protocol and line ending
  protocols have been applied to the CIF value will be the
  code-point sequence presented in the JSON file
   2. If the CIF datavalue should be interpreted as a number, it is
  that number obtained by parsing the character string found in the
  CIF according to the `<Number>` production in International Tables
  for Crystallography, Volume G, Section paragraph 57. It is
  not an error to instead represent such a datavalue as a JSON string. Note that
  the CIF `<Number>` production is identical to the JSON number format.

After reading the discussions of the past 24 hours, I am going to argue that CIF datavalues should not be interpreted as numbers. Reasons:

- This adds the unnecessary complication of what to do with uncertainties.
- This adds the unnecessary complication of what to do with "." and "?"
- This will result in irreversible conversion, since String->Value highly depends upon choice of double or float, and the invariable nuances of rounding that that parsing involves, and String->Value->String is never lossless.
- Not converting to "numbers" is an illusion. JSON is a string-based method of communication. All you have done is convert a string representing a number to another string representing a number. True, it means the browser (or whatever) can internally  convert the incoming (CIF)string-to-(program)number-to-(JSON)string to a number, who cares? If I am an implementer, I will know what is a number and what is not, and then I can decide for myself (as I do now for CIF files) what I want to do with "." and "?". And if I am a CIF-to-JSON converter, I will simply never do the (CIF)string-to-(program)number business in the first place, and instead simply faithfully convert (CIF)string to (JSON)string, because in that case it is no my job to interpret CIF data as anything. My job as a CIF-to-JSON converter algorithm is simply to do the conversion without regard to author intent.


cif-developers mailing list

Reply to: [list | sender only]
International Union of Crystallography

Scientific Union Member of the International Science Council (admitted 1947). Member of CODATA, the ISC Committee on Data. Partner with UNESCO, the United Nations Educational, Scientific and Cultural Organization in the International Year of Crystallography 2014.

International Science Council Scientific Freedom Policy

The IUCr observes the basic policy of non-discrimination and affirms the right and freedom of scientists to associate in international scientific activity without regard to such factors as ethnic origin, religion, citizenship, language, political stance, gender, sex or age, in accordance with the Statutes of the International Council for Science.