Representing this JSOn in Quads


#1

Hi there,

How would I represent this structure in a quad format ?

"macs": [
      {
        "coi": "AUTOBOTS",
        "coi_ctrls": [
          {
            "coi_ctrl": "HOTROD",
            "disp_nm": "HOTROD"
          }
        ],
        "disp_nm": "AUTOBOTS"
      }
    ]

#2

First of all, I want to mention that we support import of JSON-LD files, so you may be interested in learning how to turn your custom JSON into this format.

But here is how you can convert it directly to nquads:

I will assume that top-level object has an id <root>. Each JSON object (like {...}) will need to have a file-unique id. We call these IDs Blank Nodes (“bnodes” for short), and they are written as _:xxxx in nquads format. This is all the information we need to convert the file.

The result will look like this:

<root> <macs> _:n1 .

# node 1
_:n1 <coi> "AUTOBOTS" .
_:n1 <disp_nm> "AUTOBOTS" .
_:n1 <coi_ctrls> _:n2 .

# node 2
_:n2 <coi_ctrl> "HOTROD" .
_:n2 <disp_nm> "HOTROD" .

#3

Thanks a bunch, that helps