Skip to content

embedding lists in framed document does not expand #206

@eroux

Description

@eroux

The following example (in playground) fails to frame correctly:

input:

{
  "@context": {
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#"
  },
  "@id": "http://www.myresource/uuid",
  "@type": "http://www.myresource/uuidtype",
  "http://www.myresource.com/ontology/1.0#talksAbout": {
    "@list": [
    {
      "@id": "http://rdf.freebase.com/ns/m.018w8",
      "rdfs:label": [
        {
          "@value": "Basketball",
          "@language": "en"
        }
      ]
    }
    ] }
}

code:

	    String jsonld = "{\n" + 
	            "  \"@context\": {\n" + 
	            "    \"rdfs\": \"http://www.w3.org/2000/01/rdf-schema#\"\n" + 
	            "  },\n" + 
	            "  \"@id\": \"http://www.myresource/uuid\",\n" + 
	            "  \"@type\": \"http://www.myresource/uuidtype\",\n" + 
	            "  \"http://www.myresource.com/ontology/1.0#talksAbout\": {\n" + 
	            "    \"@list\": [\n" + 
	            "    {\n" + 
	            "      \"@id\": \"http://rdf.freebase.com/ns/m.018w8\",\n" + 
	            "      \"rdfs:label\": [\n" + 
	            "        {\n" + 
	            "          \"@value\": \"Basketball\",\n" + 
	            "          \"@language\": \"en\"\n" + 
	            "        }\n" + 
	            "      ]\n" + 
	            "    }\n" + 
	            "    ] }\n" + 
	            "}";
	    String frame = "{\n" + 
	            "  \"@context\": {},\n" + 
	            "  \"@type\": \"http://www.myresource/uuidtype\"\n" + 
	            "}";
	    Object jsonObject = JsonUtils.fromString(jsonld);
	    Object res = JsonLdProcessor.frame(jsonObject,  
	            JsonUtils.fromString(frame), new JsonLdOptions());
	    System.out.println("Framed:\n"+JsonUtils.toPrettyString(res)+"\n\n");
	    res = JsonLdProcessor.compact(jsonObject, new HashMap<String,String>(), new JsonLdOptions());
	    System.out.println("Compacted:\n"+JsonUtils.toPrettyString(res)+"\n\n");

output:

Framed:
{
  "@graph" : [ {
    "@id" : "http://www.myresource/uuid",
    "@type" : "http://www.myresource/uuidtype",
    "http://www.myresource.com/ontology/1.0#talksAbout" : {
      "@list" : [ {
        "@id" : "http://rdf.freebase.com/ns/m.018w8"
      } ]
    }
  } ]
}


Compacted:
{
  "@id" : "http://www.myresource/uuid",
  "@type" : "http://www.myresource/uuidtype",
  "http://www.myresource.com/ontology/1.0#talksAbout" : {
    "@list" : [ {
      "@id" : "http://rdf.freebase.com/ns/m.018w8",
      "http://www.w3.org/2000/01/rdf-schema#label" : {
        "@language" : "en",
        "@value" : "Basketball"
      }
    } ]
  }
}

I'm not sure how it's linked to #201, but it looks like #65

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