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 dctype: <http://purl.org/dc/dcmitype/>
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 ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 

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

TEMPLATE <example/title.rqg>( ?example ) {
  COALESCE( 
    IF( st:call-template( <function/formatText.rqg>, ?description_en ) != "" , st:call-template( <function/formatText.rqg>, ?description_en ) , ?undef ), 
    IF( st:call-template( <function/formatText.rqg>, ?description ) != "" , st:call-template( <function/formatText.rqg>, ?description ) , ?undef ), 
    "Violation of TS 103 673 Clause 9.6.3: no title" )
}
WHERE {
  OPTIONAL { 
    ?example dcterms:title ?description_en .
    FILTER (LANG(?description_en)="en")
  }
  OPTIONAL { 
    ?example dcterms:title ?description .
    FILTER ( DATATYPE(?description) = xsd:string )
  }
}
LIMIT 1