All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sttl.d3.nodes.rq Maven / Gradle / Ivy

template st:nodes {
  "\"nodes\":[\n"
  group {
  
     format {
            '{"id": "%s", "label": "%s", "group": "%s", "class": "%s" %s %s}'        
            ?id us:label(?s) us:kind(?s) us:nodeClass(?s) 
             us:url(?s)
             reduce(rq:concat, maplist(us:property, ?s, us:nodePropertyList()))
      }
        
    ; separator = ",\n"
  }
  "\n]\n"
} 
where {
   values (?s ?id) { unnest(us:getNodes()) }
}


# st:link : service?uri=...&profile=...
# st:url  : URL either ?s itself or a proxy URL
function us:url(?s) {
    coalesce(
        st:format(', "link": "%s"', st:cget(st:link, ?s)),
        st:format(',  "url": "%s"', st:cget(st:url,  ?s)),
        if (isURI(?s), st:format(',  "url": "%s"', ?s), "")
    )
}


function us:property(?s, ?list) {
    let ((?name ?uri) = ?list) {
        coalesce(st:format(', "%s": "%s"', ?name, st:cget(?uri, ?s)), "")
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy