Skip to content

Instantly share code, notes, and snippets.

@floatingpurr
Last active May 8, 2019 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floatingpurr/490df22fdbeff0f127f71f83eff6a284 to your computer and use it in GitHub Desktop.
Save floatingpurr/490df22fdbeff0f127f71f83eff6a284 to your computer and use it in GitHub Desktop.
Query suggestions
Hello Daniel,
sorry for the late! Regarding your query, I noticed that you get some reduntant geo data in the resultset, such as:
wd:Q25 Point(-3.637848 52.349602) wd:Q21257225
wd:Q25 Point(-3.637848 52.349602) wd:Q21560979
Usually that is not a problem when you visualize your data with #defaultView:Map mode. They just overlap. This time, the
resulset you are going to render is quite heavy (100k+ entities). So, why not transforming that problem in a coloring
rule? : )
For example, you might want to design a query for getting all the cited locations with their own frequency of citation:
#defaultView:Map{"layer":"?topicsBin"}
SELECT ?topicLabel ?geoloc ?topicsBin ?topicCitations
WHERE{
BIND(
IF(?topicCitations < 10, "Log < 1",
IF(?topicCitations < 100, "Log < 2",
IF(?topicCitations < 1000, "Log < 3",
"Log >= 3")))
AS ?topicsBin)
{
SELECT ?topic ?geoloc (count(?topic) as ?topicCitations)
WHERE {
?paper wdt:P921 ?topic ;
wdt:P31 wd:Q13442814 .
?topic wdt:P625 ?geoloc.
}
GROUP BY ?topic ?geoloc
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
order by DESC(?topicCitations)
..and here is the result: http://tinyurl.com/y9blhkkh.
Same map as before but colored (Log10 clustered) and with 100x less geo points (mainly redundat information).
I hope this will help in some way :)
Good luck for your recording!
@Daniel-Mietchen
Copy link

Thanks - looks good!
The main reason for overlapping geo points is that I am doing the topic mapping by countries first, which is especially visible in Africa, on which I am concentrating in preparation for Wikimania.

@Daniel-Mietchen
Copy link

The presentation for which I had intended to use this has finally taken a different turn. Due to limited time, I could not show any Wikidata query, but I think yours is very well suited for one of my Wikimania sessions: https://wikimania2018.wikimedia.org/wiki/User:Daniel_Mietchen/Submissions/Zooming_in_on_Africa-related_research:_Wikidata-based_scholarly_profiles_of_people,_papers,_places,_topics_and_more .

@Daniel-Mietchen
Copy link

Just for the record, the presentation I mentioned sits at https://doi.org/10.5281/zenodo.1299251 .

@Daniel-Mietchen
Copy link

That Wikimania session was hampered by a malfunctioning projector, which is why I did not get to the bottom of the page.

I did use your query in this workshop a few days ago.

@floatingpurr
Copy link
Author

Hey @Daniel-Mietchen. I'm sorry, I missed your updates! I've seen them just now! Thanks : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment