summaryrefslogtreecommitdiff
path: root/topics/next-gen-databases/modifying-dump-macros.gmi
blob: a0db4f27c967b7480a69184e3ba7f2785339609c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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-
```