def get_property_list(row_uri):
	query = "SELECT ?property ?object WHERE {<%s> ?property ?object}" % row_uri
	query_url = "%s?default-graph-uri=&query=%s&format=text%%2Frdf+n3&debug=on&timeout=" % (kendra_signpost_utils.get_sparql_endpoint_uri(), urllib.quote_plus(query))
	return map(strip_result_fields, re.findall(r"(?s)<result>.*?</result>", urllib.urlopen(query_url).read()))
def get_type_list():
	query = "SELECT ?subject ?object WHERE {?subject <http://kendra.org/#hasType> ?object}"
	query_url = "%s?default-graph-uri=&query=%s&format=text%%2Frdf+n3&debug=on&timeout=" % (kendra_signpost_utils.get_sparql_endpoint_uri(), urllib.quote_plus(query))
	return map(strip_result_fields, re.findall(r"(?s)<result>.*?</result>", urllib.urlopen(query_url).read()))
for a, b in subclass_of_mappings:
    implies[a] = implies.get(a, []) + [b]

# Then prune duplicate arcs
for a in implies:
    implies[a] = {}.fromkeys(implies[a]).keys()

name_uri_to_type_uri = dict(get_type_list())

print >> logfile, "<mappings>"
print >> logfile, "same_as_mappings:", same_as_mappings
print >> logfile, "subclass_of_mappings:", subclass_of_mappings
## print >> logfile, "item_synset:", item_synset
print >> logfile, "name_uri_to_type_uri:", name_uri_to_type_uri
print >> logfile, "sparql endpoint uri", kendra_signpost_utils.get_sparql_endpoint_uri()
print >> logfile, "</mappings>"

print >> logfile, "<environment>"
for k in os.environ:
    print >> logfile, k, os.environ.get(k)
print >> logfile, "</environment>"
logfile.flush()

if os.environ.get('HTTPS', '') == 'on':
    # Warning: proxied HTTPS requests will not attempt to validate the server certificate!
    protocol = 'https'
else:
    protocol = 'http'

request_uri_path = string.split(os.environ.get('REQUEST_URI', ''), '?')[0]