Strabon

diff scripts/example-query.py @ 1552:0e334dc20181

bug in google maps key
author Dimitris Bilidas <d.bilidas@di.uoa.gr>
date Mon Nov 09 18:09:06 2020 +0200 (2020-11-09)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/example-query.py	Mon Nov 09 18:09:06 2020 +0200
     1.3 @@ -0,0 +1,29 @@
     1.4 +#!/usr/bin/env python
     1.5 +
     1.6 +import sys, re, os
     1.7 +import os
     1.8 +import glob
     1.9 +import time
    1.10 +import shutil
    1.11 +import httplib, urllib
    1.12 +
    1.13 +def main(argv):
    1.14 +
    1.15 +    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 . }'
    1.16 +    params = urllib.urlencode({'SPARQLQuery': query, 'format': "XML"})
    1.17 +    headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/xml"}
    1.18 +
    1.19 +    #conn = httplib.HTTPConnection("papos.space.noa.gr:8080")
    1.20 +    #conn.request("POST", "/endpoint/Query", params, headers)
    1.21 +
    1.22 +    conn = httplib.HTTPConnection("test.strabon.di.uoa.gr")
    1.23 +    conn.request("POST", "/NOA/Query", params, headers)
    1.24 +
    1.25 +    response = conn.getresponse()
    1.26 +    print response.status, response.reason
    1.27 +    print response.msg
    1.28 +    print response.read()
    1.29 +    return 0
    1.30 +
    1.31 +if __name__ == "__main__":
    1.32 +    sys.exit(main(sys.argv))