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 fun: <http://w3id.org/sparql-generate/fn/>

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

SELECT  <function/label.rqg>( ?s, ?lang ) ?label ( fun:log("label is", ?label) AS ?null )
WHERE {
  VALUES ( ?property ?priority ) { 
        ( rdfs:label 1 ) 
        ( skos:prefLabel 2 ) 
        ( obo:IAO_0000118 3 ) }
  ?s ?property ?label
  FILTER(LANG(?label) = str(?lang) || LANG(?label) = "").
} ORDER BY DESC ( LANG(?label)) ?priority
LIMIT 1