PREFIX fun: <http://w3id.org/sparql-generate/fn/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

BASE <https://saref.etsi.org/documentation/>

TEMPLATE <ontology/toc-bar.rqg>( ?entity , ?property ) {
  before = "\n<ul>" ;
  BOX { "\n<li>"

    TEMPLATE {
      <function/hrefTitle.rqg>(fun:prefixedIRI(?entity),?label)
    } WHERE { OPTIONAL{ ?entity rdfs:label ?label } } LIMIT 1 . 

    TEMPLATE <ontology/toc-bar.rqg>( ?sub , ?property )
    WHERE {
      ?sub ?property ?entity
      FILTER( ISURI( ?sub ) )
    } ORDER BY ?sub . 

  "</li>" }
  ; after = "\n</ul>"
}