Strabon

diff scripts/example-query.py @ 1422:f86d1129ce79

it turns out that there is no simple way of having the datatype of a constant geometry available in the query builder, thus it is not easy for geof:getSRID to determine the correct datatype and return the appropriate URI for the CRS, when that has SRID 4326. Therefore, we choose to always return CRS84, even for strdf:WKT arguments. Notice, that when geof:getSRID is called evaluated in Java, we have such information available and we can return the correct result. However, we chose in changeset 1420:37792dd7041b to always push the evaluation of all spatial functions in the database. The respective tests have been updated as well.
author Babis Nikolaou <charnik@di.uoa.gr>
date Tue Sep 23 14:05:26 2014 +0300 (2014-09-23)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/example-query.py	Tue Sep 23 14:05:26 2014 +0300
     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))