User talk:Wolfgang Fahl

From FactGrid
Revision as of 14:13, 18 September 2024 by Wolfgang Fahl (talk | contribs) (→‎claude AI: new section)
Jump to navigation Jump to search

SPARQL Suche

claude AI

<source lang='sparql'>

  1. defaultView:Map{"hide":["?line"]}

SELECT * WHERE {

 # Select entities related to a specific item (Q995329)
 ?q wdt:P2 wd:Q995329 .
 
 # Get the number of displaced persons for each entity
 ?q wdt:P1198 ?Umsiedler .
 
 # Get the origin location of the displaced persons
 ?q p:P1198/pq:P95 ?woher .
 ?woher wdt:P48 ?coord1 .
 # Extract latitude and longitude for the origin
 ?woher p:P48/psv:P48 ?valuenode1. 
 ?valuenode1 wikibase:geoLatitude ?lat1 . 
 ?valuenode1 wikibase:geoLongitude ?lon1.
 
 # Get the internment location
 ?q p:P1198/pq:P216 ?interniert .
 ?interniert wdt:P48 ?coord2 .
 # Extract latitude and longitude for the internment location
 ?interniert p:P48/psv:P48 ?valuenode2. 
 ?valuenode2 wikibase:geoLatitude ?lat2 . 
 ?valuenode2 wikibase:geoLongitude ?lon2.
 
 # Get the destination location
 ?q p:P1198/pq:P29 ?dest .
 ?dest wdt:P48 ?coord3 .
 # Extract latitude and longitude for the destination
 ?dest p:P48/psv:P48 ?valuenode3. 
 ?valuenode3 wikibase:geoLatitude ?lat3 . 
 ?valuenode3 wikibase:geoLongitude ?lon3.
 
 # Calculate distances between points
 BIND(geof:distance(?coord1, ?coord2) AS ?dist).
 BIND(geof:distance(?coord2, ?coordD) AS ?dist2).
 
 # Create layer values based on distances (possibly for visualization)
 BIND(floor(?dist/10) AS ?layer).
 BIND(floor(?dist2/10) AS ?layer).
 
 # Create a LINESTRING connecting all three points
 BIND(CONCAT('LINESTRING (', STR(?lon1), ' ', STR(?lat1), ',', STR(?lon2), ' ', STR(?lat2), ',', STR(?lon3), ' ', STR(?lat3), ')') AS ?str) .
 BIND(STRDT(?str, geo:wktLiteral) AS ?line)

} </source>