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

Abierto
#320 10 comentarios 0 reacciones 2 asignados Ver en GitHub

@jh-RLI ya está trabajando en esto.

Desde el 29/9/2026.

  • #322 de @Ludee — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
45/100
Tipo de issue
Refactorización
Claridad
Necesita aclaración
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Python
Estrellas
26
Forks
4
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de OpenEnergyPlatform/oemetadata

Todos los issues de OpenEnergyPlatform/oemetadata

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.