about summary refs log tree commit diff
path: root/examples
diff options
context:
space:
mode:
authorMunyoki Kilyungi2026-01-26 19:19:32 +0300
committerMunyoki Kilyungi2026-01-26 19:19:32 +0300
commit493f65f358f399143a20a9068bc0336596f8dc0e (patch)
treeeea4a9b7cab17ad4b47369a869f24549fffee298 /examples
parent296e3208c92a22b2e7cc994618eddab73bc6abdc (diff)
downloadgn-transform-databases-493f65f358f399143a20a9068bc0336596f8dc0e.tar.gz
Update schema.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/classification.scm72
1 files changed, 54 insertions, 18 deletions
diff --git a/examples/classification.scm b/examples/classification.scm
index d94276a..c9d9d63 100755
--- a/examples/classification.scm
+++ b/examples/classification.scm
@@ -20,10 +20,11 @@
    (gnc:resource_classification_scheme a skos:ConceptScheme)
    (gnc:resource_classification_scheme skos:prefLabel "GeneNetwork Resource Classification Scheme")
    (gnc:resource_classification_scheme skos:definition "A hierarchical classification scheme for organizing GeneNetwork resources by dataset type, resource set (inbredset group), or species.")
-   (gnc:resource_classification_scheme xkos:numberOfLevels "3")
+   (gnc:resource_classification_scheme xkos:numberOfLevels "4")
    (gnc:resource_classification_scheme xkos:levels gnc:dataset_type)
    (gnc:resource_classification_scheme xkos:levels gnc:set)
    (gnc:resource_classification_scheme xkos:levels gnc:species)
+   (gnc:resource_classification_scheme xkos:levels gnc:family)
    (gnc:dataset_type a xkos:ClassificationLevel)
    (gnc:dataset_type skos:inScheme gnc:resource_classification_scheme)
    (gnc:dataset_type skos:prefLabel "Dataset Type")
@@ -100,7 +101,7 @@
     (set skos:prefLabel (field Species MenuName))
     (set skos:altLabel (field Species SpeciesName))
     (set gnt:short_name (field Species Name))
-    (set gnt:has_family (string->identifier "family" (field Species Family)))
+    (set gnt:has_family (string->identifier "family" (field Species Family) #:separator "_"))
     (set gnt:has_uniprot_taxon_id (ontology
                                    'taxon:
                                    (field Species TaxonomyId)))))
@@ -119,11 +120,19 @@
     (set gnt:has_strain
          (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_"))))
 
-(define-transformer species-families
+
+(define-transformer species-families-list
   (tables (Species)
           "GROUP BY FAMILY")
   (schema-triples
-   (gnt:has_family_order_id a owl:DatatypeProperty))
+   (gnc:family a xkos:ClassificationLevel)
+   (gnc:family skos:inScheme gnc:resource_classification_scheme)
+   (gnc:family skos:prefLabel "Family")
+   (gnc:family skos:definition "An organizational classification level used in GeneNetwork to group resources into families.")
+   (gnc:family xkos:depth "4")
+   (gnc:family xkos:previousLevel gnc:species)
+   (gnt:has_family_order_id a owl:DatatypeProperty)
+   (gnt:has_family_order_id rdfs:range xsd:integer))
   (triples (string->identifier "family" (field Species Family) #:separator "_")
     (set gnt:has_species
          (string->identifier "" (remap-species-identifiers (field Species Fullname))))
@@ -132,6 +141,15 @@
          (annotate-field (field Species OrderId)
                          '^^xsd:integer))))
 
+(define-transformer species-families-fanout
+  (tables (Species))
+  (schema-triples
+   (gnt:has_family_order_id a owl:DatatypeProperty))
+  (triples (string->identifier "family" (field Species Family) #:separator "_")
+    (set gnt:has_species
+         (string->identifier "" (remap-species-identifiers (field Species Fullname))))))
+
+
 (define-transformer inbred-set
   (tables (InbredSet
            (left-join Species "ON InbredSet.SpeciesId=Species.Id")
@@ -174,28 +192,44 @@
     (set gnt:has_species
          (string->identifier "" (remap-species-identifiers (field Species Fullname))))))
 
-(define-transformer inbredset-families
+(define-transformer inbredset-families-list
   (tables (InbredSet)
-          "WHERE Family IS NOT NULL")
+          "WHERE Family IS NOT NULL GROUP BY Family")
   (triples (string->identifier "family" (field InbredSet Family) #:separator "_")
+    (set rdf:type 'gnc:family)
     (set rdfs:label (field InbredSet Family))
     (set gnt:has_family_order_id
          (annotate-field (field InbredSet FamilyOrder)
                          '^^xsd:integer))))
 
-(define-transformer species-families-fanout
-  (tables (Species))
-  (schema-triples
-   (gnt:has_family_order_id a owl:DatatypeProperty))
-  (triples (string->identifier "family" (field Species Family) #:separator "_")
-    (set gnt:has_species
-         (string->identifier "" (remap-species-identifiers (field Species Fullname))))))
-
 (define-transformer inbredset-families-fanout
   (tables (InbredSet)
           "WHERE Family IS NOT NULL")
   (triples (string->identifier "family" (field InbredSet Family) #:separator "_")
-    (set gnt:has_strain (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_"))))
+    (set gnt:has_strain
+         (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_"))))
+
+(define-transformer family-category-inbredset
+  (tables (InbredSet)
+          "WHERE public > 0 GROUP BY Family")
+  (schema-triples
+   (gnt:assigned_strain rdfs:domain gnc:set)
+   (gnt:assigned_strain a owl:ObjectProperty)
+   (gnt:assigned_strain rdfs:label "These families have been assigned to these strains"))
+  (triples "gnc:family"
+    (set gnt:assigned_strain
+         (string->identifier "family" (field InbredSet Family) #:separator "_"))))
+
+(define-transformer family-category-species
+  (tables (Species)
+          "GROUP BY Family")
+  (schema-triples
+   (gnt:assigned_species rdfs:domain gnc:set)
+   (gnt:assigned_species a owl:ObjectProperty)
+   (gnt:assigned_species rdfs:label "These families have been assigned to these species"))
+  (triples "gnc:family"
+    (set gnt:assigned_species
+         (string->identifier "family" (field Species Family) #:separator "_"))))
 
 
 
@@ -235,10 +269,12 @@
           species
           species-fan-out
           inbred-set
-          species-families
-          inbredset-families
+          species-families-list
           species-families-fanout
-          inbredset-families-fanout))
+          inbredset-families-list
+          inbredset-families-fanout
+          family-category-inbredset
+          family-category-species))
    (outputs
     `(#:documentation ,documentation
       #:rdf ,output))))