Add runs entry type and provenance relationships - #595
Conversation
In this commit we introduce the following additions to the OPTIMADE specification: - Entry Type Categories: classifies every entry type as `data`, `execution`, or `metadata`. Standard types: `runs`/`calculations` → execution; `references` → metadata; `structures`/`trajectories`/`files` → data. An OPTIONAL `category` field is added to the Entry Listing Info Endpoint response. - Reserved provenance relationship keys (in Entry Listing JSON Response Schema): `inputs`, `outputs`, `output_of`, `input_for`, `source_of`, `derived_from` are reserved and exempt from the grouping-by-entry-type rule. Category constraints, cardinality, and acyclicity rules are defined. - Provenance Relation Objects (§ Provenance Relation Objects): the six provenance relationships resolve to reified edge objects (`input_rel`, `output_rel`, `derived_rel`) carrying a mandatory `label` and an optional `workflow_uri` (on `derived_rel`). The `target` key is reserved. Relationships can be filtered by `label`/`workflow_uri` via a standard OPTIMADE filters; fetching, pagination, and `include=target` conventions are specified. - Runs Entries: new `execution`-category entry type representing a specific workflow execution (could also be experimental). Properties: `workflow_uri` (REQUIRED, nullable), `inputs`/`outputs` relationships. - Provenance relationships on data entries: `output_of` (to-one, exclusive creator rule), `input_for` (unbounded to-many), `source_of` (unbounded to-many, per-source label uniqueness), `derived_from` (unbounded to-many, label non-uniqueness on incoming side, optional `workflow_uri` on edge). - Calculations classified as `execution` category (potentially to be deprecated?) - Worked examples (in Sec. Provenance Examples) illustrating all new relationships. Note: all these changes are backward compatible.
Open issues for discussionThe following points were flagged in the draft and might require explicit approval or discussion:
|
- Deprecate the `calculations` entry type and `/calculations` endpoint in favor of `runs`. - Relax server-side acyclicity to SHOULD (SHOULD NOT create cycles) while keeping the client-side MUST NOT assume / MUST guard rules and all the explanatory text. - Add an `x-optimade-category` key to the Property Definition format and expose it (instead of a bare `category` field) in the entry info endpoint. - Rename reserved `/workflows` -> `/workflow_declarations`, and the `workflow_uri` attribute (on runs and derived edges) -> `workflow_declaration_uri`. - Split the former `outputs`/`output_of` into `creates`/`created_by` (unchanged single-and-exclusive-creator semantics) and add a new `returns`/`returned_by` relationship: many runs may return the same data node (no exclusivity), return labels are unique per run but not per returned datum. Document create (how data came into existence) vs. return (which workflow returned it, e.g. a subworkflow creates and the parent returns the same data). A run may carry both edges to a node; the most common case is a return edge alone, then create+return, then create alone. Note that create edges are optional and that provenance granularity is up to the provider (a single creating run may stand in for a complex internal workflow). - Clarify graph rules: at most one edge of a given type per ordered node pair (create+return together is allowed), and the acyclic subgraph is defined only by input and create edges followed in data-flow direction. - Rename reified edge types `*_rel` -> `*_relationships`.
Revise the provenance vocabulary in response to review, and sharpen the meaning of the data-to-data links. - Rename the eight relationship keys to a consistent has_*/is_* pairing: inputs -> has_input, input_for -> is_input, creates -> has_artifact, created_by -> is_artifact, returns -> has_output, returned_by -> is_output, source_of -> has_product, derived_from -> is_product. - Rename three of the reified edge types to match: create_relationships -> artifact_relationships, return_relationships -> output_relationships, derived_relationships -> product_relationships. (input_relationships is unchanged.) Section headings, cross-references, example URLs, JSON `type`/`id` fields, and `include=` query strings are updated throughout; semantics are unchanged. - Reframe has_product/is_product with curation as the primary purpose: a provider uses them to flag its recommended derived result (e.g. the preferred `_exmpl_band_structure` of a structure), while the underlying derivation remains the meaning of the link and, where known, is recorded in `workflow_declaration_uri`. - Explain the naming: a product is a derived property of the source that lives in a separate `data` node rather than inside the entry's own attributes. This motivates the per-source `label` uniqueness (like property/attribute names within a node), and clarifies that product names and attribute names live in separate namespaces (the same name may appear as both). - Note that a has_product edge is strictly one-to-one; a many-to-one derivation (e.g. an activation energy from two structures via NEB) cannot use a data-to-data link and MUST instead go through a `runs` entry (carrying the `workflow_declaration_uri`).
|
I have started to work through this in tandem with a mock-implementation. Quite a bit of this PR is centered around the new "categorization" concept now declared via
What is a use-case for an OPTIMADE server implementer and/or an OPTIMADE API user that is served by these category declarations, vs., them just not being there? Meaning: without them, a database is allowed to represent provenance relationships between any entry types for which it deems it makes sense to declare such relationships for. |
In this commit we introduce the following additions to the OPTIMADE specification:
Entry Type Categories: classifies every entry type as
data,execution, ormetadata. Standard types:runs/calculations→ execution;references→ metadata;structures/trajectories/files→ data. An OPTIONALcategoryfield is added to the Entry Listing Info Endpoint response.
Reserved provenance relationship keys (in Entry Listing JSON Response Schema):
inputs,outputs,output_of,input_for,source_of,derived_fromare reserved and exempt from the grouping-by-entry-type rule. Category constraints, cardinality, and acyclicity rules are defined.Provenance Relation Objects (§ Provenance Relation Objects): the six provenance relationships resolve to reified edge objects (
input_rel,output_rel,derived_rel) carrying a mandatorylabeland an optionalworkflow_uri(onderived_rel). Thetargetkey is reserved. Relationships can be filtered bylabel/workflow_urivia a standard OPTIMADE filters; fetching, pagination, andinclude=targetconventions are specified.Runs Entries: new
execution-category entry type representing a specific workflow execution (could also be experimental). Properties:workflow_uri(REQUIRED, nullable),inputs/outputsrelationships.Provenance relationships on data entries:
output_of(to-one, exclusive creator rule),input_for(unbounded to-many),source_of(unbounded to-many, per-source label uniqueness),derived_from(unbounded to-many, label non-uniqueness on incoming side, optionalworkflow_urion edge).Calculations classified as
executioncategory (potentially to be deprecated?)Worked examples (in Sec. Provenance Examples) illustrating all new relationships.
Note: all these changes are backward compatible.
Please follow the guidelines here to create a new pull request.
If your pull request requires discussion, make sure the OPTIMADE developer list is alerted (for more info see the link above.)