v2.1.0 JSON-LD context produces wrong or missing RDF triples, Blank Nodes
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start with oemetadata/v2/v21/context.json, example.json, and schema.json, then reproduce the expansion with rdflib and PyLD as described. Compare the generated RDF against the issue's namespace, term, class/property, prefix, and datatype findings; done means the v2.1 context and example no longer lose or invalidate the specified triples and regression coverage is added.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description of the issue
When oemetadata/v2/v21/example.json is converted to RDF with oemetadata/v2/v21/context.json, some metadata is silently dropped and several triples use wrong or invalid IRIs.
JSON Schema validation still passes, so none of this is visible without converting to RDF.
Expected: every key in the schema either maps to a well-known predicate with the correct datatype, or is explicitly marked as JSON-only.
Current: the problems below. They are ordered by impact.
1. Wrong namespaces for dct and dcat (regression from v2.0.x)
"dcat": "https://www.w3.org/ns/dcat#",
"dct": "https://purl.org/dc/terms/",
Both namespaces are defined with http://. With https://, every dct:* and dcat:* term (title, description, license, subject, spatial, temporal, keyword, accessURL, …) becomes a different, non-standard IRI.
Standard tools and queries that look for dct:title or dcat:keyword will not find them.
v2/v20/context.json and production still use the correct http:// versions. The change came in with 0d86e74 (#296) and has already been copied to oemetadata/latest/context.json on develop.
2. Keys without a term definition are dropped from the RDF
JSON-LD processors silently drop any key the context does not define. There is no error.
These keys exist in schema.json/example.json but not in context.json:
| Key | Probable cause | What is lost |
|---|---|---|
datasetLicenses |
Renamed from licenses (#296); context not updated |
All dataset license information |
resourceLicenses |
Same | All resource license information |
projectContext |
New in v2.1, no term definition | Project, funding, publisher, contact |
mappingRelation |
Added in #302 without a term definition | Every skos:exactMatch etc. on isAbout / valueReference |
3. "@id": null in the example is rejected by strict processors
example.json contains "@id": null six times (in the empty valueReference entries).
pyld fails the whole document with Invalid JSON-LD syntax; "@id" value must be a string.
Some tools (e.g. rdflib) accept it, so whether the file parses depends on the tool.
4. Classes used as properties
These terms map to an RDF class, but they are used as a property (predicate):
| Key | Mapped to | Suggested property |
|---|---|---|
contributors |
foaf:Agent |
dct:contributor (or prov:qualifiedAttribution, see below) |
resources |
dcat:Dataset |
dcat:distribution (or dct:hasPart) |
resource (foreign key reference) |
dcat:Distribution |
a csvw reference property, e.g. csvw:resource |
timeseries |
dct:PeriodOfTime |
dct:temporal, with @type dct:PeriodOfTime on the object |
A class used as a predicate is valid RDF syntax, but the result has no useful meaning and does not work with DCAT/Dublin Core tooling.
5. Broken ncit prefix
"ncit": "http://purl.obolibrary.org/obo/ncit.owl",
The prefix has no trailing separator, so nullable → ncit:NCIT_C47840 expands to http://purl.obolibrary.org/obo/ncit.owlNCIT_C47840, which is not a valid term IRI.
The correct IRI is http://purl.obolibrary.org/obo/NCIT_C47840. That means prefix http://purl.obolibrary.org/obo/, as already used for IAO.
This prefix is the same in v2.0.
6. Datatypes that don't match the values
| Key | Declared type | Example value |
|---|---|---|
embargoPeriod.start / .end |
xsd:dateTime |
"2024-10-11" (a date) |
sources.publicationYear |
xsd:date |
"2023" (a year → xsd:gYear) |
The resulting literals are ill-typed and are rejected or ignored by validating RDF stores and SHACL.
Steps to Reproduce
pip install rdflib pyld- Merge
oemetadata/v2/v21/example.jsonwith the@contextfromoemetadata/v2/v21/context.json. Replace the example's remote@contextURL, and remove the"@id": nullentries so the document parses at all. - Parse with rdflib (
Graph().parse(data=..., format="json-ld")) and inspect the predicates.
Alternatively paste the merged document into the JSON-LD Playground and look at the N-Quads tab. - You will see:
https://purl.org/dc/terms/…andhttps://www.w3.org/ns/dcat#…predicates;- no license, project context or
mappingRelationtriples; …/ncit.owlNCIT_C47840;- rdflib warnings for the ill-typed date literals.
- Running
pyld.jsonld.expand()on the unmodified merged document fails on"@id": null.
Ideas of solution
-
Namespaces: set
dctanddcatback tohttp://, in bothv21/context.jsonandlatest/context.json. This is a trivial fix with no downside. -
Missing terms: add term definitions for
datasetLicenses,resourceLicenses(e.g.dct:license,@container: @set) andprojectContext(e.g.prov:wasGeneratedBywith a scoped context for its sub-keys).
mappingRelationneeds a modelling decision. Its value (skos:exactMatch) really describes which predicate should connect the column to the concept, and a plain term definition can't express that. The options are:- (a) map it as a plain literal /
@vocabIRI for now; - (b) model the mapping as its own node, e.g. SSSOM-style
subject/predicate/object; - (c) have a generator emit
column skos:exactMatch conceptdirectly.
(a) is quick. (b) or (c) produce usable RDF.
- (a) map it as a plain literal /
-
"@id": null: omit@idin the example/template when there is no value, instead of writingnull. Alternatively, have the template use an empty object and document that keys without a value should be left out. -
Classes as properties: remap to the properties suggested above. For
contributors, usedct:contributorfor now. The proper model separates the contribution (role, date, object; a qualified attribution) from the agent (person, with an IRI such as an ORCID). That could be done in a follow-up. -
ncit: change the prefix tohttp://purl.obolibrary.org/obo/(or mapnullableto the full IRI). Consider backporting to v2.0. -
Datatypes: use
xsd:datefor the embargo period, or change the example to full datetimes. Usexsd:gYearforpublicationYear. -
Prevent regressions: add a test that expands the example with the context and fails when a schema key is neither mapped nor on an explicit "JSON-only" allow-list, when a prefix IRI does not end in
/or#, or when a literal is ill-typed. That test would have caught items 1, 2, 5 and 6.
Out of scope here and worth a separate enhancement issue: many nodes end up as blank nodes (licenses, contributors, sources, columns, …) because they have no @id. This makes them impossible to link across datasets.
Context and Environment
- Version used: v2.1.0 (in development,
develop/feature-298-module-energy-system) - Operating system: Linux (WSL2)
- Environment setup and (python) version: Python 3.10.12, rdflib 7.6.0, PyLD 3.3.0; also checked with the JSON-LD Playground
Workflow checklist
- I am aware of the workflow in CONTRIBUTING.md
- Lenguaje dominante
- Python
- Estrellas
- 26
- Forks
- 4
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OpenEnergyPlatform/oemetadata
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
OpenEnergyPlatform/oemetadata#328 ·
-
Develop AI tooling for usersAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
OpenEnergyPlatform/oemetadata#327 · 1 comentario ·
-
Codecov workflow fails on every develop push: frictionless not installedPosiblemente ocupada @jh-RLI la tomó hace 52 días. Abiertopart: github :octocat: status: active 🚧 type: bug 🐛
OpenEnergyPlatform/oemetadata#325 · 1 asignado ·
-
The "@id" fields cause problems, rename to "id"Posiblemente ocupada @jh-RLI la tomó hace 52 días. Abiertopart: backend 🧱 part: documentation 📖 priority: critical 🔥 status: active 🚧 type: enhancement ⚙️
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
OpenEnergyPlatform/oemetadata#320 · 10 comentarios · 2 asignados ·
-
Revise and update testsPosiblemente ocupada @jh-RLI la tomó hace 52 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
OpenEnergyPlatform/oemetadata#316 · 1 comentario · 3 asignados ·
Todos los issues de OpenEnergyPlatform/oemetadata
Issues similares
-
needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
flashinfer-ai/flashinfer#9803 ·
Los mantenedores suelen responder en 1 día
-
bug frontend good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
oscarbol09/thesisforge#61 ·
-
api bug performance
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
oscarbol09/audiobard#159 ·
-
area:web p2 product:business triage:active type:bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 89/100
cuadrao-ai/argus#2328 ·
Los mantenedores suelen responder en 1 día
-
bug frontend good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
nikhilb2/simple_invoicing#907 ·