Discussion List Archives

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

RE: Anyone want to write a JSON schema for CIF-JSON?

On Wednesday, June 21, 2017 12:16 PM, Marcin Wojdyr wrote:

> I modified my converter to conform to the current CIF-JSON draft and tested the schema a bit. I got one error:
>
> Message:Array item count 0 is less than minimum count of 1.
>
> This was for empty loop:
>
> loop_
> _nop
>
> which I assumed should be converted to empty array:
>
> "_nop": []

Empty loops are not valid in CIF, so every data name in a valid CIF has at least one corresponding value, even if that value is the unknown-value placeholder (?).  The draft schema validates this.

> OTOH empty loops could be just skipped, this is not explicit in the draft.

That is a question of how your particular CIF-to-JSON conversion software handles this invalid form, supposing it accepts the CIF at all.

For what it's worth, when the CIF API's parser is instructed to recover from that particular error, it will accept the invalid empty loop.  Its internal data model can accommodate it, and accepting it serves the purpose of detecting duplicate names.  Data can be added to such loops afterward to make them valid, and in case that's not done, the API has a function specifically for finding and removing data-less loops.  I'd have to check what my own CIF API based CIF-to-JSON converter does in this case, but I suspect that at the moment, it does as yours does.  I consider that a flaw, which I will fix presently.

> Apart from this the schema works for me.

Thanks for checking it out.  I think there's at least one validation it should perform but doesn't, and it is on my agenda to write some automated tests.  I'm not sure when those tests will be realized, however.

> Just note that the draft has URI ending with cif-json.txt and in the schema it's cif-json.json.

Yes, I noted this in my comments accompanying the draft.  The URI in the JSON schema document seems more appropriate to me because we are in fact using a formal JSON-schema schema, and I suppose that detail is still flexible at this point.  We *do* need to reach a resolution on this, however, and to make corrections to schema and/or example as needed.


Cheers,

John

--
John C. Bollinger, Ph.D.
Computing and X-Ray Scientist
Department of Structural Biology
St. Jude Children's Research Hospital
John.Bollinger@StJude.org
(901) 595-3166 [office]
www.stjude.org


________________________________

Email Disclaimer: www.stjude.org/emaildisclaimer
Consultation Disclaimer: www.stjude.org/consultationdisclaimer
_______________________________________________cif-developers mailing listcif-developers@iucr.orghttp://mailman.iucr.org/cgi-bin/mailman/listinfo/cif-developers

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.