Manybubbles added a comment.

I came up with some other fun ones a few days ago while testing a data load:

I've been playing with some queries this morning.

Who discovered the most asteroids:
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX entity: http://www.wikidata.org/entity/
PREFIX t: http://www.wikidata.org/entity/assert/
SELECT ?discoverer ?discovererName (COUNT(?asteroid) AS ?count)
WHERE {

  ?asteroid t:P31 entity:Q3863 .
  ?asteroid t:P61 ?discoverer .
  OPTIONAL { ?discoverer rdfs:label ?discovererName }

}
GROUP BY ?discoverer ?discovererName
ORDER BY DESC(?count)

I realized that that query is probably wrong when I wrote the one for who 
discovered the most planets:
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX entity: http://www.wikidata.org/entity/
PREFIX t: http://www.wikidata.org/entity/assert/
SELECT ?discoverer ?discovererName (COUNT(?planet) as ?count)
WHERE {

  ?ppart t:P279* entity:Q634 .
  ?planet t:P31 ?ppart .
  ?planet t:P61 ?discoverer .
  OPTIONAL { ?discoverer rdfs:label ?discovererName }

}
GROUP BY ?discoverer ?discovererName
ORDER BY DESC(?count)

The trick with planets is that there are a bunch of subtypes. Interestingly 
this query ran virtually instantly. The only trouble is that you have to 
remember to write it.


TASK DETAIL
  https://phabricator.wikimedia.org/T96925

REPLY HANDLER ACTIONS
  Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign 
<username>.

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Jdouglas, Manybubbles
Cc: Jdouglas, Manybubbles, Aklapper, jkroll, Smalyshev, Wikidata-bugs, aude, 
daniel, JanZerebecki



_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to