I have solved my problem but it was hard to do. In fact, I was using an INSERT syntax that does not seem to work for geospatial even if it is working for the standard query. I cannot explain why but if someone can explain, I would appreciate.
The triples produced with both insert statements are exactly the same. I am sure that the two inserts are not exactly doing the same thing however. Internally, there must be a diiference but what exactly? I have included that comparison at the end of this text.
(1) How I have first inserted my geospatial triples (this is for Geometry but I was doing lat and long the same way). With those triples I was not able to calculate the distance.
with <http://cdpq.com/rcagraph_geo_c2>
insert
{?s ?p ?o}
using <http://cdpq.com/rcagraph>
where {
values(?city) {("Montreal")}
values(?p) {(rdf:type)}
values(?o) {(geo:Geometry)}
?prop onto:Property-cityName ?city .
?prop onto:Property-id ?id .
bind(iri(concat("http://www.cdpq.com/PropertyGeom/", str(?id))) as ?s)
}
(2) How I have finally inserted my geospatial triples and got the distance calculated.
insert { graph http://cdpq.com/rcagraph_geo_c4 { ?s ?p ?o} }
where {
graph http://cdpq.com/rcagraph
{
values(?city) {("Montreal")}
values(?p) {(rdf:type)}
values(?o) {(geo:Geometry)}
?prop onto:Property-cityName ?city .
?prop onto:Property-id ?id .
bind(iri(concat("http://www.cdpq.com/PropertyGeom/", str(?id))) as ?s)
}
}
(3) The tiples comparison. For graph c2, I was not able to get the distance calculated but for c4, I can.