Mercurial > hg > NetworkVis
diff ismi-python-neo4jrestclient/ismi-vis.py @ 21:d964d9a23837
now with clickable author names in detail panel.
author | casties |
---|---|
date | Fri, 09 Oct 2015 15:01:20 +0200 |
parents | d8bbf6d5920b |
children | 80010fb9dbce |
line wrap: on
line diff
--- a/ismi-python-neo4jrestclient/ismi-vis.py Fri Oct 09 12:54:39 2015 +0200 +++ b/ismi-python-neo4jrestclient/ismi-vis.py Fri Oct 09 15:01:20 2015 +0200 @@ -188,9 +188,9 @@ " optional match (s)-[:was_created_by]->(sa:PERSON)" " optional match (t)<-[:is_commentary_on]-(c:TEXT)" " optional match (c)-[:was_created_by]->(ca:PERSON)" - " return t,a.label,s.label,s.ismi_id,sa.label,c.label,c.ismi_id,ca.label") + " return t,a.label,a.ismi_id,s.label,s.ismi_id,sa.label,c.label,c.ismi_id,ca.label") print("query:%s"%query) - results = gdb.query(query, returns=(Node,str,str,str,str,str,str,str), + results = gdb.query(query, returns=(Node,str,str,str,str,str,str,str,str), params={"text_id": int(text_id)}) print("result:%s"%results) @@ -198,9 +198,10 @@ author = None scs = {} cs = {} - for [t,a_label,s_label,s_id,sa_label,c_label,c_id,ca_label] in results: + for [t,a_label,a_id,s_label,s_id,sa_label,c_label,c_id,ca_label] in results: text = t author = a_label + author_id = a_id if s_id is not None and s_id != "None": scs[int(s_id)] = {"title": s_label, "author":sa_label} @@ -209,7 +210,7 @@ print("text:%s scs:%s cs:%s"%(text, scs, cs)) return Response(dumps({"title": text['label'], "attrs": text.properties, - "author": author, + "author": {"label": author, "ismi_id": author_id}, "commenting": scs, "commentaries": cs}), mimetype="application/json")