Required Permission: Project Settings management (Read more about permissions in User Groups)
Table of Contents
The data schema defines how data from the graph database is represented or formatted in the UI, as well as the project's virtual properties. Only users with Project Settings permission can change it.
Data Schema is also used to specify which node labels and relationship types are used in the project (the default is an unrestricted view of all nodes and relationships). Nodes and relationships not listed in this setting are not visible in the project. This setting can be used to distinguish between data for analysis and other data in the graph that can be hidden for all users.
Another usage of Data Schema is to set up UID values as long-term IDs for saving visualizations when using the Neo4j graph DB. For more information, see UID in Saved Visualizations.
Configuration
In the "Application Menu" (top right), choose the page "Project Settings".
In the "Project Settings" panel, click on the "Data Schema" row.
Enter the JSON configuration and confirm it by pressing the "Save" button.
Description of configuration
Configuration is entered in JSON format. Example:
{ "nodeLabels":["Company", "Person"], "relationshipTypes":["*"], "calculateNumOfRelatedNodes":false, "calculateNumOfRelations":true, "nodeUid":{ "labels":["Company","Person"], "property":"uuid", "manageIndex":true }, "relationshipUid":{ "types":[ ], "property":"uuid", "manageIndex":true }, "nodeProperties":{ "database":[ { "property":"title", "title":"Title", "dataType":"text", "dataRole":null, "formatString":null, "hidden":false, "inputRestrictions":{ "mandatory":true, "readOnly":false, "strict":false, "multiple":false, "values":null, "groups":null, "trimming":false } }, { "property":"incidents", "dataType":"number", "dataRole":"metric", "inputRestrictions":{ "min":0, "max":100000, "range":true } }, { "property":"type", "title":"Type", "dataType":"text", "dataRole":"dimension", "formatString":null, "inputRestrictions":{ "mandatory":false, "readOnly":false, "strict":true, "multiple":false, "trimming":true, "values":["TYPE 1.1","TYPE 1.2","TYPE 2.1","TYPE 2.2"], "groups":[ { "label":"TYPE 1", "values":["TYPE 1.1","TYPE 1.2"] }, { "label":"TYPE 2", "values":["TYPE 2.1","TYPE 2.2"] } ] } } ], "virtual":[ { "property":"title", "title":"Title", "dataType":"text", "dataRole":null, "formatString":null, "formula":"return 'value';" } ] }, "relProperties":{ "database":[ { "property":"type", "title":"Type", "dataType":"text", "dataRole":"dimension", "formatString":null, "inputRestrictions":{ "mandatory":false, "readOnly":false, "strict":false, "multiple":false, "values":null, "groups":null } }, { "property":"subtype", "title":"Subtype", "dataType":"number", "dataRole":"dimension", "formatString":null, "inputRestrictions":{ "mandatory":false, "readOnly":false, "strict":true, "multiple":false, "values":["TYPE 1.1","TYPE 1.2","TYPE 2.1","TYPE 2.2"], "groups":[ { "label":"TYPE 1", "values":["TYPE 1.1","TYPE 1.2"] }, { "label":"TYPE 2", "values":["TYPE 2.1","TYPE 2.2"] } ] } } ], "virtual":[ { "property":"title", "title":"Title", "dataType":"text", "dataRole":null, "formatString":null, "formula":"return 'value';" } ] }, "mergedRelProperties":[ { "property":"title", "title":"Title", "dataType":"text", "dataRole":null, "formatString":null, "formula":"return edge.data.property_name;" } ], "dirMergedRelProperties":[ { "property":"title", "title":"Title", "dataType":"text", "dataRole":null, "formatString":null, "formula":"return edges.length;" } ], "nodePropertyGroups":[ { "title":"Main", "properties":[ { "property":"title" }, { "property":"type" } ] } ]}Explanation of JSON properties:
Property | Values | Default | Description |
|---|---|---|---|
nodeLabels mandatory | Array of strings | [ "*" ] | An array of node labels is visible in the project. Nodes that are not listed are not visible in the project. The "*" value means all existing labels are visible. An empty array is not a valid value for this setting. |
relationshipTypes mandatory | Array of strings | [ "*" ] | An array of relationship types visible in the project. Relationship types that are not listed are not visible in the project. The "*" value means all existing relationships are visible. An empty array is not a valid value for this setting. |
calculateNumOfRelatedNodes | Boolean | false | If set to false, the "_numOfRelatedNodes" system property is not calculated in visualization. This leads to more performant queries in bigger graphs, especially with high-degree nodes. By default, it’s set to false and should be changed to true only when needed (which is quite rare). |
calculateNumOfRelations | Boolean | true | If set to false on a Gremlin-based graph database (e.g., Azure Cosmos DB or JanusGraph), the "_numOfRelations" system property is not calculated in visualization. This leads to more performant queries in bigger graphs, especially with high-degree nodes. With this feature disabled, you won't be able to see if a node is expandable (but it still will be expanded when using the expand function). |
nodeUid | Object | If present, this object defines the configuration for UID usage in saved visualizations. For more information, see UID in Saved Visualizations. | |
nodeUid.labels | Array of strings | An array of strings representing node labels that are used for UID functionality. All nodes have to be covered with these labels. If the array is empty, all labels in the database are used (updated on config save or when opening any saved visualization). | |
nodeUid.property | String | Property key name where the UIDs are stored on nodes. | |
nodeUid.manageIndex | Boolean | false |
If set to true, the node UNIQUE SCHEMA indexes are automatically created in Neo4j for every combination of nodeUid.labels and nodeUid.property to ensure optimal performance on visualization loading. This ensures that the visualization loading will be as fast as possible. |
relationshipUid | Object | If present, this object defines the configuration for UID usage in saved visualizations. For more information, see UID in Saved Visualizations. | |
relationshipUid.types | Array | Empty array | An array of strings representing relationship types that are used for UID functionality. If the array is empty, all labels in the database are used (updated on config save or when opening any saved visualization). |
relationshipUid.property | String | Property key name where the UIDs are stored in relationships. | |
relationshipUid.manageIndex | Boolean | false |
Neo4j 4.x For UID to work with relationships, a fulltext index is needed (because Neo4j, before version 4.3, doesn't have implicit indexes for relationships). Neo4j 5.x If set to true, the node UNIQUE SCHEMA indexes are automatically created in Neo4j for every combination of relationshipUid.types and relationshipUid.property to ensure optimal performance on visualization loading. This ensures that the visualization loading will be as fast as possible. |
nodeProperties mandatory | List of DPD and list of VPD | Contains a list of node Database Property Definitions (DPD) and node Virtual Property Definitions (VPD) used in UI. | |
nodeProperties.database | Array of DPD objects | List of node DB properties used in UI. Every DB property is defined as a JSON Object called DPD (Database Property Definition). | |
nodeProperties.virtual | Array of VPD objects | List of node virtual properties used in UI. Every virtual property is defined as a JSON Object called VPD (Virtual Property Definition). | |
relProperties mandatory | List of DPD and list of VPD | Contains a list of relationship Database Property Definitions (DPD) and relationship Virtual Property Definitions (VPD) used in UI. | |
relProperties.database | Array of DPD objects | List of relationship DB properties used in UI. Every DB property is defined as a JSON Object called DPD (Database Property Definition). | |
relProperties.virtual | Array of VPD objects | List of relationship virtual properties used in UI. Every virtual property is defined as a JSON Object called VPD (Virtual Property Definition). | |
mergedRelProperties mandatory | Array of VPD objects | List of merged relationship virtual properties used in UI. Every virtual property is defined as a JSON Object called VPD (Virtual Property Definition). | |
dirMergedRelProperties mandatory | Array of VPD objects | List of direction merged relationship virtual properties used in UI. Every virtual property is defined as a JSON Object called VPD (Virtual Property Definition). | |
VPD.property mandatory | String | The technical name of a virtual property defined by this VPD. | |
VPD.title | String | VPD.property | Property title used in UI. You can define a custom title for every property. This is useful when you want to use user-friendly and formatted names in UI instead of technical names of properties. When not defined or set to null, the value of VPD.property is used. |
VPD.formula | String | Body of a JavaScript function used to calculate the value of this virtual property (be sure to escape special characters like newline or tab). | |
VPD.dataType | undefined, null, "text", "number", "url", "datetime", “boolean” | null | Type of formatting for values in the UI of this virtual property.
|
VPD.formatString | Numeral.js format string | "0.00" | If dataType is set to "number", the formatString is used with the Numeral.js library to format numbers in the UI. Note: Language-dependent formatting is set according to the user's locale in the profile. If dataType is set to "datetime", these formatString values are available:
|
VPD.dataRole | undefined, null, "dimension", "metric" | null | Defines how to use virtual property in the UI.
Note: for properties with a defined "dataRole", the property charts on the tab Stat in visualization are automatically added. |
VPD.hidden | true, false | false | If true, the property is by default hidden on the tab Detail in visualization. Users can unhide the property. |
DPD.property mandatory | String | The technical name of a DB property defined by this DPD. Value is used for reference purposes, e.g., in Style mappers. | |
DPD.title | String | DPD.property | Property title used in UI. You can define a custom title for every property. This is useful when you want to use user-friendly and formatted names in UI instead of DB model names of properties. When not defined or set to null, the DB name (technical name) of the property is used (DPD.property). |
DPD.dataType | undefined, null, "text", "number", "url", "datetime", “boolean” | null | Type of formatting for values in the UI of this DB property.
|
DPD.formatString | Numeral.js format string | "0.00" | If dataType is set to "number", the formatString is used with the Numeral.js library to format numbers in the UI. Note: Language-dependent formatting is set according to the user's locale in the profile. If dataType is set to "datetime", these formatString values are available
|
DPD.dataRole | undefined, null, "dimension", "metric" | null | Defines how to use the DB property in the UI.
|
DPD.hidden | true, false | false | If true, the property is by default hidden on the tab Detail in visualization. The user can unhide the property. |
DPD.inputRestrictions | Object | Defines restrictions for the input field in the create and update forms. See Input Restrictions for all types of input fields that can be created with this setting. | |
DPD.inputRestrictions.mandatory | true, false | false | If set to true, it's mandatory to enter some value in the create and update forms (the user can't save the change without any value entered for this property). |
DPD.inputRestrictions.readOnly | true, false | false | If set to true, the value of this property is read-only in the create and update forms. |
DPD.inputRestrictions.strict | true, false | false | If strict is set to true, the user can choose only values defined in values or groups when editing DB data via the create or update form. The strict values functionality is available only if dataType is set to "text" and dataRole to "dimension". |
DPD.inputRestrictions.multiple | true, false | false | If multiple is set to true, the user can choose multiple values (defined in values or groups) as a property value when editing DB data via the create or update form. These values are then stored as an array of values in DB property. The data type of the stored values can be defined with the DPD.dataType setting. |
DPD.inputRestrictions.values | Array of plain values | Values available in the suggestions list. | |
DPD.inputRestrictions.groups | Array of GDO objects | Values in the suggestions list are grouped for better user orientation. Every group is defined by a GDO (Group Definition Object). | |
DPD.inputRestrictions.trimming | true, false | true | If set to true or not defined, every property value entered through the UI is trimmed before saving (leading and trailing spaces are removed). |
DPD.inputRestrictions.range | true, false | false | When set to true, the property will be handled as an interval value in the UI. For instance, in all filters, a number range selector will be used as the input element. When “min” and “max” are also defined, then a Slider input element will be used in the UI. |
DPD.inputRestrictions.min | Number | Defines the minimal value that can be set by the user when the property is edited using the UI. The “max” and “range” attributes have to be defined as well. | |
DPD.inputRestrictions.max | Number | Defines the maximal value that can be set by the user when the property is edited using the UI. The “min” and “range” attributes have to be defined as well. | |
GDO.title mandatory | String | Title of a group of values shown in the suggestions list in the create and update forms. | |
GDO.values mandatory | Array of plain values | Values used in this specific group in the suggestions list in the create and update forms. | |
nodePropertyGroups | Array of NTDO objects | Set how to group node properties to tabs in the view, create, and update forms. Every tab is defined by NTDO (Node Tab Definition Object). | |
NTDO.title mandatory | String | Label (or title) of the group used as tab label in view, create, and update forms. | |
NTDO.properties mandatory | Array of objects | Referenced DB properties used in this tab. Every reference is made with a simple object that has only one property, called "property", whose value is the name of the referenced DB property (property key). For example: {"property":"type"} |
GraphDB support
When using GraphDB, a special GraphDB configuration object can be added to the Data Schema. If no object is defined, a default object is used silently (see below).
Default GraphDb object for data schema
Use this configuration object as a template, update it to your needs, and insert it into your Data Schema configuration.
"graphDb": { "nodeMappings": { "labels": [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ], "literals": [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ] }, "prefixes": { "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", "http://www.w3.org/2000/01/rdf-schema#": "rdfs", "http://www.w3.org/2001/XMLSchema# ": "xsd", "http://www.w3.org/2002/07/owl#": "owl", "http://www.w3.org/2004/02/skos/core#": "skos", "http://purl.org/dc/terms/": "dcterms", "http://purl.org/dc/elements/1.1/": "dc", "http://xmlns.com/foaf/0.1/": "foaf", "http://www.w3.org/ns/prov#": "prov", "http://schema.org/": "schema", "http://www.w3.org/2003/01/geo/wgs84_pos#": "geo", "http://rdfs.org/ns/void#": "void", "http://purl.org/linked-data/cube#": "qb", "http://dbpedia.org/property/": "dbp", "http://dbpedia.org/ontology/": "dbo" } }The configuration consists of three parts:
graphDb.nodeMappins.labels
graphDb.nodeMappings.literals
graphDb.prefixes
Parameters | Description | Example |
|---|---|---|
graphDb.nodeMappings.labels | An array of predicates, where objects are considered a label | [http://www.w3.org/1999/02/22-rdf-syntax-ns#type] |
graphDb.nodeMappings.literals | An array of predicates, where objects are considered as literals (even if there exists a predicate for this object). These will be presented as node properties in a visualization. | |
graphDb.prefixes | A map of URIs (keys) and their shortened form (values) that will be shortened on a frontend for brevity. E.g.: “http://www.w3.org/2000/01/rdf-schema#label” will map to “rdfs:label” | { "http://www.w3.org/2000/01/rdf-schema#": "rdfs"} |