summary refs log tree commit diff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2026-02-16 07:15:20 +0300
committerMunyoki Kilyungi2026-02-16 07:15:20 +0300
commit7056a0a08a5a4f9344ebaf4ae4128eaec1ab63e2 (patch)
tree580229a5fe5eea42f639659e420b55d35f4710cc
parenta94840c1b2976b95c23b016f948d81455f83bba1 (diff)
downloadgn-ai-7056a0a08a5a4f9344ebaf4ae4128eaec1ab63e2.tar.gz
Add example sparql query.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--issues/ai/search.gmi25
1 files changed, 24 insertions, 1 deletions
diff --git a/issues/ai/search.gmi b/issues/ai/search.gmi
index 3a104fad..f7ddfd2c 100644
--- a/issues/ai/search.gmi
+++ b/issues/ai/search.gmi
@@ -30,6 +30,29 @@ We need fan-out to GN-specific pages.  Related to task listed below in ⁰
 
 * [X] (johannesm, bonfacem) Design a proper JSON output format for the system
 * [X] ⁰(johannesm, bonfacem) Teach model how to build link to trait result page in CD
+* [X] (bonfacem) Sparql query to fetch phenotypes and dataset metadata.
+Dataset metadata for a given phenotype.
+
+```
+SPARQL
+PREFIX gn:  <http://rdf.genenetwork.org/v1/id/>
+PREFIX gnc: <http://rdf.genenetwork.org/v1/category/>
+PREFIX gnt: <http://rdf.genenetwork.org/v1/term/>
+
+SELECT ?phenotype_dataset
+       (GROUP_CONCAT(DISTINCT CONCAT(STR(?p), " = ", STR(?o)); separator=" | ") AS ?metadata)
+FROM <http://rdf.genenetwork.org/v1>
+WHERE {
+  ?set gnt:has_phenotype_data ?phenotype_dataset .
+  ?phenotype_dataset gnt:has_strain ?set ;
+                     ?p ?o .
+}
+GROUP BY ?phenotype_dataset
+LIMIT 10;
+
+```
+
+
 * [ ] (johannesm, bonfacem) Extend / Modify (directly use sparql) corpus to molecular traits (later genotypes, precompute data and RIFs).
 * [ ] (johannesm, bonfacem) Have a sync on build of xapian search. We want to teach the LLM how to build a xapian search so that the user has a fallback
 * [ ] (johannesm, ! bonfacem) Add REST API for processing answers from AI processing.
@@ -288,4 +311,4 @@ System feedback:
     "final_answer": "The BXDPublish dataset contains multiple traits related to Intraocular pressure (IOP) measurements in BXD mice. These include: BXD_16337 (IOP in 1-2 months old mice, mean 15.28 mmHg), BXD_16338 (IOP in 2.1-5 months old mice, mean 16.09 mmHg), BXD_16339 (IOP in 5.1-9 months old mice, mean 16.56 mmHg), BXD_16340 (IOP in 9.1-13 months old mice, mean 15.66 mmHg), and BXD_16342 (IOP across all ages 1-30 months, mean 15.80 mmHg). All measurements are from both sexes and represent averages of left and right eyes."                     
 }
 
-```
\ No newline at end of file
+```