@prefix ex: <https://kg.earthmetabolome.org/metrin/api/.well-known/examples/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

ex:005 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "How many features have the same SIRIUS and ISDB annotation?"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX emi: <https://w3id.org/emi#>

SELECT (COUNT(?feature) AS ?count)
WHERE {
        ?lcms emi:hasMassiveDOI ?massive_doi ;
            emi:hasLCMSFeatureSet ?feature_list .
        # FILTER(regex(str(?massive_doi), "MSV000087728")) # MassIVE id filter, MSV000087728 is pf1600, MSV000093464 is 337 Korean medicinal plants, if you want to query both you can pipe "MSV000087728|MSV000093464". You can apply or not these filters by ucommenting/commenting this line.
        ?feature_list emi:hasLCMSFeature ?feature .
        ?feature emi:hasAnnotation ?sirius_annotation .
        ?sirius_annotation a emi:StructuralAnnotation ;
            prov:wasGeneratedBy ?activity ;
            emi:hasChemicalStructure ?sirius_ik2d .
        ?activity prov:wasAssociatedWith <https://bio.informatik.uni-jena.de/software/sirius> .
        ?feature emi:hasAnnotation ?isdb_annotation .
        ?activity_isdb prov:wasAssociatedWith <https://oolonek.github.io/ISDB> .
        ?isdb_annotation a emi:StructuralAnnotation ;
            prov:wasGeneratedBy ?activity_isdb ;
            emi:hasChemicalStructure ?isdb_ik2d .
    FILTER(?isdb_ik2d = ?sirius_ik2d) .
}""" ;
    schema:target <https://kg.earthmetabolome.org/metrin/api/> .

