-
Notifications
You must be signed in to change notification settings - Fork 1
Nodes
Nodes are the building block of the whole pipeline to augment data with semantics. With Nodes, data can be passed in JSON, which can be explored, described, and tagged, and the nodes can then be used to build data models.
A Node corresponds roughly to one of the accessors of the JSON data passed in parameter, namely, a path/data pair. In addition, Nodes can contain sub-nodes, called children, to form a tree structure.
Note: Tree is a special node with the automatic name "$" and the automatic type "Root". Useful for quickly creating trees!
Nodes contain default attributes, generated at initialization, and immutable:
-
fieldName
: What is the name of the accessor, i.e., the endpoint of the accessor. -
data
: The data of the Node; empty if it is another Node (e.g., dict or list). -
foundType
: The type corresponding todata
. -
parent
: If applicable, the parent Node to this Node. -
children
: If applicable, the children of this Node. -
path
: The full path of this Node's accessor.
Note: Nodes can be of type NodeList or NodeDict, to differentiate them even more explicitly from root (Tree) or leaf Nodes!
In addition to the immutable attributes described above, Nodes can contain other arbitrary attributes.
Note: More on the attributes workflow.
In particular, at initialization, Nodes get the following attributes free of charge:
-
descriptiveType
: A URI to describe (in a semantic sense) the type ofdata
. -
unique
: Whether the Node is unique (a single path in the whole Tree) or not. -
default
: If applicable, the default value ofdata
. -
description
: A human-readable description ofdata
, whatever its usefulness, content, or other element useful to the reader. -
choices
: If applicable, a list containing possible choices fordata
. -
regex
: If applicable, a regex for formattingdata
.
By default, these values are set to None, but can be changed by a browser to add information to the nodes.
Finally, a special attribute that can be used in many ways: traversal
, which is basically a dictionnary of the whole Node and its children.
The idea of the Nodes is to be the main entry point for data exploration, and to allow you to prepare the ground for the generation of Models. It is with them that you start your journey towards the golden fleece, concretely. (:.
from argonodes.nodes import Tree
json_data = ...
tree = Tree(json_data)