Skip to content

Research: Cross-resource references — @link objects only vs. flat @id strings for interoperability #6

@Sam-Bolling

Description

@Sam-Bolling

Finding

The server returns cross-resource references exclusively as @link objects (e.g., "system@link": { "href": "systems/<uuid>", "rel": "..." }) and never as flat @id strings (e.g., "system@id": "0520"). This is a research spike to determine which cross-reference format(s) the OGC spec mandates, what clients should expect, and whether both formats should be supported for interoperability.

Review Source: Live integration testing and client library audit from ogc-csapi-explorer and ogc-client-CSAPI_2
Severity: P4-Informational (research spike)
Category: API Design / Interoperability
Ownership: connected-systems-go


Problem Statement

When fetching resources like datastreams, the Go server returns cross-references to parent systems using @link objects:

{
  "id": "abc-123",
  "name": "Temperature",
  "system@link": {
    "href": "systems/def-456",
    "rel": "parent",
    "type": "application/geo+json"
  }
}

It does NOT return a flat system@id field. In contrast, OSH SensorHub returns flat @id references:

{
  "id": "0812",
  "name": "Temperature",
  "system@id": "0520"
}

Comparative behavior:

Server system@id (flat) system@link (object)
OSH SensorHub ✅ Present ❌ Absent
connected-systems-go ❌ Absent ✅ Present

Impact on clients:

Our client library (ogc-client-CSAPI_2) originally parsed only system@id. When pointed at the Go server, datastreams appeared to have no parent system — breaking the Explorer's map view (0 datastreams shown) and the data model diagram's system↔datastream navigation.

Workarounds applied:

  1. Library parser (part2.ts): Added system@link.href fallback in parseBaseStream() — extracts system ID from the link href
  2. Explorer (MapViewPage.vue): Added extractSystemId() helper that checks system@link.hrefsystem@idsystem@link chain
  3. Explorer (DataModelDiagram.vue): Added system@link.href fallback for diagram navigation
  4. Filed as library issue: Phase 8 / Task C1: Issue #166 — Part 2 @link fallback in cross-reference fields ogc-client-CSAPI_2#166

Research Questions

This spike should produce analysis, findings, and recommendations that may result in follow-on issues:

  1. What does OGC 23-002 specify for cross-resource references? Does it mandate @id, @link, or both?
  2. Are @id and @link supposed to be alternative encodings of the same relationship, or do they have different semantics? (e.g., @id for in-collection references, @link for cross-collection)
  3. Should a conformant server provide BOTH @id AND @link? Or is one sufficient?
  4. What about @link.href format — should it be a relative path (systems/uuid) or an absolute URL? Our Explorer's extractSystemId() must handle both.
  5. How do other OGC API implementations handle this? (e.g., pygeoapi, ldproxy, GeoServer)
  6. Should connected-systems-go also emit system@id alongside system@link for backward compatibility? Would this be a simple addition?
  7. Are there other cross-reference patterns we haven't encountered yet? (e.g., deployment@link, procedure@link, datastream@link)

Expected Deliverables

  • Analysis of OGC 23-002 cross-reference encoding requirements
  • Inventory of all cross-reference fields in Part 1 and Part 2 resource types
  • Comparison of @id vs @link behavior across known CSAPI server implementations
  • Recommendation: emit both, emit one, or make it content-negotiable
  • If changes are recommended, file follow-on implementation issue(s)

Scope

  • ❌ Do NOT implement changes in this spike — research and recommend only
  • ❌ Do NOT change client-side workarounds — they handle both formats and should remain

Related Issues

References

# Document What It Provides
1 OGC 23-001 §7.2 Resource links and cross-references
2 OGC 23-002 §8-10 Part 2 resource JSON encoding
3 GeoJSON (RFC 7946) Base format that CSAPI extends
4 ogc-client-CSAPI_2 #166 Library issue for @id vs @link parsing
5 Explorer commit 2f0869a Client-side workaround for system@link.href fallback

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions