Skip to content

Add relational ingest + schema-fingerprinted DatasetView flattening (Phases 0–2) - #10

Draft
chicoreus with Copilot wants to merge 7 commits into
masterfrom
copilot/first-non-flat-data-pull-request
Draft

chicoreus with Copilot wants to merge 7 commits into
masterfrom
copilot/first-non-flat-data-pull-request

Conversation

Copilot AI commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

This PR introduces the first non-flat-data implementation slice by adding relational ingest and reusable, standalone DatasetView flattening while preserving the existing flat execution pipeline. It covers Phase 0–2 scope: provenance-aware graph modeling, relational metadata ingest, view JSON reuse/compatibility, flattening policies, built-in view applicability, and incremental GUI/CLI wiring.

  • Relational model + provenance

    • Added RecordGraph (core row + related rows by relation name).
    • Added value-level provenance via SourceCell and surfaced it on CanonicalRecord (provenanceByTerm).
    • Added schema discovery records (DatasetSchema, TableSchema, RelationshipSchema) for view authoring and compatibility checks.
  • Relational metadata + ingest

    • DwC-A parsing now captures extension coreid (DwcArchiveMetaParser / DwcArchiveCoreMeta).
    • Data Package parsing now captures schema.foreignKeys (DataPackageDialectParser / DataPackageResourceMeta).
    • Added RelationalDatasetIngestor to build deterministic RecordGraph collections from selected core/grain + related rows, with diagnostics for unmatched relations.
  • Reusable DatasetView JSON + compatibility

    • Added standalone view model: DatasetView, DatasetViewJoin, DatasetViewMapping, DatasetViewCardinalityPolicy.
    • Added DatasetViewIO for load/save and schema-fingerprint validation.
    • Added deterministic schema fingerprinting (SchemaFingerprint) based on table shape + relationships to gate reuse across compatible datasets.
  • View flattening (bridge to current flat pipeline)

    • Added ViewFlattener and ViewFlattenResult.
    • Implemented cardinality policies:
      • AGGREGATE: deterministic " | " aggregation
      • FIRST_ROW: deterministic first related row selection
      • REJECT: non-fatal diagnostic + empty mapped value
    • Preserves per-term source provenance on flattened records for future write-back support.
  • Built-in views + fallback behavior

    • Added built-in view selector (BuiltInDatasetViews) for:
      • DwC Data Package → occurrence grain (when required relationships exist)
      • Event core + occurrence extension → occurrence grain (when applicable)
    • DefaultIngestService now supports:
      • explicit view path (bdq.dataset.view / --dataset-view)
      • built-in view auto-application when schema matches
      • fallback to existing flat ingest behavior when no view applies.
  • CLI/config + GUI integration

    • Added config key bdq.dataset.view and CLI flag --dataset-view.
    • Threaded dataset view through AppConfig, ConfigLoader, WorkbenchFacade, and app CLI help.
    • Added incremental Swing workflow entrypoint: Build Dataset View... (adjacent to record filters), with schema/relationship display, suggested direct mappings, preview, and load/save JSON.
// Explicit standalone view usage (CLI/config path wired through AppConfig -> IngestService)
RecordDataset dataset = ingestService.ingest(
	config.datasetPath(),
	config.datasetTable(),
	config.datasetView()
);

Copilot AI and others added 2 commits September 23, 2026 01:36
Co-authored-by: chicoreus <3864169+chicoreus@users.noreply.github.com>
Co-authored-by: chicoreus <3864169+chicoreus@users.noreply.github.com>
Copilot AI changed the title [WIP] Add relational ingest and provenance tracking for dataset views Add relational ingest + schema-fingerprinted DatasetView flattening (Phases 0–2) Sep 23, 2026
Copilot AI requested a review from chicoreus September 23, 2026 01:45

@chicoreus chicoreus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot [INFO] 26 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.410 s
[INFO] Finished at: 2026-09-22T22:02:47-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.14.0:compile (default-compile) on project bdq_workbench: Compilation failure: Compilation failure:
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[139,25] illegal start of expression
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[107,17] 'try' without 'catch', 'finally' or resource declarations
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[151,25] illegal start of type
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[151,32] invalid method declaration; return type required
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[151,61] expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[161,19] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[163,17] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[169,17] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[170,17] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[172,25] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[174,33] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[175,25] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[177,17] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[179,17] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[181,25] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[183,33] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[185,33] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[189,33] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[192,33] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[194,25] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[196,17] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[198,17] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[199,9] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[203,17] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[205,17] class, interface, enum, or record expected
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/RelationalDatasetIngestor.java:[206,9] class, interface, enum, or record expected

Co-authored-by: chicoreus <3864169+chicoreus@users.noreply.github.com>

Copilot AI commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot [INFO] 26 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------...

Fixed in commit 478c7ff. I moved resolveReferencedTableLabel(...) out of ingestDataPackage(...) into class scope, which resolves the malformed method nesting that caused the reported compiler syntax errors.

@chicoreus chicoreus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot [ERROR] Errors:
[ERROR] BdqWorkbenchGuiTest.buildConfigUsesGuiDedupSelection:741 » NoSuchMethod org.filteredpush.bdq_workbench.app.BdqWorkbenchGui.buildConfig(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,org.filteredpush.bdq_workbench.app.CachedResourceResolver,org.filteredpush.bdq_workbench.app.AppConfig)
[INFO]
[ERROR] Tests run: 185, Failures: 0, Errors: 1, Skipped: 0

Co-authored-by: chicoreus <3864169+chicoreus@users.noreply.github.com>

Copilot AI commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot [ERROR] Errors:
[ERROR] BdqWorkbenchGuiTest.buildConfigUsesGuiDedupSelection:741 » NoSuchMethod org.filteredpush.bdq_workbench.app.BdqWorkbenchGui.buildConfig(java.lang.String,java.lang.S...

Fixed in commit ad5fc82. I restored a backward-compatible BdqWorkbenchGui.buildConfig(...) overload with the previous signature and delegated it to the dataset-view-aware overload using an empty dataset-view value, which resolves the NoSuchMethod test error.

@chicoreus chicoreus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot [ERROR] Errors:
[ERROR] BdqWorkbenchGuiTest.buildConfigUsesGuiDedupSelection:741 » NoSuchMethod org.filteredpush.bdq_workbench.app.BdqWorkbenchGui.buildConfig(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,org.filteredpush.bdq_workbench.app.CachedResourceResolver,org.filteredpush.bdq_workbench.app.AppConfig)
[INFO]
[ERROR] Tests run: 185, Failures: 0, Errors: 1, Skipped: 0

Copilot AI commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot [ERROR] Errors:
[ERROR] BdqWorkbenchGuiTest.buildConfigUsesGuiDedupSelection:741 » NoSuchMethod org.filteredpush.bdq_workbench.app.BdqWorkbenchGui.buildConfig(java.lang.String,java.lang.S...

This is already addressed by commit ad5fc82, which reintroduced the legacy buildConfig(...) signature expected by BdqWorkbenchGuiTest and delegates to the new dataset-view-aware overload.

@chicoreus chicoreus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot in the case of 22:26:03.511 DEBUG o.f.b.ingest.CoreTableSelector - Dataset offers one table, occurrence.txt [rowType=OCCURRENCE (declared rowType http://rs.tdwg.org/dwc/terms/Occurrence), declared core] the build dataset view button can immeadiately launch a message dialog with this message that is just a debug log message. Also, it may be this case or not, but clicking the build dataset view button runs for a while then runs out of heap space, it shouldn't need to read much from the file to determine fields for a view - this is with a darwin core archive input file with only an occurrence table.

Co-authored-by: chicoreus <3864169+chicoreus@users.noreply.github.com>

Copilot AI commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot in the case of 22:26:03.511 DEBUG o.f.b.ingest.CoreTableSelector - Dataset offers one table, occurrence.txt [rowType=OCCURRENCE (declared rowType http://rs.tdwg.org/dwc/terms/Occurrence), dec...

Implemented in commit 79e8a0c. The Build Dataset View flow now performs a lightweight metadata-only schema inspection first and immediately shows an info dialog for single-table datasets (including messages like Dataset offers one table, occurrence.txt [...]), then returns without running relational ingest/preview. This avoids the heavy path and prevents unnecessary heap pressure for single-table inputs.

@chicoreus chicoreus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.14.0:compile (default-compile) on project bdq_workbench: Compilation failure
[ERROR] /home/mole/git/bdq_workbench/src/main/java/org/filteredpush/bdq_workbench/ingest/DatasetSchemaInspector.java:[103,43] incompatible types: java.util.Optional<capture#1 of ? extends java.util.zip.ZipEntry> cannot be converted to java.util.Optional<java.util.zip.ZipEntry>

Co-authored-by: chicoreus <3864169+chicoreus@users.noreply.github.com>

Copilot AI commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.14.0:compile (default-compile) on project bdq_workbench: Compilation failure
[ERROR] /home/mole/git/bdq_workben...

Fixed in commit a2f8d20. I removed the Optional<ZipEntry> path that was producing the wildcard incompatibility and switched to resolving a conventional core entry name as a plain String (occurrence.txt or first .txt entry), preserving behavior while eliminating the compile error.

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.

2 participants