Skip to content
Merged
Changes from 10 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
3b9cbc5
Intermediate progress writing property ranges parameter.
JPBergsma Jun 26, 2023
eae1679
Added metadata fields to be able to use property ranges query parameter.
JPBergsma Jun 27, 2023
f00b52d
Small corrections.
JPBergsma Jun 28, 2023
2a0bef8
moved property ranges to single_entryendpoint query param + further r…
JPBergsma Jun 29, 2023
4a00af4
Some small changes after proof reading.
JPBergsma Jun 29, 2023
6905d7f
added that fields should be placed in the range dictionary.
JPBergsma Jun 29, 2023
d579c6e
Some more sentences that had to be moved to a new line.
JPBergsma Jun 30, 2023
6792962
Update optimade.rst
JPBergsma Jun 30, 2023
93ecd0b
removed unintentional changes in appendix.
JPBergsma Jun 30, 2023
a84c72e
Seperated property_ranges query parameter from the partial data.
JPBergsma Jul 4, 2023
dc11574
Merge branch 'develop' into JPBergsma/property_ranges
ml-evs Dec 19, 2023
17beeef
Apply formatting suggestions from code review
ml-evs Jan 18, 2024
cc89029
Merge branch 'develop' into JPBergsma/property_ranges
ml-evs Jan 18, 2024
6d8e24f
Apply suggestions from review
rartino Mar 22, 2024
680317b
Merge branch 'develop' into JPBergsma/property_ranges
rartino Mar 22, 2024
f2a2799
Merge branch 'develop' into JPBergsma/property_ranges
rartino Mar 22, 2024
63e3821
Minor corrections from review
rartino Mar 22, 2024
0efb5e7
Merge branch 'develop' into JPBergsma/property_ranges
rartino Jun 13, 2024
bf7e5b4
Edit property slice definition [WIP]
rartino Jun 13, 2024
d029756
Edit property slice definition [WIP]
rartino Jun 13, 2024
63f122f
Edit property slice definition [WIP]
rartino Jun 13, 2024
f863308
Edit property slice definition [WIP]
rartino Jun 13, 2024
a73029a
Edit property slice definition [WIP]
rartino Jun 13, 2024
c098e47
Improve handing of Python dependencies
rartino Jun 14, 2024
4f704c1
Improve handing of Python dependencies
rartino Jun 14, 2024
266545b
Improve handing of Python dependencies
rartino Jun 14, 2024
e562f49
Revert "Improve handing of Python dependencies"
rartino Jun 14, 2024
315546a
Edit property slice definition [WIP]
rartino Jun 14, 2024
ce9661b
Small sentence fix
giovannipizzi Jun 14, 2024
358157f
Clarifying the part on dimension names.
giovannipizzi Jun 14, 2024
7e29652
Apply suggestions from review
rartino Jun 15, 2024
085030d
Define the term array for OPTMADE data types
rartino Jun 15, 2024
b3a96a0
Fix examples for slicing assuming a trajectory cartesian_site_coordin…
rartino Jun 15, 2024
6231d2a
Adjust confusing phrasing about slicing based on review comment
rartino Jun 15, 2024
9f639d1
Apply suggestions from code review
giovannipizzi Jul 4, 2024
46eafb5
Apply suggestions from code review
giovannipizzi Jul 4, 2024
657a696
Change the format of property_slices to the syntax dim_xxx[start:stop…
rartino Jun 18, 2024
919b83d
Fix in formulation for property_slices format dim_xxx[start:stop:step]
rartino Oct 18, 2024
a623390
Apply suggestions from review
rartino Oct 18, 2024
b164c09
Apply suggestions from code review
rartino Sep 15, 2025
628b4da
Apply changes from review
rartino Sep 15, 2025
010c348
Changes from code review
rartino Sep 15, 2025
3e49e5e
Update from code review
rartino Sep 15, 2025
1520533
Update from code review
rartino Sep 15, 2025
d7d2a81
Update from code review
rartino Sep 15, 2025
3f4f3a3
Changes from code review
rartino Sep 15, 2025
589ab54
Update from code review
rartino Sep 15, 2025
8ddf260
Changes from code review
rartino Sep 15, 2025
f0f120a
Update from code review
rartino Sep 15, 2025
e23a5c8
Merge branch 'develop' into JPBergsma/property_ranges
rartino Sep 15, 2025
aa644fc
Apply suggestions from code review
ndaelman-hu Sep 16, 2025
ea15d1f
Update optimade.rst
gmrigna Sep 17, 2025
21ca65e
Replace "array" with "list" following the discussion at the OPTIMADE …
gmrigna Sep 17, 2025
2f14be9
Update optimade.rst
gmrigna Sep 17, 2025
fd3d2c1
Fixing RST issues and remaining array/list ambiguity
giovannipizzi Sep 17, 2025
116c3ad
Fix spurious old syntax for slices
giovannipizzi Sep 17, 2025
52a8827
Adding explicit discussion of valid lists
giovannipizzi Sep 17, 2025
ed5b790
Several textual clarifications
giovannipizzi Sep 17, 2025
611174d
Update optimade.rst
giovannipizzi Sep 17, 2025
dd03e2d
Update optimade.rst
giovannipizzi Sep 17, 2025
01a8799
Reverting one change after discussion
giovannipizzi Sep 17, 2025
987590d
Renamed property_slices to dimension_slices for better clarity
giovannipizzi Sep 17, 2025
731cf0a
Adding client implementation note on discovering sliceable dimensions
giovannipizzi Sep 17, 2025
ef816e8
Minor fixes
giovannipizzi Sep 17, 2025
4b6bf5d
Update optimade.rst
giovannipizzi Sep 18, 2025
293e68b
Adding comment by @rartino
giovannipizzi Sep 18, 2025
70500e7
Improvement to clarify that all null values must be specified in lists.
giovannipizzi Sep 18, 2025
47d8485
Update optimade.rst
gmrigna Sep 19, 2025
d98ab47
Update optimade.rst
gmrigna Sep 19, 2025
9038665
Update list definition based on review discussions
rartino Sep 19, 2025
e45c523
Merge branch 'develop' into JPBergsma/property_ranges
giovannipizzi Sep 19, 2025
d36092f
Removing leftover lines on fix over GitHub
giovannipizzi Sep 19, 2025
da14ac2
Minor grammar fix
rartino Sep 19, 2025
d2f8644
Apply suggestions from code review
rartino Sep 19, 2025
4578c0e
Add suggestion from review
rartino Sep 19, 2025
18cd2e5
Merge branch 'develop' into JPBergsma/property_ranges
rartino Sep 19, 2025
697b2c1
Remove trailing whitespace
rartino Sep 19, 2025
310ea6e
Fix formulation based on code reivew
rartino Sep 19, 2025
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
122 changes: 121 additions & 1 deletion optimade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ The default partial data format is named "jsonlines" and is described in the App
An implementation SHOULD always include this format as one of the partial data formats provided for a property that has been omitted from the response to the initial query.
Implementations MAY provide links to their own non-standard formats, but non-standard format names MUST be prefixed by a database-provider-specific prefix.

Below follows an example of the :field:`data` and :field:`meta` parts of a response using the JSON response format that communicates that the property value has been omitted from the response, with three different links for different partial data formats provided.
Below follows an example of the :field:`data` and :field:`meta` parts of a response using the JSON response format.
It communicates that the property value has been omitted from the response and includes three different links for different partial data formats provided.

.. code:: jsonc

Expand Down Expand Up @@ -493,6 +494,78 @@ Below follows an example of the :field:`data` and :field:`meta` parts of a respo
// ...
}


Metadata for Property_ranges query parameter
Comment thread
ml-evs marked this conversation as resolved.
Outdated
--------------------------------------------

If the server supports the :query-param:`property_ranges` query parameter, as described in section `Single Entry URL Query Parameters`_, additional metadata SHOULD be present for each field for which the :query-param:`property_ranges` query parameter can be used.
The client needs this metadata to be able to select only a part of the data of a property.
This metadata is stored in a dictionary in the field :field:`range` which is stored as per property metadata as described in section `Metadata properties`_
Comment thread
ml-evs marked this conversation as resolved.
Outdated

- :field:`range`: Dictionary

A dictionary that contains the data necessary for the client to select only a sub_range of a property.
Comment thread
ml-evs marked this conversation as resolved.
Outdated
If the property_ranges query parameter is supported for this property the following keys MUST be present.
Comment thread
ml-evs marked this conversation as resolved.
Outdated
Otherwise this dictionary and these keys are optional.
Comment thread
ml-evs marked this conversation as resolved.
Outdated

- :field:`indexable_dim`: List of Strings.
The list of range_ids of the dimensions for which slicing is supported, i.e. the client can request a subrange in this dimension via the :query-param:`property_ranges` query parameter.
Comment thread
ml-evs marked this conversation as resolved.
Outdated

- :field:`layout`: String.
A string either equal to :val:`"dense"` or :val:`"sparse"` to indicate whether the property is returned in a dense or sparse layout.

- :field:`data_range`: List of Slice Objects.
Comment thread
ml-evs marked this conversation as resolved.
Outdated
This field describes how the values are distributed in the different dimensions.
It consists of a slice object for each dimension of the property.
Comment thread
ml-evs marked this conversation as resolved.
Outdated
The order of the slice objects must be the same as in the :field:`range_ids` field in the property definition.
If the :field:`layout` field is set to :val:`"sparse"` the value of the :field:`step` sub-field has no meaning.

- :field:`nvalues`: Integer.
The total number of values in the property.
SHOULD be a queryable property with support for all mandatory filter features.

Below follows an example of the :field:`data` and :field:`meta` parts of a response using the JSON response format.
It communicates that the property value has been omitted from the response and metadata that makes it possible to request only a part of the data for this property.

.. code:: jsonc

{
// ...
"data": {
"type": "structures",
"id": "2345678",
"attributes": {
"a": null
}
"meta": {
"property_metadata":{
"a":{
"range":{
"range_ids":["frames","particles"],
"indexable_dim": ["frames"],
"data_range": [{
"start": 1,
"step": 1,
"stop": 200,
},{
"start": 1,
"step": 1,
"stop": 3,
}],
"layout":"dense",
"nvalues": 600
}
}
},
"partial_data_links": {
//...
}
}
}
// ...
}

Comment thread
ml-evs marked this conversation as resolved.
Outdated

Metadata properties
-------------------

Expand Down Expand Up @@ -1167,6 +1240,40 @@ The rules for which properties are to be present for an entry in the response ar
Single Entry URL Query Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- **property\_ranges**: A set of slices which specify which sub-range of a property should be returned.
Comment thread
ml-evs marked this conversation as resolved.
Outdated

The property to which this sub-range should be applied can be specified via the :query-param:`response_fields` query parameter.
Each slice consists of the name of a dimension directly followed by the requested slice in this dimension.
The dimension name and the start, stop and step values of the slice are separated by colons (":", ASCII 58(0x3A))
The slice is defined in a similar manner as the `slice object`_.
If no value is placed between the colons for a component of the slice the default value is used.
Comment thread
ml-evs marked this conversation as resolved.
Outdated

The first integer specifies the start of the slice, i.e. the first index in that dimension for which values should be returned.
The default is the index of the first value.
The second integer specifies the end/stop of the slice, i.e. the last index for which values should be returned.
The default is the index of the last value of the property.
And the third integer specifies the step size in that dimension.
Comment thread
ml-evs marked this conversation as resolved.
Outdated
The default is :val:`1`

Multiple dimensional slices can be defined by specifying a range for each dimension.
Comment thread
ml-evs marked this conversation as resolved.
Outdated
These ranges are separated by a comma (",", ASCII 44(0x2C)).
The slices are 0 based, i.e. the first value has index 0, and inclusive i.e. for the range :val:`:10:20:1` the last value returned belongs to index 20.
Comment thread
ml-evs marked this conversation as resolved.
Outdated

In general support is OPTIONAL, property definitions may however deviate from this and place stricter requirements on servers.
Comment thread
ml-evs marked this conversation as resolved.
Outdated
Databases MUST use these ranges for properties where the dimension is listed under indexable_dimensions, if this is not the case the database MAY return more data than was specified in the range.
Comment thread
ml-evs marked this conversation as resolved.
Outdated

If a dimension is not specified, it is assumed that the whole range in that dimension is requested.
If one or more values are not present at one of the requested combination of indexes, the server MAY either decide to return null or if possible adjust the returned range so the indexes for which no value is defined are no longer part of the range.
Comment thread
rartino marked this conversation as resolved.
Outdated
The latter is only allowed when no defined values would be lost.
Comment thread
rartino marked this conversation as resolved.
Outdated
For dense arrays that may mean that the field :field:`returned_range` differs from the requested range.
Comment thread
rartino marked this conversation as resolved.
Outdated
When a value is, however, explicitly set to :val:`null` and :val:`null` has a meaning beyond indicating that no value has been defined :val:`null` MUST be returned
Comment thread
ml-evs marked this conversation as resolved.
Outdated

Example: In this example the Cartesian site positions are requested for particles 30 through 70 for 1 out of every 10 frames of the first 1000 frames of a trajectory.

:query-url:`http://example.com/optimade/v1/structures/id_12345?response_fields=cartesian_site_positions&property_ranges=frames::1000:10,particles:30:70::`
Comment thread
ml-evs marked this conversation as resolved.
Outdated

|
Comment thread
ml-evs marked this conversation as resolved.
Outdated

The client MAY provide a set of additional URL query parameters for this endpoint type.
URL query parameters not recognized MUST be ignored.
While the following URL query parameters are OPTIONAL for clients, API implementations MUST accept and handle them:
Expand Down Expand Up @@ -2110,6 +2217,19 @@ A Property Definition MUST be composed according to the combination of the requi
- :val:`partial`: the defined property MUST be queryable with support for a subset of the filter language operators as specified by the field :field:`query-support-operators`.
- :val:`none`: the defined property does not need to be queryable with any features of the filter language.

- :field:`property_range`: Dictionary.
A dictionary that contains information needed to use the :query-param:`property_range` query parameter
Comment thread
ml-evs marked this conversation as resolved.
Outdated

- :field:`supported`: Boolean.
This field indicates whether the it is possible to use the :query-param:`property_range` query parameter in combination with this field. If true the use of the :query-param:`property_range` is supported
Comment thread
ml-evs marked this conversation as resolved.
Outdated

- :field:`range_ids`: List of Strings.
A list with an identifier for each dimension of the property.
The outermost dimension of a nested array should come first.
Comment thread
rartino marked this conversation as resolved.
Outdated
If, within one entry, dimensions for two or more properties share the same :field:`range_id` those dimensions should be thought of as the same dimension.
Comment thread
rartino marked this conversation as resolved.
Outdated
For example, if both the :property:`energy` and :property:`cartesian_site_positions` of a molecular dynamics trajectory share a range_id of :val:`frames`.
Comment thread
rartino marked this conversation as resolved.
Outdated
This means that the energy at index x(in the dimension labelled by this range_id) belongs to the cartesian_site_positions at the same index x.
Comment thread
ml-evs marked this conversation as resolved.
Outdated
Comment thread
rartino marked this conversation as resolved.
Outdated

- :field:`query-support-operators`: List of Strings.
Defines the filter language features supported on this property.
Each string in the list MUST be one of :val:`<`, :val:`<=`, :val:`>`, :val:`>=`, :val:`=`, :val:`!=`, :val:`CONTAINS`, :val:`STARTS WITH`, :val:`ENDS WITH`:, :val:`HAS`, :val:`HAS ALL`, :val:`HAS ANY`, :val:`HAS ONLY`, :val:`IS KNOWN`, :val:`IS UNKNOWN` with the following meanings:
Expand Down