prefix oio: <http://www.geneontology.org/formats/oboInOwl#>
prefix def: <http://purl.obolibrary.org/obo/IAO_0000115>
prefix owl: <http://www.w3.org/2002/07/owl#>

SELECT ?cls ?def (group_concat(?xref) as ?xrefs) WHERE 
{
  ?cls a owl:Class .
  OPTIONAL { ?cls oio:hasDbXref ?xref } .
  OPTIONAL { ?cls def: ?def } .
  FILTER (!isBlank(?cls))
}
GROUP BY ?cls ?def
