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/terms/>
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 foaf: <http://xmlns.com/foaf/0.1/>
BASE <https://saref.etsi.org/documentation/>

TEMPLATE <function/formatText.rqg>( ?text ) { 
  TEMPLATE { ?text }
  WHERE { FILTER ( DATATYPE(?text) = <http://www.iana.org/assignments/media-types/text/html>) } .
  TEMPLATE { fun:markdownToHTML( ?text ) }
  WHERE { FILTER ( DATATYPE(?text) = <http://www.iana.org/assignments/media-types/text/markdown>) } .
  TEMPLATE { <function/processLines.rqg>( ?text ) }
  WHERE { FILTER ( DATATYPE(?text) != <http://www.iana.org/assignments/media-types/text/html> && 
                   DATATYPE(?text) != <http://www.iana.org/assignments/media-types/text/markdown> ) } .
}