query-766143e5da6ad02636f3c848919c3b62
Most common properties (excluding external ids) for a type of item on a given Wikipedia SELECT ?id ?idlabel (round(?count*1000/?total)/10 AS ?percent) WITH { SELECT ?item WHERE { ?item wdt:P31/wdt:P279? wd:Q5398426 . ?arwp schema:about ?item ; schema:isPartOf https://ary.wikipedia.org/ } } AS %list WITH { SELECT (COUNT(?item) AS ?total) WHERE { include %list } } AS %total WITH { SELECT ?id (COUNT(DISTINCT ?item) AS ?count) WHERE { include %list ?item ?p [] . ?id wikibase:claim ?p . FILTER(?p != p:P31) MINUS { ?id wikibase:propertyType wikibase:ExternalId } } GROUP BY ?id } AS %props WHERE { include %props include %total ?id rdfs:label ?idlabel . FILTER (lang(?idlabel) = "en") } ORDER BY DESC(?percent) LIMIT 50
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX p: <http://www.wikidata.org/prop/>
# Most common properties (excluding external ids) for a type of item on a given Wikipedia
SELECT ?id ?idlabel (round(?count*1000/?total)/10 AS ?percent)
WHERE {
{
SELECT ?id (COUNT(DISTINCT ?item) AS ?count) WHERE {
{
SELECT ?item WHERE {
?item wdt:P31/wdt:P279? wd:Q5398426 .
?arwp schema:about ?item ; schema:isPartOf <https://ary.wikipedia.org/>
}
} ?item ?p [] .
?id wikibase:claim ?p . FILTER(?p != p:P31)
MINUS { ?id wikibase:propertyType wikibase:ExternalId }
}
GROUP BY ?id
} {
SELECT (COUNT(?item) AS ?total) WHERE {
{
SELECT ?item WHERE {
?item wdt:P31/wdt:P279? wd:Q5398426 .
?arwp schema:about ?item ; schema:isPartOf <https://ary.wikipedia.org/>
}
} }
} ?id rdfs:label ?idlabel . FILTER (lang(?idlabel) = "en")
}
ORDER BY DESC(?percent)
LIMIT 50