The "@id" fields cause problems, rename to "id"

Aperta
#320 10 commenti 0 reazioni 2 assegnatari Vedi su GitHub

@jh-RLI ci sta già lavorando.

Dal 29/9/2026.

  • #322 di @Ludee — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
python
Ambito
documentation

Direzione di ricerca

Look for '@id' field definitions in the metadata schema files. Understand the schema structure and where these fields are used. Check for any validation or processing that depends on the '@id' naming. Rename occurrences to 'id' and ensure the schema remains valid.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

part: backend 🧱 part: documentation 📖 priority: critical 🔥 status: active 🚧 type: enhancement ⚙️

Description of the issue

OEMetadata instance documents use @id wherever a resource — usually an ontology term — is referenced. The @ prefix creates concrete friction for consumers:

  • JSONPath (RFC 9535) reserves @ as the current-node identifier, so $.subject[*].@id is not expressible. Every extraction rule needs bracket notation.
  • GraphQL field names must match /[_A-Za-z][_0-9A-Za-z]*/. @id is illegal as a field name, which blocks a GraphQL surface over OEMetadata.
  • @ is not a valid identifier character in most languages. Generated models need explicit alias declarations (Field(alias="@id") in Pydantic); JS/TS destructuring becomes awkward.
  • YAML reserves @ as an indicator character, so the key must be quoted in any YAML representation.

Ideas of solution

Alias the keyword in the context. Instance documents then write id, and the emitted RDF is unchanged:

"@context": { "id": "@id", ... }

Keyword aliasing exists for exactly this purpose and is standard practice in the JSON-LD ecosystem.

This affects @id in instance documents only. Occurrences inside context term definitions — "publicationYear": {"@id": "fabio:hasPublicationYear"} — are unaffected, because aliased keywords may not be used within a context itself. These are confined to the single context file and never appear in user-authored metadata.

Data Package reserves a root-level id for globally unique identifiers and explicitly permits non-IRI values such as bare UUIDs. If OEMetadata inherits that field unchanged, aliasing id to @id would silently reinterpret such values as relative IRIs resolved against the document base.

Workflow checklist

Lingua principale
Python
Stelle
26
Fork
4
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenEnergyPlatform/oemetadata

Tutte le issue di OpenEnergyPlatform/oemetadata

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.