1
0
mirror of https://github.com/gsi-upm/sitc synced 2025-12-15 09:38:16 +00:00

Updated URL rdf and LOD

This commit is contained in:
J. Fernando Sánchez
2020-02-20 11:28:55 +01:00
parent 21dc5ec3de
commit 2248188219
7 changed files with 2406 additions and 183 deletions

View File

@@ -20,7 +20,9 @@ display_javascript(js, raw=True)
def send_query(query, endpoint):
FORMATS = ",".join(["application/sparql-results+json", "text/javascript", "application/json"])
FORMATS = ",".join(["application/sparql-results+json",
"text/javascript",
"application/json"])
data = {'query': query}
# b = quote_plus(query)
@@ -33,7 +35,11 @@ def send_query(query, endpoint):
res = urlopen(r)
data = res.read().decode('utf-8')
if res.getcode() == 200:
return json.loads(data)
try:
return json.loads(data)
except Exception:
print('Got: ', data, file=sys.stderr)
raise
raise Exception('Error getting results: {}'.format(data))
@@ -60,7 +66,7 @@ def solution():
def query(query, endpoint=None, print_table=False):
global LAST_QUERY
endpoint = endpoint or "http://fuseki.cluster.gsi.dit.upm.es/sitc/"
endpoint = endpoint or "http://fuseki.gsi.upm.es/sitc/"
results = send_query(query, endpoint)
tuples = to_table(results)