Strabon
view scripts/example-query.py @ 1424:c8cc4daeeafa
corrected tests that were expecting a WKT in 4326 to contain also the URI of the CRS; we do not include this anymore, if the CRS is the default for that datatype
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Tue Sep 23 14:36:26 2014 +0300 (2014-09-23) |
parents | |
children |
line source
1 #!/usr/bin/env python
3 import sys, re, os
4 import os
5 import glob
6 import time
7 import shutil
8 import httplib, urllib
10 def main(argv):
12 query = 'PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> SELECT ?H (strdf:transform(?HGEO, <http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?GEO) WHERE { ?H rdf:type noa:Hotspot . ?H noa:hasAcquisitionTime ?HAT . FILTER(str(?HAT) = "2010-08-21T21:20:00") . ?H noa:isDerivedFromSensor ?HS . FILTER(str(?HS) = "MSG1_RSS" ) . ?H noa:hasGeometry ?HGEO . }'
13 params = urllib.urlencode({'SPARQLQuery': query, 'format': "XML"})
14 headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/xml"}
16 #conn = httplib.HTTPConnection("papos.space.noa.gr:8080")
17 #conn.request("POST", "/endpoint/Query", params, headers)
19 conn = httplib.HTTPConnection("test.strabon.di.uoa.gr")
20 conn.request("POST", "/NOA/Query", params, headers)
22 response = conn.getresponse()
23 print response.status, response.reason
24 print response.msg
25 print response.read()
26 return 0
28 if __name__ == "__main__":
29 sys.exit(main(sys.argv))