query-65a8b9a46299afe0f4ffb2bf2e194f40
PropertiesPM20 folder ID (P4293)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?property ?pid ?propertyLabel ?cntPreExistingItems ?cntNewItems ?cntTotal
where {
{
select (sum(?old) as ?cntPreExistingItems)
((count(?item) - ?cntPreExistingItems) as ?cntNewItems) (count(?item) as ?cntTotal) ?relation
where {
?item ?relation [rdf:type wikibase:BestRank; prov:wasDerivedFrom/pr:P4293 ?ref_value ] .
# restrict to companies archive
filter(strstarts(?ref_value, 'co/'))
# check if the item was created before start of the PM20 companies' linking phase
# at 2021-04-26, first new item Q106647030
bind(xsd:integer(strafter(str(?item), concat(str(wd:), 'Q'))) as ?qidNum)
bind(if(?qidNum < 106647030, 1, 0) as ?old)
}
group by ?relation
having (?cntTotal > 1)
}
?property wikibase:claim ?relation .
bind(strafter(str(?property), 'http://www.wikidata.org/entity/') as ?pid)
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
order by desc(?cntTotal)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?_anon_42b5416610844a34809f33a099ae9de1105300")
v9("?cntNewItems"):::projected
v8("?cntPreExistingItems"):::projected
v10("?cntTotal"):::projected
v3("?item")
v6("?old")
v11("?pid"):::projected
v10("?property"):::projected
v5("?qidNum")
v2("?ref_value")
v4("?relation")
a1((" "))
a2((" "))
c9(["bd:serviceParam"]):::iri
c4(["wikibase:BestRank"]):::iri
c11(["en"]):::literal
f0[["?cntTotal > '1^^xsd:integer'"]]
f0 --> v10
f1[["starts-with(?ref_value,'co/')"]]
f1 --> v2
a1 --"a"--> c4
a1 --"prov:wasDerivedFrom"--> a2
a2 --"pr:P4293"--> v2
v3 -->v4--> a1
bind2[/"http://www.w3.org/2001/XMLSchema#integer(substring-after(str(?item),concat(str('wd:'),'Q')))"/]
v3 --o bind2
bind2 --as--o v5
bind3[/"if(?qidNum < '106647030^^xsd:integer','1^^xsd:integer','0^^xsd:integer')"/]
v5 --o bind3
bind3 --as--o v6
bind7[/"count(?item)"/]
v3 --o bind7
bind7 --as--o v7
bind8[/"sum(?old)"/]
v6 --o bind8
bind8 --as--o v8
bind9[/" - ?cntPreExistingItems"/]
null --o bind9
v8 --o bind9
bind9 --as--o v9
bind10[/"count(?item)"/]
v3 --o bind10
bind10 --as--o v10
v10 --"wikibase:claim"--> v4
bind11[/"substring-after(str(?property),'http://www.wikidata.org/entity/')"/]
v10 --o bind11
bind11 --as--o v11
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end