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

ex:NXQ_00283 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Proteins with no reported mitochondrial localization but interacting with 20 or more mitochondrial proteins ('gold' quality) "@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX : <http://nextprot.org/rdf/>
PREFIX nextprot_cv: <http://nextprot.org/rdf/terminology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?entry (str(?gen) as ?gene) (count(distinct ?mitopartner) as ?mitcount) (count(distinct ?partner) as ?itcount) WHERE {
values ?mitloc {nextprot_cv:GO_0005739 nextprot_cv:SL-0173} # GO and SL values for mitochondrion
 ?entry :isoform ?iso.
 ?entry :gene / :recommendedName / rdfs:label ?gen.
 filter not exists { ?iso :cellularComponent /:term / :childOf ?mitloc }
 ?iso :binaryInteraction ?it, ?it2.
 ?it :interactant ?mitopartner; :quality :GOLD .
 ?mitopartner :isoform / :cellularComponent ?loc .
 ?loc :quality :GOLD; :term / :childOf ?mitloc .
 ?it2 :interactant ?partner; :quality :GOLD .
} group by ?entry ?gen ?mitcnt having (count(distinct ?mitopartner) >= 20)
order by desc(?mitcnt)""" ;
    schema:keywords "PPI",
        "subcellular location",
        "tutorial" ;
    schema:target <https://sparql.nextprot.org/sparql> .

