PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX voaf: <http://purl.org/vocommons/voaf#>
PREFIX dc:   <http://purl.org/dc/terms/>
PREFIX vann: <http://purl.org/vocab/vann/>
PREFIX st: <http://ns.inria.fr/sparql-template/>
PREFIX doc: <https://w3id.org/seas/documentation/html/loweringRule#>
BASE <https://saref.etsi.org/documentation/>

TEMPLATE doc:authors (?ontology, ?predicate, ?term){
    "- **" str(?term) ":** \n"  # first time
    "  - " str(?htmlauthorname) " " str(?htmlauthor) "\n"
    st:call-template(doc:moreauthors, ?ontology, ?predicate)
} WHERE { 
    ?ontology ?predicate ?author .
    OPTIONAL {
     ?author foaf:name ?name .
    }
    BIND( IF(BOUND(?name), str(?name) , "") AS ?htmlauthorname)
    BIND( IF(isIRI(?author), CONCAT( "[", str(IRI(?author)), "](", str(?author), ")") ,"") AS ?htmlauthor)
} ORDER BY ?author LIMIT 1