Unable to filter the edges in an efficient manner using model/instances/query endpoint
Hello
We have Flexible model which has Entity view and then a property named parent refers to Entity back as an edge. Now our user sends us an query to get all the entities say whose name is “SomeString”. And then we construct a query as below, but it errors out.
{
"with": {
"Entity": {
"nodes": {
"filter": {
"and": [
{
"matchAll": {}
},
{ "hasData": [
{
"type": "view",
"space": "slb-pdm-dm-governed",
"externalId": "Entity",
"version": "1_7"
}
]},
{"or": [
{
"and": [
{
"nested": {
"scope": [
"slb-pdm-dm-governed",
"Entity/1_7",
"parent"
],
"filter": {
"in": {
"property": [
"node",
"name"
],
"values": [
"SomeString"
]
}
}
}
}
]
}
]}
]
},
"chainTo": "destination",
"direction": "outwards"
}
},
"parent.Entity": {
"nodes": {
"from": "Entity",
"filter": {
"and": [
{
"hasData": [
{
"type": "view",
"space": "slb-pdm-dm-governed",
"externalId": "Entity",
"version": "1_7"
}
]
},
{
"in": {
"property": [
"node",
"externalId"
],
"values": [
"56debee29ada4609beff4c12bb9244a3"
]
}
}
]
},
"through": {
"source": {
"space": "slb-pdm-dm-governed",
"externalId": "Entity",
"version": "1_7",
"type": "view"
},
"identifier": "parent"
},
"chainTo": "destination",
"direction": "outwards"
}
}
},
"select": {
"Entity": {
"sources": [
{
"source": {
"space": "slb-pdm-dm-governed",
"externalId": "Entity",
"version": "1_7",
"type": "view"
},
"properties": [
"name",
"parent"
]
}
]
},
"parent.Entity": {
"sources": [
{
"source": {
"space": "slb-pdm-dm-governed",
"externalId": "Entity",
"version": "1_7",
"type": "view"
},
"properties": [
"name"
]
}
]
}
}
}
with an error- {
"error": {
"code": 400,
"message": "Invalid in filter with property reference [node, name]. Property reference must have the format [<space>, <externalId|externalId/version>, <property>] or [<node|edge>, <property>]. Valid base properties are [space, externalId, createdTime, lastUpdatedTime, type] for node, and [space, externalId, createdTime, lastUpdatedTime, startNode, endNode, type] for edge."
}
}
As we get the name from the user as input we really dont know about the external Id at that point in time. How do we go with this ?
Other way we can do is we dont pass edge filter in Views filter part rather we pass it in edges filter, but then we get all the nodes available and then we have to traverse through all the nodes to find out relevant node. Can you help here?
Regards,
Neeraj B
Check the
documentation
Ask the
Community
Take a look
at
Academy
Cognite
Status
Page
Contact
Cognite Support
