Project:SPARQL/examples: Difference between revisions

From Beyond Notability
Line 1,076: Line 1,076:
   OPTIONAL { ?property schema:description ?propertyDescription . }
   OPTIONAL { ?property schema:description ?propertyDescription . }
    
    
   FILTER(LANG(?propertyLabel) = 'en') # removes label language dups
   FILTER(LANG(?propertyLabel) = 'en') # removes label language dups (but not description dups)
}
}


order by ?propertyLabel
order by ?propertyLabel
</sparql>
=== Counts of items for each value of the property "instance of" (P12) ===
<sparql tryit="1">
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
SELECT  ?value ?valueLabel  (count(*) as ?count)
WHERE { 
  VALUES (?p) { (bnwdt:P12) } 
 
  ?s ?p ?value.
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
group by ?value ?valueLabel
ORDER BY lcase(?valueLabel)


</sparql>
</sparql>