query-4191ad60efd8ea744ee78ae55743ba92
Efficient use of P2837 (P2837)P2837 can be used to get the month name for a date. MONTH(?date) gets us a number and the item for the month has P2837. Below a series of samples, some work others don't. All should give a row with the following columns: March 3 wd:Q42(1) Sample
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?m ?monthnameLabel
{
VALUES ?item { wd:Q42 }
?item wdt:P569 ?date
BIND(MONTH(?date) as ?m)
?monthname wdt:P2837 ?monthnb
FILTER(?monthnb = ?m)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?date")
v3("?item"):::projected
v5("?m"):::projected
v5("?monthname")
v1("?monthnb")
c4(["bd:serviceParam"]):::iri
c6(["en"]):::literal
f0[["?monthnb = ?m"]]
f0 --> v1
f0 --> v5
bind1[/VALUES ?item/]
bind1-->v3
bind10(["wd:Q42"])
bind10 --> bind1
v3 --"wdt:P569"--> v4
bind2[/"month-from-dateTime(?date)"/]
v4 --o bind2
bind2 --as--o v5
v5 --"wdt:P2837"--> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end