Mercurial > hg > NetworkVis
diff ismi-python-neo4jrestclient/ismi-vis.py @ 17:09c0a9ceb778
more pimping of commentaries_authors.
author | casties |
---|---|
date | Wed, 07 Oct 2015 15:41:00 +0200 |
parents | ad3eefa2cb80 |
children | d8bbf6d5920b |
line wrap: on
line diff
--- a/ismi-python-neo4jrestclient/ismi-vis.py Tue Oct 06 19:26:46 2015 +0200 +++ b/ismi-python-neo4jrestclient/ismi-vis.py Wed Oct 07 15:41:00 2015 +0200 @@ -151,17 +151,21 @@ except KeyError: return [] else: - query = ("MATCH (t:TEXT)-[:was_created_by]->(p:PERSON) " - "WHERE p.ismi_id = {id} " - "RETURN t,p") + query = ("MATCH (t:TEXT)-[:was_created_by]->(p:PERSON {ismi_id: {id}})" + " RETURN t,p,exists((t)-[:is_commentary_on]->()),exists(()-[:is_commentary_on]->(t))") results = gdb.query( query, - returns=(Node,Node), + returns=(Node,Node,bool,bool), params={"id": int(q)} ) # {"name": "(?i).*" + q + ".*"} print("search for %s returned %s results"%(repr(q),len(results))) - return Response(dumps([{"text": text.properties, "author": author.properties} for [text,author] in results]), + data = [{"text": t.properties, + "author": a.properties, + "is_commentary": is_com, + "has_commentaries": has_com} + for [t,a,is_com,has_com] in results] + return Response(dumps(data), mimetype="application/json")