
sttl.dbedit.profile.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.
The newest version!
template st:profile {}
where {}
# "10/2015"^^xsd:gYearMonth
function us:before(?date){
let (?m = xsd:integer(strbefore(?date, "/")),
?y = xsd:integer(strafter(?date, "/")),
?mm = if (?m = 1, 12, ?m - 1),
?yy = if (?m = 1, ?y - 1, ?y))
{
strdt(concat(us:digit(?mm), "/", ?yy), xsd:gYearMonth)
}
}
function us:after(?date){
let (?m = xsd:integer(strbefore(?date, "/")),
?y = xsd:integer(strafter(?date, "/")),
?mm = if (?m = 12, 1, ?m + 1),
?yy = if (?m = 12, ?y + 1, ?y))
{
strdt(concat(us:digit(?mm), "/", ?yy), xsd:gYearMonth)
}
}
function us:digit(?n){
if (?n < 10 && strlen(str(?n)) = 1, concat("0", ?n), ?n)
}
function us:year(?date, ?incr){
let (?m = xsd:integer(strbefore(?date, "/")),
?y = ?incr + xsd:integer(strafter(?date, "/")))
{
strdt(concat(us:digit(?m), "/", ?y), xsd:gYearMonth)
}
}
function us:root(){
}
function us:clean(?s){
if (contains(?s, "Swastika")
|| contains(?s, "Panzer-Division")
,
"", ?s)
}
function us:split(?list, ?n) {
let (?table = xt:list()) {
xt:add(?table, xt:list());
for (?e in ?list) {
if (xt:size(xt:first(?table)) = ?n) {
xt:add(?table, 0, xt:list())
} ;
xt:add(xt:first(?table), ?e)
} ;
return (xt:reverse(?table))
}
}
#
# Generation of HTML table of DBpedia updates given ?list of updates
#
function us:table(list, size) {
let ( table = us:split(list, size),
ftable = coalesce(us:format("table.html"), "\n%s
\n"),
frow = coalesce(us:format("tr.html"), "%s %s \n"),
fcell = coalesce(us:format("td.html"), "%s \n"))
{
st:format(ftable,
letdyn (n = 0) {
us:mapconcat (lambda(row) {
st:format(frow,
set(n = n + 1),
us:mapconcat (lambda(cell) { st:format(fcell, cell) }, row) )
} , table)
}
)
}
}
function us:mapconcat(fun, exp) {
reduce(rq:concat, maplist(fun, exp))
}
# URL of HTML format in the server (/data/format/dbedit/name)
function us:format(?name) {
st:getFormat("dbedit", ?name)
}
#
# One cell of the HTML table of DBpedia updates
#
function us:cell(?l, ?c, ?x, ?i){
st:format (
coalesce(us:format("cell.html"),
"""
%s (%s)
""") ,
st:plink(?x, st:dbpedia),
?x,
us:clean(?i),
?l,
?c
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy