Skip to content

Graph Structure

Kasi Chonpimai edited this page Dec 6, 2016 · 1 revision

Graph in Knowledge API

As defined in /model/graph.js, a graph consists of a Map of {id: Resource}. The resource class itself is decoupled into /model/resource.js, so that the graph maintain simple structure and doesn't need full knowledge of what a resource is.

JSON Serialization

Instead of a list of resources, to make it easier for client to use the graph data, the API returns graph structure in the following format:

{
  nodes: [
    {
      uri: <resource_uri>, 
      properties: [
        <property_type>: <uri>,
        ... 
      ]
    },
    ...
  ],
  edges: [
    {
      s: <source_uri>
      t: <terminate_uri>
      r: <relationship>
    },
    ...
  ]
}

Clone this wiki locally