query-b6c0c9964c8ffdf7920d3763cd5da7d3
Ordinals in all languages/notations: 0th to 100th
by Jura1, 2021-04-05
SELECT ?nv ?item ?itemLabel (GROUP_CONCAT(DISTINCT(str(?l)); separator=", ") as ?all) { ?item wdt:P31 wd:Q191780 ; wdt:P1181 ?nv . ?item (rdfs:label | skos:altLabel) ?l . ?item rdfs:label ?enl . FILTER( lang(?enl)="en" && ?l != ?enl && ?nv < 101 ) SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?nv ?item ?itemLabel ORDER BY ?nv
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 skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Ordinals in all languages/notations: 0th to 100th
# by Jura1, 2021-04-05
SELECT ?nv ?item ?itemLabel (GROUP_CONCAT(DISTINCT(str(?l)); separator=", ") as ?all)
{
?item wdt:P31 wd:Q191780 ; wdt:P1181 ?nv .
?item (rdfs:label | skos:altLabel) ?l .
?item rdfs:label ?enl .
FILTER( lang(?enl)="en"
&& ?l != ?enl
&& ?nv < 101 )
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
GROUP BY ?nv ?item ?itemLabel
ORDER BY ?nv
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?all")
v2("?enl")
v4("?item"):::projected
v3("?l"):::projected
v1("?nv"):::projected
c9(["bd:serviceParam"]):::iri
c1(["en"]):::literal
c4(["wd:Q191780"]):::iri
f0[["?enl = 'en'?l != ?enl?nv < '101^^xsd:integer'"]]
f0 --> v2
f0 --> v3
f0 --> v1
v4 --"wdt:P31"--> c4
v4 --"wdt:P1181"--> v1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v4 --"skos:altLabel"--> v3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"rdfs:label"--> v3
end
union0r <== or ==> union0l
end
v4 --"rdfs:label"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c1
end
bind2[/"str(?l)"/]
v3 --o bind2
bind2 --as--o v5