0

I am new to Neo4j and py2neo. I used the GraphObject model like so:

class Capability(GraphObject):
    __primarykey__ = "term"

    term = Property()

    child_of = RelatedTo("Capability")
    parent_to = RelatedTo("Capability")

After I create a "Capability":

c = Capability()
c.term = name
graph.push(c)

Querying the database in the Neo4j browser gives me this:

enter image description here

Where the nodes are blank. Furthermore if I change the model to this:

class Capability(GraphObject):
    __primarylabel__ = "name"
    __primarykey__ = "term"

    term = Property()

    child_of = RelatedTo("Capability")
    parent_to = RelatedTo("Capability")

Where the "primarylabel" I get names in the nodes in Neo4J like expected, but the node is no longer considered a "Capability" - which means I also can't search for "Capability":

enter image description here

... which makes sense since I overrided the primary label, but it seems odd that the only way I can see the label of the Capability in Neo4J is by not having the node be considered a Capability.

So the questions is: in py2neo, how can I create a node that is considered a Capability based on the model as well as have the term label show up in the Neo4J node graph (instead of blank)?

Sean
  • 2,412
  • 3
  • 25
  • 31

2 Answers2

2

It's actually just a simple tweak inside the User Interface. (2 second fix)

Click on the node label type you want to affect in the tags bar at the top. A bar will appear at the bottom of the window that allows you to choose the Colour, Size and Caption that will format the Nodes you see in the UI.

Thus, click on the property you see as an option next to 'Caption' and it will become what is displayed on your nodes of that type.

enter image description here

JBoz
  • 43
  • 1
  • 6
0

After hours of trying to figure out what I don't fully understand regarding Neo4j and the question above - I finally figured it out: "Capability" is some sort of reserved word!

Once I changed the class name from "Capability" to "CapabilityZ" it started working as expected. Ouch.

Still confused since "Capability" is not in the docs anywhere....

Hopefully this saves some poor schmuck like me out there.

Sean
  • 2,412
  • 3
  • 25
  • 31
  • As far as I know "Capability" is not a reserved word. I just added a :Capability node in my Neo4j instance without trouble. If there is some kind of reserved word conflict, it probably isn't in Neo4j/Cypher. Maybe it's conflicting with your previous Capability definition? – InverseFalcon Sep 06 '16 at 21:14
  • 1
    ... as a matter of fact, "Cap" and "CapabilityNode" caused problems too. Only worked when I called the class "Term". So frustratingly weird! – Sean Sep 06 '16 at 23:55
  • @InverseFalcon this wasn't at the Neo4j level, but occurred when using the py2neo library. I don't think it was a conflict since "Cap" didn't work (when I used it for the first time) either. :-/ I am sure I am missing something though - since it is way to weird. – Sean Sep 07 '16 at 01:59