about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBonfaceKilz2022-06-22 13:10:47 +0300
committerArun Isaac2022-06-23 11:27:32 +0530
commit145c06b8e6abf8e9571660def1502822269a5f57 (patch)
treefea22d8be13530abf43c6eeab0fa12054a972171
parent9a5161536bc55ec9a62012c26d21aaced881dc8f (diff)
downloadgn-transform-databases-145c06b8e6abf8e9571660def1502822269a5f57.tar.gz
Dump groups.
* dump.scm (dump-groups): New dump.
(main): Call dump-groups.

Signed-off-by: Arun Isaac <arunisaac@systemreboot.net>
-rwxr-xr-xdump.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/dump.scm b/dump.scm
index c81ee99..40c8003 100755
--- a/dump.scm
+++ b/dump.scm
@@ -775,6 +775,27 @@ is a <table> object."
     (set gn:inbredSet (field InbredSet Name InbredSetName))
     (set gn:description (field CaseAttribute Description))
     (set gn:caseAttributeId (field CaseAttribute Id))))
+
+(define-dump dump-groups
+  (tables (InbredSet
+           (left-join Species "USING (SpeciesId)"))
+          (string-join
+           '("WHERE Species.Name IN "
+             "(SELECT Name FROM Species ORDER BY OrderId) "
+             "GROUP BY InbredSet.Name "
+             "ORDER BY "
+             "IFNULL(InbredSet.FamilyOrder, InbredSet.FullName) "
+             "ASC, IFNULL(InbredSet.Family, InbredSet.FullName) "
+             "ASC, InbredSet.FullName ASC, InbredSet.MenuOrderId ASC")))
+  (schema-triples
+   (gn:name rdfs:range rdfs:Literal)
+   (gn:binomialName rdfs:range rdfs:Literal)
+   (gn:species rdfs:range gn:species))
+  (triples (string->identifier "inbredSet" (field InbredSet Name))
+    (set gn:name (field InbredSet Name))
+    (set gn:binomialName (field InbredSet fullName))
+    (set gn:species (field Species Name))))
+
 
 ;; Main function
 
@@ -804,3 +825,4 @@ is a <table> object."
        (dump-info-files db)
        (dump-schema db)
        (dump-case-attributes db)
+       (dump-groups db)))))