incf-nidash / PyNIDM

Other
21 stars 31 forks source link

Question: is there a collection of pre-crafted queries against some NIDM graphs instances #275

Open yarikoptic opened 3 years ago

yarikoptic commented 3 years ago

e.g. against reprolake. I am thinking about something as simple as some json/yaml of a type

- description: Return known "sexes" of participants
  sameAs:
     datalad: datalad search --show-keys short sex
  sparql: |
    SELECT DISTINCT ?open_neuro_id ?de ?label ?description ?diag_val
    WHERE {
        ?de nidm:isAbout <http://uri.interlex.org/ilx_0497879>;
          rdfs:label ?label ;
          dct:description ?description .

        ?acq_o ?de ?diag_val;
          prov:wasGeneratedBy ?acq.

        ?acq prov:qualifiedAssociation/prov:agent ?subject_iri;
            dct:isPartOf+ ?project .

        ?subject_iri ndar:src_subject_id ?subject_id .
        ?project a nidm:Project;
            dctypes:title ?projectname;
            prov:Location ?project_location .

        BIND( strafter(?project_location,"openneuro/") AS ?open_neuro_id ) .
    }
- description: Return known to the graph diagnosis
  sparql: |
    SELECT DISTINCT ?de ?label ?description ?concept
    WHERE {
        ?de rdfs:label ?label ;
            dct:description ?description;
            nidm:source_variable ?source .

        OPTIONAL {
          ?de nidm:isAbout ?concept .
        }

        FILTER  (
                  regex(?label, "diag", "i" ) ||
                  regex(?description, "diag", "i" ) ||
                  regex(?source, "diag", "i")  ||

                  regex(?label, "disease", "i") ||
                  regex(?description, "disease", "i") ||
                  regex(?source, "disease", "i")  ||

                  regex(?label, "disorder", "i") ||
                  regex(?description, "disorder", "i") ||
                  regex(?source, "disorder", "i") 

                    )
    }

with then cmdline helper like nidm-queries supporting commands like

dbkeator commented 3 years ago

Hi, Well, there are several places they exist but we don't have a registry or a YAML representation as you suggest. Places to find queries:

I think ultimately we'd like to keep a registry somewhere, probably with PyNIDM of text files containing SPARQL queries. Our query utility pynidm query allows one to use a text-file based SPARQL query. We could update that feature to use a YAML-based SPARQL query...

Dave