simplify iatc slides
[arxana.git] / org / honey-spec.org
blob4ff6656714f1e1a4d98d6bbf0e182765e33250ab
2 * Introduction
4 This is a specification of the interface between the middle-end and
5 back-end of the arxana system.
7 * Dispatcher
9 The dispatcher is an applicaton layer which mediates interactions
10 between the middle end and the back-end(s).
12 ** Registries
14 These commands and variables implement the plexus registry.
16 *** type-registry
18 variable type-registry
20 This is where the dispatcher maintains information about different
21 types of supported backends is stored.
23 *** plexus-registry
25 This is where the dispatcher maintains information about the plexi
26 currently defined in the system is stored.
28 *** storage-types
30 function storage-types ()
32 Return a list of types of databases which the system currently
33 recognizes.
35 *** storage-type-p
37 predicate storage-type-p (type)
39 Query whhether a particular type is currently supported.
41 *** remove-handler
43 function
45 remove-handler (type)
47 Remove a certain type of handler from the type registry.
49 *** show-plexus-registry
51 function show-plexus-registry ()
53 List the plexi currently open in the system.
55 *** set-current-plexus
57 function set-current-plexus (plex)
59 Define the default plexus to which subsequent commands will apply.
61 *** show-current-plexus
63 function show-current-plexus ()
65 Return the plexus currently being examined.
67 *** with-current-plexus
69 macro with-current-plexus (plex &rest expr)
71 Evaluate the enclosed code in the context of a specified plexus.
74 ** Labelling nemata
76 For the convenience of the user, the system allows one to label nemata
77 and plexi with descriptive names which can be used in place of the
78 identifiers which it assigns to them.
80 *** label-nema
82 function label-nema (uid label)
84 Assign the label to the given object.
86 *** label2uid
88 function label2uid (label)
90 Return the unique identifier corresponding to a label.
92 *** uid2label
94 function uid2label (uid)
96 Return the label associated to a unique identifier.
99 * Honey
101 Honey is the protocol whereby arxana communicates with the database
102 routines in which the triples reside.  Standardizing the form of
103 this interface makes it possible to swap out one type of database (say
104 hash tables) for another type (say a relational database) without
105 making any changes to the middle-end code or changing the functionality.
107 Wth a few exceptions which will be noted below, the commands here come
108 in two versions --- a system version which is called by the
109 dispatcher and which directly interacts with the appropriate database
110 and a user version which is a wrapper around the system-level form
111 in which the dispatcher adds convenience and bookkeeping.
113 ** Instance operations
115 These operations create, initialize, and destroy instances of plexi.
117 *** initialize-handler
119 function
121 system: initialize-handler ()
123 Initialize the handler for a certain type the first time that that
124 type is added to the type registry.
126 *** finalize-handler
128 function
130 system: finalize-handler ()
132 Clean up whatever data structures the handler was using whien it is
133 removed from the type registry or when arxana shuts down.
135 *** add-plexus
137 function 
139 system: add-plexus ()
140 user: add-plexus ()
142 Create a new plexus.
144 *** reset-plexus
146 function 
148 system: reset-plexus (plex)
149 user: reset-plexus (plex)
151 Restore a plexus to its original state.
153 *** remove-plexus
155 system: remove-plexus (plex)
156 user: remove-plexus (plex)
158 Remove a plexus.
160 function reset-plexus ()
162 ** Bulk operatons
164 These operations act on the database as a whole.
166 *** download-en-masse
168 function
170 system: download-en-masse (plex)
171 user: download-en-masse ()
173 Produce a serialization of the database as quintuples.
175 *** upload-en-masse
177 function
179 system: upload-en-masse (plex)
180 user: upload-en-masse (plex)
182 Load a representation of a database as quintuples into memory.
184 *** add-en-masse
186 function
188 system: add-en-masse (plex)
189 user:  add-en-masse (plex)
191 Add multiple nemata given as list of quartuplets.
193 ** Individual operations
195 These operations act on individual items in the database.
197 *** add-nema
199 function 
201 system add-nema (plex src txt snk)
202 user: add-nema (src txt snk)
204 Enter a new nema to the database.
206 *** get-content
208 function 
210 system: get-content (plex nema)
211 user: get-content (uid)
213 Return the content of the nema.
215 *** get-source
217 function 
219 system: get-source (plex nema)
220 user: get-source (uid)
222 Return the source of the nema.
224 *** get-sink
226 function 
228 system: get-sink (plex nema)
229 user: get-sink (uid)
231 Return the sink of the nema.
233 *** get-forward-links
235 function 
237 system: get-forward-links (plex nema)
238 user: get-forward-links (uid)
240 Return all links having given object as source.
242 *** get-backward-links
244 function 
246 system: get-backward-links (plex nema)
247 user: get-backward-links (uid)
249 Return all links having given object as sink.
251 *** update-content
253 function
255 system: update-content (plex nema txt)
256 user: update-content (uid txt)
258 Replace the content of the nema.
260 *** update-source
262 function
264 system: update-source (plex nema new-src)
265 user: update-source (uid new-src)
267 Replace the source of the nema.
269 *** update-sink
271 function
273 system: update-sink (plex nema new-snk)
274 user: update-sink (uid new-snk)
276 Change the sink of the nema.
278 *** remove-nema
280 function
282 system: remove-nema (plex nema)
283 user: remove-nema (uid)
285 Remove this nema from the database.
287 ** Queries
289 These are commands for querying the database.
291 *** uid-p
293 predicate
295 user: uid-p (uid)
297 Is this a valid uid?
299 *** uid-list
301 function
303 user: uid-list ()
305 List of all valid uid's.
307 *** ground-p
309 predicate
311 system: ground-p (plex nema)
312 user: ground-p (uid)
314 Is this nema the ground?
316 *** source-p
318 predicate
320 system: source-p (plex x y)
321 user: source-p (x y)
323 Is the former nema the sink of the latter?
325 *** sink-p
327 predicate 
329 system: sink-p (plex x y)
330 user: sink-p (x y)
332 Is the former nema the sink of the latter?
334 *** links-from
336 function 
338 system: links-from (plex x y)
339 user: links-from (x y)
341 Return all links from nema x to nema y.
343 *** links-p
345 predicate 
347 system: links-p (plex x y)
348 user: links-p (x y)
350 Does nema x link to nema y?"
352 *** triple-p
354 predicate 
356 system: triple-p (plex x y z)
357 user: triple-p (x y z)
359 Do the three items form a triplet?
361 *** plexus-p
363 predicate 
365 user: plexus-p (x)
367 Is this object a plexus?
369 ** Iteration
371 These commands allow the end user to run loops over the database
372 without having to interact directly with the backend structures. 
374 *** do-plexus
376 macro 
378 system: do-plexus (plex var body res)
379 user: do-plexus (var body res)
381 Loop over the current plexus binding var to each nema in turn,
382 evaluating the body, and returning res.
384 *** map-plexus
386 function 
388 system: map-plexus (plex func)
389 user: map-plexus (func)
391 Evaluate func over all nemata in the plexus and return a list of the
392 results.
394 *** filter-plexus
396 function 
398 system: filter-plexus (plex pred)
399 user: filter-plexus (pred)
401 Return a list of all nemata satisfying the condition pred.