PREFIX st:   <http://ns.inria.fr/sparql-template/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX fun: <http://w3id.org/sparql-generate/fn/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX swrl: <http://www.w3.org/2003/11/swrl#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX iter: <http://w3id.org/sparql-generate/iter/>

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

TEMPLATE <term/class.rqg>( ?class ) {

""" 
<div class='description'><dl>{st:incr()}

{ TEMPLATE <term/classDescriptionSubjectObject.rqg>( ?class, "isequivalentto", owl:equivalentClass) . }
{ TEMPLATE <term/classDescriptionSubject.rqg>( ?class, 'hassuperclasses', rdfs:subClassOf) . }
{ TEMPLATE <term/classDescriptionObject.rqg>( ?class, "hassubclasses", rdfs:subClassOf) . }
{ TEMPLATE <term/classDescriptionObject.rqg>( ?class, "isindomainof", rdfs:domain) . }
{ TEMPLATE <term/classDescriptionObject.rqg>( ?class, "isinrangeof", rdfs:range)   . }
{ TEMPLATE <term/classDescriptionSubjectObject.rqg>( ?class, "isdisjointwith", owl:disjointWith)   . } 
"""

TEMPLATE { 
  before = "\n<dt>{ fun:property(<en.properties>, "hasmembers") }</dt><dd>" ;
    TEMPLATE <term/individualAndLiteralDescription.rqg>( ?member ) . 
  ; separator = ", "
  ; after = "</dd>"
} 
WHERE {
  ?member rdf:type ?class
  FILTER(ISURI(?member))
} .

# # keys
# TEMPLATE {
#   before = "\n<dt>{ fun:property(<en.properties>, "haskeys") }</dt><dd>" ;
#     TEMPLATE <term/propertyDescription.rqg>( <en.properties> , ?key ) . 
#   ; separator = ", "
#   ; after = "</dd>"
# } WHERE {
#   ?class owl:hasKey / rdf:rest* / rdf:first  ?key
# } .

st:decr()"\n</dl></div>"

}