sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

008

Which features in the positive ionization mode have the most fragments and neutral losses in common with the feature identified as mzspec:MSV000087728:VGF143_H08_features_ms2_pos.mgf:scan:707

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX emi: <https://purl.org/emi#>
PREFIX sosa: <http://www.w3.org/ns/sosa/>

SELECT ?feature ?massive_doi (SAMPLE(?rt) AS ?retention_time) (SAMPLE(?pm) AS ?parent_mass) (COUNT(?peakloss) AS ?count)
WHERE {
    ?lcms a emi:LCMSAnalysisPos ;
        emi:hasMassiveDOI ?massive_doi ;
        sosa:hasResult ?feature_list .
    #FILTER(regex(str(?massive_doi), "MSV000087728")) # MassIVE id filter
    ?feature_list emi:hasLCMSFeature ?feature .
    ?feature a emi:LCMSFeature ;
        emi:hasSpec2VecDoc ?doc ;
        emi:hasParentMass ?pm ;
        emi:hasRetentionTime ?rt .
    ?doc emi:hasSpec2VecLoss|emi:hasSpec2VecPeak ?peakloss .

    {
        SELECT ?peakloss WHERE {
            ?feature a emi:LCMSFeature ;
                emi:hasUSI "mzspec:MSV000087728:VGF143_H08_features_ms2_pos.mgf:scan:707" ;
                emi:hasSpec2VecDoc ?doc .
            ?doc emi:hasSpec2VecLoss|emi:hasSpec2VecPeak ?peakloss .
        }
    }
} GROUP BY ?feature ?massive_doi ORDER BY DESC(?count)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v12("?count")
  v6("?doc")
  v5("?feature"):::projected 
  v4("?feature_list")
  v2("?lcms")
  v3("?massive_doi"):::projected 
  v11("?parent_mass")
  v9("?peakloss"):::projected 
  v7("?pm"):::projected 
  v10("?retention_time")
  v8("?rt"):::projected 
  c6(["emi:LCMSFeature"]):::iri 
  c13(["mzspec:MSV000087728:VGF143_H08_features_ms2_pos.mgf:scan:707"]):::literal 
  c2(["emi:LCMSAnalysisPos"]):::iri 
  v2 --"a"-->  c2
  v2 --"emi:hasMassiveDOI"-->  v3
  v2 --"sosa:hasResult"-->  v4
  v4 --"emi:hasLCMSFeature"-->  v5
  v5 --"a"-->  c6
  v5 --"emi:hasSpec2VecDoc"-->  v6
  v5 --"emi:hasParentMass"-->  v7
  v5 --"emi:hasRetentionTime"-->  v8
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    v6 --"emi:hasSpec2VecPeak"-->  v9
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v6 --"emi:hasSpec2VecLoss"-->  v9
  end
  union0r <== or ==> union0l
  end
  v5 --"a"-->  c6
  v5 --"emi:hasUSI"-->  c13
  v5 --"emi:hasSpec2VecDoc"-->  v6
  subgraph union1[" Union "]
  subgraph union1l[" "]
    style union1l fill:#abf,stroke-dasharray: 3 3;
    v6 --"emi:hasSpec2VecPeak"-->  v9
  end
  subgraph union1r[" "]
    style union1r fill:#abf,stroke-dasharray: 3 3;
    v6 --"emi:hasSpec2VecLoss"-->  v9
  end
  union1r <== or ==> union1l
  end
  bind3[/"sample(?rt)"/]
  v8 --o bind3
  bind3 --as--o v10
  bind4[/"sample(?pm)"/]
  v7 --o bind4
  bind4 --as--o v11
  bind5[/"count(?peakloss)"/]
  v9 --o bind5
  bind5 --as--o v12