[Wikidata] Re: connecting coordinates

2022-01-27 Thread Jan Macura
Dear Olaf,

I would never use SPARQL for a data manipulation like you desire. Up to the
best of my knowledge, SPARQL (even not GeoSPARQL) is not even capable of
fulfilling your needs. Simply because it can't return both a table of
results (which you probably need as you query for multiple properties) and
a single result (which would the connection of the points be).
Export your ordered results into some table or JSON file and post-process
it with some other tool/language. That is the best advice I can give you at
the moment.

Yet the simple requirement and the fact that no one was able to answer your
question within 1 day has driven my attention. So I experimented and I
think that something like the following query should give you the journey
you seek (connection of points in given order).
Why it refuses to render as a map, I don't honestly know, but might be
because the result itself is a string.
But of course, by this approach you loose all the interesting information
about the points/events. You *only *get the journey.

SELECT (concat("LINESTRING(",group_concat(?coor;separator=", "),")") AS
?journey) WITH {
SELECT DISTINCT ?coordinates WHERE {
  ?person wdt:P2 wd:Q9;
wdt:P106 ?dob.
  FILTER(("1700-01-01"^^xsd:dateTime <= ?dob) && (?dob <
"1720-01-01"^^xsd:dateTime))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  ?person wdt:P47 ?Localisation.
  ?Localisation wdt:P48 ?coordinates .
  FILTER BOUND(?coordinates).
}
ORDER BY DESC(?dob)
  } AS %q
  WHERE {
INCLUDE %q
  BIND((STRLEN(?coordinates)-7) AS ?len) .
  BIND(SUBSTR(?coordinates,7,?len) AS ?coor).
}

Best regards
 Jan

On Wed, 26 Jan 2022 at 13:55, Olaf Simons 
wrote:

> Dear all,
>
> a colleague has put data on FactGrid on a group of people travelling
> though early 18th-century Europe. I wonder how I could connect the
> geographic coordinates in their chronological order.
>
> This is the table that has the order
>
> https://tinyurl.com/ycrumyvb
>
> could somone show me how I connect the dots?
>
> much obliged,
> Olaf
>
>
>
> Dr. Olaf Simons
> Forschungszentrum Gotha der Universität Erfurt
> Am Schlossberg 2
> 99867 Gotha
> Büro: +49-361-737-1722
> Mobil: +49-179-5196880
> Privat: Hauptmarkt 17b/ 99867 Gotha
> ___
> Wikidata mailing list -- wikidata@lists.wikimedia.org
> To unsubscribe send an email to wikidata-le...@lists.wikimedia.org
>
___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


[Wikidata] Re: connecting coordinates

2022-01-27 Thread Haddad, TC
Apologies in advance, as my knowledge is more on the geospatial side than
on the SPARQL side, so I am interested if there is a solution as well.

Geospatially speaking, order can be preserved if the chronologically sorted
points returned can be converted to a LineString before display. Looking
into the topic, it seems that for this to be supported you might need to
support GeoSPARQL extensions.

https://opengeospatial.github.io/ogc-geosparql/geosparql11/spec.html

The only reference I could find to a function for this conversion from
points--> LineString was in these docs:
https://graphdb.ontotext.com/documentation/standard/sparql-functions-reference.html#geosparql-functions

in which there is a reference to a GeoSPARQL extension function that could
be of use:

shortestLine(geomLiteral g1, geomLiteral g2)

This appears to only create individual line segments between 2 points at a
time, but it is a start. LineStrings can be arbitrarily long, however, so
using 2 points is just the bare bones of functionality. A function that
accepts an ordered list of points would be more ideal.

Geospatially speaking, individual line segments can also be grouped
together as MultiLineStrings, which would allow you to join multiple
journeys together (useful for e.g. taking one long train journey and
connecting to a second train line midway).


Other docs that seem to mention support for LineStrings or MultiLineStrings
if useful:

https://docs.cambridgesemantics.com/anzograph/v2.3/userdoc/geo-spatial.htm
https://jena.apache.org/documentation/geosparql/



On Thu, Jan 27, 2022 at 5:49 AM James Heald  wrote:

> [This email originated from outside of OSU. Use caution with links and
> attachments.]
>
> Agreed.  I don't think it's guaranteed that the GROUP_CONCAT will
> respect the order of items it's given.  (I believe this is a standing
> well-known requested feature in SPARQL circles).
>
> But yet, it seems to work.
>
> eg here's a version of the previous query, sorted by longitude
> https://w.wiki/4kXS
> and the points *do* seem to be being joined together in the right order.
>
>--  J.
>
>
> On 27/01/2022 13:39, Bruno BELHOSTE wrote:
> > The real problem is how to order the events in the query according to
> > their dates in order to draw the line from one event place to the next
> > event place.
> >
> > It is clearly not easy.
> >
> > Best,
> >
> > Bruno
> >
> > Le 27/01/2022 à 14:04, James Heald a écrit :
> >> You're looking for a query like this one, I think
> >>
> >> https://w.wiki/4kW4
> >>
> >> but adapted to your data.
> >>
> >> All best,
> >>
> >>   James.
> >>
> >>
> ___
> Wikidata mailing list -- wikidata@lists.wikimedia.org
> To unsubscribe send an email to wikidata-le...@lists.wikimedia.org
>
___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


[Wikidata] Re: connecting coordinates

2022-01-27 Thread Bruno BELHOSTE

You need to have the events put in chronological order inside the database.

It is not the case in the Olaf's problem because the dates come from 
different pages.


Bruno


Le 27/01/2022 à 14:48, James Heald a écrit :
Agreed. I don't think it's guaranteed that the GROUP_CONCAT will 
respect the order of items it's given.  (I believe this is a standing 
well-known requested feature in SPARQL circles).


But yet, it seems to work.

eg here's a version of the previous query, sorted by longitude
   https://w.wiki/4kXS
and the points *do* seem to be being joined together in the right order.

  --  J.


On 27/01/2022 13:39, Bruno BELHOSTE wrote:
The real problem is how to order the events in the query according to 
their dates in order to draw the line from one event place to the 
next event place.


It is clearly not easy.

Best,

Bruno

Le 27/01/2022 à 14:04, James Heald a écrit :

You're looking for a query like this one, I think

https://w.wiki/4kW4

but adapted to your data.

All best,

  James.



___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org

___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


[Wikidata] Re: connecting coordinates

2022-01-27 Thread James Heald
Agreed.  I don't think it's guaranteed that the GROUP_CONCAT will 
respect the order of items it's given.  (I believe this is a standing 
well-known requested feature in SPARQL circles).


But yet, it seems to work.

eg here's a version of the previous query, sorted by longitude
   https://w.wiki/4kXS
and the points *do* seem to be being joined together in the right order.

  --  J.


On 27/01/2022 13:39, Bruno BELHOSTE wrote:
The real problem is how to order the events in the query according to 
their dates in order to draw the line from one event place to the next 
event place.


It is clearly not easy.

Best,

Bruno

Le 27/01/2022 à 14:04, James Heald a écrit :

You're looking for a query like this one, I think

https://w.wiki/4kW4

but adapted to your data.

All best,

  James.



___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


[Wikidata] Re: connecting coordinates

2022-01-27 Thread Bruno BELHOSTE
The real problem is how to order the events in the query according to 
their dates in order to draw the line from one event place to the next 
event place.


It is clearly not easy.

Best,

Bruno

Le 27/01/2022 à 14:04, James Heald a écrit :

You're looking for a query like this one, I think

https://w.wiki/4kW4

but adapted to your data.

All best,

  James.


On 26/01/2022 23:20, Daniel Mietchen via Wikidata wrote:

Hi Olaf,
you could bind the dates such that they can be used as the color 
layer for

the dots on the map: https://tinyurl.com/y9yb6blb . This way, they are
sorted in time, and you can clock your way through by looking at 
which dots

appear or change their colour.
I also looked into getting the dots connected in some way but no luck 
there

yet.
Best,
Daniel

On Wed, Jan 26, 2022 at 6:12 PM Olaf Simons 


wrote:


Hi Haddad,

I remain puzzled by the railway network - this is too bright for me. 
This
search produces a person, and a series of events in chronological 
sequence


https://tinyurl.com/ya85ymss

I have no problem to get the places as dots on a map

https://tinyurl.com/y997e8bc

but that's not telling me how he moved... I hoped there is a nice 
command

like bind these as sorted...

Best,
Olaf








Haddad, TC  hat am 26.01.2022 17:29

geschrieben:



to join a list of points into lines, you can use LineString or
MultiLineString formats:
https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry 



presumably you would sort the points chronologically before 
grouping them

this way to get the shape you are expecting.

On Wed, Jan 26, 2022 at 4:55 AM Olaf Simons <

olaf.sim...@pierre-marteau.com>

wrote:

[This email originated from outside of OSU. Use caution with links 
and

attachments.]

Dear all,

a colleague has put data on FactGrid on a group of people travelling
though early 18th-century Europe. I wonder how I could connect the
geographic coordinates in their chronological order.

This is the table that has the order

https://tinyurl.com/ycrumyvb

could somone show me how I connect the dots?

much obliged,
Olaf



Dr. Olaf Simons
Forschungszentrum Gotha der Universität Erfurt
Am Schlossberg 2
99867 Gotha
Büro: +49-361-737-1722
Mobil: +49-179-5196880
Privat: Hauptmarkt 17b/ 99867 Gotha
___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


Dr. Olaf Simons
Forschungszentrum Gotha der Universität Erfurt
Am Schlossberg 2
99867 Gotha
Büro: +49-361-737-1722
Mobil: +49-179-5196880
Privat: Hauptmarkt 17b/ 99867 Gotha
___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org




___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org

___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org

___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


[Wikidata] Re: connecting coordinates

2022-01-27 Thread James Heald

You're looking for a query like this one, I think

https://w.wiki/4kW4

but adapted to your data.

All best,

  James.


On 26/01/2022 23:20, Daniel Mietchen via Wikidata wrote:

Hi Olaf,
you could bind the dates such that they can be used as the color layer for
the dots on the map: https://tinyurl.com/y9yb6blb . This way, they are
sorted in time, and you can clock your way through by looking at which dots
appear or change their colour.
I also looked into getting the dots connected in some way but no luck there
yet.
Best,
Daniel

On Wed, Jan 26, 2022 at 6:12 PM Olaf Simons 
wrote:


Hi Haddad,

I remain puzzled by the railway network - this is too bright for me. This
search produces a person, and a series of events in chronological sequence

https://tinyurl.com/ya85ymss

I have no problem to get the places as dots on a map

https://tinyurl.com/y997e8bc

but that's not telling me how he moved... I hoped there is a nice command
like bind these as sorted...

Best,
Olaf








Haddad, TC  hat am 26.01.2022 17:29

geschrieben:



to join a list of points into lines, you can use LineString or
MultiLineString formats:
https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry

presumably you would sort the points chronologically before grouping them
this way to get the shape you are expecting.

On Wed, Jan 26, 2022 at 4:55 AM Olaf Simons <

olaf.sim...@pierre-marteau.com>

wrote:


[This email originated from outside of OSU. Use caution with links and
attachments.]

Dear all,

a colleague has put data on FactGrid on a group of people travelling
though early 18th-century Europe. I wonder how I could connect the
geographic coordinates in their chronological order.

This is the table that has the order

https://tinyurl.com/ycrumyvb

could somone show me how I connect the dots?

much obliged,
Olaf



Dr. Olaf Simons
Forschungszentrum Gotha der Universität Erfurt
Am Schlossberg 2
99867 Gotha
Büro: +49-361-737-1722
Mobil: +49-179-5196880
Privat: Hauptmarkt 17b/ 99867 Gotha
___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


Dr. Olaf Simons
Forschungszentrum Gotha der Universität Erfurt
Am Schlossberg 2
99867 Gotha
Büro: +49-361-737-1722
Mobil: +49-179-5196880
Privat: Hauptmarkt 17b/ 99867 Gotha
___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org




___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org

___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


[Wikidata] Re: connecting coordinates

2022-01-26 Thread Daniel Mietchen via Wikidata
Hi Olaf,
you could bind the dates such that they can be used as the color layer for
the dots on the map: https://tinyurl.com/y9yb6blb . This way, they are
sorted in time, and you can clock your way through by looking at which dots
appear or change their colour.
I also looked into getting the dots connected in some way but no luck there
yet.
Best,
Daniel

On Wed, Jan 26, 2022 at 6:12 PM Olaf Simons 
wrote:

> Hi Haddad,
>
> I remain puzzled by the railway network - this is too bright for me. This
> search produces a person, and a series of events in chronological sequence
>
> https://tinyurl.com/ya85ymss
>
> I have no problem to get the places as dots on a map
>
> https://tinyurl.com/y997e8bc
>
> but that's not telling me how he moved... I hoped there is a nice command
> like bind these as sorted...
>
> Best,
> Olaf
>
>
>
>
>
>
>
> > Haddad, TC  hat am 26.01.2022 17:29
> geschrieben:
> >
> >
> > to join a list of points into lines, you can use LineString or
> > MultiLineString formats:
> > https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry
> >
> > presumably you would sort the points chronologically before grouping them
> > this way to get the shape you are expecting.
> >
> > On Wed, Jan 26, 2022 at 4:55 AM Olaf Simons <
> olaf.sim...@pierre-marteau.com>
> > wrote:
> >
> > > [This email originated from outside of OSU. Use caution with links and
> > > attachments.]
> > >
> > > Dear all,
> > >
> > > a colleague has put data on FactGrid on a group of people travelling
> > > though early 18th-century Europe. I wonder how I could connect the
> > > geographic coordinates in their chronological order.
> > >
> > > This is the table that has the order
> > >
> > > https://tinyurl.com/ycrumyvb
> > >
> > > could somone show me how I connect the dots?
> > >
> > > much obliged,
> > > Olaf
> > >
> > >
> > >
> > > Dr. Olaf Simons
> > > Forschungszentrum Gotha der Universität Erfurt
> > > Am Schlossberg 2
> > > 99867 Gotha
> > > Büro: +49-361-737-1722
> > > Mobil: +49-179-5196880
> > > Privat: Hauptmarkt 17b/ 99867 Gotha
> > > ___
> > > Wikidata mailing list -- wikidata@lists.wikimedia.org
> > > To unsubscribe send an email to wikidata-le...@lists.wikimedia.org
> > >
> > ___
> > Wikidata mailing list -- wikidata@lists.wikimedia.org
> > To unsubscribe send an email to wikidata-le...@lists.wikimedia.org
>
> Dr. Olaf Simons
> Forschungszentrum Gotha der Universität Erfurt
> Am Schlossberg 2
> 99867 Gotha
> Büro: +49-361-737-1722
> Mobil: +49-179-5196880
> Privat: Hauptmarkt 17b/ 99867 Gotha
> ___
> Wikidata mailing list -- wikidata@lists.wikimedia.org
> To unsubscribe send an email to wikidata-le...@lists.wikimedia.org
>
___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


[Wikidata] Re: connecting coordinates

2022-01-26 Thread Olaf Simons
Hi Haddad, 

I remain puzzled by the railway network - this is too bright for me. This 
search produces a person, and a series of events in chronological sequence

https://tinyurl.com/ya85ymss

I have no problem to get the places as dots on a map

https://tinyurl.com/y997e8bc

but that's not telling me how he moved... I hoped there is a nice command like 
bind these as sorted...

Best,
Olaf







> Haddad, TC  hat am 26.01.2022 17:29 geschrieben:
> 
>  
> to join a list of points into lines, you can use LineString or
> MultiLineString formats:
> https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry
> 
> presumably you would sort the points chronologically before grouping them
> this way to get the shape you are expecting.
> 
> On Wed, Jan 26, 2022 at 4:55 AM Olaf Simons 
> wrote:
> 
> > [This email originated from outside of OSU. Use caution with links and
> > attachments.]
> >
> > Dear all,
> >
> > a colleague has put data on FactGrid on a group of people travelling
> > though early 18th-century Europe. I wonder how I could connect the
> > geographic coordinates in their chronological order.
> >
> > This is the table that has the order
> >
> > https://tinyurl.com/ycrumyvb
> >
> > could somone show me how I connect the dots?
> >
> > much obliged,
> > Olaf
> >
> >
> >
> > Dr. Olaf Simons
> > Forschungszentrum Gotha der Universität Erfurt
> > Am Schlossberg 2
> > 99867 Gotha
> > Büro: +49-361-737-1722
> > Mobil: +49-179-5196880
> > Privat: Hauptmarkt 17b/ 99867 Gotha
> > ___
> > Wikidata mailing list -- wikidata@lists.wikimedia.org
> > To unsubscribe send an email to wikidata-le...@lists.wikimedia.org
> >
> ___
> Wikidata mailing list -- wikidata@lists.wikimedia.org
> To unsubscribe send an email to wikidata-le...@lists.wikimedia.org

Dr. Olaf Simons
Forschungszentrum Gotha der Universität Erfurt
Am Schlossberg 2
99867 Gotha
Büro: +49-361-737-1722
Mobil: +49-179-5196880
Privat: Hauptmarkt 17b/ 99867 Gotha
___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org


[Wikidata] Re: connecting coordinates

2022-01-26 Thread Haddad, TC
to join a list of points into lines, you can use LineString or
MultiLineString formats:
https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry

presumably you would sort the points chronologically before grouping them
this way to get the shape you are expecting.

On Wed, Jan 26, 2022 at 4:55 AM Olaf Simons 
wrote:

> [This email originated from outside of OSU. Use caution with links and
> attachments.]
>
> Dear all,
>
> a colleague has put data on FactGrid on a group of people travelling
> though early 18th-century Europe. I wonder how I could connect the
> geographic coordinates in their chronological order.
>
> This is the table that has the order
>
> https://tinyurl.com/ycrumyvb
>
> could somone show me how I connect the dots?
>
> much obliged,
> Olaf
>
>
>
> Dr. Olaf Simons
> Forschungszentrum Gotha der Universität Erfurt
> Am Schlossberg 2
> 99867 Gotha
> Büro: +49-361-737-1722
> Mobil: +49-179-5196880
> Privat: Hauptmarkt 17b/ 99867 Gotha
> ___
> Wikidata mailing list -- wikidata@lists.wikimedia.org
> To unsubscribe send an email to wikidata-le...@lists.wikimedia.org
>
___
Wikidata mailing list -- wikidata@lists.wikimedia.org
To unsubscribe send an email to wikidata-le...@lists.wikimedia.org