User talk:Wolfgang Fahl: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 56: | Line 56: | ||
<pre> | <pre> | ||
#defaultView:Map{"hide":["?line"]} | #defaultView:Map{"hide":["?line"]} | ||
SELECT | SELECT ?q ?Umsiedler ?woher ?interniert ?dest ?line ?color WHERE { | ||
# Select entities related to a specific item (Q995329) | # Select entities related to a specific item (Q995329) | ||
?q wdt:P2 wd:Q995329 . | ?q wdt:P2 wd:Q995329 . | ||
Line 86: | Line 86: | ||
?valuenode3 wikibase:geoLatitude ?lat3 . | ?valuenode3 wikibase:geoLatitude ?lat3 . | ||
?valuenode3 wikibase:geoLongitude ?lon3. | ?valuenode3 wikibase:geoLongitude ?lon3. | ||
# Create a LINESTRING connecting all three points | # 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(CONCAT('LINESTRING (', STR(?lon1), ' ', STR(?lat1), ',', STR(?lon2), ' ', STR(?lat2), ',', STR(?lon3), ' ', STR(?lat3), ')') AS ?str) . | ||
BIND(STRDT(?str, geo:wktLiteral) AS ?line) | BIND(STRDT(?str, geo:wktLiteral) AS ?line) | ||
# Assign color based on internment camp | |||
# This is a simple example; you may need to adjust based on your specific camps | |||
BIND( | |||
CASE | |||
WHEN ?interniert = wd:Q12345 THEN "rgb(255,0,0)" # Red for camp 1 | |||
WHEN ?interniert = wd:Q67890 THEN "rgb(0,255,0)" # Green for camp 2 | |||
WHEN ?interniert = wd:Q11111 THEN "rgb(0,0,255)" # Blue for camp 3 | |||
ELSE "rgb(128,128,128)" # Gray for unknown camps | |||
END AS ?color | |||
) | |||
} | } | ||
</pre> | </pre> | ||
https://ngdemo.bitplan.com/colormap |
Latest revision as of 13:19, 18 September 2024
SPARQL Suche
claude AI
<source lang='sparql'>
- 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>
Prompt
the visualization is awkward we want to changes- map to rgb values we give and choose the color not by the distance but by the "lager"
Claude AI
#defaultView:Map{"hide":["?line"]} SELECT ?q ?Umsiedler ?woher ?interniert ?dest ?line ?color 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. # 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) # Assign color based on internment camp # This is a simple example; you may need to adjust based on your specific camps BIND( CASE WHEN ?interniert = wd:Q12345 THEN "rgb(255,0,0)" # Red for camp 1 WHEN ?interniert = wd:Q67890 THEN "rgb(0,255,0)" # Green for camp 2 WHEN ?interniert = wd:Q11111 THEN "rgb(0,0,255)" # Blue for camp 3 ELSE "rgb(128,128,128)" # Gray for unknown camps END AS ?color ) }