Specification of query endpoint. For more information, see Query language.
Query specification.
Matching nodes and edges
The response for a failed request.
from cognite.client.data_classes.data_modeling.query import Query, Select, NodeResultSetExpression, EdgeResultSetExpression, SourceSelector from cognite.client.data_classes.filters import Range, Equals from cognite.client.data_classes.data_modeling.ids import ViewId movie_id = ViewId("mySpace", "MovieView", "v1") actor_id = ViewId("mySpace", "ActorView", "v1") query = Query( with_ = { "movies": NodeResultSetExpression(filter=Range(movie_id.as_property_ref("releaseYear"), lt=2000)), "actors_in_movie": EdgeResultSetExpression(from_="movies", filter=Equals(["edge", "type"], {"space": movie_id.space, "externalId": "Movie.actors"})), "actors": NodeResultSetExpression(from_="actors_in_movie"), }, select = { "actors": Select( [SourceSelector(actor_id, ["name"])], sort=[InstanceSort(actor_id.as_property_ref("name"))]), }, ) res = client.data_modeling.instances.query(query) from cognite.client.data_classes.data_modeling.data_types import UnitReference, UnitSystemReference selected_source = SourceSelector( source=ViewId("my-space", "my-xid", "v1"), properties=["f32_prop1", "f32_prop2", "f64_prop1", "f64_prop2"], target_units=[ TargetUnit("f32_prop1", UnitReference("pressure:kilopa")), TargetUnit("f32_prop2", UnitReference("pressure:barg")), TargetUnit("f64_prop1", UnitSystemReference("SI")), TargetUnit("f64_prop2", UnitSystemReference("Imperial")), ], ) SourceSelector(source=ViewId("my-space", "my-xid", "v1"), properties=["*"])
{- "items": {
- "result-expression1": [
- {
- "instanceType": "node",
- "version": 0,
- "space": "string",
- "externalId": "string",
- "type": {
- "space": "string",
- "externalId": "string"
}, - "createdTime": 1730204346000,
- "lastUpdatedTime": 1730204346000,
- "deletedTime": 1730204346000,
- "properties": {
- "space-name1": {
- "view-or-container-identifier1": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}, - "view-or-container-identifier2": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}
}, - "space-name2": {
- "view-or-container-identifier1": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}, - "view-or-container-identifier2": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}
}
}
}
], - "result-expression2": [
- {
- "instanceType": "node",
- "version": 0,
- "space": "string",
- "externalId": "string",
- "type": {
- "space": "string",
- "externalId": "string"
}, - "createdTime": 1730204346000,
- "lastUpdatedTime": 1730204346000,
- "deletedTime": 1730204346000,
- "properties": {
- "space-name1": {
- "view-or-container-identifier1": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}, - "view-or-container-identifier2": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}
}, - "space-name2": {
- "view-or-container-identifier1": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}, - "view-or-container-identifier2": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}
}
}
}
]
}, - "typing": {
- "result-expression1": {
- "space-name1": {
- "view-or-container-external-id1": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}, - "view-or-container-external-id2": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}
}, - "space-name2": {
- "view-or-container-external-id1": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}, - "view-or-container-external-id2": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}
}
}, - "result-expression2": {
- "space-name1": {
- "view-or-container-external-id1": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}, - "view-or-container-external-id2": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}
}, - "space-name2": {
- "view-or-container-external-id1": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}, - "view-or-container-external-id2": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}
}
}
}, - "nextCursor": {
- "cursor-name1": "string",
- "cursor-name2": "string"
}
}