In [1]:
%load_ext autoreload
%autoreload 2
import os, sys
# import_path = os.path.abspath('..') not necessary ?
install_path = '/home/stephan/Repos/ENES-EUDAT/enes_graph_use_case'
sys.path.append(install_path)
from neo4j_prov import provio
In [2]:
#rov_doc_from_json = provio.get_provdoc('json',install_path+"/neo4j_prov/examples/wps-prov.json")
prov_doc_from_json = provio.get_provdoc('json','/home/stephan/Repos/ENES-EUDAT/submission_forms/test/ingest_prov_1.json')
rels = provio.gen_graph_model(prov_doc_from_json)
In [3]:
print prov_doc_from_json.get_records()
print rels
In [4]:
provio.visualize_prov(prov_doc_from_json)
Out[4]:
In [ ]:
prov_doc_from_xml = provio.get_provdoc('xml',install_path+"/neo4j_prov/examples/wps-prov.xml")
rels = provio.gen_graph_model(prov_doc_from_xml)
In [ ]:
print prov_doc_from_xml.get_records()
print rels
In [5]:
from py2neo import Graph, Node, Relationship, authenticate
authenticate("localhost:7474", "neo4j", "prolog16")
# connect to authenticated graph database
graph = Graph("http://localhost:7474/db/data/")
graph.delete_all()
In [6]:
for rel in rels:
graph.create(rel)
In [7]:
%load_ext cypher
%matplotlib inline
In [8]:
results = %cypher http://neo4j:prolog16@localhost:7474/db/data MATCH (a)-[r]-(b) RETURN a,r, b
results.get_graph()
results.draw()
Out[8]:
To help visualization of large graphs the javascript library from Almende B.V. is helpful (git clone git://github.com/almende/vis.git) Therefore a javascript visualization generation is provided by the vis script (which I adapted from https://github.com/nicolewhite/neo4j-jupyter/tree/master/scripts)
In [9]:
from neo4j_prov.vis import draw
In [10]:
options = {"16":"label"}
result_iframe = draw(graph,options)
In [ ]: