Skip to content

Fix source relationship direction and duplicate inverses - #333

Merged
ewlarson merged 1 commit into
developfrom
feature/issue-306-source-relationships
Aug 18, 2026
Merged

Fix source relationship direction and duplicate inverses#333
ewlarson merged 1 commit into
developfrom
feature/issue-306-source-relationships

Conversation

@ewlarson

Copy link
Copy Markdown
Contributor

Summary

  • label a child's dct:source link as Source record...
  • label a parent's inverse source links as Derived records...
  • standardize incremental relationship sync on the existing canonical dct:isSourceOf predicate
  • normalize and deduplicate legacy dct:sourceOf rows while they remain in the database
  • make Browse all for derived records filter children through dct_source_sm

Before and after

The original issue identifies this parent and child:

Parent resource

Production currently returns both dct:isSourceOf and the legacy dct:sourceOf for the same 20 children.

Before After this change
Source records... → Address points, Bridges, Bus routes, etc. Derived records... → Address points, Bridges, Bus routes, etc.
A second dct:sourceOf section repeats the same children. The legacy alias is normalized and duplicate children are removed, leaving one section.
Browse all 20 records... falls back to a nonexistent dct:isSourceOf_agg filter. Browse all 20 records... uses include_filters[dct_source_sm][]=b1g_gxSjhzRCQ7xQ.

Child resource

The child stores b1g_gxSjhzRCQ7xQ in dct_source_sm, which means the linked record is its source/parent.

Before After this change
Derived records... → Urban Base Layers [Maryland--Baltimore] {2026} Source record... → Urban Base Layers [Maryland--Baltimore] {2026}

The Princeton example from the issue currently has the same duplicate inverse predicates; it is normalized by the same compatibility path.

Root cause

The frontend labels for dct:source and dct:isSourceOf were reversed. Separately, the full relationship population script used dct:isSourceOf, while newer incremental synchronization emitted dct:sourceOf. A full reconciliation therefore left the old canonical row in place and added a second alias row.

Incremental synchronization now emits dct:isSourceOf and includes dct:sourceOf in its cleanup set. The relationship presenter also canonicalizes and deduplicates both spellings, so deploying and refreshing resource representations corrects existing records without requiring an immediate full relationship rebuild.

Validation

  • python -m pytest backend/tests/services/test_relationship_sync.py backend/tests/services/test_relationship_service.py — 21 passed
  • make lint-check — passed
  • npm test -- --run — 946 passed
  • npm run build — client and SSR production builds passed
  • targeted frontend ESLint and Prettier checks — passed

Closes #306

@ewlarson
ewlarson requested a review from karenmajewicz August 18, 2026 17:07
@ewlarson
ewlarson marked this pull request as ready for review August 18, 2026 17:07
@ewlarson
ewlarson merged commit 78466a2 into develop Aug 18, 2026
12 checks passed
@ewlarson
ewlarson deleted the feature/issue-306-source-relationships branch August 18, 2026 18:48
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.

Source relationship is displaying backwards

1 participant