equal
deleted
inserted
replaced
84 return res_dict |
84 return res_dict |
85 # We build the filter string |
85 # We build the filter string |
86 filter_str = "" |
86 filter_str = "" |
87 for i,uri in enumerate(uri_list): |
87 for i,uri in enumerate(uri_list): |
88 res_dict[uri] = "" |
88 res_dict[uri] = "" |
89 filter_str += (" || ?uri = <" + uri + ">") if i else ("?uri = <" + uri + ">") |
89 uri = uri.replace(" ", "") # avoid bug when only few urls are not good |
90 |
90 filter_str += (" || ?uri = <" + uri + ">") if i else ("?uri = <" + uri + ">") |
91 # We request the labels |
91 # We request the labels |
92 res = requests.get( |
92 res = requests.get( |
93 settings.SPARQL_QUERY_ENDPOINT, |
93 settings.SPARQL_QUERY_ENDPOINT, |
94 params={'query':query % (scheme_uri, filter_str), 'timeout':10},#, '$root' : "<"+uri+">"}, |
94 params={'query':query % (scheme_uri, filter_str), 'timeout':10},#, '$root' : "<"+uri+">"}, |
95 headers={'accept':'application/sparql-results+json'}, |
95 headers={'accept':'application/sparql-results+json'}, |
108 tmp_dict[b['label']['xml:lang']] = b['label']['value'] |
108 tmp_dict[b['label']['xml:lang']] = b['label']['value'] |
109 if not first_label: |
109 if not first_label: |
110 first_label = b['label']['value'] |
110 first_label = b['label']['value'] |
111 else: |
111 else: |
112 if 'acro' in b and 'value' in b['acro']: |
112 if 'acro' in b and 'value' in b['acro']: |
113 first_label = b['acro']['value'] + " : " + b['label']['value'] |
113 first_label = b['acro']['value'] + ". " + b['label']['value'] |
114 else: |
114 else: |
115 first_label = b['label']['value'] |
115 first_label = b['label']['value'] |
116 if lang in tmp_dict or first_label: |
116 if lang in tmp_dict or first_label: |
117 if lang in tmp_dict: |
117 if lang in tmp_dict: |
118 label = tmp_dict[lang] |
118 label = tmp_dict[lang] |