From 1ee7893fdc7622090a409c3b431fd65737b76dd3 Mon Sep 17 00:00:00 2001 From: Dan Wolfson Date: Wed, 11 Nov 2026 21:33:20 +0000 Subject: [PATCH 1/2] docs: report specs after 6.2.37/6.2.38 (complex values, render intents, DOCUMENT, surfaces) docs/output-formats-and-report-specs.md: - Output formats updated (TABLE structured flag, DICT flat/native, SERIES/BAR/PIE, DOCUMENT) and a new "Which output type for which surface" section: Portal, Trellis and the terminal render; MCP/A2A take un-rendered DICT; JSON is raw by design; two nesting levels. - Column model lists valid_values, render, max_items, max_lines, label, and Format.document. - "Complex values" rewritten: the structured TABLE shape (columns, rows keyed by key, total/shown/total_basis, notes, "none on N rows" / "not read"), native DICT, value_names() for consumers reading either shape, a render-intent table with LIST and CLI examples and type defaults (checked against the code), and how each surface draws them. - New "Rendered text and notes (6.2.37)": F1-F10 and the "more may exist" notes. - DOCUMENT: {a|b} file-name alternatives, the three built-in validators and per-node SHACL findings; DCAT Catalog with scope or search_string and its file names; run_report TABLE/DOCUMENT in the CLI section. docs/design/output_generation_and_normalization.md: the native layer and rendering at the edge (value/native per column, _legacy_text, the context variables). docs/dr_egeria_manual.md: Create Report's Output Format excludes DOCUMENT. pyegeria/view/README.md: structured_table and the relationship map. Signed-off-by: Dan Wolfson --- .../output_generation_and_normalization.md | 33 +- docs/dr_egeria_manual.md | 2 +- docs/output-formats-and-report-specs.md | 290 +++++++++++++----- pyegeria/view/README.md | 2 + 4 files changed, 251 insertions(+), 76 deletions(-) diff --git a/docs/design/output_generation_and_normalization.md b/docs/design/output_generation_and_normalization.md index e06cacae..fee74cfc 100644 --- a/docs/design/output_generation_and_normalization.md +++ b/docs/design/output_generation_and_normalization.md @@ -70,13 +70,42 @@ Report specifications (`FormatSet`) can now define columns with a `detail_spec` - **REPORT (Markdown)**: Renders a vertical section for each detail column, recursively calling the formatter. - **LIST (Markdown Table)**: Displays a compact summary in the main table row and appends a linked detail section below the table. - **DICT**: Includes nested lists of formatted dictionaries, matching the detail specification. -- **TABLE (CLI)**: Summarizes nested collections by joining names/display names of child elements. +- **TABLE (CLI)**: Draws the structured table: nested collections by the column's render intent, sub-tables as + separate tables after the main one. ### 3. Recursive Formatting Control: `include_preamble` To prevent redundant report headers when the formatter calls itself recursively, `generate_output` now accepts an `include_preamble` boolean (default `True`). This flag is automatically disabled for recursive detail calls. ### 4. Smart Summarization -When rendering nested collections in horizontal formats (`LIST` and CLI `TABLE`), the system now attempts to join the `name` or `displayName` of child elements instead of just providing a count (e.g., "Team A, Team B" instead of "2 items"). +When rendering nested collections in horizontal formats (`LIST` and CLI `TABLE`), the system draws them by the column's render intent (names joined, bullets, key–values) instead of just providing a count (e.g., "Team A, Team B" instead of "2 items"); past `max_items` it says "+N more". + +### 5. Native values, rendered at the edge (6.2.37) + +Values used to be stringified while an element was read (`populate_common_columns` joined relationships into +"a, b", classifications into "A, B" and zones into "a, b"), so every output type, DICT included, started from +strings. Since 6.2.37 extraction keeps a **native layer** beside each column's text: + +- related elements as `{guid, qualifiedName, displayName, type}` (`related_ref`); +- classifications as `{name, properties?}`, zones as a list; +- property values as they come (lists stay lists). + +Each column dict carries the native value under `native` and the text under `value`. The text is derived from the +native value by one function, `_legacy_text` (qualifiedName first, or the display name when the column sets +`label: display_name`), so the default outputs are byte-identical to what they were. + +Renderers choose which to read: + +- the default DICT/TABLE rows and the text outputs read `value` (the flat text); +- `dict_shape="native"` DICT rows and the structured TABLE (`table_shape="structured"`, + `pyegeria/view/structured_table.py`) read `native`; +- LIST cells and the CLI's Rich table draw lists, maps and related elements from `native` by the column's render + intent (`markdown_cell_from_native`, `run_report.render_structured_table`). + +The shape is carried into a find method's own generator by a context variable (`dict_shape_for_call`), so no OMVS +signature changed. What each list request sent (page size, graph depth, relationship filters) is recorded per call +in another context variable (`recording_list_requests`), never on the shared client: the executor reads it to say +"more may exist" when a page was full, and to tell an empty relationship that was read ("none") from one that was +not requested ("not read"). See "Complex values" in `docs/output-formats-and-report-specs.md`. ## Unified Execution Pipeline diff --git a/docs/dr_egeria_manual.md b/docs/dr_egeria_manual.md index c7a909e6..3c1158d6 100644 --- a/docs/dr_egeria_manual.md +++ b/docs/dr_egeria_manual.md @@ -298,7 +298,7 @@ Dr.Egeria organizes its commands into "families," each corresponding to a specif - `Create Report Spec`: a `ReportSpec` (a `ReportType` collection) with its `Microflow` (the stage list as JSON), `Target Type Name`, `Aliases`, `Output Types` and `Include Preamble`. - `Create Dashboard`: a `Dashboard` asset (a `DataSet`, sibling of `Report`) with `Aliases`, `Refresh Time Interval` (minutes) and `Layout Style`. Its sheets and placements are `Create Display Data Container` / `Create Display Data Field` (Schema Maker). The local `Create Dashboard Sheet` records above are unchanged. - `Link Report Type Instance` (ReportType → Report) and `Link Report Run Of` (ResultsSet → Report, with `Result State`, `Result State Reason`, `Result Location`); each also accepts `Detach`/`Unlink`/`Remove`. - - `Create Report` also writes Egeria's typed `outputFormat` and `reportParameters` (JSON). `Output Format` accepts every format in pyegeria's report-spec registry plus `KPI`. + - `Create Report` also writes Egeria's typed `outputFormat` and `reportParameters` (JSON). `Output Format` accepts every format in pyegeria's report-spec registry plus `KPI`, except `DOCUMENT`: a document report runs through `run_report --output-format DOCUMENT` or `exec_report_spec` until the Portal and Egeria Advisor can show one. - **Asset Maker** (added 2026-09-11): Instantiate Open Metadata catalog templates via `pyegeria/omvs/automated_curation.py`'s create-from-template surface — no update path, since the underlying OMVS methods are create-only. The generic, Advanced-only `Create Element` (raw `typeName`/`templateGUID`/`placeholderPropertyValues`) moved to the Automation family on 2026-10-02; twelve Basic-level, type-specific wrappers remain here for the common cases: `Create Secrets Store Element`, `Create Kafka Server Element`, `Create CSV Data File Element`, `Create Postgres Server Element`, `Create Postgres Database Element`, `Create Folder Element`, `Create UC Server Element`, `Create UC Catalog Element`, `Create UC Schema Element`, `Create UC Table Element`, `Create UC Function Element`, `Create UC Volume Element`. Live-verified: `Create Schema Type` (see below) and `Create CSV Data File Element` round-tripped against a running server; `Create Kafka Server Element` currently fails on a server with no "Apache Kafka Server" catalog template registered — a pre-existing gap in that server's template catalog, not a defect in this command. - **Automation** (added 2026-10-02): Commands that set Egeria's governance engines running, via `pyegeria/omvs/automated_curation.py` (processors in `md_processing/v2/automation.py`). - `Initiate Governance Action Process` / `Initiate Governance Action Type`: run a process or a single action type. `Action Targets` takes one `action target name: element` pair per line; `Request Parameters` takes `name: value` pairs. diff --git a/docs/output-formats-and-report-specs.md b/docs/output-formats-and-report-specs.md index 327c1521..d94e3217 100644 --- a/docs/output-formats-and-report-specs.md +++ b/docs/output-formats-and-report-specs.md @@ -35,25 +35,65 @@ profile = client.get_my_profile(output_format="DICT", report_spec="My-User-MD") pyegeria supports multiple output types. Each report spec declares which types it supports. -- DICT: Python list/dict structures — best for programmatic use and tests. This format provides a "materialized" view where properties are cleaned up and nested elements are promoted to logical keys. -- JSON: Raw Egeria response dictionary — ideal for advanced users who need to process the exact response from the Egeria platform without any pyegeria-specific transformations. -- LIST: Markdown table (horizontal). Good for compact overviews. Nested values are automatically summarized (names/display names). If a `detail_spec` is configured, master rows include `[details]` links to rich detail sections appended below the table. -- REPORT: Rich Markdown (vertical). Ideal for deep dives. Renders nested dict/list values as hierarchical bullet lists (using the hyphen `-` as the default bullet character) and includes vertical detail sections for master-detail columns. +- DICT: Python list/dict structures — best for programmatic use and tests. A "materialized" view: properties are + cleaned up and nested elements are promoted to logical keys. By default values are flat strings (a relationship + column is "a, b"); `dict_shape="native"` returns native lists and objects instead (see + [Complex values](#complex-values-structured-tables-and-native-rows)). +- JSON: Raw Egeria response — for advanced users who need the exact response from the Egeria platform. It ignores + the report spec's columns by design. +- TABLE: rows for a table. `exec_report_spec` returns the same rows as DICT unless the caller asks for + `table_shape="structured"`, which returns a typed table (`kind: "table"`). The `run_report` CLI asks for the + structured table and draws it with Rich. +- LIST: Markdown table (horizontal). Good for compact overviews. A list of scalars is shown as bullets in its cell, + related elements are joined by name, and a `detail_spec` column adds a `[details]` link to a detail section + appended below the table. +- REPORT: Rich Markdown (vertical). Ideal for deep dives. Renders lists as markdown lists, nested values as + hierarchical bullet lists, and `detail_spec` columns as sub-reports. - REPORT-GRAPH: Recursive, linked Markdown report. Builds anchor-linked sections per element (by GUID), and adds link lists for peer and child/nested elements; recurses while avoiding cycles. - FORM: Markdown suitable for Dr.Egeria editable forms. Complex values are summarized to keep the form concise and manageable. - MD: Plain Markdown (legacy simple rendering). - MERMAID: Mermaid graph text for supported responses. - HTML: HTML wrapper around Markdown (when enabled in generators). - GRAPH: Generates a standalone HTML page natively rendering dynamic Vega-Lite visualizations. Functions identically to `HTML` when rendering but signals intent for rich visualization output. -- TABLE: Used for generating a rich textual table for terminal display. +- SERIES / BAR / PIE: Vega-Lite charts of an analytic function's result. +- DOCUMENT: one document in a published standard (for example a DCAT-AP 3 catalog), built by an exporter and + validated (see [Document outputs](#document-outputs)). Tip: Use DICT for APIs and automation; use LIST for dashboards/browsing; use REPORT for deep, readable details; use FORM when producing updateable forms. +### Which output type for which surface + +A report spec does not say which surface it is for: the output type states the intent, and each surface has its +own renderer for it. + +- **Who renders what:** + - The **Portal** (Local Dashboards, Report Specs, the Explorer), **Trellis** (Egeria Advisor, Resource Explorer) + and the **terminal** (the `run_report` CLI, the Textual TUIs) render: they draw tables, markdown and charts. + - **MCP and A2A** clients take un-rendered output: DICT rows (or the structured TABLE), which the model reads. + - **JSON** is Egeria's raw response and ignores the report spec, by design. DICT is the structured form. +- **Choosing a type:** + - **A number** → DICT, through an analytic function (a KPI). **A trend** → SERIES. **Proportions** → BAR/PIE. + - **Rows of things with a few fields, possibly with lists** → TABLE. Every surface draws it as a table and + handles lists and small sub-tables. + - **One thing in depth, or prose** → REPORT (or FORM for an editable record). + - **A quick name list with drill-down links** → LIST. + - **Relationships as a picture** → MERMAID. + - **A standard file** (DCAT, ...) → DOCUMENT. + - **Data for a program** → DICT (structured, spec-shaped; `dict_shape="native"` for native values) or JSON (raw + Egeria). +- **Nesting:** a table shows **two levels**: the row, and a cell drawn as bullets, key–values or a sub-table of + scalars. A third level (an object inside a sub-table cell) is shown as a count and names, with a note. For real + hierarchies use REPORT, MERMAID or a LIST with drill-down. + ### Custom Column Formatting -You can customize how column data is rendered in `LIST` format (Markdown tables) by setting the `format` attribute to a string, such as `"bulleted-list"`. +You can customize how column data is rendered by setting the `format` attribute to a string, such as `"bulleted-list"`. + +- `bulleted-list`: Renders list values as a vertical bulleted list: in a `LIST` table cell with HTML line breaks + (`
`), and in `REPORT`/`MD` as a markdown list (since 6.2.37). -- `bulleted-list`: Renders list values as a vertical bulleted list using HTML line breaks (`
`) within the Markdown table cell. This is useful for improving the readability of long lists. +For lists, maps and related elements in general, prefer the column's `render` (see +[Column render intents](#column-render-intents)); `format` stays for compatibility. Example: ```python @@ -100,6 +140,12 @@ Report specs are defined using Pydantic models in `pyegeria/view/_output_format_ - `key`: property key to extract from the data (snake_case or camelCase supported) - `format`: optional flag to apply formatting suitable for tables/links - `detail_spec`: optional name of another report spec to render a nested detail section (master–detail) + - `valid_values`: optional list or map of the values the column may hold + - `render`, `max_items`, `max_lines`, `label` (6.2.37, all optional): how the value is drawn; see + [Column render intents](#column-render-intents) +- Format (DOCUMENT only) + - `document`: the standard, media type, file name and validator of a DOCUMENT format; see + [Document outputs](#document-outputs) Example (Python) — simplified snippet: @@ -258,13 +304,15 @@ Egeria OMVS responses often include related elements and nested hierarchies. pye - related element properties (e.g., `name`, `qualifiedName`, `guid`, `type`, `description`) - recursively processed `nested_elements` - Schema‑driven promotion: if the current spec includes attributes with `detail_spec`, pyegeria builds a type→key map from those linked specs and promotes matching nested elements into those keys. Example: a role that has nested `Project` items becomes `{"projects": [ ... ]}` when the column points to a `Project` detail spec. -- Smart Summarization: when rendering collections in tables (`LIST` or CLI `TABLE`), pyegeria now attempts to summarize them by joining the names or display names of child elements, rather than just showing a count. +- Smart Summarization: when rendering collections in tables (`LIST` or CLI `TABLE`), pyegeria draws them by the column's render intent (names joined, bullets, key–values, or a count past `max_items`), never only a count (see [Column render intents](#column-render-intents)). ### How formats handle nested values -- DICT: returns full nested dict/lists for downstream processing (materialized). +- DICT: returns full nested dict/lists for downstream processing (materialized). Relationship columns are joined + strings unless the caller asks for `dict_shape="native"`. - JSON: returns the raw Egeria response structure. -- LIST: shows a compact summary (names/identifiers) in the master row and adds a `[details]` link if a `detail_spec` is configured. A detail section is appended below using the linked spec. +- LIST: draws each cell by the column's render intent (bullets, joined names, key–values, a count) and adds a `[details]` link if a `detail_spec` is configured. A detail section is appended below using the linked spec. +- TABLE (structured): sub-rows as a nested table, two levels at most (see [Which output type for which surface](#which-output-type-for-which-surface)). - REPORT: renders nested dicts/lists as hierarchical markdown bullet lists (using the hyphen `-` as the default bullet character) for a clean read-only view. - FORM: shows summarized values only to keep the form updateable and concise. @@ -376,65 +424,147 @@ Notes --- -### Structured tables and native rows +### Complex values: structured tables and native rows -Report specs render complex values (lists, maps, related elements) from **native values**. Two caller -flags expose them; neither is a spec field, and the defaults return today's shapes unchanged. +Since 6.2.37, report specs keep **native values** (lists, maps, related elements) while they read an element, and +each output type renders them at the edge. Two **caller flags** expose the native values. Neither is a spec field, +and their defaults return today's shapes unchanged, so existing applications work as before. -- `exec_report_spec(name, output_format="TABLE", table_shape="structured")` returns: +#### The structured TABLE (`table_shape="structured"`) - ``` - {"kind": "table", - "columns": [{"key", "name", "type", "render", "detail_spec", "valid_values", "max_items", "max_lines"}], - "rows": [{key: native value}], - "total": int | None, "shown": int, "notes": [str]} - ``` +```python +from pyegeria.view.format_set_executor import exec_report_spec + +table = exec_report_spec("Risk-DrE-Basic", output_format="TABLE", table_shape="structured", + params={"search_string": "CocoPharma::Risk::"}) +``` + +returns + +``` +{"kind": "table", + "columns": [{"key", "name", "type", "render", "detail_spec", "valid_values", "max_items", "max_lines"}, ...], + "rows": [{key: native value, ...}, ...], + "total": int | None, "total_basis": "one page", "shown": int, + "notes": [str, ...]} +``` + +- **`columns`**: each column's `type` is inferred from its values: `scalar` (a short value), `text` (long or + multi-line), `list` (of scalars), `map`, `elements` (related elements) or `table` (sub-rows, e.g. a + `detail_spec` column). A column that mixes kinds takes the widest, and the notes say so. `render` is the + column's own, else the default for its type (below). +- **`rows`**: keyed by column **key** (not display name). Related elements are + `{guid, qualifiedName, displayName, type}`, so a renderer can show the display name and link by GUID. +- **`total`, `shown`, `total_basis`**: `shown` is the number of rows. When the query filled its page size, + `total` is `None` and the notes say "Showing the first 100: the query stopped at its page size of 100; more may + exist." (Egeria's paging contract: only an empty page proves the end). Otherwise `total` is the row count, and + `total_basis` says what it rests on: `"one page"`, the single page the query returned. +- **Empty relationship cells say what they mean.** Egeria omits a relationship an element does not have, so an + empty cell could mean "none" or "not asked for". The structured table tells them apart from the request it sent: + - requested (graph depth 1 or more, not excluded by a relationship filter) and absent: an explicit `[]`, and a + note such as "Solution Blueprint: none on 100 rows (read at graph depth 3)."; + - not requested: `null`, and a note such as "Members: not read on 1 row (graph depth 0)."; + - when the request cannot tell: `null` and "not established". +- **Two levels**: an object inside a sub-row is reduced to `{count, names, guid?}`, with a note. +- `_async_run_report(name, client, output_format="TABLE", table_shape="structured")` returns the same shape. + +#### Native DICT rows (`dict_shape="native"`) + +`exec_report_spec(name, output_format="DICT", dict_shape="native")` (and `generate_output(..., dict_shape="native")` +and the async twin) returns DICT rows keyed by display name, as DICT always is, but with native values: + +- lists stay lists; +- related elements are objects with both names, `{guid, qualifiedName, displayName, type}`; +- classifications (`{name, properties?}`) and zones are lists; +- `format=True` columns are not stringified (no link wrapping, no `|` escaping): a consumer that renders a native + value as markdown escapes it itself; +- empty relationship cells and their notes follow the structured table's rules. + +The default, `"flat"`, is unchanged; `dict_shape` does not change TABLE (its structured form is `table_shape`). +Any other `table_shape` or `dict_shape` value is refused with a sentence. Both flags apply to find-method specs: +DOCUMENT, chart and analytic results ignore them. + +A consumer that must read both shapes uses `pyegeria.view.output_formatter.value_names(value)`: the names a DICT +cell holds, from a native list (qualifiedName first) or a flat string (split on commas, a `[text](#guid)` link +unwrapped), never a string iterated character by character. My Egeria's Shop for Data uses it. + +```python +from pyegeria.view.output_formatter import value_names + +value_names([{"guid": "g1", "qualifiedName": "Folder::A"}]) # ['Folder::A'] +value_names(" [Folder::A, Folder::B](#g1) ") # ['Folder::A', 'Folder::B'] +``` - `type` is inferred from the column's values: `scalar` (a short value), `text` (long or multi-line), - `list` (of scalars), `map`, `elements` (related elements) or `table` (sub-rows, e.g. a `detail_spec` - column). A column that mixes kinds takes the widest and the notes say so. `render` is the column's own, - else the default for its type (`text`, `bullets`, `kv`, `join`, `subtable`). Related elements are - `{guid, qualifiedName, displayName, type}`. A table shows two levels: an object inside a sub-row is - reduced to `{count, names, guid?}` with a note. `total` is the row count when the query did not fill - its page; when it did, `total` is `None` and the notes say "more may exist" (Egeria's paging contract). - `total_basis` says what `total` rests on: `"one page"` (the one page the query returned; a short page - is not promised to be the last). - An empty relationship cell says what it means: when the request asked for that relationship (graph - depth 1 or more, not filtered out) it is an explicit empty list and the notes say "none"; when it did - not, the cell is `null` and the notes say "not read". Egeria omits a relationship an element does not - have, so this is the only way to tell the two apart. The flat DICT and text outputs stay blank. -- `exec_report_spec(name, output_format="DICT", dict_shape="native")` (and `generate_output(..., - dict_shape="native")`) returns DICT rows with native values: lists stay lists, related elements are - objects with both names, classifications and zones are lists, and `format=True` columns are not - stringified. The default `"flat"` is unchanged. `dict_shape` does not change TABLE (its structured form - is `table_shape`). -- A column can say how it renders (R2), all optional: - - `render`: `text`, `join`, `bullets`, `kv`, `subtable`, `count` or `link`. Unset, it follows the - value's type (above); a column of related elements with more than `max_items` in a cell defaults to - `count`. `subtable` without a `detail_spec` uses the objects' own scalar keys. - - `max_items` (default 10): list items shown before "+N more". - - `max_lines` (default 3): lines of long text shown in web-oriented outputs. Markdown documents - (REPORT, LIST) do not clamp. - - `label`: `qualified_name` (the default) or `display_name`, the name a related element shows in text - outputs. Set it per column (Digital-Products sets `display_name` on Product Manager and License); - there is no global switch, because consumers split qualifiedNames. - These fields travel in Egeria-held specs (microflow column items; `label` travels as `related_label`, - since an item's own `label` is the column's title). -- Renderers draw from native values (R3): - - **LIST (markdown table cells):** a list of scalars is bullets, one item per line (`a
b`), with - "+N more" past `max_items`; related elements are joined, "a, b (+N more: c, d)", in the column's - `label`; a map is `k: v
...`; a `count` column shows the number. `|` is escaped and newlines - become `
`. A `format=True` or `detail_spec` column keeps its own rendering. REPORT and LIST are - documents, not tiles, so long text is not clamped. - - **REPORT:** lists are markdown lists, and `detail_spec` columns are sub-reports after the row. - - **CLI (`run_report --output-format TABLE`):** asks for the structured table and draws it with Rich: - bullets one per line, a map as a nested table, long text cut at `max_lines` with "…", a sub-table as - a separate table after the main one titled " · ", and columns that do not fit the - terminal dropped from the end of the author's order with a footer naming them. The library function - `list_generic` keeps the flat rows unless asked (`table_shape="structured"`); the Textual report TUI - stays on flat rows. -- Both apply to find-method specs; DOCUMENT, chart and analytic results ignore them. Any other value is - refused with a sentence. `_async_run_report` takes the same flags. +#### Column render intents + +A column can say how its value is drawn. All four fields are optional; unset, the default follows the value's +type, so existing specs need no edit. + +| `render` | Draws | LIST cell (markdown) | CLI (Rich) | Default for | +|---|---|---|---|---| +| `text` | the value as text | `**Likelihood:** Low — ...` | wrapped, cut at `max_lines` with "…" | `scalar`, `text` | +| `join` | names joined | `QN::a, QN::b (+2 more: QN::c, QN::d)` | `a, b (+2 more)` | `elements` | +| `bullets` | one item per line | `first
second
+1 more` | `• first` per line | `list` | +| `kv` | key–value pairs | `contactName: Robbie
hospital: Oak Dene` | a nested two-column table | `map` | +| `subtable` | sub-rows | with a `detail_spec`: `3 items [details](#...)` and a detail section; without: the names joined | "3 items · see below", then a separate table | `table` | +| `count` | the number of items | `14` | `14` | `elements` with more than `max_items` in a cell | +| `link` | a link to the element | today drawn like `join` | today drawn like `join` | (never a default; for renderers that link by GUID) | + +- `max_items` (default 10): items shown before "+N more". +- `max_lines` (default 3): lines of long text shown in web-oriented and terminal outputs. Markdown documents + (REPORT, LIST) are documents, not tiles, and do not clamp. +- `label`: `qualified_name` (the default) or `display_name`, the name a related element shows in text outputs. + It is set per column, never globally, because consumers split and link qualifiedNames. The built-in + Digital-Products spec sets `display_name` on Product Manager and License. +- `subtable` without a `detail_spec` uses the objects' own scalar keys. + +```python +Column(name="Description", key="description", render="text", max_lines=4) +Column(name="Implications", key="implications", render="bullets", max_items=5) +Column(name="Product Manager", key="assigned_actors", label="display_name") +``` + +These fields travel in Egeria-held specs: a microflow column item carries `render`, `max_items` and `max_lines` +under those names, and `label` as `related_label` (an item's own `label` is the column's title). A held spec with +a bad value is skipped with the reason, never a sync failure. + +#### How each surface draws them + +- **LIST (markdown table cells):** by the column's render intent, as in the table above. `|` is escaped and + newlines become `
`. A `format=True` or `detail_spec` column keeps its own rendering. +- **REPORT:** lists are markdown lists, and `detail_spec` columns are sub-reports after the row. +- **CLI (`run_report --output-format TABLE`):** asks for the structured table and draws it with Rich: bullets one + per line, a map as a nested table, long text cut at `max_lines` with "…", each sub-table as a separate table after + the main one titled " · ", and columns that do not fit the terminal dropped from the end of + the author's order with a footer naming them. Caps and notes are printed after the table. The library function + `list_generic` keeps flat rows unless asked (`table_shape="structured"`); the Textual report TUI stays on flat + rows and shows a list as one joined cell. +- **Portal and Egeria Advisor:** they render DICT rows today; asking for the structured table is their next step. + +### Rendered text and notes (6.2.37) + +6.2.37 corrected how report specs render **text** (REPORT, LIST, MD, FORM, HTML and the CLI table). DICT and JSON +row shapes did not change. Anything that parses pyegeria's rendered text should expect: + +- **F1:** header classifications are joined with `", "` (no stray newline before the comma). +- **F2:** REPORT/MD/FORM show a `False` or `0` value instead of dropping it. +- **F3:** FORM/MD say "Diagram omitted in this format; see REPORT or MERMAID." instead of silently dropping a + diagram; `links`, `implemented by` and `sub_components` render as values. +- **F4:** the CLI table shows list items with "(+N more)", never only "N items", and a map as one `k: v; ...` cell + instead of dotted columns. +- **F5:** the CLI table keeps the author's column order and names the columns it cannot show + ("+N more columns: ..."). +- **F6:** LIST never drops an unnamed object in a list value: it shows its first text value or + "(unnamed )". +- **F7:** the Digital-Products `Members` column reads Egeria's `collectionMembers`. Relationship columns show + qualifiedNames unless a column sets `label: display_name`. +- **F8:** a result that filled its page size says so: "Showing the first 100: the query stopped at its page size of + 100; more may exist." It comes as `notes` beside `data` (DICT/TABLE), as a line at the end of text output, and + under the CLI table. It never says only "100". `page_size` and `start_from` given as text are converted to whole + numbers, and anything else is refused in words. +- **F9:** markdown table cells escape `|` and turn newlines into `
`; markdown emphasis is kept. +- **F10:** `format="bulleted-list"` works in REPORT/MD (a markdown list), not only in LIST. +- **LIST cells** follow the column's render intent: a list of scalars is bullets (`a
b`) instead of "a, b". ### Document outputs @@ -463,9 +593,11 @@ Load rules (each refusal is a sentence): analytic function is refused: a find returns elements, not a document. - `DOCUMENT` stands alone in its format row, needs its `document` block, and the spec has no other formats. Only a DOCUMENT format carries a `document` block. -- `file_name` is a single file name: no path separators, no `..`, not hidden. Parameter values - filled into it are made file-name safe (`Folder::Sales/EU` becomes `Folder_Sales_EU`) and the - result is checked again. A parameter the run did not supply is refused. +- `file_name` is a single file name: no path separators, no `..`, not hidden. Each `{field}` is a + plain parameter name, or alternatives separated by `|` (6.2.38): `{scope|search_string}` takes the + first one the run supplies. Values filled into it are made file-name safe (`Folder::Sales/EU` + becomes `Folder_Sales_EU`) and the result is checked again. A field none of whose parameters the + run supplied is refused ("needs one of the parameters 'scope', 'search_string'"). Run it with `exec_report_spec(name, output_format="DOCUMENT", params={...})`. Any other output format asked of a DOCUMENT spec is refused with a sentence naming DOCUMENT, and DOCUMENT asked of @@ -500,11 +632,14 @@ with the reason. **Validators** are registered by name with `pyegeria.view.document_validators.register_document_validators({name: fn})`, where `fn(text, media_type, **validator_options) -> (valid: bool, findings: list[str])`; a name already -registered raises `DocumentValidatorCollision`. Two are built in: +registered raises `DocumentValidatorCollision`. Three are built in: - `json-schema` (jsonschema): option `schema`, for JSON or YAML text; - `shacl` (pySHACL over rdflib): option `shapes` (Turtle), for JSON-LD, Turtle, RDF/XML, - N-Triples… by media type. Findings read " : ". + N-Triples… by media type. Findings are per focus node and path: "Dataset : missing + dct:description", or " : : "; warnings are prefixed and do not + make the document invalid; +- `dcat-ap-3-shacl`: `shacl` bound to the DCAT-AP 3.0.1 shapes shipped with pyegeria. A validator **never fetches over the network**. In a report spec, `schema`/`shapes` must be package data (`package:/`): specs can be held in Egeria and written @@ -528,11 +663,17 @@ the DCAT-AP 3.0.1 shapes vendored in `pyegeria/view/data/dcat-ap-3/` (CC BY 4.0; and hashes in the README there). ```bash +# A collection or folder: writes ./out/DashboardFolder_Consumer_Portal-dcat.jsonld run_report --report "DCAT Catalog" --output-format DOCUMENT --output ./out --param scope=DashboardFolder::Consumer::Portal + +# Or the assets matching a search (6.2.38): the file is named from the search string +run_report --report "DCAT Catalog (Turtle)" --output-format DOCUMENT --output ./out --param "search_string=DataLake::PROJ-CT" ``` -- `scope` is a collection qualifiedName or GUID; `export_dcat` also takes `search_string` (assets - in the asset domain), `format` (`jsonld` or `turtle`) and `page_size`. +- Give `scope` (a collection qualifiedName or GUID) or `search_string` (assets in the asset + domain). Both specs name their file `{scope|search_string}-dcat.jsonld` (or `.ttl`); a run with + neither is refused. `export_dcat` also takes `format` (`jsonld` or `turtle`; each built-in spec + fixes its own) and `page_size`; it reads page by page until an empty page. - A `dcat:Dataset` is an **Asset**. DigitalProducts and Agreements are Bitol's: each is named in the notes (": a DigitalProduct, not a DCAT dataset (Bitol)"), never exported. - It reads as the caller. A zoned Asset the caller can read is `dct:accessRights NON_PUBLIC`. A @@ -1069,7 +1210,10 @@ pyegeria provides ready-to-use CLI commands to discover and run report specs. - `list_reports`: Lists all registered report specs with their Family, Description, and Available Formats. Use `--search/-s` to filter by name, family, description, or aliases. - `run_report`: Executes a report spec and renders output: - - `TABLE`: paged, interactive Rich table in the terminal + - `TABLE`: a Rich table in the terminal, drawn from the structured table (lists one per line, sub-tables after + the main table, dropped columns and "more may exist" notes in a footer) + - `DOCUMENT`: writes the document to `--output ` as its file name (`--force` to overwrite) and prints the + validation line - `MD`/`REPORT`/`FORM`/`LIST`/`HTML`: writes a timestamped file to your outbox - `DICT`: returns machine-readable data (materialized) - `JSON`: returns raw machine-readable data from Egeria diff --git a/pyegeria/view/README.md b/pyegeria/view/README.md index e0ae6042..d562218c 100644 --- a/pyegeria/view/README.md +++ b/pyegeria/view/README.md @@ -15,6 +15,8 @@ into MD/LIST/DICT/REPORT/MERMAID/chart output. | `output_formatter.py` | `generate_output()` — materializes elements into MD/LIST/DICT/REPORT formats. | | `format_set_executor.py` | `exec_report_spec()` — runs a `FormatSet`'s query/render path; dispatches `SERIES`/`BAR`/`PIE` output formats to Vega-Lite chart rendering before normal Format-row lookup; runs a DOCUMENT spec's exporter and validator (SD-1). | | `document_validators.py` | DOCUMENT validators by name: built-ins `json-schema`, `shacl`, `dcat-ap-3-shacl`; never fetch over the network; a spec may name only `package:` files. | +| `structured_table.py` | The structured TABLE (`table_shape="structured"`, `kind: "table"`): column types and render defaults, two levels, total/shown/total_basis, and "none" / "not read" for empty relationship cells. | +| `egeria_relationship_fields.py` | Generated map of Egeria's relationship list fields to their relationship types (`scripts/gen_egeria_relationship_fields.py`). | | `export_dcat.py` | `export_dcat` analytic function: a DCAT-AP 3 catalog (JSON-LD/Turtle) of the Assets in a collection or search, read as the caller (SD-2). Shapes vendored in `data/dcat-ap-3/`. | | `analytic_registry.py` / `analytic_demo_specs.py` | `analytic_registry.py` is the registry of analytic routines (aggregated-result functions, as opposed to per-element query+format). Each entry is a routine declaration (`RoutineDeclaration`; `AnalyticFunctionSpec` is its compatibility view): `inputs` by role, `params` with a `category`, `bindings` (the python binding is `function`, and a module allow-list applies to it only; a report spec names routines by registered name, never by path, ISSUE-173), `declaration` (results, `out`), `tile_safe`, `admission`. `analytic_demo_specs.py` holds one real, executable demo `FormatSet` per registered function. | | `role_supply.py` | `RoleSupply` protocol and `PlainSupply`: how the executor obtains a routine's declared inputs (`egeria_client:`, `reader:`, `viewer`, `subject`). Plain pyegeria supplies the caller's `EgeriaTech` only. `RoleRefused`, `NoSuchReader`, `CallerTokenExpired`. | From 0214ee0789dd71ee5d0cc08314f16271e2851150 Mon Sep 17 00:00:00 2001 From: Dan Wolfson Date: Wed, 11 Nov 2026 21:34:46 +0000 Subject: [PATCH 2/2] docs: the DCAT search paging note is expected until Egeria's asset-domain paging fix (read-back n1) Signed-off-by: Dan Wolfson --- docs/output-formats-and-report-specs.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/output-formats-and-report-specs.md b/docs/output-formats-and-report-specs.md index d94e3217..bbf38d19 100644 --- a/docs/output-formats-and-report-specs.md +++ b/docs/output-formats-and-report-specs.md @@ -673,7 +673,11 @@ run_report --report "DCAT Catalog (Turtle)" --output-format DOCUMENT --output ./ - Give `scope` (a collection qualifiedName or GUID) or `search_string` (assets in the asset domain). Both specs name their file `{scope|search_string}-dcat.jsonld` (or `.ttl`); a run with neither is refused. `export_dcat` also takes `format` (`jsonld` or `turtle`; each built-in spec - fixes its own) and `page_size`; it reads page by page until an empty page. + fixes its own) and `page_size`; it reads page by page until an empty page. A search-scoped + catalog may carry the note "Stopped reading ... Egeria answered with exactly the page before it + (it ignored startFrom)": that is expected until Egeria fixes paging on its asset-domain search + (the Egeria team is investigating). The page that was read is exported in full; the note says + that later pages, if any, were not read. - A `dcat:Dataset` is an **Asset**. DigitalProducts and Agreements are Bitol's: each is named in the notes (": a DigitalProduct, not a DCAT dataset (Bitol)"), never exported. - It reads as the caller. A zoned Asset the caller can read is `dct:accessRights NON_PUBLIC`. A