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 — omit doesn't work for multiple objects · Issue #316 · jsonld-java/jsonld-java

omit doesn't work for multiple objects #316

New issue
Copy link
New issue
Copy link
Open
Open
omit doesn't work for multiple objects#316
Copy link

Description

@garpinc
garpinc
opened on Jun 7, 2021
Issue body actions

I'm getting back following even though I've specified to omit graph

{
  "@context" : [ "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/ClassConcept", "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/PrimaryKey", "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/MetadataDictionary" ],
  "@graph" : [ {
    "uri" : "http://test1",
    "type" : "metaframe:MetadataDictionary",
    "metaDataConcepts" : {
      "uri" : "http://testc1",
      "type" : "metaframe:ClassConcept",
      "primaryKey" : [ {
        "uri" : "http://pk1",
        "type" : "metaframe:PrimaryKey",
        "priority" : "5"
      }, {
        "uri" : "http://pk2",
        "type" : "metaframe:PrimaryKey",
        "priority" : "6"
      } ]
    },
    "title" : "test1"
  }, {
    "uri" : "http://test2",
    "type" : "metaframe:MetadataDictionary",
    "title" : "test2"
  } ]
}

I see

2.3.4 Omit graph flag
The omit graph flag determines if framed output containing a single node object is contained within @graph, or not. The initial value for the omit graph flag is set using the omitGraph option, or based on the processing mode; if processing mode is json-ld-1.0, the output always includes a @graph member, otherwise, the @graph member is used only to describe multiple node objects, consistent with compaction. See § 4.2.2 Framing Algorithm for a further discussion.

which seems to indicate "@graph member is used only to describe multiple node".. But what do I do if I want no graph at all and I just want a list of the objects?

Activity

  1. acka47 commented on Jun 8, 2021

    @acka47
    acka47
    on Jun 8, 2021
    More actions

    I see several reasons the data couldn't be processed as you wish:

    1. It is not valid JSON-LD: The @context links do not point to valid JSON-LD context files (see also the JSON-LD playground)
    2. You use uri instead of the JSON-LD keyword @id to indicate the URI of a node.
    3. However, if I use a valid context (like https://schema.org for testing purpose) and @id you won't get rid of the @graph anyway because you have two distinct nodes (http://test1 and http://test2) which are not linked to each other so that one description can not be embedded in the other and @graph becomes necessary.

    Here is some correct JSON-LD for testing:

    {
      "@context":"https://schema.org",
      "@graph":[
        {
          "@id":"http://test1",
          "type":"metaframe:MetadataDictionary",
          "metaDataConcepts":{
            "@id":"http://testc1",
            "type":"metaframe:ClassConcept",
            "primaryKey":[
              {
                "@id":"http://pk1",
                "type":"metaframe:PrimaryKey",
                "priority":"5"
              },
              {
                "@id":"http://pk2",
                "type":"metaframe:PrimaryKey",
                "priority":"6"
              }
            ]
          },
          "title":"test1"
        },
        {
          "@id":"http://test2",
          "type":"metaframe:MetadataDictionary",
          "title":"test2"
        }
      ]
    }

    When I put this in the playground and add a JSON-LD frame with the node of type metaframe:MetadataDictionary as root object and @embed": "@always", there will still be two separate nodes that need a @graph around them to be represented as JSON-LD. See https://tinyurl.com/246b6sfp.

  2. dr0i commented on Jun 15, 2021

    @dr0i
    dr0i
    on Jun 15, 2021
    Member
    More actions

    @acka47 thx for clarification/explanation! Very detailed :)
    @garpinc is this helpful to solve your problem?

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.