template.d3.rul Maven / Gradle / Ivy
template st:start {
format {
ft:graph.html
st:call-template(st:graph)
}
}
where {
}
]]>
template st:hierarchy {
format {
ft:hierarchy.html
?id
us:plist(?list)
us:plist(?plist)
?graph
}
}
where {
bind (substr(replace(rand(), "\\.", ""), 0, 5) as ?id)
bind (coalesce(st:get(st:hierarchy), xt:list(rdfs:subClassOf)) as ?list)
bind (coalesce(st:get(st:nodePropertyDisplay), xt:list("url")) as ?plist)
bind (st:call-template(st:graph) as ?graph)
bind (if (st:get(st:trace, true), xt:print(?graph), true) as ?tmp)
}
]]>
template st:chart {
format {
d3:mychart.html
?id
coalesce(xt:json(coalesce(st:get(st:mappings), xt:mappings())),
"{ error: 'error when reading st:mappings'}")
}
}
where {
bind (substr(replace(rand(), "\\.", ""), 0, 5) as ?id)
}
]]>
template st:frame {
format {
ft:frame.html
?id
us:plist(?list)
us:plist(?plist)
?graph
}
}
where {
bind (substr(replace(rand(), "\\.", ""), 0, 5) as ?id)
bind (coalesce(st:get(st:hierarchy), xt:list(rdfs:subClassOf)) as ?list)
bind (coalesce(st:get(st:nodePropertyDisplay), xt:list("url")) as ?plist)
bind (st:call-template(st:graph) as ?graph)
bind (if (st:get(st:trace, true), xt:print(?graph), true) as ?tmp)
}
]]>
50, concat(substr(?l, 1, 50), "..."), ?l)) { ?s }
}
function us:literal(?l) {
let (?s = us:shorten(?l)) {
replace(replace(replace(str(?s), "\n", ""), "\"", "'"), "\r", "")
}
}
function us:nodeClass(?s) {
coalesce(st:getclass(?s),
if (isLiteral(?s), "literal", if (isURI(?s), "uri", "bnode") ) )
}
function us:prefix(?p) {
if (strstarts(?p, rdf:), "rdf",
if (strstarts(?p, rdfs:), "rdfs",
if (strstarts(?p, owl:), "owl",
if (strstarts(?p, foaf:), "foaf",
if (strstarts(?p, skos:), "skos",
if (strstarts(?p, dc:), "dc",
"default") ) ))))
}
function us:edgeClass(?g, ?p) {
coalesce(st:getclass(?g), us:prefix(?p))
}
function us:edgeGroup(?g, ?p) {
coalesce(st:getgroup(?g), us:prefix(?p))
}
function us:plist(?list) {
reduce(lambda(?a, ?b) {concat(?a, ", " , ?b) },
maplist(lambda(?name) { st:format("\"%s\"", us:pname(?name)) }, ?list)
)
}
function us:pname(?x) {
if (isURI(?x), st:turtle(?x), ?x)
}
]]>
0)
}
]]>
template st:title {
if (bound(?title), st:format("%s
", str(?title)), "")
if (bound(?uri), st:format("URI: %s
", str(?uri)), "")
if (bound(?param) || bound(?mode),
st:format("%s %s %s
", coalesce(str(?param), ""), coalesce(str(?arg), ""), coalesce(str(?mode), "")),
"")
}
where {
bind (st:get(st:title) as ?title)
bind (st:get(st:get(st:uriparam)) as ?uri)
bind (st:get(st:param) as ?param)
bind (st:get(st:mode) as ?mode)
bind (st:get(st:arg) as ?arg)
}
]]>
template st:graphic {
format {
ft:graphic.html
st:call-template(st:graph)
}
}
where {
}
]]>
template st:ontology {
format {
ft:ontology.html
?id
us:plist(?list)
us:plist(?plist)
?graph
}
}
where {
bind (substr(replace(rand(), "\\.", ""), 0, 5) as ?id)
bind (coalesce(st:get(st:hierarchy), xt:list(rdfs:subClassOf)) as ?list)
bind (coalesce(st:get(st:nodePropertyDisplay), xt:list("url")) as ?plist)
bind (st:call-template(st:graph) as ?graph)
bind (if (st:get(st:trace, true), xt:print(?graph), true) as ?tmp)
}
]]>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy