template.web.rul Maven / Gradle / Ivy
template st:selecttable(?n, ?q, ?t, ?s, ?qt) {
format {
ft:table.html
group { st:call-template(st:selectparam2, ?n, ?select) }
}
}
where {
bind (st:get(st:context) as ?g)
graph ?g {
?qt st:name ?n
optional { ?qt st:select ?select }
}
}
]]>
template st:result {
st:apply-templates-with(?sttl)
}
where {
bind (st:get(st:query) as ?query)
bind (coalesce(st:get(st:sttl), spq:result) as ?sttl)
filter bound(?query)
}
]]>
template st:prev(?t) {
format {
ft:prev.html
st:plink(?n)
}
}
where {
bind (st:get(st:context) as ?g)
graph ?g {
?q1 st:name ?t ; st:index ?i
bind (?i - 1 as ?j)
?q2 st:index ?j ;
st:name ?n
}
}
]]>
template st:tail {
format {
ft:tail.html
st:call-template(st:content)
}
}
where {
bind (st:get(st:context) as ?g)
graph ?g {
?ds a st:Dataset
}
}
]]>
template st:next(?t) {
format {
ft:next.html
st:plink(?n)
}
}
where {
bind (st:get(st:context) as ?g)
graph ?g {
?q1 st:name ?t ; st:index ?i
bind (?i + 1 as ?j)
?q2 st:index ?j ;
st:name ?n
}
}
]]>
template st:selectform(?t) {
format {
ft:selectform.html
st:get(st:service)
st:get(st:profile)
st:call-template(st:prev, ?t)
st:call-template(st:list, ?t)
st:call-template(st:next, ?t)
}
}
where {
}
]]>
template st:form(?n, ?q, ?t, ?s, ?qt) {
format {
ft:form.html
st:get(st:service)
st:get(st:profile)
str(?t)
str(?s)
?n
if (?s = st:null, "", st:format(ft:nav.html))
st:call-template(st:selecttable, ?n, ?q, ?t, ?s, ?qt)
st:call-template(st:selectsilent,?n, ?q, ?t, ?s, ?qt)
str(?q)
}
}
where {
bind (st:get(st:context) as ?g)
graph ?g {
?qt st:name ?n
}
}
]]>
template st:selectsilent(?n, ?q, ?t, ?s, ?qt) {
format {
ft:silent.html ?name ?value
}
}
where {
bind (st:get(st:context) as ?g)
graph ?g {
?qt st:name ?n .
?qt st:select ?input .
?input st:type st:silent ; st:name ?name ; st:value ?value
}
}
]]>
template st:list(?t) {
format {
if (?q = ?t, ft:optionselected.html, ft:option.html)
?q
str(?i)
str(?title)
}
}
where {
bind (st:get(st:context) as ?g)
graph ?g {
values ?qt {st:Query sw:Query}
[] a ?qt ;
st:index ?i ;
st:name ?q ;
rdfs:label ?title
}
}
order by ?i
]]>
"
group distinct {
"" str(?d) ""
; separator="
"
}
"
"
}
where {
bind (st:get(st:context) as ?g)
graph ?g {
?ds a st:Dataset
?ds ?p [ st:uri ?d ]
}
}
]]>
template st:selectparam2(?n, ?select) {
format {
if (?insert, ft:selectparam2insert.html , ft:selectparam2.html)
coalesce(?title, "")
?name
if (bound (?default),
st:format(
us:format (st:get(?uri, ?default)),
?default, coalesce(?label, "Any")),
"")
group {
format {
us:format (coalesce(
#st:get(?uri) = if (isURI(?value), ?value, str(?value)),
if (isURI(?value),
st:get(?uri) = ?value || st:get(?uri) = str(?value),
st:get(?uri) = str(?value)),
false))
?value ?value
}
}
}
}
where {
bind (st:get(st:context) as ?g)
# TODO: mandatory to bind ?select parameter
graph ?g { ?select st:name ?name ; st:uri ?uri
optional { ?select st:action ?action }
bind (coalesce(?action = st:insert, false) as ?insert)
}
{
graph ?g {
?select st:value/rdf:rest*/rdf:first ?value }
}
union
{
graph ?g {
?select st:graph ?gname
optional { ?select st:title ?title }
optional { ?select st:default ?default optional { ?select st:defaultLabel ?label }}
# get graph object ?gg in context corresponding to graph name ?gname
bind (st:get(?gname) as ?gg)
filter bound(?gg)
{ ?select st:relation ?p
graph ?gg {
select distinct ?p ?value
where {
{?x ?p ?value}
union
{?value ?p ?x}
filter (! isBlank(?value))
}
order by ?value }
}
union
{ ?select st:predicate ?p
graph ?gg {
select distinct ?p ?value
where { ?x ?p ?value filter (! isBlank(?value)) }
order by ?value }
}
union
{ ?select st:predicate [ ?p ?object ]
graph ?gg {
select distinct ?p ?object ?value
where { ?value ?p ?object }
order by ?value }
}
}
}
union
{
graph ?g {
?select st:graph ?gname ; st:function ?fun
optional { ?select st:title ?title }
optional { ?select st:default ?default optional { ?select st:defaultLabel ?label }}
# get graph object ?gg in context corresponding to graph name ?gname
bind (st:get(?gname) as ?gg)
filter bound(?gg)
values ?value { unnest (xt:focus(?gg, funcall(?fun))) }
}
}
}
function us:format(?b) {
if (?b,
'',
'')
}
]]>
template st:head {
format {
ft:head.html str(?title)
}
}
where {
bind (coalesce(st:get(st:title), "Tutorial") as ?title)
}
]]>
template st:display(?n) {
format {
ft:display.html
str(?l)
str(?c)
if (bound(?r), st:format(ft:documentation.html, str(?r)), "")
st:call-template(st:form,
?n,
coalesce(st:get(st:query), str(?q)),
str(?q),
coalesce(?s, st:null),
?qt
)
}
}
where {
# named graph that contains definition of queries
bind (st:get(st:context) as ?g)
graph ?g {
?qt st:name ?n ;
rdfs:label ?l ;
rdfs:comment ?c ;
st:query ?q
optional { ?qt st:reference ?r }
optional { ?qt st:solution ?s }
optional { ?qt sw:body ?s }
filter(lang(?c) = (coalesce(st:get(st:lang), "fr")))
}
}
]]>
template st:selectparam(?n, ?select) {
format {
ft:selectparam.html
?name
group {
format {
if (st:get(?uri, ?value),
'',
'')
?value ?value
}
}
}
}
where {
bind (st:get(st:context) as ?g)
graph ?g {
?select st:name ?name ; st:uri ?uri ;
st:value/rdf:rest*/rdf:first ?value
}
}
]]>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy