query-54d14d51bd0f47df39d03758fb6a46b3
02:17, 4 February 2020 (UTC)) talk (Dipsacus fullonum) 00:03, 4 February 2020 (UTC) – Somehow I overlooked the conversion to xsd:integer so that isn't a problem. --talk (Dipsacus fullonum --BTW. The sorting of item numbers as strings is bad. It will give Q9 > Q80 > Q700 > Q6000 etc. 23:56, 3 February 2020 (UTC)) talk (Dipsacus fullonumIt is also possible to add a search for use in references. --Below is code to show the most recent items and lexemes which use P4970 in statements, qualifiers and references (up to 10 of each):
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
SELECT ?type ?item ?property
WHERE
{
{
SELECT ("Item" as ?type) ?item
WHERE
{
?item wdt:P4970 [] .
FILTER(SUBSTR(STR(?item),32,1) = "Q")
}
ORDER BY DESC(xsd:integer(SUBSTR(STR(?item),33)))
LIMIT 10
}
UNION
{
SELECT ("Lexeme" as ?type) ?item
WHERE
{
?item wdt:P4970 [] .
FILTER(SUBSTR(STR(?item),32,1) = "L")
}
ORDER BY DESC(xsd:integer(SUBSTR(STR(?item),33)))
LIMIT 10
}
UNION
{
SELECT ("Qualifier" as ?type) ?item ?property
WHERE
{
?item ?property [pq:P4970 [] ].
}
ORDER BY DESC(xsd:integer(SUBSTR(STR(?item),33)))
LIMIT 10
}
UNION
{
SELECT ("Reference" as ?type) ?item ?property
WHERE
{
?item ?property _:statement.
_:statement prov:wasDerivedFrom _:refnode.
_:refnode pr:P4970 _:ref.
}
ORDER BY DESC(xsd:integer(SUBSTR(STR(?item),33)))
LIMIT 10
}
}
ORDER BY ?type DESC(xsd:integer(SUBSTR(STR(?item),33)))
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?item"):::projected
v3("?property"):::projected
v4("?type"):::projected
a1((" "))
a2((" "))
a4((" "))
a3((" "))
a5((" "))
a6((" "))
a7((" "))
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
v2 -->v3--> a5
a5 --"prov:wasDerivedFrom"--> a6
a6 --"pr:P4970"--> a7
bind0[/"'Reference'"/]
bind0 --as--o v4
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
a3 --"pq:P4970"--> a4
v2 -->v3--> a3
bind1[/"'Qualifier'"/]
bind1 --as--o v4
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
f2[["substring(str(?item),'32^^xsd:integer','1^^xsd:integer') = 'L'"]]
f2 --> v2
v2 --"wdt:P4970"--> a2
bind3[/"'Lexeme'"/]
bind3 --as--o v4
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f4[["substring(str(?item),'32^^xsd:integer','1^^xsd:integer') = 'Q'"]]
f4 --> v2
v2 --"wdt:P4970"--> a1
bind5[/"'Item'"/]
bind5 --as--o v4
end
union0r <== or ==> union0l
end