prefix owl: <http://www.w3.org/2002/07/owl#>
prefix oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?cls ?pred ?val ?synType
WHERE 
  { ?cls ?pred ?val ;
         a owl:Class .
    FILTER (
    ?pred = rdfs:label ||
    ?pred = oboInOwl:hasRelatedSynonym ||
    ?pred = oboInOwl:hasNarrowSynonym ||
    ?pred = oboInOwl:hasBroadSynonym ||
    ?pred = oboInOwl:hasExactSynonym
    )

    OPTIONAL {
      [
       a owl:Axiom ;
         owl:annotatedSource ?cls ;
         owl:annotatedProperty ?pred ;
         owl:annotatedTarget ?val ;
         oboInOwl:hasSynonymType ?synType
      ]
    }
  }
