neomodel
neomodel copied to clipboard
How to get Node label?
I have Nodes available but I don't know the label. How do I get the node label of a given node?
This functionality is available in cypher like following
label(node)
Returns:
node label
Thank you.
Suppose I have the following models from the documentation.
class FriendRel(StructuredRel):
since = DateTimeProperty(
default=lambda: datetime.now(pytz.utc)
)
met = StringProperty()
class Person(StructuredNode):
name = StringProperty()
friends = RelationshipTo('Person', 'FRIEND', model=FriendRel)
With the following data.
>>> bob = Person(name='bob').save()
To get bob's labels, simply use the following:
>>> bob.labels()
['Person']
Thank you @Enprogames, I'll close this issue!