diff options
author | Munyoki Kilyungi | 2023-07-01 10:01:40 +0300 |
---|---|---|
committer | Munyoki Kilyungi | 2023-07-01 10:01:40 +0300 |
commit | 06b2771206832df9831cf19100d3a74a8dc0ee6f (patch) | |
tree | 6821f8bfd2ba8d89738b5f45244a61c5a07bab86 /topics/next-gen-databases | |
parent | 85e56a945a0462f41aa780e279b78f491e449d28 (diff) | |
download | gn-gemtext-06b2771206832df9831cf19100d3a74a8dc0ee6f.tar.gz |
Document new idea regarding modifying dumps at the macro level
Diffstat (limited to 'topics/next-gen-databases')
-rw-r--r-- | topics/next-gen-databases/modifying-dump-macros.gmi | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/topics/next-gen-databases/modifying-dump-macros.gmi b/topics/next-gen-databases/modifying-dump-macros.gmi new file mode 100644 index 0000000..a0db4f2 --- /dev/null +++ b/topics/next-gen-databases/modifying-dump-macros.gmi @@ -0,0 +1,52 @@ +# Modifying dump macros + +Look at the following guix snippet: + +``` +(modify-services %desktop-services + (guix-service-type config => (guix-configuration + (inherit config) + (substitute-urls + (append (list "https://substitutes.nonguix.org") + %default-substitute-urls)) + (authorized-keys + (append (list (local-file "/etc/guix/nonguix/signing-key.pub") + (local-file "/etc/guix/guix-past/signing-key.pub")) + %default-authorized-guix-keys))))) +``` + +The above snippet demonstrates how you can modify services on the fly. In GN, consider a dump: + +``` +(define-dump dump-species + (tables (Species)) + (schema-triples + (gn:name rdfs:range rdfs:Literal) + (gn:displayName rdfs:range rdfs:Literal) + (gn:binomialName rdfs:range rdfs:Literal) + (gn:family rdfs:range rdfs:Literal)) + (triples (string->identifier "species" (field Species FullName)) + (set rdf:type 'gn:species) + (set gn:name (field Species SpeciesName)) + (set gn:displayName (field Species MenuName)) + (set gn:binomialName (field Species FullName)) + (set gn:family (field Species Family)) + (set gn:organism (ontology 'ncbiTaxon: (field Species TaxonomyId))))) +``` + +We could have all the dumps in one file, say: + +``` +%genenetwork-tables-dump +``` + +which have the default dumps that were defined earlier. Should someone want to change something, one possible interface would be: + +``` +(modify-dump %genenetwork-tables-dump + (dump-species schema-triples => + (schema-triples + (inherit schema-triples) + (replace (gn:name rdfs:range rdfs:Literal) + (gn:name rdfs:range gn:something- +``` |