Project:SPARQL/examples: Difference between revisions

Line 1,421: Line 1,421:


<sparql tryit="1">
<sparql tryit="1">
# All the external IDs on women's Wikidata pages, with counts
# All the external IDs on BN women's Wikidata pages, with counts and descriptions
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
Line 1,432: Line 1,432:
PREFIX wd:  <http://www.wikidata.org/entity/>
PREFIX wd:  <http://www.wikidata.org/entity/>


SELECT ?p ?prop_label (count(?prop_label) as ?count)  
SELECT ?p ?id_label ?id_description  (count(?p) as ?count)
 
WHERE {   
WHERE {   
   ?person bnwdt:P3 bnwd:Q3 . #select women
   ?person bnwdt:P3 bnwd:Q3 . #select women
Line 1,442: Line 1,443:
    
    
     SERVICE <https://query.wikidata.org/sparql> {
     SERVICE <https://query.wikidata.org/sparql> {
     ?wikidata ?p ?s .
     ?wikidata ?p ?s .
           ?prop wikibase:claim ?p;     
           ?prop wikibase:claim ?p;     
               wikibase:propertyType wikibase:ExternalId;   
               wikibase:propertyType wikibase:ExternalId;   
               rdfs:label ?prop_label. filter(lang(?prop_label)="en") .  
               rdfs:label ?id_label. filter(lang(?id_label)="en") .  
        }   
      ?prop schema:description ?id_description .
      filter(lang(?id_description) = "en") .   
      }   
        
        
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en, en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en, en-gb". }  
}
}
group by ?p ?prop_label
group by ?p ?id_label ?id_description
ORDER BY desc(?count)
ORDER BY desc(?count)


586

edits