Hi,
I am creating nodes using py2neo as follows
from py2neo import neo4j
graph_db = neo4j.GraphDatabaseService("http://localhost:7474/db/data")
print graph_db.neo4j_version
graph_db.clear()
if not graph_db.get_or_create_index(neo4j.Node, "Kiran"):
from py2neo import node,rel
trial = graph_db.create(
node(name="Kiran"),
node(name="teja"),
rel(0, "Brother", 1),
)
#else:
details = graph_db.get_index(neo4j.Node, "Kiran")
print details
and I am able to see the index of the node created.
but if I try to visualize the graph in the browser using cypher, it returns
me nothing. it says 0 rows...
also I am trying to publish some network related data as follows:
from py2neo import neo4j
from py2neo import node,rel
graph_db = neo4j.GraphDatabaseService("http://localhost:7474/db/data")
def nodepublish(dpid, port, mac):
if graph_db.get_index( neo4j.Node, dpid ) == None:
create = graph_db.create({"DPID": dpid})
print "switch "+str(dpid)+" added to graph"
if graph_db.get_index( neo4j.Node, mac ) == None:
query = neo4j.CypherQuery(graph_db, "MATCH (sw) WHERE sw.DPID =
"+str(dpid)+" CREATE (nd {MAC: "+str(mac)+"}) CREATE (sw)-[:connected
{PORT: "+str(port)+"}]->(nd)")
print "node "+str(mac)+" added to graph"
when I call the nodepublish() function, it just keeps on creating
duplicates.
if I send nodepublish (1,1, "aa:aa:aa")
it creates the node with dpid:1 everytime i call the function instead of
skipping the if statement once the get_index() doesnt return None.
can someone help me out please?
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.