-
Notifications
You must be signed in to change notification settings - Fork 0
Graph format
Fields that are not Required may take on values undefined or null. Fields that are required must conform to the type specified in the Type column.
When creating a graph with knowledgeGraph.create, you may pass an entire graph to its configuration object. A graph is defined by two properties: concepts and dependencies. Each of these is a list of the appropriate object type.
| Field | Required | Type | Meaning |
|---|---|---|---|
concepts |
Yes | List of concept objects | The concepts that make up the graph (see below) |
dependencies |
No | List of dependency objects | Dependencies between concepts (see below) |
var graph = {
concepts: [..],
dependencies: [..]
};
A concept must have an id that is unique within the graph. Usually this identifier is a short string similar to the concept's name. A concept can have a name which will be displayed next to the concept as a label. A concept can have a content object which defines different types of content for the node. Different plugins may use different subsets of the content object in different ways. See the content section below for more details. Finally, a concept may have a list of dependencies. Each element in the list should refer to the id of another node in the graph (and must therefore have the same type as the target id).
| Field | Required | Type | Meaning |
|---|---|---|---|
id |
Yes | String or number | The unique identifier of this concept |
name |
No | String | A label to be displayed on the concept |
content |
No | List of Content Objects | See below |
dependencies |
No | List of id types or dependency objects |
Concepts that must be learned before this concept |
var concept = {
id: 'theory-of-relativity',
name: 'The Theory of Relativity!',
content: [{..}],
dependencies: ['physics']
};
A content object may contain any properties that are required by your page. For example, if a link property is provided, the concept's name label will be hyperlinked to that address.
| Field | Required | Type | Meaning |
|---|---|---|---|
description |
No | String | More descriptive information for the node |
link |
No | String | Hyperlink for the concept's label |
content: [{
description: 'Relativity - Wikipedia',
link: 'http://en.wikipedia.org/wiki/Theory_of_relativity'
}, {
description: 'Relativity - Youtube',
link: 'www.youtube.com/watch?v=30KfPtHec4s'
}]
Dependency objects may be provided two ways - first, in a list inside a concept object, and second, as a list inside the graph, outside the concept list. If a dependency object is specified inside a concept, the concept field of the dependency object may be omitted - it is implicit. The dependency property should refer to another concept which must be learned first. The optional reason field allows creators to provide motivation for this dependency.
| Field | Required | Type | Meaning |
|---|---|---|---|
concept |
Sometimes | Concept id type |
Concept that can be learned next |
dependency |
Yes | Concept id type |
Concept that must be learned first |
reason |
No | String | Why this dependency exists |
{
concept: 'theory-of-relativity',
dependency: 'physics',
reason: 'Relativity is hard'
}