The data modeling language extension for GraphQL
This article describes the current capabilities of the Data modeling language extension for GraphQL (DML).
The DML extension lets you control both the data model-centric, and the view-centric —the solution data model—management of a Data Modeling Service (DMS) based schema.
The data modeling REST API (DMS) in combination with the Cognite Python SDK offers more power and flexibility than the DML extension. They're the preferred tools for managing industrial knowledge graphs in Cognite Data Fusion (CDF).
Basics
The data model format is in the GraphQL Schema Definition Language. Each data model has many types, consisting of properties, each with a specified type.
Each type can contain properties that reference other types, forming a relationship. You can also specify the properties as a list of references to nodes of other types.
Use !
to indicate that a field is required and that each instance of the template must contain the value.
To add comments, enter "comment"
above the field/type definition.
This example is a simple industry data model:
type Equipment {
"Unique identifier for the equipment"
id: int!
"name of the piece of equipment"
name: String!
"the parts included to build this equipment"
parts: [Part]
"the documents describing use and maintenance for the equipment"
documentation: [Document] @reverseDirectRelation(throughProperty: "equipment")
}
type Part {
id: int!
name: String!
documentation: [Document]
}
type Document {
id: int!
name: String!
source: String!
"the equipment this document describes"
equipment: Equipment
"the parts this document describes"
parts: [Part]
}