-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Further updates to property definitions #460
[WIP] Further updates to property definitions #460
Conversation
For some reason I cannot request a review from @fekad via the Reviewers system, so I ping him here instead. Since you gave much good feedback on the initial property definitions, and I suspect you may have thoughts on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To limit slosh/churn I will wait until Antanas' review has been addressed before taking a look, please re-request my review after that
Co-authored-by: Antanas Vaitkus <[email protected]>
Co-authored-by: Johan Bergsma <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the changes.
So, another thing came up as I was working on the property definitions yesterday. It turns out that, since I don't want to duplicate my unit definitions in the source files, I more or less automatically get definition files also for units. Hence, it is going to be trivial to do the same thing for physical units as we are about to do for properties, i.e., give them URIs that are URLs under I've set things up for this in #445. For example, YAML source files for the angstrom and meter:
This actually seems very useful in itself, in that it provides a way in any context to reference our precise unit definitions via these URIs. However, this motivates a few additions I'd like to do the Unit definitions format:
Any thoughts? Given that this PR isn't yet merged, can I add these changes also to this PR, or should they go in their own? Edit: Also one more thing: we have inherited from JSON Schema that the text in our descriptions uses commonmark. However, it is super inconvenient not to be able to write math expressions in our context. I suppose one could embed HTML MathML. But, for our use, should we not refer to an extension (or define ourselves) that allow embedding of LaTeX expressions inside $ signs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments @rartino. Might make sense to also accept further contributions to this PR if that is easier for you. Will try to respond your most recent comment outside of this particular review.
I like the sound of this!
I think MathML makes som sense as the only real native web standard I know of (especially now that Chrome has support for it again since January 2023), however I think we are all most familiar with LaTeX. GitHub right now will render e.g., with MathJax, but seemingly not MathML: x = − b ± b2 − 4ac 2 a x = \frac{-b\pm\sqrt{b^2-4ac}}{2a} x = {-b plusminus sqrt {b^2 - 4 ac}} over {2 a}Given that Mathjax supports MathML input, perhaps this is the standard we could assume (which would also enable asciimath etc)? |
Co-authored-by: Matthew Evans <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll approve this for now @rartino, just let me know if you want another review if you do add the unit stuff here.
I think this is a great way to go. How is it best expressed? Something like:
I rather not allow people to use MathML as it really isn't very human readable in raw form. |
Sounds good to me! I think that makes it a lot easier for us to host a really nice rendered version of the definitions and schemas somewhere outside of GitHub |
In that case KaTex could also be a nice Latex renderer. |
Co-authored-by: Matthew Evans <[email protected]>
…nd Physical Unit Definitions
…units to be defined one level higher, but rename unit-defintions to units so the fields can be named the same thing.
…units to be defined one level higher, but rename unit-defintions to units so the fields can be named the same thing.
Co-authored-by: Johan Bergsma <[email protected]> Co-authored-by: Antanas Vaitkus <[email protected]>
- :field:`x-optimade-unit-definitions`: List. | ||
A list of definitions of the symbols used in the Property Definition (including its nested levels) for physical units given as values of the :field:`x-optimade-unit` field. | ||
This field **MUST be included at the outermost level of a property definition** if the defined property, at any level, includes an :field:`x-optimade-unit` with a value that is not :val:`dimensionless` or :val:`inapplicable`, and it MUST include definitions of all units used on all levels in the property definition. | ||
The field MAY also occur at deeper nesting levels (but this is not required). | ||
If it does, the unit definitions provided MUST be redundant with those provided at higher nesting levels. | ||
See subsection `Physical Units in Property Definitions`_ for the details on how units are represented in OPTIMADE Property Definitions and the precise format of this dictionary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should make x-optimade-unit-definitions always REQUIRED in the outermost level (so, possibly an empty list). The specification just gets bulky from the OPTIONAL - oh but often REQUIRED - categorization. However, setting this to REQUIRED requires updating the property definitions in #445.
For now, I'd suggest we merge the property definitions without 'pattern' and thus the symops would have to be validated outside of what can be done with the schemas. If anyone feels strongly enough about this omission, I think we have all pieces in place to finish #160, and then bring over the regex subset into this PR. |
Co-authored-by: Matthew Evans <[email protected]>
This PR is now merged into #445 |
In the work on #445 a few more things have come up in need of adjustments in the specification.
This PR adopts
$comment
from JSON Schema to address #459. Even if I, in the work on definitions, ended up not needing it, I foresee possible future uses and it is a trivial extension.This PR bundles a potentially controversial change of something that has irked me more and more when working on the definitions. The
type
field we inherit from JSON Schema is AFAIK the only place in the OPTIMADE standard where a dictionary field may have multiple data types, either String or List. Hence, I'm going to propose that we force Property Definitions to always use the list format. Most of our properties anyway allow"null"
and are thus not affected. For the few that don't, it may seem silly to force ["string"] over "string"; but having started the work on converting these definitions between various formats in #445, I really think the simplification of the representation format is worth it.Further changes in this PR are:
The addition of
x-optimade-requirements/response-default-level
to specify to what degree a property should or should not be included in a response per default. We have this information embedded in some of our current property definitions on this format: "Response: REQUIRED in the response."A corresponding addition in
x-optimade-implementation/response-default
for implementations to indicate what a specific implementation does for each field. (I had to name it differently, since the latter should be a boolean and the former a string.)When I was adding these, I realized we need to clarify what is, and what is not, "the same" in terms of Property Definitions, so this is also done. Feel free to complain (and/or suggest fixes) if these formulations are not clear. They are, however, IMO absolutely important.
I should say I was initially a bit hesitant if the "default response" info really belong in the Property Definitions. However, after some thinking, I really believe they do. When groupings of people uses this format to "develop standards" e.g. for biomol, experimental, magnetism, etc., databases they will want to be able to say what a database is expected to return by "default", just as we wanted for the basic properties we have standardized so far.