Notion Property
A Notion Property is a dynamic property that provides a reference to certain properties of related nodes.
Details
The Format/Code
field of the notion property specifies the constraints for the reference. The parameters are specified as comma-separated values in the following format. <collection>,<properties>,<auto-creation>
Parameter | Value | Description |
---|---|---|
<collection> |
Collection of nodes | Nodes that contain the properties to be referenced |
<properties> |
Comma-seperated list of property names | These properties will be referenced |
<auto-creation> |
Boolean | Optional: If set to true and no reference was found, a node and relationship will be created |
In the above example, the notion property is configured to reference the name
property of the related Task
nodes found within the tasks
collection. This is very similar to the extract()
built-in function.
A notion property can be configured to reference more than one property; the output of the property will then be an object (or a list of objects) instead of a single value / values.
When setting the value of a notion property, Structr will look for an existing object based on the configured property name and value, and create a relationship to the object if present. Structr can even automatically create the related object if it doesn’t exist yet. To enable this auto-creation feature, the Format/Code
field must contain the boolean value true
as its last value.
Note
For dynamically created attributes (i.e. not built-in ones) one needs to append “Property” to the attribute name in the notion definition.
Example with Auto-Creation Enabled
JSON Output
{
"query_time": "0.000897187",
"result_count": 1,
"result": {
"taskNames": [
"Task1",
"Task2",
"Task3",
"Task4"
]
},
"serialization_time": "0.000051543"
}