Skip to content

Make use of x-jsonld-* annotation keywords - #99

Merged
jviotti merged 2 commits into
mainfrom
jsonld
Jul 27, 2026
Merged

Make use of x-jsonld-* annotation keywords#99
jviotti merged 2 commits into
mainfrom
jsonld

Conversation

@jviotti

@jviotti jviotti commented Jul 25, 2026

Copy link
Copy Markdown
Member

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

Review in cubic

@jviotti
jviotti force-pushed the jsonld branch 5 times, most recently from 46d96f9 to 2acb2bc Compare July 27, 2026 13:49
@jviotti
jviotti marked this pull request as ready for review July 27, 2026 15:44
@augmentcode

augmentcode Bot commented Jul 27, 2026

Copy link
Copy Markdown

This pull request is abnormally large and would use a significant amount of tokens to review. If you still wish to review it, comment "augment review" and we will review it.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11 issues found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="schemas/2020-12/ietf/http/method-standard.json">

<violation number="1" location="schemas/2020-12/ietf/http/method-standard.json:14">
P2: The third `anyOf` branch (WebDAV methods) is missing an `x-jsonld-self` annotation — only two of the three branches are annotated. For consistent JSON-LD representation, either add annotations for these values too, or document why they're intentionally excluded.</violation>

<violation number="2" location="schemas/2020-12/ietf/http/method-standard.json:14">
P2: The `#{this}` template in `x-jsonld-self` will not resolve to a concrete value — no template processor exists in this repo. The established pattern from `status-standard.json` is to use hardcoded fragment identifiers (e.g. `#GET`, `#PATCH`). Consider expanding the templates to explicit, concrete IRIs matching the convention.</violation>
</file>

<file name="schemas/2020-12/iso/currency/2015/numeric-currency.json">

<violation number="1" location="schemas/2020-12/iso/currency/2015/numeric-currency.json:399">
P2: The `x-jsonld-self` annotation was added to 164 entries but "Arab Accounting Dinar" (const: 396) was missed. It's the only entry without it, making the schema inconsistent.</violation>
</file>

<file name="schemas/2020-12/w3c/xmlschema/2001/string.json">

<violation number="1" location="schemas/2020-12/w3c/xmlschema/2001/string.json:6">
P2: `x-jsonld-datatype` is only added to `string.json`, while the other 43 XML Schema datatype schemas in the same directory (e.g., `integer.json`, `decimal.json`, `boolean.json`) do not get it. If this annotation is meant to provide JSON-LD datatype mappings for the XML Schema namespace, the same treatment should be applied consistently across all sibling schemas — otherwise consumers get an incomplete mapping for only one type.</violation>
</file>

<file name="schemas/2020-12/w3c/xmlschema/2001/name.json">

<violation number="1" location="schemas/2020-12/w3c/xmlschema/2001/name.json:13">
P1: Duplicate JSON key `x-jsonld-datatype` — the file already has this key with the same value. Duplicate keys have undefined behavior across JSON parsers: some will reject the schema, others silently use the last value. Remove this duplicate line.</violation>
</file>

<file name="templates/schemas/2020-12/xbrl/utr/pure-item-type.jq">

<violation number="1" location="templates/schemas/2020-12/xbrl/utr/pure-item-type.jq:30">
P2: If `$unit_iris` is an empty array at runtime, `$unit_iris[0]` is null and indexing into it (`$unit_iris[0][key]`) raises a jq error before the `!= null` check. This would crash template evaluation for any unit whose `nsUnit` matches the first two IN values. Consider guarding with `(($unit_iris | length) > 0 and $unit_iris[0][key] != null)` to handle empty input safely.</violation>
</file>

<file name="schemas/2020-12/xbrl/utr/memory-item-type-normative.json">

<violation number="1" location="schemas/2020-12/xbrl/utr/memory-item-type-normative.json:23">
P2: QUDT prefixed byte URIs use full `BYTE` instead of abbreviated `BY`, making them unresolvable. Every other SI-prefixed unit in this codebase (e.g., KiloM2, GigaW, HectoL) follows QUDT's convention of abbreviating the base unit name (Metre→M, Watt→W, Litre→L). The same pattern applies to byte: BYTE→BY.</violation>

<violation number="2" location="schemas/2020-12/xbrl/utr/memory-item-type-normative.json:31">
P2: Same QUDT URI issue as Gigabyte entry above — KiloBYTE should be KiloBY.</violation>

<violation number="3" location="schemas/2020-12/xbrl/utr/memory-item-type-normative.json:39">
P2: Same QUDT URI issue — MegaBYTE should be MegaBY.</violation>

<violation number="4" location="schemas/2020-12/xbrl/utr/memory-item-type-normative.json:47">
P2: Same QUDT URI issue — TeraBYTE should be TeraBY.</violation>

<violation number="5" location="schemas/2020-12/xbrl/utr/memory-item-type-normative.json:55">
P2: Same QUDT URI issue — PetaBYTE should be PetaBY.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

"element-name",
"element.name"
],
"x-jsonld-datatype": "http://www.w3.org/2001/XMLSchema#Name",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Duplicate JSON key x-jsonld-datatype — the file already has this key with the same value. Duplicate keys have undefined behavior across JSON parsers: some will reject the schema, others silently use the last value. Remove this duplicate line.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At schemas/2020-12/w3c/xmlschema/2001/name.json, line 13:

<comment>Duplicate JSON key `x-jsonld-datatype` — the file already has this key with the same value. Duplicate keys have undefined behavior across JSON parsers: some will reject the schema, others silently use the last value. Remove this duplicate line.</comment>

<file context>
@@ -10,6 +10,7 @@
     "element-name",
     "element.name"
   ],
+  "x-jsonld-datatype": "http://www.w3.org/2001/XMLSchema#Name",
   "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
   "x-links": [
</file context>

@@ -11,6 +11,7 @@
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The third anyOf branch (WebDAV methods) is missing an x-jsonld-self annotation — only two of the three branches are annotated. For consistent JSON-LD representation, either add annotations for these values too, or document why they're intentionally excluded.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At schemas/2020-12/ietf/http/method-standard.json, line 14:

<comment>The third `anyOf` branch (WebDAV methods) is missing an `x-jsonld-self` annotation — only two of the three branches are annotated. For consistent JSON-LD representation, either add annotations for these values too, or document why they're intentionally excluded.</comment>

<file context>
@@ -11,6 +11,7 @@
   ],
   "anyOf": [
     {
+      "x-jsonld-self": "http://www.w3.org/2011/http-methods#{this}",
       "enum": [
         "GET",
</file context>

],
"anyOf": [
{
"x-jsonld-self": "http://www.w3.org/2011/http-methods#{this}",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The #{this} template in x-jsonld-self will not resolve to a concrete value — no template processor exists in this repo. The established pattern from status-standard.json is to use hardcoded fragment identifiers (e.g. #GET, #PATCH). Consider expanding the templates to explicit, concrete IRIs matching the convention.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At schemas/2020-12/ietf/http/method-standard.json, line 14:

<comment>The `#{this}` template in `x-jsonld-self` will not resolve to a concrete value — no template processor exists in this repo. The established pattern from `status-standard.json` is to use hardcoded fragment identifiers (e.g. `#GET`, `#PATCH`). Consider expanding the templates to explicit, concrete IRIs matching the convention.</comment>

<file context>
@@ -11,6 +11,7 @@
   ],
   "anyOf": [
     {
+      "x-jsonld-self": "http://www.w3.org/2011/http-methods#{this}",
       "enum": [
         "GET",
</file context>

"title": "W3C XML Schema string",
"description": "The string datatype represents character strings in XML (§3.2.1)",
"examples": [ "Hello World", "", "Line 1\nLine 2", "Multiple spaces" ],
"x-jsonld-datatype": "http://www.w3.org/2001/XMLSchema#string",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: x-jsonld-datatype is only added to string.json, while the other 43 XML Schema datatype schemas in the same directory (e.g., integer.json, decimal.json, boolean.json) do not get it. If this annotation is meant to provide JSON-LD datatype mappings for the XML Schema namespace, the same treatment should be applied consistently across all sibling schemas — otherwise consumers get an incomplete mapping for only one type.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At schemas/2020-12/w3c/xmlschema/2001/string.json, line 6:

<comment>`x-jsonld-datatype` is only added to `string.json`, while the other 43 XML Schema datatype schemas in the same directory (e.g., `integer.json`, `decimal.json`, `boolean.json`) do not get it. If this annotation is meant to provide JSON-LD datatype mappings for the XML Schema namespace, the same treatment should be applied consistently across all sibling schemas — otherwise consumers get an incomplete mapping for only one type.</comment>

<file context>
@@ -3,6 +3,7 @@
   "title": "W3C XML Schema string",
   "description": "The string datatype represents character strings in XML (§3.2.1)",
   "examples": [ "Hello World", "", "Line 1\nLine 2", "Multiple   spaces" ],
+  "x-jsonld-datatype": "http://www.w3.org/2001/XMLSchema#string",
   "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
   "x-links": [ "https://www.w3.org/TR/xmlschema-2/#string" ],
</file context>

(if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end) +
(if (.["{http://www.xbrl.org/2009/utr}nsUnit"] | IN("http://www.xbrl.org/2009/utr", "http://www.xbrl.org/2003/instance")) and $unit_iris[0][.["{http://www.xbrl.org/2009/utr}unitId"]] != null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: If $unit_iris is an empty array at runtime, $unit_iris[0] is null and indexing into it ($unit_iris[0][key]) raises a jq error before the != null check. This would crash template evaluation for any unit whose nsUnit matches the first two IN values. Consider guarding with (($unit_iris | length) > 0 and $unit_iris[0][key] != null) to handle empty input safely.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At templates/schemas/2020-12/xbrl/utr/pure-item-type.jq, line 30:

<comment>If `$unit_iris` is an empty array at runtime, `$unit_iris[0]` is null and indexing into it (`$unit_iris[0][key]`) raises a jq error before the `!= null` check. This would crash template evaluation for any unit whose `nsUnit` matches the first two IN values. Consider guarding with `(($unit_iris | length) > 0 and $unit_iris[0][key] != null)` to handle empty input safely.</comment>

<file context>
@@ -26,7 +26,12 @@
         (if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
-        (if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
+        (if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end) +
+        (if (.["{http://www.xbrl.org/2009/utr}nsUnit"] | IN("http://www.xbrl.org/2009/utr", "http://www.xbrl.org/2003/instance")) and $unit_iris[0][.["{http://www.xbrl.org/2009/utr}unitId"]] != null
+         then {"x-jsonld-self": $unit_iris[0][.["{http://www.xbrl.org/2009/utr}unitId"]]}
+         elif .["{http://www.xbrl.org/2009/utr}nsUnit"] == "http://www.xbrl.org/2003/iso4217"
</file context>
Suggested change
(if (.["{http://www.xbrl.org/2009/utr}nsUnit"] | IN("http://www.xbrl.org/2009/utr", "http://www.xbrl.org/2003/instance")) and $unit_iris[0][.["{http://www.xbrl.org/2009/utr}unitId"]] != null
(if (.["{http://www.xbrl.org/2009/utr}nsUnit"] | IN("http://www.xbrl.org/2009/utr", "http://www.xbrl.org/2003/instance")) and ($unit_iris | length) > 0 and $unit_iris[0][.["{http://www.xbrl.org/2009/utr}unitId"]] != null

{
"title": "Terabyte",
"description": "Terabytes of Memory per IEEE 1541-2002",
"x-jsonld-self": "http://qudt.org/vocab/unit/TeraBYTE",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Same QUDT URI issue — TeraBYTE should be TeraBY.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At schemas/2020-12/xbrl/utr/memory-item-type-normative.json, line 47:

<comment>Same QUDT URI issue — TeraBYTE should be TeraBY.</comment>

<file context>
@@ -12,41 +12,47 @@
     {
       "title": "Terabyte",
       "description": "Terabytes of Memory per IEEE 1541-2002",
+      "x-jsonld-self": "http://qudt.org/vocab/unit/TeraBYTE",
       "x-status": "REC",
       "x-symbol": "TB",
</file context>
Suggested change
"x-jsonld-self": "http://qudt.org/vocab/unit/TeraBYTE",
"x-jsonld-self": "http://qudt.org/vocab/unit/TeraBY",

{
"title": "Megabyte",
"description": "Megabytes of Memory per IEEE 1541-2002",
"x-jsonld-self": "http://qudt.org/vocab/unit/MegaBYTE",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Same QUDT URI issue — MegaBYTE should be MegaBY.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At schemas/2020-12/xbrl/utr/memory-item-type-normative.json, line 39:

<comment>Same QUDT URI issue — MegaBYTE should be MegaBY.</comment>

<file context>
@@ -12,41 +12,47 @@
     {
       "title": "Megabyte",
       "description": "Megabytes of Memory per IEEE 1541-2002",
+      "x-jsonld-self": "http://qudt.org/vocab/unit/MegaBYTE",
       "x-status": "REC",
       "x-symbol": "MB",
</file context>
Suggested change
"x-jsonld-self": "http://qudt.org/vocab/unit/MegaBYTE",
"x-jsonld-self": "http://qudt.org/vocab/unit/MegaBY",

{
"title": "Kilobyte",
"description": "Kilobytes of Memory per IEEE 1541-2002",
"x-jsonld-self": "http://qudt.org/vocab/unit/KiloBYTE",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Same QUDT URI issue as Gigabyte entry above — KiloBYTE should be KiloBY.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At schemas/2020-12/xbrl/utr/memory-item-type-normative.json, line 31:

<comment>Same QUDT URI issue as Gigabyte entry above — KiloBYTE should be KiloBY.</comment>

<file context>
@@ -12,41 +12,47 @@
     {
       "title": "Kilobyte",
       "description": "Kilobytes of Memory per IEEE 1541-2002",
+      "x-jsonld-self": "http://qudt.org/vocab/unit/KiloBYTE",
       "x-status": "REC",
       "x-symbol": "kB",
</file context>
Suggested change
"x-jsonld-self": "http://qudt.org/vocab/unit/KiloBYTE",
"x-jsonld-self": "http://qudt.org/vocab/unit/KiloBY",

{
"title": "Yen",
"x-country-names": [ "JAPAN" ],
"x-jsonld-self": "http://publications.europa.eu/resource/authority/currency/JPY",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The x-jsonld-self annotation was added to 164 entries but "Arab Accounting Dinar" (const: 396) was missed. It's the only entry without it, making the schema inconsistent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At schemas/2020-12/iso/currency/2015/numeric-currency.json, line 399:

<comment>The `x-jsonld-self` annotation was added to 164 entries but "Arab Accounting Dinar" (const: 396) was missed. It's the only entry without it, making the schema inconsistent.</comment>

<file context>
@@ -36,312 +39,364 @@
     {
       "title": "Yen",
       "x-country-names": [ "JAPAN" ],
+      "x-jsonld-self": "http://publications.europa.eu/resource/authority/currency/JPY",
       "x-minor-unit": 0,
       "const": 392
</file context>

Comment thread schemas/2020-12/ietf/geojson/geometry-collection.json
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti
jviotti merged commit 0691274 into main Jul 27, 2026
3 checks passed
@jviotti
jviotti deleted the jsonld branch July 27, 2026 16:30
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.

1 participant