GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Context serialization created using JSONLD_FRAME_FLAT setting @set for @type results in an invalid Context · Issue #337 · jsonld-java/jsonld-java

Context serialization created using JSONLD_FRAME_FLAT setting @set for @type results in an invalid Context #337

New issue
Copy link
New issue
Copy link
Open
Open
Context serialization created using JSONLD_FRAME_FLAT setting @set for @type results in an invalid Context#337
Copy link

Description

@dnx2710
dnx2710
opened on Mar 16, 2023
Issue body actions

Given a context like:

"@context": {
    "@vocab": "https://example.org",
    "@type": {
      "@container": "@set"
    }
}

When using the serialization for framing, the term's definition value for @id is used and added to the context resulting in:

"@context": {
    "@vocab": "https://example.org",
    "@type": {
      "@id": "type"
      "@container": "@set"
    }
}

This goes against the de-serialization rules:

jsonld-java/core/src/main/java/com/github/jsonldjava/core/Context.java

Lines 324 to 328 in 7a6cd62

if (JsonLdUtils.isKeyword(term)
&& !(options.getAllowContainerSetOnType() && JsonLdConsts.TYPE.equals(term)
&& !(context.get(term)).toString().contains(JsonLdConsts.ID))) {
throw new JsonLdError(Error.KEYWORD_REDEFINITION, term);
}

The type's @id definition was added in change: 673dac2 and seems like it was tested with compact serialization.

Serialization references:

jsonld-java/core/src/main/java/com/github/jsonldjava/core/Context.java

Lines 470 to 472 in 7a6cd62

if (JsonLdConsts.TYPE.equals(term)) {
definition.put(JsonLdConsts.ID, "type");
}

jsonld-java/core/src/main/java/com/github/jsonldjava/core/Context.java

Lines 1173 to 1178 in 7a6cd62

final String cid = this.compactIri((String) definition.get(JsonLdConsts.ID));
final Boolean reverseProperty = Boolean.TRUE
.equals(definition.get(JsonLdConsts.REVERSE));
if (!(term.equals(cid) && !reverseProperty)) {
defn.put(reverseProperty ? JsonLdConsts.REVERSE : JsonLdConsts.ID, cid);
}

jsonld-java/core/src/main/java/com/github/jsonldjava/core/JsonLdProcessor.java

Line 329 in 7a6cd62

final Map<String, Object> rval = activeCtx.serialize();

Reacted by jake-goldsmith

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.