Skip to content

Add runs entry type and provenance relationships - #595

Draft
giovannipizzi wants to merge 3 commits into
Materials-Consortia:developfrom
giovannipizzi:add_runs_endpoint_and_provenance
Draft

Add runs entry type and provenance relationships#595
giovannipizzi wants to merge 3 commits into
Materials-Consortia:developfrom
giovannipizzi:add_runs_endpoint_and_provenance

Conversation

@giovannipizzi

Copy link
Copy Markdown
Contributor

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.

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.)

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.
@giovannipizzi

giovannipizzi commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Open issues for discussion

The following points were flagged in the draft and might require explicit approval or discussion:

  1. workflow_uri nullability (currently: REQUIRED-but-nullable): allows for providers to avoid creating an artificial URI just to respect the specs. -> DECISION: OK

  2. Filter/sort support on relation objects beyond label and workflow_uri: the current text leaves broader query support unspecified (neither required nor prohibited). Should a minimum set of filter features be mandated for relation-object endpoints? -> DECISION: not decided, keep as is for now.

  3. available_endpoints and entry_types_by_format: no wording change to Sec. 5.3/5.5.1 is needed (both already require implemented entry-listing endpoints to be reflected in the Base Info Endpoint). Implementers should add "runs" to available_endpoints and entry_types_by_format.json, and expose /info/runs. The three new relation types (input_rel/output_rel/derived_rel) are deliberately not added to available_endpoints. -> DECISION: OK

  4. calculations classified as execution — future deprecation: the role of calculations is now unclear given the introduction of runs. Options: (a) deprecate in favour of runs; (b) give it non-overlapping semantics (e.g. its own inputs/outputs). This PR classifies it as execution and removes the old "future work" note. We should decide if we want to deprecate or remove in this PR directly. -> DECISION: deprecate

  5. output_of single-and-exclusive-creator rule: a consequence is that two runs genuinely producing a byte-identical artifact MUST model them as two distinct data entries. The source_of/derived_from mechanism (unbounded) is the designated way to instead represent "returning" rather than "creating". Is this OK? -> DECISION: OK as is, but we will add a RETURN/CREATE separation of the output links (with different semantics).

  6. Promoting relation types to top-level entry types: input_rel/output_rel/derived_rel are currently embedded-only (no /v1/input_rel endpoint). A future version MAY promote them to top-level entry points (in a backward-compatible way) if use cases for global cross-node queries emerge. For now, this does not seem needed. -> DECISION: Do NOT promote for now.

  7. Acyclicity is required but server-unenforceable: the spec requires acyclicity but cannot mandate server-side verification. Clients MUST guard against cycles when traversing (this is written now as a note in the specs). -> DECISION: use SHOULD NOT for the requirement on the server (since it's not enforceable), but keep the discussion, and keep MUST NOT for the client recommendation.

  8. meta fields on the to-one output_of related response: the output_of related endpoint returns a single relation object rather than a list. This PR treats it like a single-entry fetch (omits data_returned/data_available, shows only optional more_data_available). To be confirmed if this matches how the OPTIMADE spec usually populates meta fields on single-resource responses. -> DECISION: OK as is.

- 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`.
@giovannipizzi
giovannipizzi requested a review from ndaelman-hu July 3, 2026 09:13
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`).
@rartino

rartino commented Aug 6, 2026

Copy link
Copy Markdown
Member

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 x-optimade-category- which thus comes with a non-negligible complexity cost for the specification. Two questions:

  • Why does this not rather live in the top x-optimade-defintion field as simply category? We have all the other declarative information about the entity being defined there.

  • This might be me dimmed by a couple of weeks of vacation, but did we discuss these category-based provenance limitations during the workshop? Do we need them?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants