template.cdn.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.
template cn:body(?c) {
format {
us:format("body.html")
st:call-template(cn:rowtitle, ?c)
st:call-template(cn:table, ?min, ?max)
}
}
where {
?c cn:start ?min ; cn:finish ?max
}
]]>
prefix foaf:
template cn:table(?min, ?max) {
format {
us:format("date.html")
st:call-template(cn:wikidate, ?d)
st:call-template(cn:row, ?d)
}
}
where {
{select distinct ?d where {
values ?p { cn:date cn:begin }
?uri ?p ?d
}}
filter(?min <= ?d && ?d <= ?max)
}
order by asc(?d)
]]>
template cn:img(?i) {
""
}
where {
# bind(?u as ?uri)
# bind(?t as ?text)
}
]]>
template st:start {
st:call-template(st:substart, (coalesce(st:get(st:uri), cn:XIV)))
}
where {
}
]]>
template cn:hlink(?u, ?t) {
format { "%s" ?u ?t}
}
where {
}
]]>
prefix o:
template cn:href(?r, ?u, ?t, ?i) {
""
if (?img,
concat(st:call-template(cn:img, ?i), "
"),
"")
if (isURI(?r) && ?isp,
st:call-template(st:navlab, ?r, ?t),
st:call-template(cn:hlink, ?u, ?t))
""
}
where {
bind ( exists { ?r a ?tt . filter (?tt in (foaf:Person, o:Place))
} as ?isp )
bind (bound(?i) && strstarts(?i, "http://") as ?img)
}
]]>
prefix foaf:
template cn:date(?date, ?topic) {
group { ?uri ; separator = "
" }
}
where {
graph ?g { [] cn:topic ?topic .
{ ?uri cn:date ?date } union { ?uri cn:begin ?date }
}
}
]]>
template cn:sign {
st:call-template(cn:icon, cn:icon)
format { us:format("sign.html") }
now()
}
where {
}
]]>
template cn:icon {
format {
us:format("icontable.html")
group {
format {
us:format("icon.html")
?i ?i
}
}
}
}
where { }
values ?i {
#
#
}
]]>
template st:navlab(?u, ?t) {
format {
"%s"
st:plink(?u, st:dbpedia)
?t
}
}
where {
}
]]>
Query
"""
st:get(st:service)
st:get(st:query)
}
}
where {
}
]]>
template cn:row(?d) {
format {
"%s "
group {
st:call-template(cn:date, ?d, ?topic)
}
}
}
where {
values ?topicList { unnest(st:get(st:topic)) }
bind (kg:number() as ?n)
values ?topic { unnest(?topicList) }
}
group by ?n
order by ?n
]]>
template st:substart(?cent) {
st:call-template(cn:content, ?cent)
st:call-template(cn:sign, cn:sign)
}
where {
}
]]>
template st:servlet {
st:get(st:service)
"?query="
}
where {
}
]]>
template cn:tail(?c, ?title) {
format {
us:format("tail.html")
st:call-template(cn:index, ?title)
}
}
where {
}
]]>
template cn:index(?title) {
format {
us:format("indextable.html")
if (bound(?before),
st:format(us:format("before.html"), st:plink(?before)),
"")
st:call-template(cn:elem, ?title)
if (bound(?after),
st:format(us:format("after.html"), st:plink(?after)),
"")
}
st:call-template(cn:list)
}
where {
?century rdfs:label ?title ;
cn:start ?min
bind (if (?min = 1, 0, ?min) - 100 as ?be)
bind (if (?min = -100, -99, ?min) + 100 as ?af)
bind (coalesce(st:get(st:min), -1000) as ?fst)
bind (coalesce(st:get(st:max), 3000) as ?rst)
optional { ?before cn:start ?be filter (?be >= ?fst) }
optional { ?after cn:start ?af filter (?af <= ?rst) }
}
]]>
template cn:content(?c) {
st:call-template(cn:head, ?c, ?title)
st:call-template(cn:body, ?c)
st:call-template(cn:tail, ?c, ?title)
}
where {
?c rdfs:label ?title
}
]]>
template cn:elem(?title) {
format {
us:format("index.html")
st:plink(?century)
if (?show, "bold", "undefined")
?date
}
}
where {
bind (coalesce(st:get(st:min), -1000) as ?fst)
bind (coalesce(st:get(st:max), 3000) as ?rst)
?century cn:start ?min ; cn:finish ?max ; rdfs:label ?date
filter (?min >= ?fst && ?max <= ?rst)
bind (?date = ?title as ?show)
}
order by ?min
]]>
prefix foaf:
template cn:wikidate(?d) {
format {
"%s"
?d ?d
}
}
where {
}
]]>
prefix foaf:
prefix o:
template cn:geticon {
?ic
}
where {
service {
?in o:thumbnail ?ic
# ?in foaf:depiction ?ic
}
}
]]>
prefix foaf:
prefix o:
prefix w:
prefix r:
template cn:test(?p) {
"" str(?p) "
"
}
where {
service {
select * where {
?p a ?t
} limit 1
}
}
pragma {kg:query kg:detail true}
]]>
template cn:head(?c, ?title) {
format {
us:format("head.html")
str(?title)
?title
st:call-template(cn:icon, cn:icon)
st:call-template(cn:index, ?title)
}
}
where {
}
]]>
template cn:list {
format {
us:format("listtable.html")
st:plink(, st:dbpedia)
group {
format {
us:format("list.html")
st:misc(?query)
str(?title)
}
}
}
}
where {
}
values (?query ?title){
("/data/query/cdnplace.rq" "Lieu")
("/data/query/cdnperson.rq" "Personne")
("/data/query/cdnfr.rq" "France")
("/data/query/cdneds.rq" "Savoie")
("/data/query/cdnmisc.rq" "Autre")
}
]]>
template cn:rowtitle(?c) {
format {
"%s "
if (?label = "Antiquité",
if (?max <= 500, str(?label), " "),
str(?label))
}
}
where {
?c cn:start ?min ; cn:finish ?max
bind (unnest(st:get(st:text)) as ?label)
}
]]>
template cn:style(?in) {
if (?d <= 1000, "s09",
if (?d <= 1100, "s10",
if (?d <= 1200, "s11",
if (?d <= 1300, "s12",
if (?d <= 1400, "s13",
if (?d <= 1500, "s14",
if (?d <= 1600, "s15",
if (?d <= 1700, "s16",
if (?d <= 1800, "s17",
if (?d <= 1900, "s18", "s19"))))))))))
}
where {
bind(?in as ?d)
}
]]>
prefix foaf:
prefix o:
prefix w:
prefix r:
template {
if (bound(?link),
st:call-template(cn:href, ?in, ?link, ?ctx, ?ic),
?ctx)
" " ?c " " ?l
}
where {
?in cn:date ?d ; rdfs:label ?ctx .
optional { ?in cn:link ?lnk }
optional { ?in rdfs:comment ?c }
optional { ?in cn:list ?l }
optional { ?in st:icon ?ii }
bind (
if (bound(?ii), ?ii,
if (isURI(?in), st:call-template(cn:geticon, ?in), ""))
as ?ic)
bind (
if (isURI(?in) && strstarts(?in, r:),
concat(w:, (substr(?in, strlen(r:) + 1))),
?lnk)
as ?link)
}
]]>
prefix foaf:
template {
if (bound(?lnk),
st:call-template(cn:href, ?lnk, ?c),
?c)
}
where {
?in rdf:rest*/rdf:first ?elem
{ ?elem rdfs:label ?c ; cn:link ?lnk }
union
{ ?elem rdfs:comment ?c }
}
]]>
prefix foaf:
prefix o:
prefix w:
prefix r:
template {
st:call-template(cn:href,
?in, coalesce(?link, ?in), ?mds, ?ic)
coalesce(str(?cc), "")
}
where {
?in cn:begin ?d ; rdfs:label ?mds .
optional { ?in cn:link ?lnk }
optional { ?in st:icon ?ii }
optional { ?in rdfs:comment ?cc }
bind (
if (bound(?ii), ?ii,
if (isURI(?in), st:call-template(cn:geticon, ?in), ""))
as ?ic)
bind (
if (isURI(?in) && strstarts(?in, r:),
concat(w:, (substr(?in, strlen(r:) + 1))),
?lnk)
as ?link)
}
]]>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy