Content-Length: 327068 | pFad | https://github.com/w3c/json-ld-api/issues/514

C8 No roundtrip with property-based data indexing · Issue #514 · w3c/json-ld-api · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No roundtrip with property-based data indexing #514

Closed
pchampin opened this issue Oct 21, 2020 · 6 comments · Fixed by #528
Closed

No roundtrip with property-based data indexing #514

pchampin opened this issue Oct 21, 2020 · 6 comments · Fixed by #528

Comments

@pchampin
Copy link
Contributor

This issue has been spotted in w3c/wot-thing-description#988. I can't yet decide if it is an implementation bug (which appears in both the playground and the Ruby distiller) or a problem in the API spec.

It is caused during compaction, when the @index property of a term definition using a compact IRI. Not only does it not roundtrip, but it fails with an "IRI confused with prefix" error.

Minimal example (see in playground) :

{
  "@context": {
    "ex": "http://example.org/ns/",
    "prop": {
      "@id": "ex:prop",
      "@container": "@index",
      "@index": "ex:name"
    }
  },
  "prop": {
    "foo": { "@id": "ex:foo"},
    "bar": { "@id": "ex:bar"}
  }
}

Note that expansion works fine. Replacing "@index": "ex:name" with "@index": "http://example.org/ns/name" in the compaction context solves the problem.

What is embarassing is that the example from the spec suffers from the same problem: it expands correctly, but fails to compact back, with the same error (see in playground).

@RoboPhred
Copy link

RoboPhred commented Oct 22, 2020

removed

I had thought I found another form of the same issue, but the issue I was tracking was a flaw in the JSON Schema RDF context, which has since been corrected.

@gkellogg
Copy link
Member

It's falling afoul of logic in the Term Selection algorithm step 9 where it things that var should be an IRI or IRI reference. Something is needed for this case, and it's odd that it didn't come up before now.

I'd say that this is a spec error with an unknown resolution at this time.

@vcharpenay
Copy link

vcharpenay commented May 14, 2021

Replacing "@index": "ex:name" with "@index": "http://example.org/ns/name" in the compaction context solves the problem.

If the problem is roundtripping, it seems to me that there's another related problem in this example: when compacting with the full URI as index property, the result is as follows (on the playground):

{
  "@context": {
    "ex": "http://example.org/ns/",
    "prop": {
      "@id": "ex:prop",
      "@container": "@index",
      "@index": "http://example.org/ns/name"
    }
  },
  "prop": {
    "@none": [
      {
        "@id": "ex:bar",
        "ex:name": "bar"
      },
      {
        "@id": "ex:foo",
        "ex:name": "foo"
      }
    ]
  }
}

The @none index key shouldn't be here. It's as if the index property is ignored when compacting. I've encountered the same problem on the WoT Thing Description context (see w3c/wot-thing-description#1077).

@gkellogg
Copy link
Member

Summary:

The value of @index on a property map can be a Compact IRI in addition to an IRI. The Compaction Algorithm is updated to first expand this value before re-compacting it. Added additional language to the Compaction Algorithm step 12.8.9.6.1 to first expand container key before compacting it.

@gkellogg
Copy link
Member

@iherman this may or may not be considered an editorial change. Also, the description doesn't render properly in the errata doc.

@gkellogg
Copy link
Member

I've updated my implementation and deployed it on the Ruby RDF Distiller.

gkellogg added a commit that referenced this issue May 20, 2021
… to first expand container key before compacting it.

Fixes #514.
gkellogg added a commit that referenced this issue Oct 24, 2024
…ss-3 changes. (#616)

* Add candidate change and insertions for #380/#388.
* Reorder change details with newest first.
* Comment out 2021-01-05 editorial changes to node-map-generation algorithm.
* Comment out 2021-02-25 editorial changes to IRI expansion algorithm.
* Add Candidate Correction 2 for issue #514.
* CANDIDATE CORRECTION 3 for issue 565, PR 566 to "Fix context processing for reverse terms".
* CANDIDATE CORRECTION 4 for `extractAllScripts` option to `toRdf()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/w3c/json-ld-api/issues/514

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy