Search code examples
neo4jneo4jclient

Neo4jClient - Returning labels belonging to node


In using the Neo4j client for .NET I have not been able to find a way to capture labels belonging to a specific node.

I can observe that this data is available by capturing network traffic, but I cannot find any way to retrieve this data using the API. The same applies to retrieving the node IDs - I can observe those on the wire, but not in code.

Is this not yet implemented?


Solution

  • You should not be dealing with node ids. They are deprecated, and will go away more and more.

    To retrieve the labels, copying straight from https://github.com/Readify/Neo4jClient/wiki/cypher-examples, this Cypher:

    MATCH (user:User)
    WHERE user.Id = 1234
    RETURN labels(user)
    

    Is this C#:

    graphClient.Cypher
        .Match("(user:User)")
        .Where((User user) => user.Id == 1234)
        .Return(user => user.Labels())
        .Results