Skip to content

Context broken on flattening #261

Description

@aawaken

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