def contain_children(request, identifier): """ Returns JSON data with spatial containment for a given uuid identiffied entity """ ent = Entity() found = ent.dereference(identifier) if found: depth = 1 recursive = False if 'depth' in request.GET: try: depth = int(float(request.GET['depth'])) except: depth = 1 et = EntityTemplate() children = et.get_containment_children(ent, depth) json_output = json.dumps(children, indent=4, ensure_ascii=False) return HttpResponse(json_output, content_type='application/json; charset=utf8') else: raise Http404
def description_hierarchy(request, identifier): """ Returns JSON data with descriptive property and type hierarchies for a given uuid identiffied entity """ item_type = False class_uri = False if '/' in identifier: id_ex = identifier.split('/') identifier = id_ex[0] if len(id_ex) >= 2: item_type = id_ex[1] if len(id_ex) >= 3: class_uri = id_ex[2] ent = Entity() found = ent.dereference(identifier) if found: depth = 1 recursive = False if 'depth' in request.GET: try: depth = int(float(request.GET['depth'])) except: depth = 1 et = EntityTemplate() children = et.get_description_tree(ent, depth, True, item_type, class_uri) json_output = json.dumps(children, indent=4, ensure_ascii=False) return HttpResponse(json_output, content_type='application/json; charset=utf8') else: raise Http404
def hierarchy_children(request, identifier): """ Returns JSON data for an identifier in its hierarchy """ et = EntityTemplate() children = et.get_children(identifier) if children is not False: json_output = json.dumps(children, indent=4, ensure_ascii=False) return HttpResponse(json_output, content_type='application/json; charset=utf8') else: raise Http404
def hierarchy_children(request, identifier): """ Returns JSON data for an identifier in its hierarchy """ et = EntityTemplate() children = et.get_described_children(identifier) if children is not False: json_output = json.dumps(children, indent=4, ensure_ascii=False) return HttpResponse(json_output, content_type='application/json; charset=utf8') else: raise Http404
def contain_children(request, identifier): """ Returns JSON data with spatial containment for a given uuid identiffied entity """ ent = Entity() found = ent.dereference(identifier) if found: depth = 1 recursive = False if 'depth' in request.GET: try: depth = int(float(request.GET['depth'])) except: depth = 1 et = EntityTemplate() children = et.get_containment_children(ent, depth) json_output = json.dumps(children, indent=4, ensure_ascii=False) return HttpResponse(json_output, content_type='application/json; charset=utf8') else: raise Http404
def description_hierarchy(request, identifier): """ Returns JSON data with descriptive property and type hierarchies for a given uuid identiffied entity """ item_type = False class_uri = False if '/' in identifier: id_ex = identifier.split('/') identifier = id_ex[0] if len(id_ex) >= 2: item_type = id_ex[1] if len(id_ex) >= 3: class_uri = id_ex[2] ent = Entity() found = ent.dereference(identifier) if found: depth = 1 recursive = False if 'depth' in request.GET: try: depth = int(float(request.GET['depth'])) except: depth = 1 et = EntityTemplate() children = et.get_description_tree(ent, depth, True, item_type, class_uri) json_output = json.dumps(children, indent=4, ensure_ascii=False) return HttpResponse(json_output, content_type='application/json; charset=utf8') else: raise Http404