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 broken on flattening · Issue #261 · jsonld-java/jsonld-java

Context broken on flattening #261

New issue
Copy link
New issue
Copy link
Open
Open
Context broken on flattening#261
Copy link

Description

@aawaken
aawaken
opened on Jun 19, 2019
Issue body actions

Given this context, registered as "http://myproject.com/definitions/v1/models/partnerships":

{
  "@context": {
    "@vocab": "http://myproject.com/definitions/v1/types#",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "state": {
      "@id": "partnershipState"
    },
    "type": {
      "@id": "partnershipType"
    },
    "issuerId": {
      "@id": "issuer"
    },
    "partnerId": {
      "@id": "partner"
    }
  }
}

After flattening using the mentioned context

BASE = "http://myproject.com/definitions/v1/models/";
JsonLdOptions jsonLdOpts = new JsonLdOptions();
String type = "partnerships";
jsonLdOpts.setProcessingMode(JsonLdOptions.JSON_LD_1_1);
Object flattened = JsonLdProcessor.flatten(jsonObject, BASE + type, jsonLdOpts);

the resutling document contains broken context:

 "@context" : {
    "@vocab" : "http://myproject.com/definitions/v1/types#",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "state" : "partnerId:shipState",
    "type" : "partnerId:shipType",
    "issuerId" : "http://myproject.com/definitions/v1/types#issuer",
    "partnerId" : "http://myproject.com/definitions/v1/types#partner"
  }

Looks like the JSON-LD processor replaces "partner" in "partnershipState" with "partnerId:", resulting in "partnerId:shipState"

I'm using jsonld-java:0.12.3

Thanks

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.