Skip to content
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

Common rules for inclusion and querying #210

Merged
merged 32 commits into from
Dec 20, 2019
Merged
Changes from 12 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
aef2e4d
Describing which properties are returned by default in entry list req…
merkys Nov 25, 2019
39b78d6
Adding a callback to 'Single Entry Endpoints'.
merkys Nov 25, 2019
65de03c
Dropping '**Response**: OPTIONAL in the response' as paragraph in 'En…
merkys Nov 25, 2019
746a4d8
Shortening '**Response**: REQUIRED in the response unless explicitly …
merkys Nov 25, 2019
2a393f0
Requiring 'lattice_vectors' in the response as per @rartino's comment…
merkys Nov 25, 2019
724f6f7
Making coordinate-related properties OPTIONAL (includes #203).
merkys Nov 25, 2019
2b61396
Describing the general treatment of properties that are not marked as…
merkys Nov 25, 2019
ade5532
Removing notices about optional usage of properties in filters as thi…
merkys Nov 25, 2019
39d3b85
Property 'nsites' is no longer required to support querying (includes…
merkys Nov 25, 2019
f29f48b
Adjusting the definition of Queryable property.
merkys Nov 28, 2019
c69d5f0
Fixing vocabulary: 'entry description' -> 'response'.
merkys Dec 2, 2019
947a0b6
Splitting one sentence per line.
merkys Dec 2, 2019
502bd44
Adding a sentence on support of subset of filter operators for option…
merkys Dec 4, 2019
892f60a
Simplifying requirements for the presence in the response for a coupl…
merkys Dec 4, 2019
8a6a4b2
Simplifying requirements for the filter operators for a couple of pro…
merkys Dec 4, 2019
55f542e
Converting 'response_fields' to a list of additional optional fields.
merkys Dec 4, 2019
dc9befc
Adjusting the description of 'response_fields' according to @rartino'…
merkys Dec 4, 2019
43295c4
Merge branch 'develop' into common-rules-for-inclusion-and-querying
merkys Dec 4, 2019
e39ed9f
Adjusting the description of 'response_fields' to mean additional opt…
merkys Dec 4, 2019
172f33e
Rewording (thanks @CasperWA)
merkys Dec 5, 2019
b247be2
Marking up 'response_fields'
merkys Dec 5, 2019
256ac70
Adding missing 'with' (thanks @CasperWA)
merkys Dec 5, 2019
c8e9a92
Using real-world example (thanks @CasperWA)
merkys Dec 5, 2019
8f02b7f
Merge branch 'develop' into common-rules-for-inclusion-and-querying
merkys Dec 6, 2019
d6a4aff
Merge branch 'common-rules-for-inclusion-and-querying' of github.com:…
merkys Dec 6, 2019
1d768c5
Update to REQUIRED vs. default vs. OPTIONAL properties in the response
rartino Dec 17, 2019
5033820
Minor text fixes suggested in review
rartino Dec 18, 2019
543b0fc
Merge upstream develop
rartino Dec 18, 2019
1d6a210
Further text fixes based on review
rartino Dec 19, 2019
ad01ba2
Fix minor edit mistakes.
rartino Dec 19, 2019
3f1c5e0
Improve inconsistency between usage of terms 'filter features' and 'f…
rartino Dec 20, 2019
fe86cd4
Further minor text fixes suggested in review.
rartino Dec 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 20 additions & 33 deletions optimade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SH
**Queryable property**
An entry property that can be referred to in the filtering of results.
See section `API Filtering Format Specification`_ for more information on formulating filters on properties.
The definitions of specific properties in section `Entry List`_ states which ones MUST be queryable and which are RECOMMENDED.
The definitions of specific properties in section `Entry List`_ states which ones MUST be queryable, the rest being OPTIONAL.

**ID**
The ID entry property is a unique string referencing a specific entry in the database.
Expand Down Expand Up @@ -589,6 +589,9 @@ There MAY be multiple entry listing endpoints, depending on how many types of en
Specific standard entry types are specified in section `Entry list`_.
The API implementation MAY provide other entry types than the ones standardized in this specification, but such entry types MUST be prefixed by a database-provider-specific prefix.

By default, only those properties that are marked as REQUIRED in section `Entry list`_ MUST be present in the response.
Query parameter *response_fields* MAY be used to explicitly include or exclude properties.
merkys marked this conversation as resolved.
Show resolved Hide resolved

Entry Listing URL Query Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -731,6 +734,8 @@ Examples:
- :query-url:`http://example.com/optimade/v0.9/structures/exmpl%3Astruct_3232823`
- :query-url:`http://example.com/optimade/v0.9/calculations/232132`

The requirements for property inclusion are the same as defined in section `Entry Listing Endpoints`_.

Single Entry URL Query Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -1076,6 +1081,9 @@ An OPTiMaDe filter expression is passed in the parameter :query-param:`filter` a
API <https://jsonapi.org/format/1.0/#fetching-filtering>`__.
The filter expression allows desired properties to be compared against search values; several such comparisons can be combined using the logical conjunctions AND, OR, NOT, and parentheses, with their usual semantics.

Only those properties marked as REQUIRED in section `Entry list`_ MUST be queryable.
Query support for other properties is OPTIONAL.

When provided as an URL query parameter, the contents of the :query-param:`filter` parameter is URL-encoded by the client in the HTTP GET request, and then URL-decoded by the API implementation before any further parsing takes place.
In particular, this means the client MUST escape special characters in string values as described below for `String values`_ before the URL encoding, and the API implementation MUST first URL-decode the :query-param:`filter` parameter before reversing the escaping of string tokens.

Expand Down Expand Up @@ -1382,7 +1390,7 @@ id
- **Type**: string.
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Response**: REQUIRED in the response.
- **Query**: MUST be a queryable property with support for all mandatory filter operators.
- See section `Definition of Terms`_.

Expand All @@ -1401,7 +1409,7 @@ type
- **Type**: string.
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Response**: REQUIRED in the response.
- **Query**: Support for queries on this property is OPTIONAL.
If supported, only a subset of string comparison operators MAY be supported.

Expand All @@ -1415,7 +1423,6 @@ immutable\_id
- **Type**: string.
- **Requirements/Conventions**:

- **Response**: OPTIONAL in the response.
- **Query**: If present, MUST be a queryable property with support for all mandatory filter operators.

- **Examples**:
Expand All @@ -1430,7 +1437,7 @@ last\_modified
- **Type**: timestamp.
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Response**: REQUIRED in the response.
- **Query**: MUST be a queryable property with support for all mandatory filter operators.

- **Example**:
Expand All @@ -1444,9 +1451,6 @@ database-provider-specific properties
- **Type**: Decided by the API implementation.
- **Requirements/Conventions**:

- **Response**: OPTIONAL in the response.
- **Query**: Support for queries on these properties are OPTIONAL.
If supported, only a subset of filter operators MAY be supported.
- These MUST be prefixed by a database-provider-specific prefix as defined in appendix `Database-Provider-Specific Namespace Prefixes`_.

- **Examples**: A few examples of valid database-provided-specific property names follows:
Expand All @@ -1469,7 +1473,7 @@ elements
- **Type**: list of strings.
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Response**: REQUIRED in the response.
- **Query**: MUST be a queryable property with support for all mandatory filter operators.
- The strings are the chemical symbols, written as uppercase letter plus optional lowercase letters.
- The order MUST be alphabetical.
Expand All @@ -1490,7 +1494,7 @@ nelements
- **Type**: integer
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Response**: REQUIRED in the response.
- **Query**: MUST be a queryable property with support for all mandatory filter operators.

- **Example**: :val:`3`
Expand All @@ -1507,7 +1511,7 @@ elements\_ratios
- **Type**: list of floats
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Response**: REQUIRED in the response.
- **Query**: MUST be a queryable property with support for all mandatory filter operators.
- Composed by the proportions of elements in the structure as a list of floating point numbers.
- The sum of the numbers MUST be 1.0 (within floating point accuracy)
Expand All @@ -1529,7 +1533,7 @@ chemical\_formula\_descriptive
- **Type**: string
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Response**: REQUIRED in the response.
- **Query**: MUST be a queryable property with support for all mandatory filter operators.
- The chemical formula is given as a string consisting of properly capitalized element symbols followed by integers or decimal numbers, balanced parentheses, square, and curly brackets ``(``,\ ``)``, ``[``,\ ``]``, ``{``, ``}``, commas, the ``+``, ``-``, ``:`` and ``=`` symbols.
The parentheses are allowed to be followed by a number.
Expand Down Expand Up @@ -1560,8 +1564,7 @@ chemical\_formula\_reduced
- **Type**: string
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.

- **Response**: REQUIRED in the response.
- **Query**: MUST be a queryable property.
However, support for filters using partial string matching with this property is OPTIONAL (i.e., BEGINS WITH, ENDS WITH, and CONTAINS).
Intricate querying on formula components are instead recommended to be formulated using set-type filter operators on the multi valued :property:`elements` and :property:`elements_proportions` properties.
Expand Down Expand Up @@ -1589,8 +1592,6 @@ chemical\_formula\_hill
- **Type**: string
- **Requirements/Conventions**:

- **Response**: OPTIONAL in the response.
- **Query**: Support for queries on these properties are OPTIONAL. If supported, only a subset of filter operators MAY be supported.
merkys marked this conversation as resolved.
Show resolved Hide resolved
merkys marked this conversation as resolved.
Show resolved Hide resolved
- The overall scale factor of the chemical proportions is chosen such that the resulting values are integers that indicate the most chemically relevant unit of which the system is composed.
For example, if the structure is a repeating unit cell with four hydrogens and four oxygens that represents two hydroperoxide molecules, :property:`chemical_formula_hill` is :val:`"H2O2"` (i.e., not :val:`"HO"`, nor :val:`"H4O4"`).
- If the chemical insight needed to ascribe a Hill formula to the system is not present, the property MUST be handled as unset.
Expand All @@ -1616,7 +1617,7 @@ chemical\_formula\_anonymous
- **Type**: string
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Response**: REQUIRED in the response.
- **Query**: MUST be a queryable property. However, support for filters using partial string matching with this property is OPTIONAL (i.e., BEGINS WITH, ENDS WITH, and CONTAINS).

- **Examples**:
Expand All @@ -1637,7 +1638,7 @@ dimension\_types
- **Type**: list of integers.
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Response**: REQUIRED in the response.
- **Query**: MUST be a queryable property. Support for equality comparison is REQUIRED, support for other comparison operators are OPTIONAL.
- MUST be a list of length 3.
- Each integer element MUST assume only the value 0 or 1.
Expand All @@ -1656,8 +1657,7 @@ lattice\_vectors
- **Type**: list of list of floats.
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded, except when property `dimension_types`_ is equal to :val:`[0, 0, 0]` (in this case it is OPTIONAL).
- **Query**: Support for queries on this property is OPTIONAL. If supported, filters MAY support only a subset of comparison operators.
- **Response**: REQUIRED in the response.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume it is intentional to leave out the conditional here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The intent was to simplify the rules for inclusion/exclusion of properties. Also I had PR #206 in mind while developing the current PR.

- MUST be a list of three vectors *a*, *b*, and *c*, where each of the vectors MUST BE a list of the vector's coordinates along the x, y, and z Cartesian coordinates.
(Therefore, the first index runs over the three lattice vectors and the second index runs over the x, y, z Cartesian coordinates).
- For databases that do not define an absolute Cartesian system (e.g., only defining the length and angles between vectors), the first lattice vector SHOULD be set along *x* and the second on the *xy*-plane.
Expand All @@ -1674,8 +1674,6 @@ cartesian\_site\_positions
- **Type**: list of list of floats and/or unknown values
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Query**: Support for queries on this property is OPTIONAL. If supported, filters MAY support only a subset of comparison operators.
- It MUST be a list of length N times 3, where N is the number of sites in the structure.
- An entry MAY have multiple sites at the same Cartesian position (for a relevant use of this, see e.g., the property `assemblies`_).
- If a component of the position is unknown, the :val:`null` value should be provided instead (see section `Properties with unknown value`_).
Expand All @@ -1693,11 +1691,6 @@ nsites

- **Description**: An integer specifying the length of the :property:`cartesian_site_positions` property.
- **Type**: integer
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Query**: MUST be a queryable property with support for all mandatory filter operators.

- **Examples**:

- :val:`42`
Expand All @@ -1715,8 +1708,6 @@ species\_at\_sites
- **Type**: list of strings.
- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Query**: Support for queries on this property is OPTIONAL. If supported, filters MAY support only a subset of comparison operators.
- MUST have length equal to the number of sites in the structure (first dimension of the list property `cartesian_site_positions`_).
- Each species name mentioned in the :property:`species_at_sites` list MUST be described in the list property `species`_ (i.e. for each value in the :property:`species_at_sites` list there MUST exist exactly one dictionary in the :property:`species` list with the :property:`name` attribute equal to the corresponding :property:`species_at_sites` value).
- Each site MUST be associated only to a single species.
Expand All @@ -1742,8 +1733,6 @@ species

- **Requirements/Conventions**:

- **Response**: REQUIRED in the response unless explicitly excluded.
- **Query**: Support for queries on this property is OPTIONAL. If supported, filters MAY support only a subset of comparison operators.
- Each list member MUST be a dictionary with the following keys:

- **name**: REQUIRED; gives the name of the species; the **name** value MUST be unique in the :property:`species` list;
Expand Down Expand Up @@ -1977,7 +1966,6 @@ Database-provider-specific entry types MUST have all properties described above

- **Requirements/Conventions for properties in database-provider-specific entry types**:

- **Response**: OPTIONAL in the response.
- **Query**: Support for queries on these properties are OPTIONAL.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've deleted this for some that are OPTIONAL in the response, but not all. How do you justify this? Or rather, what is the implication?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I was a little hesitant to cleanup the requirements, but I think with the addition of general clarification in 502bd44 the rest of the optional clauses can be removed. Did so in 8a6a4b2 and 892f60a.

If supported, only a subset of filter operators MAY be supported.

Expand Down Expand Up @@ -2062,7 +2050,6 @@ Relationships with calculations MAY be used to indicate provenance where a struc

- **Requirements/Conventions for database-provider-specific properties of calculations entries**:

- **Response**: OPTIONAL in the response.
- **Query**: Support for queries on these properties are OPTIONAL.
If supported, only a subset of filter operators MAY be supported.

Expand Down