def get_AC_weight_json_from_C(c, db='default', number_nodes=40):
    node_origin = [{'nodeName':c.name, 'type':TYPE_INITIAL}]
    nodes_list = get_Aweight_list_from_C(c)
    nodes_dict = dict(nodes_list)
    data = nodesweight_dict_to_json_nodes_edges(node_origin, nodes_dict, TYPE_ACTOR)
    content = simplejson.dumps(data, ensure_ascii=False)
    logging.debug("Generated AC JSON from %s" % c.name)
    return content
Example #2
0
def ac_concept(request):
    q = request.GET.get("q", None)
    print q
#    concept = Concept.objects.get(id=q)
#   _ret = get_Aweight_list_from_C(concept)
#    _ret = get_Aweight_list_from_C(q)
    object_type, instance = is_actor_or_concept(q)
    if object_type == 'Concept':
        _ret = get_Aweight_list_from_C(instance)
        ret = dict([("actors", _ret)])
    return HttpResponse(json.dumps(ret), mimetype="text/plain")