Page MenuHomePhabricator

Create queries for example graphs
Open, LowPublic

Description

  • Administrative sub-divisions of a given entity query: modify this query to get a list of SUB-divisions of a given entity. E.g. states of USA, or provinces of Argentina. Each item must be unique, with name, flag, capital name, location, and image (all are optional{. Prevent query from returning the item itself, only subitems.
  • For a given country, get a list of all bordering countries, as well as the requested country itself. Each must be unique. Optional capital with location and image, plus country flag.
  • Given a city, get the historical population, and ensure each item is unique for that time. If more than one item is present for the same year, average them unless one is prefered. If possible, get the source of the data

Event Timeline

For the first query: https://www.mediawiki.org/wiki/User:Smalyshev_(WMF)/Countries_and_States

The problem is ?types need to be configured manually and may be different for different countries. Let's see if that works.

The third one:

SELECT (AVG(?population) as ?population) ?year WHERE {
  BIND(wd:Q64 as ?city)
  ?city p:P1082 [ ps:P1082 ?population; pq:P585 ?date ]
  BIND(year(?date) as ?year)             
} GROUP BY ?year ORDER BY ?year

@Smalyshev the first query still gets the country itself - any good way to prevent that? Thanks!!!

@Yurik you could add something like FILTER(?id != ?country) to it.

@Smalyshev sure, but I thought this might indicate that we might need to restructure the query a bit? But sure, I can totally do that.

I think it's better to use discussion page.