Skip to content

Node configuration

Zack edited this page May 3, 2018 · 9 revisions

With Popoto you can customize the display of each specific node.

The node providers defines all the functions and properties used to generate nodes on graph or viewers. This provider must contain an entry for each node labels and can be overridden to customize node rendering.

 popoto.provider.node.Provider = {}

If some functions or properties are not set in popoto.provider.node.Provider, the rendering used the default node configuration.

To add configuration you must first define the target type of the configuration, to apply the configuration for all node of that type.

To do that, wrap your configuration into an javascript object with as name the label of the desired type.

For example if we want to customize all Person nodes write:

popoto.provider.node.Provider = {
    "Person": {}
}

Now we can add all the desired configuration for the Person Node

All configuration are listed below:

Label specific parameters

These attributes are specific to a node label and will be used for every node having this label.

Is searchable

Defines whether this label can be used as root element of the graph query builder.

This property is also used to determine whether the label can be displayed in the taxonomy filter.

The default value is true.

"isSearchable": true

Auto expand relations

Defines whether this label will automatically expend its relations when displayed on graph.

If set to true, once displayed additional request will be sent on the database to retrieve its relations.

The default value is false.

"autoExpandRelations": false

Is auto load value

Defines whether this label will automatically load its available data displayed on graph.

If set to true, once displayed additional request will be sent on the database to retrieve its possible values.

The default value is false.

"isAutoLoadValue": false

Return attributes

Defines the list of attribute to return for node of this label. All the attributes listed here will be added in generated cypher queries and available in result list and in node provider's functions.

The default value contains only the Neo4j internal id. This id is used by default because it is a convenient way to identify a node when nothing is known about its attributes.

But you should really consider using your application attributes instead, it is a bad practice to rely on this attribute.

"returnAttributes": [query.NEO4J_INTERNAL_ID]

Value order by attribute

Defines the attribute used to order the value displayed on node.

Default value is "count" attribute.

"valueOrderByAttribute": "count"

Is value order ascending

Defines whether the value query order by is ascending, if false order by will be descending.

Default value is false (descending)

"isValueOrderAscending": false

Result order by attribute

Defines the attribute used to order the results.

Default value is "null" to disable order by.

"resultOrderByAttribute": null

Is result order ascending

Defines whether the result query order by is ascending, if false order by will be descending.

Default value is true (ascending)

"isResultOrderAscending": true

Constraint attribute

Defines the attribute of the node to use in query constraint for nodes of this label.

This attribute is used in the generated cypher query to build the constraints with selected values.

The default value is the Neo4j internal id.

This id is used by default because it is a convenient way to identify a node when nothing is known about its attributes.

But you should really consider using your application attributes instead, it is a bad practice to rely on this attribute.

"constraintAttribute": query.NEO4J_INTERNAL_ID

Display attribute

Defines the attribute of the node to use by default to display the node. This attribute must be present in returnAttributes list.

The default value is undefined.

If undefined the first attribute of the returnAttributes will be used or constraintAttribute if the list is empty.

"displayAttribute": undefined

Get predefined constraints

Return the list of predefined constraints to add for the given label.

These constraints will be added in every generated Cypher query.

For example if the returned list contain ["$identifier.born > 1976"] for "Person" nodes everywhere in popoto.js the generated Cypher query will add the constraint "WHERE person.born > 1976"

@returns {Array}

"getPredefinedConstraints": function () {
    return [];
}

Filter result query

Filters the query generated to retrieve the queries. @param initialQuery contains the query as an object structure. @returns {}

"filterResultQuery": function (initialQuery) {
    return initialQuery;
}