@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:018 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Which are the mouse's proteins encoded by genes which are expressed in the liver and are orthologous to human's INS gene?"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX up: <http://purl.uniprot.org/core/>
PREFIX genex: <http://purl.org/genex#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX orth: <http://purl.org/net/orth#>
PREFIX sio: <http://semanticscience.org/resource/>
PREFIX lscr: <http://purl.org/lscr#>

SELECT ?humanProtein ?mouseProtein ?mouseOmaLink {
    {
        ?humanTaxon up:commonName 'human' .
        ?mouseTaxon up:commonName 'mouse' .
    }
    SERVICE <https://sparql.omabrowser.org/sparql> {
        ?cluster a orth:OrthologsCluster ;
            orth:hasHomologousMember ?node1 ;
            orth:hasHomologousMember ?node2 .
        ?node2 orth:hasHomologousMember* ?mouseProtein .
        ?node1 orth:hasHomologousMember* ?humanProtein .
        ?humanProtein a orth:Protein ;
            rdfs:label 'INS' ;
            orth:organism/obo:RO_0002162 ?humanTaxon .
        ?mouseProtein a orth:Protein ;
            sio:SIO_010079 ?mouseGene ; # is encoded by
            orth:organism/obo:RO_0002162 ?mouseTaxon ;
            rdfs:seeAlso ?mouseOmaLink .
        ?mouseGene lscr:xrefEnsemblGene ?mouseGeneEnsembl .
        FILTER ( ?node1 != ?node2 )
    }
    {
        ?mouseGeneBgee a orth:Gene ;
            lscr:xrefEnsemblGene ?mouseGeneEnsembl ;
            genex:isExpressedIn ?cond ;
            orth:organism/obo:RO_0002162 ?mouseTaxon .
        ?cond genex:hasAnatomicalEntity/rdfs:label 'liver' .
    }
}""" ;
    schema:target <https://www.bgee.org/sparql/> ;
    spex:federatesWith <https://sparql.omabrowser.org/sparql> .
