Skip to main content
Seasoned ⭐️⭐️
Mar 20, 2025 10:25 AM UTC
Solved

Checking for how many view's instance, an edge is present.

Hello Team,
I am trying to check like how many edges(entities in my case) are null in the view(event) is there any specific way to do so? I am trying right now sdk query api like below, but not working. Please give your insights.
 

{

    "with": {

        "Event": {

            "nodes": {

                "filter": {

                    "hasData": [

                        {

                            "type": "view",

                            "space": "slb-pdm-dm-governed",

                            "externalId": "Event",

                            "version": "1_7"

                        }

                    ]

                },

                "chain_to": "destination",

                "direction": "outwards"

            },

            "limit": 10000

        },

        "Event_2_entities.Entity": {

            "edges": {

                "from": "Event",

                "direction": "outwards",

                "filter": {

                    "and": [

                        {

                            "equals": {

                                "property": [

                                    "edge",

                                    "type"

                                ],

                                "value": {

                                    "space": "slb-pdm-dm-governed",

                                    "externalId": "Event.entities"

                                }

                            }

                        },

                        {

                            "and": [

                                {

                                    "hasData": [

                                        {

                                            "type": "view",

                                            "space": "slb-pdm-dm-governed",

                                            "externalId": "Event",

                                            "version": "1_7"

                                        }

                                    ]

                                },

                                {

                                    "not": {

                                        "exists": {

                                            "property": [

                                                "slb-pdm-dm-governed",

                                                "Event/1_7",

                                                "entities"

                                            ]

                                        }

                                    }

                                }

                            ]

                        }

                    ]

                },

                "chain_to": "destination"

            },

            "limit": 10000

        },

        "entities.Entity": {

            "nodes": {

                "from": "Event_2_entities.Entity",

                "filter": {

                    "hasData": [

                        {

                            "type": "view",

                            "space": "slb-pdm-dm-governed",

                            "externalId": "Event",

                            "version": "1_7"

                        }

                    ]

                },

                "chain_to": "destination",

                "direction": "outwards"

            },

            "limit": 10000

        }

    },

    "select": {

        "Event": {

            "sources": [

                {

                    "source": {

                        "space": "slb-pdm-dm-governed",

                        "external_id": "Event",

                        "version": "1_7",

                        "type": "view"

                    },

                    "properties": [

                        "*"

                    ]

                }

            ]

        },

        "Event_2_entities.Entity": {}

    },

    "cursors": {

        "Event": null,

        "Event_2_entities.Entity": null

    }

}

 

AndersM
AndersMAnswer
Expert ⭐️⭐️⭐️⭐️
Mar 24, 2025 9:37 AM UTC

Hi Shweta,

So you are looking for instances that have data for the Event type that are not referenced as startNode for any edges with the Event.entities type?

I think you’ll have to perform that operation first by retrieving all instances that hasData in the Event view (or its backing container), and then retrieving startNode for all edges with the type Event.entities, and then do the set operation (subtraction) locally.

Thanks,

-AndersM

4 replies

Mithila Jayalath
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
Mar 21, 2025 8:44 AM UTC

​@Shweta can you please elaborate more on what you are trying to achieve here?

ShwetaAuthor
Seasoned ⭐️⭐️
Mar 21, 2025 10:16 AM UTC

Hi ​@Mithila Jayalath , want to actually fetch the count of entities in Event view and entities is edge from Entity view. Means how many event has entities attached to it.

AndersM
Expert ⭐️⭐️⭐️⭐️
AndersMAnswer
Expert ⭐️⭐️⭐️⭐️
Mar 24, 2025 9:37 AM UTC

Hi Shweta,

So you are looking for instances that have data for the Event type that are not referenced as startNode for any edges with the Event.entities type?

I think you’ll have to perform that operation first by retrieving all instances that hasData in the Event view (or its backing container), and then retrieving startNode for all edges with the type Event.entities, and then do the set operation (subtraction) locally.

Thanks,

-AndersM

ShwetaAuthor
Seasoned ⭐️⭐️
Mar 25, 2025 4:27 PM UTC

Hi ​@AndersM ,

I tried fetching by this way and got correct result.

Thank you so much for your help

Shweta