Strabon

view scripts/example-query.py @ 1499:8e6437ba6ba2

[maven-release-plugin] prepare for next development iteration
author Babis Nikolaou <charnik@di.uoa.gr>
date Wed Mar 11 20:30:53 2015 +0200 (2015-03-11)
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))