0

I'm trying to find every public university in Brazil, using Wikidata. The problem is that some of them are categorized as instance of university (Q3918) and public educational institution (Q23002037), but others are categorized as public university (Q875538), and some might be under different categories even.

So I figured if I got every entity in a subclass of public educational institution (Q23002037) and in a subclass of public educational institution (Q23002037), I'd get all the entities I needed. So I tried this, with some optimization:

SELECT ?uni ?uniLabel 
WHERE {
  hint:Query hint:optimizer "None".
?uni wdt:P17+ wd:Q155;
 wdt:P31/wdt:P279 wd:Q38723;
 wdt:P31/wdt:P279 wd:Q23002037.
  
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],pt". }
}

Run this code here

However, this only returns 15 entities. One of the entities missing is Federal University of Cariri (Q10387824), which is an entity of university and of public educational institution so it should have appeared in the query results. Can anyone help me understand what's going on, and why that entity and so many others do not show up in my results?

Thank you in advance. I'm very new to SPARQL and Wikidata Queries.

1 Answers1

0

I'm not sure how this works, but I used the Wikidata Query Builder and it worked. I got the entities I wanted in the categories and subcategories I defined.

SELECT DISTINCT ?item ?itemLabel
WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
      SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q38723.
      ?item p:P31 ?statement1.
      ?statement1 (ps:P31/(wdt:P279*)) wd:Q23002037.
      ?item p:P17 ?statement2.
      ?statement2 (ps:P17) wd:Q155.
    }
    
    LIMIT 100
  }
}

Run this code here

So yeah. Use the Wikidata Query Builder, then open it as a Wikidata Query Service, and click the (i) "Show query explanation" button, and you can choose what information to display.