functions in mapping files - the st_asText(geom) propblem

41 views
Skip to first unread message

Konstantinos Kotis

unread,
Dec 18, 2014, 3:25:49 AM12/18/14
to ontop...@googlegroups.com
Hi, 

we need to use a spatial function (st_asText) in postGIS in order to tranlsate geometry values to WKT directly in the mappings. The source (SQL query) is executed correctly (within Protege) : SELECT obj_id, traj_id, seg_id, st_asText(geom) FROM imis_seg

However, when put in server and try the mapping (see below), we get error 500 for the 'geom' variable:

ontology:imis_seg/{obj_id}/{traj_id}/{seg_id}/ a ontology:TrajectoryLineSegment ; ontology:segmentId {seg_id} ; ontology:segmentGeom {geom} ; ontology:trajectoryOfSegment ontology:imis_traj/{traj_id}/ ; ontology:segementToVessel ontology:imis_obj/{obj_id}/ . 

Even if we try to put the spatial function in the target, we get the same error:

ontology:imis_seg/{obj_id}/{traj_id}/{seg_id}/ a ontology:TrajectoryLineSegment ; ontology:segmentId {seg_id} ; ontology:segmentGeom {st_asText(geom)} ; ontology:trajectoryOfSegment ontology:imis_traj/{traj_id}/ ; ontology:segementToVessel ontology:imis_obj/{obj_id}/ . 

Any suggestions?

thanks in advance!

Kostas

PS. We had tested this function with the D2RQ mapping language, with success. 

Guohui Xiao

unread,
Dec 18, 2014, 4:10:12 AM12/18/14
to Konstantinos Kotis, ontop...@googlegroups.com
Hi, Konstantinos,

You could try to give an alias to "st_asText(geom)" 

SELECT obj_id, traj_id, seg_id, st_asText(geom) AS geomWKT FROM imis_seg

and use geomWKT in the target

ontology:imis_seg/{obj_id}/{traj_id}/{seg_id}/ a ontology:TrajectoryLineSegment ; ontology:segmentId {seg_id} ; ontology:segmentGeom {geomWKT} ; ontology:trajectoryOfSegment ontology:imis_traj/{traj_id}/ ; ontology:segementToVessel ontology:imis_obj/{obj_id}/ . 

Please note that in this case, since ST_asText is a special builtin function, ontop probably cannot apply all of the optimizations.

Let us know how it goes.

Best,

Guohui


--
You received this message because you are subscribed to the Google Groups "ontop4obda" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ontop4obda+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Guohui Xiao, PhD
Assistant Professor with a fixed-term contract
KRDB - Faculty of Computer Science        
Free University of Bozen-Bolzano
Piazza Domenicani, 3                
I-39100 Bolzano, Italy    

http://www.ghxiao.org

Guohui Xiao

unread,
Dec 18, 2014, 4:24:53 AM12/18/14
to Konstantinos Kotis, ontop...@googlegroups.com
Thanks for your quick confirmation!

Cheers,

Guohui

On 18 December 2014 at 10:22, Konstantinos Kotis <kotis....@gmail.com> wrote:
Hi Guohui,

many thanks! It worked!

Kostas
--
Konstantinos Kotis, PhD
Post Doctoral Research Scientist
Department of Digital Systems, University of Piraeus.
Head of IT Department
Samos Regional Unit, North Aegean Regional Administration (NARA).

Samos, Greece
+30 6974822712
http://gr.linkedin.com/in/kotis
Reply all
Reply to author
Forward
0 new messages