groovy - Labelling Neo4j database using Neo4django -


this question related github issue of neo4django. want create multiple graphs using neo4j graph db django web framework. i'm using django 1.4.5, neo4j 1.9.2 , neo4django 0.1.8.

as of neo4django doesn't support labeling above core purpose , want able create labels neo4django. went source code , tried tweak little see if can make addition. in understanding, file 'db/models/properties.py' has class boundproperty(attrrouter) calls gremlin script through function save(instance, node, node_is_new). script follows:

script = '''     node=g.v(nodeid);     results = neo4django.updatenodeproperties(node, propmap);     ''' 

the script calls update function library.groovy , function looks intuitive , nice. i'm trying add on function support labeling have no experience of groovy. have suggestions on how proceed? appreciated. if works big addition neo4django :)

thank

a little background:

the groovy code you've highlighted executed using neo4j gremlin plugin. first supports gremlin graph dsl (eg node=g.v(nodeid)), implemented atop groovy language. groovy dynamic superset of java, valid java code work scripts sent via connection.gremlin(...). each script sent should define results variable returned neo4django, if it's null.

anyway, accessing neo4j way handy (though deprecated i've heard :( ) because can use full neo4j embeddeded java api. try add label node

from neo4django.db import connection connection.gremlin(""" node = g.v(nodeid) label = dynamiclabel.label('label_name') node.rawvertex.addlabel(label) """, nodeid=node_id) 

you might need add import dynamiclabel- haven't run code i'm not sure. debugging code written way little tough, make liberal use of gremlin tab in neo4j admin.

if come working solution, i'd love see (or explanatory blog post!)- i'm sure helpful other users.

hth!

nb - labels supported shortly after neo4j 2.0's release- they'll replace current in-graph type structure.


Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -