PREFIX st:   <http://ns.inria.fr/sparql-template/>
PREFIX fun: <http://w3id.org/sparql-generate/fn/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
BASE <https://saref.etsi.org/documentation/>

TEMPLATE <body/classes/classes.rqg>(?ontology) {
  "<div id='classes'><h2>{ fun:property(?lang, 'classes') }</h2>\n"
  st:call-template(<body/classes/toc.rqg>, ?ontology) "\n"
  GROUP { str(?class) "\n" ; separator = "\n"}
  "\n</div>"
}
WHERE {
  { ?class a rdfs:Class } UNION { ?class a owl:Class } 
  FILTER( isuri(?class) )
} GROUP BY ?ontology
ORDER BY ASC ( ?class ) 