Skip to main content
Solved

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


Forum|alt.badge.img

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

    }

}

 

Best answer by AndersM

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

View original

Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img

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


Forum|alt.badge.img
  • Committed
  • March 21, 2025

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
Seasoned Practitioner
  • Seasoned Practitioner
  • March 24, 2025

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


Forum|alt.badge.img
  • Committed
  • March 25, 2025

Hi ​@AndersM ,

I tried fetching by this way and got correct result.

Thank you so much for your help

Shweta


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings