template.calendar.rul 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.
%s"
str(?date) day(?date)
}
}
where {
}
]]>
template st:content(?year) {
format {
us:format("content.html")
str(?dd)
str(?dd)
group {
format {
st:getFormat("util", "href.html")
st:plink(?x, st:dbpedia)
str(?title)
}
; separator = "
"
}
}
}
where {
{select distinct ?x ?date
where {
?x ?p ?date
filter (datatype(?date) in (xsd:date, xsd:dateTime))
}}
filter (year(?date) = ?year)
bind (cal:date(year(?date), month(?date), day(?date)) as ?dd)
?x rdfs:label ?l
bind (if (bound(?l), ?l, ?x) as ?title)
}
group by ?date
order by ?date
]]>
"
""
group {
"" str(?label)
st:call-template(st:main, ?year)
" "
}
" "
""
st:call-template(st:tail)
}
where {
# profile.ttl graph
bind (st:get(st:definition) as ?g)
# access to the profile.ttl graph
graph ?g {
st:calendartest st:param [
st:list/rdf:rest*/rdf:first (?label ?year)
]
}
}
]]>
template st:agenda {
format {
"""
\n%s\n
Mo Tu We Th Fr Sa Su \n
%s
"""
cal:month(?m)
group {
if (?n = 1, xt:space(cal:num(?jour) - 1), "")
if (?n < 10, " ", "") ?n " "
if (?jour = "Sunday", "\n", "")
; separator = ""
}
}
; separator = "\n"
}
where {
bind (unnest(xt:iota(12)) as ?m)
bind (unnest(xt:iota(cal:days(?y, ?m))) as ?n)
bind (xsd:date(concat(?y, "-", ?m, "-", ?n)) as ?day)
bind (xt:day(?day) as ?jour)
}
group by ?m
order by ?m
values ?y { 2015 }
function xt:space(?n) {
if (?n = 0, "", concat(" " , xt:space(?n - 1)))
}
]]>
template st:monthtab(?y, ?m) {
format {
us:format("month.html")
cal:month(?m)
st:call-template(st:title)
xt:td(?first - 1)
group {
format {
us:format("day.html")
st:call-template(st:date, ?date)
}
if (?day = "Sunday", st:format(us:format("sunday.html")), "")
; separator = ""
}
if (?first + ?days - 1 <= 35 , st:format(us:format("last.html")), "")
}
}
where {
bind (cal:days(?y, ?m) as ?days)
bind (cal:num(xt:day(cal:date(?y, ?m, 1))) as ?first)
bind (unnest(xt:iota(?days)) as ?n)
bind (cal:date(?y, ?m, ?n) as ?date)
bind (xt:day(?date) as ?day)
}
]]>
template st:profile {
}
where {}
function us:format(?name){
st:getFormat("calendar", ?name)
}
function xt:space(?n) {
if (?n = 0, "", concat(" " , xt:space(?n - 1)))
}
function xt:td(?n) {
if (?n = 0, "", concat(" " , xt:td(?n - 1)))
}
function xt:pretty(?n) {
if (?n < 10, concat(" ", ?n), ?n)
}
function us:display(?y) {
if (st:get(st:date, st:romain), xt:romain(?y), ?y)
}
]]>
%s
"""
group {
format {
"""
%s
%s
"""
?year
st:call-template(st:calendar, ?year)
}
}
}
}
where {
bind (unnest(xt:iota(?fst, ?rst)) as ?year)
}
]]>
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