diff options
Diffstat (limited to 'examples/classification.scm')
| -rwxr-xr-x | examples/classification.scm | 187 |
1 files changed, 114 insertions, 73 deletions
diff --git a/examples/classification.scm b/examples/classification.scm index e3da8da..130bec8 100755 --- a/examples/classification.scm +++ b/examples/classification.scm @@ -14,97 +14,126 @@ ;; Classification Scheme -(define-transformer classification-scheme-species - (tables (Species)) - (schema-triples - (gnc:resource_classification_scheme a skos:ConceptScheme) - (gnc:resource_classification_scheme skos:prefLabel "GeneNetwork Classification Scheme For Resources which are either defines as a dataset, an inbred group, or a species.") - (gnc:resource_classification_scheme xkos:numberOfLevels "3") - (gnc:resource_classification_scheme xkos:levels "( gnc:dataset_type gnc:set gnc:species )") - (gnc:dataset_type a xkos:ClassificationLevel) - (gnc:dataset_type skos:prefLabel "The Type of a Dataset which can be a ProbeSet, Genotype, or Phenotype") - (gnc:dataset_type xkos:depth "1") - (gnc:dataset_type skos:member gnc:probeset) - (gnc:dataset_type skos:member gnc:genotype) - (gnc:dataset_type skos:member gnc:phenotype) - (gnc:probeset skos:prefLabel "mRNA Assay Datasets") - (gnc:probeset skos:altLabel "ProbeSet") - (gnc:genotype skos:prefLabel "Genotype") - (gnc:genotype skos:altLabel "DNA Markers and SNPs") - (gnc:phenotype skos:prefLabel "Phenotype") - (gnc:phenotype skos:altLabel "Traits and Cofactors") - (gnc:species a xkos:ClassificationLevel) - (gnc:species skos:prefLabel "The species in which this resource belongs") - (gnc:species xkos:depth "3") - (gnc:species xkos:specializes gnc:set)) +(define-transformer gnc:species->gn:species + (tables (Species) + "WHERE Name != 'monkey'") (triples "gnc:species" (set skos:member (string->identifier "" (remap-species-identifiers (field Species Fullname)))))) -(define-transformer classification-scheme-set - (tables (InbredSet)) - (schema-triples - (gnc:set a xkos:ClassificationLevel) - (gnc:set skos:prefLabel "The Type of Set, Ie InbredSet/OutbredSet that a resource can belong to") - (gnc:set xkos:depth "2") - (gnc:set xkos:generalizes gnc:species)) +(define-transformer gnc:set->gn:set + (tables (InbredSet) + "WHERE public > 0 AND FullName NOT LIKE '%monkey%'") (triples "gnc:set" (set skos:member (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_")))) -(define-transformer species - (tables (Species)) - (schema-triples - (gnt:family a owl:ObjectProperty) - (gnt:family rdfs:domain gnc:species) - (gnt:family skos:definition "This resource belongs to this family") - (gnt:short_name a owl:ObjectProperty) - (gnt:short_name rdfs:domain gnc:species) - (gnt:short_name skos:definition "The short name of a given resource") - (gnt:belongs_to_species a rdf:property) - (gnt:belongs_to_species rdf:comment "This resource belongs to this species") - (gnt:belongs_to_species rdf:label "belongsToSpecies")) +(define-transformer gnc:species->metadata + (tables (Species) + "WHERE Name != 'monkey'") (triples (string->identifier "" (remap-species-identifiers (field Species Fullname))) - (set skos:inScheme 'gnc:resource_classification_scheme) + (set rdf:type 'gnc:species) (set rdfs:label (remap-species-identifiers (field Species Fullname))) (set skos:prefLabel (field Species MenuName)) (set skos:altLabel (field Species SpeciesName)) (set gnt:short_name (field Species Name)) - (set gnt:family (field Species Family)) - (set skos:notation (ontology - 'taxon: - (field Species TaxonomyId))))) + (set gnt:has_taxonomic_family (string->identifier "family" (field Species Family) #:separator "_")) + (set gnt:has_uniprot_taxon_id (ontology + 'taxon: + (field Species TaxonomyId))))) + +(define-transformer gnc:species->gn:set + (tables (InbredSet + (left-join Species "ON InbredSet.SpeciesId=Species.Id")) + "WHERE public > 0 AND Species.Name != 'monkey'") + (triples (string->identifier "" (remap-species-identifiers (field Species Fullname))) + (set gnt:has_strain + (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_")))) + +(define-transformer gn:family->gn:species/metadata + (tables (Species) + "WHERE Name != 'monkey' GROUP BY FAMILY") + (triples (string->identifier "family" (field Species Family) #:separator "_") + (set gnt:has_species + (string->identifier "" (remap-species-identifiers (field Species Fullname)))) + (set rdfs:label (field Species Family)) + (set gnt:has_family_order_id + (annotate-field (field Species OrderId) + '^^xsd:integer)))) + +(define-transformer gn:family->gn:species + (tables (Species) + "WHERE Name != 'monkey'") + (triples (string->identifier "family" (field Species Family) #:separator "_") + (set gnt:has_species + (string->identifier "" (remap-species-identifiers (field Species Fullname)))))) + -(define-transformer inbred-set +(define-transformer gn:set->metadata (tables (InbredSet (left-join Species "ON InbredSet.SpeciesId=Species.Id") (left-join MappingMethod - "ON InbredSet.MappingMethodId=MappingMethod.Id"))) - (schema-triples - (gnt:genetic-type a owl:ObjectProperty) - (gnt:genetic-type rdfs:domain gnc:set) - (gnt:code a owl:ObjectProperty) - (gnt:code rdfs:domain gnc:set) - ;; Already defined as an owl prop in species - (gnt:family rdfs:domain gnc:set) - (gnt:mapping_method a owl:ObjectProperty) - (gnt:mapping_method rdfs:domain gnc:set) - (gnt:belongs_to_group a rdf:property) - (gnt:belongs_to_group rdf:comment "This resource given to this group") - (gnt:belongs_to_group rdf:label "belongs-to-group")) + "ON InbredSet.MappingMethodId=MappingMethod.Id")) + "WHERE public > 0 AND Species.Name != 'monkey'") (triples (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_") - (set skos:inScheme 'gnc:resource_classification_scheme) + (set rdf:type 'gnc:set) (set rdfs:label (field InbredSet FullName)) (set skos:prefLabel (field InbredSet Name InbredSetName)) - (set gnt:genetic-type (field InbredSet GeneticType)) - (set gnt:family (field InbredSet Family)) - (set gnt:mapping_method (field MappingMethod Name)) - (set gnt:code (field InbredSet InbredSetCode)) - (set xkos:generalizes + (set gnt:genetic_type (field InbredSet GeneticType)) + (set dct:description (annotate-field (sanitize-rdf-string (field InbredSet description)) + '^^rdf:HTML)) + (set gnt:uses_mapping_method + (string->identifier "mapping_method" (field MappingMethod Name) #:separator "_")) + (set gnt:has_set_code (field InbredSet InbredSetCode)) + (set gnt:has_species (string->identifier "" (remap-species-identifiers (field Species Fullname)))))) +(define-transformer gn:set->gn:population + (tables (InbredSet) + "WHERE Family IS NOT NULL AND FullName NOT LIKE '%monkey%'") + (schema-triples + (gnt:has_reference_population rdfs:domain gnc:set) + (gnt:has_reference_population a owl:ObjectProperty) + (gnt:has_reference_population rdfs:comment "This group belongs to this population category.") + (gnt:has_reference_population rdfs:label "belongs to population category.")) + (triples (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_") + (set gnt:has_reference_population + (string->identifier "population" (field InbredSet Family) #:separator "_")))) + +(define-transformer gn:population->metadata + (tables (InbredSet) + "WHERE Family IS NOT NULL AND FullName NOT LIKE '%monkey%' GROUP BY Family") + (triples (string->identifier "population" (field InbredSet Family) #:separator "_") + (set rdf:type 'gnc:reference_population) + (set rdfs:label (field InbredSet Family)) + (set skos:member 'gnc:population_category) + (set gnt:has_population_order_id + (annotate-field (field InbredSet FamilyOrder) + '^^xsd:integer)))) + +(define-transformer gn:population->gn:set + (tables (InbredSet) + "WHERE Family IS NOT NULL AND FullName NOT LIKE '%monkey%'") + (triples (string->identifier "population" (field InbredSet Family) #:separator "_") + (set gnt:has_strain + (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_")))) + +(define-transformer gnc:population_category->gn:population + (tables (InbredSet) + "WHERE public > 0 AND FullName NOT LIKE '%monkey%' GROUP BY Family") + (triples "gnc:population_category" + (set gnt:has_reference_population + (string->identifier "population" (field InbredSet Family) #:separator "_")))) + +(define-transformer gnc:taxonomic_family->gn:family + (tables (Species) + "WHERE Name != 'monkey' GROUP BY Family") + (triples "gnc:taxonomic_family" + (set gnt:has_taxonomic_family + (string->identifier "family" (field Species Family) #:separator "_")))) + (let* ((option-spec @@ -120,24 +149,36 @@ read))) (with-documentation - (name "Species Metadata") + (name "GN Classification Hierarchy") (connection %connection-settings) (table-metadata? #f) (prefixes - '(("gn:" "<http://rdf.genenetwork.org/v1/id/>") + '(("dcat:" "<http://www.w3.org/ns/dcat#>") + ("dct:" "<http://purl.org/dc/terms/>") + ("gn:" "<http://rdf.genenetwork.org/v1/id/>") ("gnc:" "<http://rdf.genenetwork.org/v1/category/>") ("owl:" "<http://www.w3.org/2002/07/owl#>") ("gnt:" "<http://rdf.genenetwork.org/v1/term/>") + ("schema:" "<https://schema.org/>") ("skos:" "<http://www.w3.org/2004/02/skos/core#>") ("xkos:" "<http://rdf-vocabulary.ddialliance.org/xkos#>") + ("xsd:" "<http://www.w3.org/2001/XMLSchema#>") ("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>") ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>") ("taxon:" "<http://purl.uniprot.org/taxonomy/>"))) (inputs - (list classification-scheme-species - classification-scheme-set - species - inbred-set)) + (list gnc:species->gn:species + gnc:set->gn:set + gnc:species->metadata + gnc:species->gn:set + gn:family->gn:species/metadata + gn:family->gn:species + gn:set->metadata + gn:set->gn:population + gn:population->metadata + gn:population->gn:set + gnc:population_category->gn:population + gnc:taxonomic_family->gn:family)) (outputs `(#:documentation ,documentation #:rdf ,output)))) |
