@prefix ex: <https://www.bgee.org/sparql/.well-known/sparql-examples/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix spex:<https://purl.expasy.org/sparql-examples/ontology#> .

ex:016 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Which are the genes in Human associated to a disease that are orthologous to a gene expressed in the rat's brain?"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """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 genex: <http://purl.org/genex#>
PREFIX lscr: <http://purl.org/lscr#>
PREFIX orth: <http://purl.org/net/orth#>
PREFIX up: <http://purl.uniprot.org/core/>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX sio: <http://semanticscience.org/resource/>

SELECT ?gene ?omaLink ?uniprot ?diseaseLabel ?annotationText WHERE {
    {
        SELECT ?gene {
            ?anat rdfs:label 'brain' .
            ?gene genex:isExpressedIn ?anat ;
                orth:organism/obo:RO_0002162 ?taxonRat .
            ?taxonRat up:commonName 'rat' .
        } LIMIT 20
    }
    SERVICE <https://sparql.uniprot.org/sparql> {
        ?taxonHuman up:commonName 'Human' .
    }
    SERVICE <https://sparql.omabrowser.org/sparql/> {
        ?cluster a orth:OrthologsCluster ;
            orth:hasHomologousMember ?node1 ;
            orth:hasHomologousMember ?node2 .
        ?node2 orth:hasHomologousMember* ?protein2 .
        ?node1 orth:hasHomologousMember* ?protein1 .
        ?protein1 a orth:Protein ;
            sio:SIO_010079 ?gene . # encoded by
        ?protein2 a orth:Protein ;
            rdfs:seeAlso ?omaLink ;
            orth:organism/obo:RO_0002162 ?taxonHuman ;
            lscr:xrefUniprot ?uniprot .
        FILTER(?node1 != ?node2)
    }
    SERVICE <https://sparql.uniprot.org/sparql> {
        ?uniprot up:annotation ?annotation .
        ?annotation a up:Disease_Annotation ;
            rdfs:comment ?annotationText ;
            up:disease ?disease .
        ?disease skos:prefLabel ?diseaseLabel .
    }
}""" ;
    schema:target <https://www.bgee.org/sparql/> ;
    spex:federatesWith <https://sparql.uniprot.org/sparql> , <https://sparql.omabrowser.org/sparql/> .
