template.navlab.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 st:gmap(?r, ?lat, ?lon, ?list) {
if (st:get(st:protocol, st:ajax), "", st:format(ft:script.js))
format {
ft:map.html
str(?lat)
str(?lon)
coalesce(st:get(st:mapzoom), 7)
coalesce(st:get(st:mapicon1), "/img/bmarker.png")
st:call-template(st:gmap2, ?list)
if (st:get(st:protocol, st:ajax), "", st:format(ft:script2.js))
coalesce(st:get(st:mapsize), "mapmedium")
}
}
where {
}
]]>
prefix o:
prefix ft:
template st:descresource(?r) {
format {
ft:resource.html
str(?p)
st:call-template(st:triple, ?r, ?p, ?v)
}
}
where {
?r ?p ?v
}
]]>
prefix o:
template st:glocate {
st:call-template(st:gmap, ?in, ?lat, ?lon, aggregate(?elem))
}
where {
?in a o:Place
optional {
?in o:place [
p:longitude ?lon ;
p:latitude ?lat] }
optional {
?in p:longitude ?lon ;
p:latitude ?lat }
# search all other Place resources
optional {
select (xt:list(?res, ?lat, ?lon) as ?elem) ?res
where {
bind (st:get(st:dataset) as ?g)
graph ?g {
?res p:longitude ?lon ; p:latitude ?lat
}
}
}
filter(! bound(?res) || ?in != ?res)
}
]]>
template st:icon(?label, ?ic) {
format {
ft:img.html
str(?label) str(?ic)
}
}
where {}
]]>
prefix w:
prefix r:
prefix p:
template st:selecttry {
if (bound(?t),
st:call-template(st:select),
st:call-template(st:default))
}
where {
optional { ?x a ?t }
}
limit 1
]]>
prefix w:
prefix r:
prefix p:
prefix ft:
template st:frame(?label, ?icon, ?body) {
format {
ft:frame.html
str(?label)
if (?icon = "", "",
st:call-template(st:icon, ?label, ?icon) )
str(?body)
}
}
where {
}
]]>
prefix w:
prefix r:
prefix p:
template st:default {
""
str(?uri)
""
}
where {
bind(st:get(st:uri) as ?uri)
}
]]>
prefix o:
template st:profile {
}
where {}
function us:format(?name) {
st:getFormat("navlab", ?name)
}
#
# Get the ?q = st:person st:param property from profile.ttl
# Return properties to be displayed
# st:get(st:definition) return the profile.ttl RDF graph
#
function us:definition(?q){
st:set(st:currentProperty, ?q) ;
let (?m =
select ?p ?title ?titleen where {
bind (st:get(st:currentProperty) as ?q)
bind (st:get(st:definition) as ?def)
graph ?def {
[] ?q ?list
?list rdf:rest*/rdf:first (?p ?title ?titleen)
}
})
{ ?m }
}
#
# Default properties to be displayed for Person
#
function us:person(){
let (?m =
select * where {
values (?p ?title ?titleen) {
(p:dateDeNaissance "Naissance" "Birth")
(p:dateDeDécès "Décès" "Death")
(o:predecessor "Prédécesseur" "Predecessor")
(o:successor "Successeur" "Successor")
(o:father "Père" "Father")
(o:mother "Mère" "Mother")
(o:spouse "Conjoints" "Spouse")
(o:child "Enfants" "Children")
(o:residence "Résidence" "Residence")
(o:memberOf "Membre" "Member")
(o:bandMember "Membre" "Member")
(o:starring "Acteur" "Actor")
(o:director "Metteur en scène" "Director")
(rdfs:comment "Résumé" "Abstract")
(o:wikiPageRedirects "Voir aussi" "See Also")
(o:wikipedia "Wikipedia" "Wikipedia")
(o:dbpedia "DBpedia" "DBpedia")
}
})
{ ?m }
}
]]>
prefix w:
prefix r:
prefix p:
template st:page {
st:head()
st:call-template(st:selecttry)
st:tail()
}
where {
}
]]>
template st:desctriple(?n, ?r, ?p, ?title, ?temp) {
format {
ft:triple.html
str(?title)
st:call-template(?temp, ?r, ?p)
}
}
where {}
]]>
prefix o:
template st:descperson(?r) {
st:call-template(st:desctriple,
st:number(), ?r, ?p, ?tt, if (?href, st:href, st:property))
}
where {
bind (unnest(us:person()) as (?p, ?title, ?titleen))
bind (if (?p in (o:wikipedia, o:dbpedia), true, false) as ?href)
filter ( ?href || exists { ?r ?p ?v } )
bind (if (st:get(st:lang, "en"), ?titleen, ?title) as ?tt)
}
#
# Properties to be displayed for Person (see profile.rq)
#
function us:define(){
let (?m = us:definition(st:person)){
if (xt:size(?m) = 0) { us:person() } else { ?m }
}
}
]]>
"
}
where {
}
]]>
template st:gmap2(?list) {
format {
ft:map2.html
st:number()
str(?lat)
str(?lon)
coalesce(st:get(st:mapicon2), "/img/smarker.png")
st:plink(?r)
}
}
where {
bind (unnest(?list) as (?r, ?lat, ?lon))
}
]]>
prefix w:
prefix r:
prefix p:
template st:title(?r, ?l, ?i) {
""
"" str(?l) "
"
""""""
coalesce(str(?b), "")
if (bound(?b) && bound(?d), " -- " , "")
coalesce(str(?d), "")
"""
"""
""
}
where {
}
]]>
template st:href(?r, ?p) {
format {
ft:link.html
str(?v) str(?v)
}
}
where {
?r ?p ?v
}
]]>
prefix w:
prefix r:
prefix p:
template st:select {
st:apply-templates(?x)
}
where {
{ ?x a foaf:Person }
union { ?x a o:Place }
union { ?x a o:Resource }
filter(?x = coalesce(st:get(st:uri), ?x))
}
limit 1
]]>
prefix w:
prefix r:
prefix p:
template st:substart(?x) {
st:call-template(st:head, st:head)
st:apply-templates(?x)
st:call-template(st:tail, st:tail)
}
where {
}
]]>
prefix o:
prefix r:
template st:descplace(?r) {
st:call-template(st:desctriple,
st:number(), ?r, ?p, ?tt, if (?href, st:href, st:property))
}
where {
values (?p ?title ?titleen) {
(rdfs:comment "Résumé" "Abstract")
(p:nord "Nord" "North")
(p:nordEst "Nord Est" "North East")
(p:est "Est" "East")
(p:sudEst "Sud Est" "South East")
(p:sud "Sud" "South")
(p:sudOuest "Sud Ouest" "South West")
(p:ouest "Ouest" "West")
(p:nordOuest "Nord Ouest" "North West")
(p:latitude "Latitude" "Latitude")
(p:longitude "Longitude" "Longitude")
(o:wikipedia "Wikipedia" "Wikipedia")
(o:dbpedia "DBpedia" "DBpedia")
}
bind (if (?p in (o:wikipedia, o:dbpedia), true, false) as ?href)
filter (if (?p in (o:wikipedia, o:dbpedia), strstarts(?r, r:), true))
filter ( ?href || exists { ?r ?p ?v } )
bind (if (st:get(st:lang, "en"), ?titleen, ?title) as ?tt)
}
]]>
prefix o:
prefix w:
prefix r:
prefix p:
prefix ft:
template st:display(?r, ?l) {
format {
ft:link.html
st:pplink(?r)
str(coalesce(?l, ?pr))
}
}
where {
bind (
if (strstarts(?r, r:), concat(w:, (substr(?r, strlen(r:) + 1))), ?r)
as ?pr)
}
]]>
prefix w:
prefix r:
prefix p:
template {
st:call-template(st:frame, ?label, coalesce(?ic, ""),
st:call-template(st:descplace, ?in))
st:call-template(st:glocate, ?in)
}
where {
?in a o:Place
minus { ?in a o:Resource }
?in rdfs:label ?label
optional { ?in o:thumbnail ?ic }
}
]]>
prefix w:
prefix r:
prefix p:
template {
st:call-template(st:frame, ?label, coalesce(?ic, ""),
st:call-template(st:descresource, ?in))
}
where {
?in a o:Resource
?in rdfs:label ?label
filter(lang(?label) = 'fr')
optional { ?in o:thumbnail ?ic }
}
]]>
prefix w:
prefix r:
prefix p:
template {
st:call-template(st:frame, ?label, coalesce(?ic, ""),
st:call-template(st:descperson, ?in))
}
where {
?in a foaf:Person
minus { ?in a o:Resource }
?in rdfs:label ?label
optional { ?in o:thumbnail ?ic }
}
]]>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy