OPTIMADE Data Models¶
This page provides documentation for the optimade.models
submodule, where all the OPTIMADE (and JSON:API)-defined data models are located.
For example, the three OPTIMADE entry types, structures
, references
and links
, are defined primarily through the corresponding attribute models:
As well as validating data types when creating instances of these models, this package defines several OPTIMADE-specific validators that ensure consistency between fields (e.g., the value of nsites
matches the number of positions provided in cartesian_site_positions
).
ATOMIC_NUMBERS = {}
module-attribute
¶
CHEMICAL_SYMBOLS = ['H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 'I', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', 'Ra', 'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', 'No', 'Lr', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Nh', 'Fl', 'Mc', 'Lv', 'Ts', 'Og']
module-attribute
¶
EXTRA_SYMBOLS = ['X', 'vacancy']
module-attribute
¶
Vector3D = Annotated[list[Annotated[float, BeforeValidator(float)]], Field(min_length=3, max_length=3)]
module-attribute
¶
Assembly
¶
Bases: BaseModel
A description of groups of sites that are statistically correlated.
- Examples (for each entry of the assemblies list):
{"sites_in_groups": [[0], [1]], "group_probabilities: [0.3, 0.7]}
: the first site and the second site never occur at the same time in the unit cell. Statistically, 30 % of the times the first site is present, while 70 % of the times the second site is present.{"sites_in_groups": [[1,2], [3]], "group_probabilities: [0.3, 0.7]}
: the second and third site are either present together or not present; they form the first group of atoms for this assembly. The second group is formed by the fourth site. Sites of the first group (the second and the third) are never present at the same time as the fourth site. 30 % of times sites 1 and 2 are present (and site 3 is absent); 70 % of times site 3 is present (and sites 1 and 2 are absent).
Source code in optimade/models/structures.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
|
group_probabilities
instance-attribute
¶
sites_in_groups
instance-attribute
¶
check_self_consistency()
¶
Source code in optimade/models/structures.py
265 266 267 268 269 270 271 272 273 |
|
validate_sites_in_groups(value)
classmethod
¶
Source code in optimade/models/structures.py
253 254 255 256 257 258 259 260 261 262 263 |
|
Attributes
¶
Bases: BaseModel
Members of the attributes object ("attributes") represent information about the resource object in which it's defined. The keys for Attributes MUST NOT be: relationships links id type
Source code in optimade/models/jsonapi.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
|
model_config = ConfigDict(extra='allow')
class-attribute
instance-attribute
¶
check_illegal_attributes_fields()
¶
Source code in optimade/models/jsonapi.py
330 331 332 333 334 335 336 337 338 |
|
AvailableApiVersion
¶
Bases: BaseModel
A JSON object containing information about an available API version
Source code in optimade/models/baseinfo.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
url
instance-attribute
¶
version
instance-attribute
¶
crosscheck_url_and_version()
¶
Check that URL version and API version are compatible.
Source code in optimade/models/baseinfo.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
url_must_be_versioned_base_Url(value)
classmethod
¶
The URL must be a versioned base URL
Source code in optimade/models/baseinfo.py
38 39 40 41 42 43 44 45 46 47 |
|
BaseInfoAttributes
¶
Bases: BaseModel
Attributes for Base URL Info endpoint
Source code in optimade/models/baseinfo.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
api_version
instance-attribute
¶
available_api_versions
instance-attribute
¶
available_endpoints
instance-attribute
¶
entry_types_by_format
instance-attribute
¶
formats = ['json']
class-attribute
instance-attribute
¶
is_index = False
class-attribute
instance-attribute
¶
formats_and_endpoints_must_be_valid()
¶
Source code in optimade/models/baseinfo.py
112 113 114 115 116 117 118 119 120 121 122 |
|
BaseInfoResource
¶
Bases: Resource
Source code in optimade/models/baseinfo.py
125 126 127 128 |
|
attributes
instance-attribute
¶
id = '/'
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta = None
class-attribute
instance-attribute
¶
model_config = ConfigDict(json_schema_extra=resource_json_schema_extra)
class-attribute
instance-attribute
¶
relationships = None
class-attribute
instance-attribute
¶
type = 'info'
class-attribute
instance-attribute
¶
BaseRelationshipMeta
¶
Bases: Meta
Specific meta field for base relationship resource
Source code in optimade/models/optimade_json.py
405 406 407 408 409 410 411 412 413 |
|
BaseRelationshipResource
¶
Bases: BaseResource
Minimum requirements to represent a relationship resource
Source code in optimade/models/optimade_json.py
416 417 418 419 420 421 422 423 424 |
|
BaseResource
¶
Bases: BaseModel
Minimum requirements to represent a Resource
Source code in optimade/models/jsonapi.py
218 219 220 221 222 223 224 |
|
DataType
¶
Bases: Enum
Optimade Data types
See the section "Data types" in the OPTIMADE API specification for more information.
Source code in optimade/models/optimade_json.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
BOOLEAN = 'boolean'
class-attribute
instance-attribute
¶
DICTIONARY = 'dictionary'
class-attribute
instance-attribute
¶
FLOAT = 'float'
class-attribute
instance-attribute
¶
INTEGER = 'integer'
class-attribute
instance-attribute
¶
LIST = 'list'
class-attribute
instance-attribute
¶
STRING = 'string'
class-attribute
instance-attribute
¶
TIMESTAMP = 'timestamp'
class-attribute
instance-attribute
¶
UNKNOWN = 'unknown'
class-attribute
instance-attribute
¶
from_json_type(json_type)
classmethod
¶
Get OPTIMADE data type from a named JSON type
Source code in optimade/models/optimade_json.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
from_python_type(python_type)
classmethod
¶
Get OPTIMADE data type from a Python type
Source code in optimade/models/optimade_json.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
get_values()
classmethod
¶
Get OPTIMADE data types (enum values) as a (sorted) list
Source code in optimade/models/optimade_json.py
47 48 49 50 |
|
EntryInfoProperty
¶
Bases: BaseModel
Source code in optimade/models/entries.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
EntryInfoResource
¶
Bases: BaseModel
Source code in optimade/models/entries.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
EntryInfoResponse
¶
Bases: Success
Source code in optimade/models/responses.py
58 59 60 61 62 |
|
data
instance-attribute
¶
errors = None
class-attribute
instance-attribute
¶
included = None
class-attribute
instance-attribute
¶
jsonapi = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta
instance-attribute
¶
model_config = ConfigDict(json_encoders={datetime: lambda v: v.astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')})
class-attribute
instance-attribute
¶
The specification mandates that datetimes must be encoded following RFC3339, which does not support fractional seconds, thus they must be stripped in the response. This can cause issues when the underlying database contains fields that do include microseconds, as filters may return unexpected results.
either_data_meta_or_errors_must_be_set()
¶
Overwriting the existing validation function, since 'errors' MUST NOT be set.
Source code in optimade/models/optimade_json.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
|
EntryRelationships
¶
Bases: Relationships
This model wraps the JSON API Relationships to include type-specific top level keys.
Source code in optimade/models/entries.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
references = None
class-attribute
instance-attribute
¶
structures = None
class-attribute
instance-attribute
¶
check_illegal_relationships_fields()
¶
Source code in optimade/models/jsonapi.py
296 297 298 299 300 301 302 303 304 |
|
EntryResource
¶
Bases: Resource
The base model for an entry resource.
Source code in optimade/models/entries.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
attributes
instance-attribute
¶
id
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta = None
class-attribute
instance-attribute
¶
model_config = ConfigDict(json_schema_extra=resource_json_schema_extra)
class-attribute
instance-attribute
¶
relationships = None
class-attribute
instance-attribute
¶
type
instance-attribute
¶
EntryResourceAttributes
¶
Bases: Attributes
Contains key-value pairs representing the entry's properties.
Source code in optimade/models/entries.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
immutable_id = None
class-attribute
instance-attribute
¶
last_modified
instance-attribute
¶
model_config = ConfigDict(extra='allow')
class-attribute
instance-attribute
¶
cast_immutable_id_to_str(value)
classmethod
¶
Convenience validator for casting immutable_id
to a string.
Source code in optimade/models/entries.py
110 111 112 113 114 115 116 117 |
|
check_illegal_attributes_fields()
¶
Source code in optimade/models/jsonapi.py
330 331 332 333 334 335 336 337 338 |
|
EntryResponseMany
¶
Bases: Success
Source code in optimade/models/responses.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
data
instance-attribute
¶
errors = None
class-attribute
instance-attribute
¶
included = None
class-attribute
instance-attribute
¶
jsonapi = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta
instance-attribute
¶
model_config = ConfigDict(json_encoders={datetime: lambda v: v.astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')})
class-attribute
instance-attribute
¶
The specification mandates that datetimes must be encoded following RFC3339, which does not support fractional seconds, thus they must be stripped in the response. This can cause issues when the underlying database contains fields that do include microseconds, as filters may return unexpected results.
either_data_meta_or_errors_must_be_set()
¶
Overwriting the existing validation function, since 'errors' MUST NOT be set.
Source code in optimade/models/optimade_json.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
|
EntryResponseOne
¶
Bases: Success
Source code in optimade/models/responses.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
data = None
class-attribute
instance-attribute
¶
errors = None
class-attribute
instance-attribute
¶
included = None
class-attribute
instance-attribute
¶
jsonapi = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta
instance-attribute
¶
model_config = ConfigDict(json_encoders={datetime: lambda v: v.astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')})
class-attribute
instance-attribute
¶
The specification mandates that datetimes must be encoded following RFC3339, which does not support fractional seconds, thus they must be stripped in the response. This can cause issues when the underlying database contains fields that do include microseconds, as filters may return unexpected results.
either_data_meta_or_errors_must_be_set()
¶
Overwriting the existing validation function, since 'errors' MUST NOT be set.
Source code in optimade/models/optimade_json.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
|
ErrorLinks
¶
Bases: BaseModel
A Links object specific to Error objects
Source code in optimade/models/jsonapi.py
112 113 114 115 116 117 118 119 120 |
|
about = None
class-attribute
instance-attribute
¶
ErrorResponse
¶
Bases: Response
errors MUST be present and data MUST be skipped
Source code in optimade/models/responses.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
data = None
class-attribute
instance-attribute
¶
errors
instance-attribute
¶
included = None
class-attribute
instance-attribute
¶
jsonapi = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta
instance-attribute
¶
model_config = ConfigDict(json_encoders={datetime: lambda v: v.astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')})
class-attribute
instance-attribute
¶
The specification mandates that datetimes must be encoded following RFC3339, which does not support fractional seconds, thus they must be stripped in the response. This can cause issues when the underlying database contains fields that do include microseconds, as filters may return unexpected results.
data_must_be_skipped()
¶
Source code in optimade/models/responses.py
45 46 47 48 49 |
|
either_data_meta_or_errors_must_be_set()
¶
Source code in optimade/models/jsonapi.py
403 404 405 406 407 408 409 410 411 412 |
|
ErrorSource
¶
Bases: BaseModel
an object containing references to the source of the error
Source code in optimade/models/jsonapi.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
Implementation
¶
Bases: BaseModel
Information on the server implementation
Source code in optimade/models/optimade_json.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
homepage = None
class-attribute
instance-attribute
¶
issue_tracker = None
class-attribute
instance-attribute
¶
maintainer = None
class-attribute
instance-attribute
¶
name = None
class-attribute
instance-attribute
¶
source_url = None
class-attribute
instance-attribute
¶
version = None
class-attribute
instance-attribute
¶
ImplementationMaintainer
¶
Bases: BaseModel
Details about the maintainer of the implementation
Source code in optimade/models/optimade_json.py
231 232 233 234 235 236 |
|
email
instance-attribute
¶
IndexInfoAttributes
¶
Bases: BaseInfoAttributes
Attributes for Base URL Info endpoint for an Index Meta-Database
Source code in optimade/models/index_metadb.py
17 18 19 20 21 22 23 24 25 |
|
api_version
instance-attribute
¶
available_api_versions
instance-attribute
¶
available_endpoints
instance-attribute
¶
entry_types_by_format
instance-attribute
¶
formats = ['json']
class-attribute
instance-attribute
¶
is_index = True
class-attribute
instance-attribute
¶
formats_and_endpoints_must_be_valid()
¶
Source code in optimade/models/baseinfo.py
112 113 114 115 116 117 118 119 120 121 122 |
|
IndexInfoResource
¶
Bases: BaseInfoResource
Index Meta-Database Base URL Info endpoint resource
Source code in optimade/models/index_metadb.py
46 47 48 49 50 51 52 53 54 55 56 57 |
|
attributes
instance-attribute
¶
id = '/'
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta = None
class-attribute
instance-attribute
¶
model_config = ConfigDict(json_schema_extra=resource_json_schema_extra)
class-attribute
instance-attribute
¶
relationships
instance-attribute
¶
type = 'info'
class-attribute
instance-attribute
¶
IndexInfoResponse
¶
Bases: Success
Source code in optimade/models/responses.py
52 53 54 55 |
|
data
instance-attribute
¶
errors = None
class-attribute
instance-attribute
¶
included = None
class-attribute
instance-attribute
¶
jsonapi = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta
instance-attribute
¶
model_config = ConfigDict(json_encoders={datetime: lambda v: v.astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')})
class-attribute
instance-attribute
¶
The specification mandates that datetimes must be encoded following RFC3339, which does not support fractional seconds, thus they must be stripped in the response. This can cause issues when the underlying database contains fields that do include microseconds, as filters may return unexpected results.
either_data_meta_or_errors_must_be_set()
¶
Overwriting the existing validation function, since 'errors' MUST NOT be set.
Source code in optimade/models/optimade_json.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
|
IndexRelationship
¶
Bases: BaseModel
Index Meta-Database relationship
Source code in optimade/models/index_metadb.py
34 35 36 37 38 39 40 41 42 43 |
|
data
instance-attribute
¶
InfoResponse
¶
Bases: Success
Source code in optimade/models/responses.py
65 66 67 68 |
|
data
instance-attribute
¶
errors = None
class-attribute
instance-attribute
¶
included = None
class-attribute
instance-attribute
¶
jsonapi = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta
instance-attribute
¶
model_config = ConfigDict(json_encoders={datetime: lambda v: v.astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')})
class-attribute
instance-attribute
¶
The specification mandates that datetimes must be encoded following RFC3339, which does not support fractional seconds, thus they must be stripped in the response. This can cause issues when the underlying database contains fields that do include microseconds, as filters may return unexpected results.
either_data_meta_or_errors_must_be_set()
¶
Overwriting the existing validation function, since 'errors' MUST NOT be set.
Source code in optimade/models/optimade_json.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
|
JsonApi
¶
Bases: BaseModel
An object describing the server's implementation
Source code in optimade/models/jsonapi.py
58 59 60 61 62 63 64 65 66 |
|
Link
¶
Bases: BaseModel
A link MUST be represented as either: a string containing the link's URL or a link object.
Source code in optimade/models/jsonapi.py
41 42 43 44 45 46 47 48 49 50 51 52 |
|
LinksResource
¶
Bases: EntryResource
A Links endpoint resource object
Source code in optimade/models/links.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
attributes
instance-attribute
¶
id
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta = None
class-attribute
instance-attribute
¶
model_config = ConfigDict(json_schema_extra=resource_json_schema_extra)
class-attribute
instance-attribute
¶
relationships = None
class-attribute
instance-attribute
¶
type = 'links'
class-attribute
instance-attribute
¶
relationships_must_not_be_present()
¶
Source code in optimade/models/links.py
116 117 118 119 120 |
|
LinksResourceAttributes
¶
Bases: Attributes
Links endpoint resource object attributes
Source code in optimade/models/links.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
aggregate = Aggregate.OK
class-attribute
instance-attribute
¶
base_url
instance-attribute
¶
description
instance-attribute
¶
homepage
instance-attribute
¶
link_type
instance-attribute
¶
model_config = ConfigDict(extra='allow')
class-attribute
instance-attribute
¶
name
instance-attribute
¶
no_aggregate_reason = None
class-attribute
instance-attribute
¶
check_illegal_attributes_fields()
¶
Source code in optimade/models/jsonapi.py
330 331 332 333 334 335 336 337 338 |
|
LinksResponse
¶
Bases: EntryResponseMany
Source code in optimade/models/responses.py
108 109 110 111 112 113 114 115 116 |
|
data
instance-attribute
¶
errors = None
class-attribute
instance-attribute
¶
included = None
class-attribute
instance-attribute
¶
jsonapi = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta
instance-attribute
¶
model_config = ConfigDict(json_encoders={datetime: lambda v: v.astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')})
class-attribute
instance-attribute
¶
The specification mandates that datetimes must be encoded following RFC3339, which does not support fractional seconds, thus they must be stripped in the response. This can cause issues when the underlying database contains fields that do include microseconds, as filters may return unexpected results.
either_data_meta_or_errors_must_be_set()
¶
Overwriting the existing validation function, since 'errors' MUST NOT be set.
Source code in optimade/models/optimade_json.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
|
Meta
¶
Bases: BaseModel
Non-standard meta-information that can not be represented as an attribute or relationship.
Source code in optimade/models/jsonapi.py
35 36 37 38 |
|
model_config = ConfigDict(extra='allow')
class-attribute
instance-attribute
¶
OptimadeError
¶
Bases: Error
detail MUST be present
Source code in optimade/models/optimade_json.py
128 129 130 131 132 133 134 135 136 |
|
code = None
class-attribute
instance-attribute
¶
detail
instance-attribute
¶
id = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta = None
class-attribute
instance-attribute
¶
source = None
class-attribute
instance-attribute
¶
status = None
class-attribute
instance-attribute
¶
title = None
class-attribute
instance-attribute
¶
__hash__()
¶
Source code in optimade/models/jsonapi.py
191 192 |
|
Periodicity
¶
Bases: IntEnum
Integer enumeration of dimension_types values
Source code in optimade/models/structures.py
48 49 50 51 52 |
|
Person
¶
Bases: BaseModel
A person, i.e., an author, editor or other.
Source code in optimade/models/references.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
Provider
¶
Bases: BaseModel
Information on the database provider of the implementation.
Source code in optimade/models/optimade_json.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
|
ReferenceResource
¶
Bases: EntryResource
The references
entries describe bibliographic references.
The following properties are used to provide the bibliographic details:
- address, annote, booktitle, chapter, crossref, edition, howpublished, institution, journal, key, month, note, number, organization, pages, publisher, school, series, title, volume, year: meanings of these properties match the BibTeX specification, values are strings;
- bib_type: type of the reference, corresponding to type property in the BibTeX specification, value is string;
- authors and editors: lists of person objects which are dictionaries with the following keys:
- name: Full name of the person, REQUIRED.
- firstname, lastname: Parts of the person's name, OPTIONAL.
- doi and url: values are strings.
- Requirements/Conventions:
- Support: OPTIONAL support in implementations, i.e., any of the properties MAY be
null
. - Query: Support for queries on any of these properties is OPTIONAL. If supported, filters MAY support only a subset of comparison operators.
- Every references entry MUST contain at least one of the properties.
- Support: OPTIONAL support in implementations, i.e., any of the properties MAY be
Source code in optimade/models/references.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
attributes
instance-attribute
¶
id
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta = None
class-attribute
instance-attribute
¶
model_config = ConfigDict(json_schema_extra=resource_json_schema_extra)
class-attribute
instance-attribute
¶
relationships = None
class-attribute
instance-attribute
¶
type = 'references'
class-attribute
instance-attribute
¶
validate_attributes(value)
classmethod
¶
Source code in optimade/models/references.py
323 324 325 326 327 328 329 330 331 332 333 |
|
ReferenceResourceAttributes
¶
Bases: EntryResourceAttributes
Model that stores the attributes of a reference.
Many properties match the meaning described in the BibTeX specification.
Source code in optimade/models/references.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
address = None
class-attribute
instance-attribute
¶
annote = None
class-attribute
instance-attribute
¶
authors = None
class-attribute
instance-attribute
¶
bib_type = None
class-attribute
instance-attribute
¶
booktitle = None
class-attribute
instance-attribute
¶
chapter = None
class-attribute
instance-attribute
¶
crossref = None
class-attribute
instance-attribute
¶
doi = None
class-attribute
instance-attribute
¶
edition = None
class-attribute
instance-attribute
¶
editors = None
class-attribute
instance-attribute
¶
howpublished = None
class-attribute
instance-attribute
¶
immutable_id = None
class-attribute
instance-attribute
¶
institution = None
class-attribute
instance-attribute
¶
journal = None
class-attribute
instance-attribute
¶
key = None
class-attribute
instance-attribute
¶
last_modified
instance-attribute
¶
model_config = ConfigDict(extra='allow')
class-attribute
instance-attribute
¶
month = None
class-attribute
instance-attribute
¶
note = None
class-attribute
instance-attribute
¶
number = None
class-attribute
instance-attribute
¶
organization = None
class-attribute
instance-attribute
¶
pages = None
class-attribute
instance-attribute
¶
publisher = None
class-attribute
instance-attribute
¶
school = None
class-attribute
instance-attribute
¶
series = None
class-attribute
instance-attribute
¶
title = None
class-attribute
instance-attribute
¶
url = None
class-attribute
instance-attribute
¶
volume = None
class-attribute
instance-attribute
¶
year = None
class-attribute
instance-attribute
¶
cast_immutable_id_to_str(value)
classmethod
¶
Convenience validator for casting immutable_id
to a string.
Source code in optimade/models/entries.py
110 111 112 113 114 115 116 117 |
|
check_illegal_attributes_fields()
¶
Source code in optimade/models/jsonapi.py
330 331 332 333 334 335 336 337 338 |
|
ReferenceResponseMany
¶
Bases: EntryResponseMany
Source code in optimade/models/responses.py
150 151 152 153 154 155 156 157 158 |
|
data
instance-attribute
¶
errors = None
class-attribute
instance-attribute
¶
included = None
class-attribute
instance-attribute
¶
jsonapi = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta
instance-attribute
¶
model_config = ConfigDict(json_encoders={datetime: lambda v: v.astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')})
class-attribute
instance-attribute
¶
The specification mandates that datetimes must be encoded following RFC3339, which does not support fractional seconds, thus they must be stripped in the response. This can cause issues when the underlying database contains fields that do include microseconds, as filters may return unexpected results.
either_data_meta_or_errors_must_be_set()
¶
Overwriting the existing validation function, since 'errors' MUST NOT be set.
Source code in optimade/models/optimade_json.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
|
ReferenceResponseOne
¶
Bases: EntryResponseOne
Source code in optimade/models/responses.py
140 141 142 143 144 145 146 147 |
|
data
instance-attribute
¶
errors = None
class-attribute
instance-attribute
¶
included = None
class-attribute
instance-attribute
¶
jsonapi = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta
instance-attribute
¶
model_config = ConfigDict(json_encoders={datetime: lambda v: v.astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')})
class-attribute
instance-attribute
¶
The specification mandates that datetimes must be encoded following RFC3339, which does not support fractional seconds, thus they must be stripped in the response. This can cause issues when the underlying database contains fields that do include microseconds, as filters may return unexpected results.
either_data_meta_or_errors_must_be_set()
¶
Overwriting the existing validation function, since 'errors' MUST NOT be set.
Source code in optimade/models/optimade_json.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
|
RelatedLinksResource
¶
Bases: BaseResource
A related Links resource object
Source code in optimade/models/index_metadb.py
28 29 30 31 |
|
Relationship
¶
Bases: Relationship
Similar to normal JSON API relationship, but with addition of OPTIONAL meta field for a resource.
Source code in optimade/models/optimade_json.py
427 428 429 430 431 432 433 |
|
data = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta = None
class-attribute
instance-attribute
¶
at_least_one_relationship_key_must_be_set()
¶
Source code in optimade/models/jsonapi.py
279 280 281 282 283 284 285 |
|
RelationshipLinks
¶
Bases: BaseModel
A resource object MAY contain references to other resource objects ("relationships"). Relationships may be to-one or to-many. Relationships can be specified by including a member in a resource's links object.
Source code in optimade/models/jsonapi.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
|
related = None
class-attribute
instance-attribute
¶
self = None
class-attribute
instance-attribute
¶
either_self_or_related_must_be_specified()
¶
Source code in optimade/models/jsonapi.py
250 251 252 253 254 255 256 |
|
Relationships
¶
Bases: BaseModel
Members of the relationships object ("relationships") represent references from the resource object in which it's defined to other resource objects. Keys MUST NOT be: type id
Source code in optimade/models/jsonapi.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
check_illegal_relationships_fields()
¶
Source code in optimade/models/jsonapi.py
296 297 298 299 300 301 302 303 304 |
|
Resource
¶
Bases: BaseResource
Resource objects appear in a JSON API document to represent resources.
Source code in optimade/models/jsonapi.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
attributes = None
class-attribute
instance-attribute
¶
id
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta = None
class-attribute
instance-attribute
¶
model_config = ConfigDict(json_schema_extra=resource_json_schema_extra)
class-attribute
instance-attribute
¶
relationships = None
class-attribute
instance-attribute
¶
type
instance-attribute
¶
ResourceLinks
¶
Bases: BaseModel
A Resource Links object
Source code in optimade/models/jsonapi.py
307 308 309 310 311 312 313 314 315 |
|
self = None
class-attribute
instance-attribute
¶
Response
¶
Bases: BaseModel
A top-level response.
Source code in optimade/models/jsonapi.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
|
data = None
class-attribute
instance-attribute
¶
errors = None
class-attribute
instance-attribute
¶
included = None
class-attribute
instance-attribute
¶
jsonapi = None
class-attribute
instance-attribute
¶
links = None
class-attribute
instance-attribute
¶
meta = None
class-attribute
instance-attribute
¶
model_config = ConfigDict(json_encoders={datetime: lambda v: v.astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')})
class-attribute
instance-attribute
¶
The specification mandates that datetimes must be encoded following RFC3339, which does not support fractional seconds, thus they must be stripped in the response. This can cause issues when the underlying database contains fields that do include microseconds, as filters may return unexpected results.
either_data_meta_or_errors_must_be_set()
¶
Source code in optimade/models/jsonapi.py
403 404 405 406 407 408 409 410 411 412 |
|
ResponseMeta
¶
Bases: Meta
A JSON API meta member that contains JSON API meta objects of non-standard meta-information.
OPTIONAL additional information global to the query that is not specified in this document, MUST start with a database-provider-specific prefix.
Source code in optimade/models/optimade_json.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
|
api_version
instance-attribute
¶
data_available = None
class-attribute
instance-attribute
¶
data_returned = None
class-attribute
instance-attribute
¶
implementation = None
class-attribute
instance-attribute
¶
last_id = None
class-attribute
instance-attribute
¶
model_config = ConfigDict(extra='allow')
class-attribute
instance-attribute
¶
more_data_available
instance-attribute
¶
optimade_schema = None
class-attribute
instance-attribute
¶
provider = None
class-attribute
instance-attribute
¶
query
instance-attribute
¶
response_message = None
class-attribute
instance-attribute
¶
time_stamp = None
class-attribute
instance-attribute
¶
warnings = None
class-attribute
instance-attribute
¶
ResponseMetaQuery
¶
Bases: BaseModel
Information on the query that was requested.