sttl.calendar.month.rq Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of corese-core Show documentation
Show all versions of corese-core Show documentation
Corese is a Semantic Web Factory (triple store and SPARQL endpoint) implementing RDF, RDFS, SPARQL 1.1
Query and Update.
prefix cal:
template st:month(?y, ?m) {
format {
"""
%s
Mo Tu We Th Fr Sa Su \n
%s
%s
# additional space when last day is sunday (because \n alone fails)
%s
"""
cal:month(?m)
group {
if (?n = 1, xt:space(?first - 1), "")
xt:pretty(?n)
#st:call-template(st:date, ?date) " "
if (?jour = "Sunday", "\n", "")
; separator = ""
}
if (?first + ?days - 1 < 35 , "\n ", "")
if (?first + ?days - 1 = 35 && ?last = 7, " ", "")
}
; separator = "\n"
}
where {
bind (cal:days(?y, ?m) as ?days)
bind (cal:num(xt:day(xsd:date(concat(?y, "-", ?m, "-", 1))))
as ?first)
bind (cal:num(xt:day(xsd:date(concat(?y, "-", ?m, "-", ?days))))
as ?last)
bind (unnest(xt:iota(?days)) as ?n)
bind (xsd:date(concat(?y, "-", ?m, "-", ?n)) as ?date)
bind (xt:day(?date) as ?jour)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy