@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#> .
@prefix spex:<https://purl.expasy.org/sparql-examples/ontology#> .

ex:NXQ_00272 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Proteins involved in coronaviruses/SARS-CoV-2 pathways with associated medical information"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX : <http://nextprot.org/rdf/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?entry (str(?gen) AS ?gene) ?pathwayname (str(?discom) AS ?discom1) ?medsource WHERE {
 SERVICE <http://sparql.wikipathways.org/sparql> {
 {?geneProduct a wp:Protein}
 union
 {?geneProduct a wp:GeneProduct}

 ?geneProduct rdfs:label ?genraw .
 bind (concat( ""^^xsd:string, ?genraw) as ?gen).
 filter(!regex(?gen,"[ a-z-]")). # ensures official gene names for subsequent neXtprot matching

 ?geneProduct dcterms:isPartOf ?pathway .
 ?pathway a wp:Pathway .
 ?pathway wp:organism ?organism .
 filter(contains(str(?organism),"9606"))

 ?pathway dcterms:title ?pathwayname .
 filter(regex(?pathwayname,"sars-cov-2","i")|| regex(?pathwayname,"corona","i") ).
 }

 ?entry a :Entry .
 ?entry :gene / :recommendedName / rdfs:label ?gen .
 ?entry :isoform ?iso.
 ?iso :medical ?med.
 ?med rdfs:comment ?discom.
 ?med :evidence/:assignedBy ?medsource.
}
order by ?entry""" ;
    schema:keywords "disease",
        "federated query",
        "pathway",
        "tutorial" ;
    schema:target <https://sparql.nextprot.org/sparql> ;
    spex:federatesWith <http://sparql.wikipathways.org/sparql> .

