Merge branch 'mob'
[arxana.git] / latex / arxana-reboot.tex
blobae908bba6ec31712b7d3377f0039f8ac49fe690d
1 %;; arxana.tex -*- mode: Emacs-Lisp; -*-
2 %;; Copyright (C) 2005-2009 Joe Corneli <holtzermann17@gmail.com>
4 %;; This program is free software: you can redistribute it and/or modify
5 %;; it under the terms of the GNU Affero General Public License as published by
6 %;; the Free Software Foundation, either version 3 of the License, or
7 %;; (at your option) any later version.
8 %;;
9 %;; This program is distributed in the hope that it will be useful,
10 %;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 %;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 %;; GNU Affero General Public License for more details.
13 %;;
14 %;; You should have received a copy of the GNU Affero General Public License
15 %;; along with this program. If not, see <http://www.gnu.org/licenses/>.
17 % (progn
18 % (find-file "~/arxana.tex")
19 % (save-excursion
20 % (goto-char (point-max))
21 % (let ((beg (progn (search-backward "\\begin{verbatim}")
22 % (match-end 0)))
23 % (end (progn (search-forward "\\end{verbatim}")
24 % (match-beginning 0))))
25 % (eval-region beg end)
26 % (lit-process))))
28 %%% Commentary:
30 %% To load: remove %'s above and evaluate with C-x C-e.
32 %% Alternatively, run this:
33 % head -n 13 arxana.tex | sed -e "/%/s///" > arxana-loader.el
34 %% on the command line to produce something you can use
35 %% to load Arxana when you start Emacs:
36 % emacs -l arxana-loader.el
38 %% Or put the expression in your ~/.emacs (perhaps wrapped
39 %% in function like `eval-arxana').
41 %% Or search for a similar form below and evaluate there!
43 %% Q. Where exactly are we supposed to store the most
44 %% up-to-date Arxana files when they are ready to go?
46 %% A. Copy them into /usr/lib/sbcl/site-systems/arxana/
47 %% and that should be enough. Make sure that arxana.asd
48 %% is in that directory and that you have a symbolic link,
49 %% made via
51 %% ln -s ./arxana/arxana.asd .
53 %% in the directory /usr/lib/sbcl/site-systems/
54 %% -- Make sure to load once as root to generate new fasls.
56 %% Q. How to run the remote slime after that?
58 %% A. Make sure that Emacs `slime-protocol-version' matches
59 %% Common Lisp's `swank::*swank-wire-protocol-version*', then,
60 %% like this:
62 %% ssh -L 4005:127.0.0.1:4005 joe@li23-125.members.linode.com
63 %% linode$ sbcl
64 %% M-x slime-connect RET RET
66 %%% Code:
68 \documentclass{article}
70 \usepackage{amsmath}
71 \usepackage{amsthm}
72 \usepackage{verbatim}
74 \newcommand{\meta}[1]{$\langle${\it #1}$\rangle$}
76 \theoremstyle{definition}
77 \newtheorem{nota}{Note}[section]
79 \parindent = 1.2em
81 \newenvironment{notate}[1]
82 {\begin{nota}[{\bf {\em #1}}]}%
83 {\end{nota}}
85 \makeatletter
86 \newenvironment{elisp}
87 {\let\ORGverbatim@font\verbatim@font
88 \def\verbatim@font{\ttfamily\scshape}%
89 \verbatim}
90 {\endverbatim
91 \let\verbatim@font\ORGverbatim@font}
92 \makeatother
94 \makeatletter
95 \newenvironment{common}[1]
96 {\let\ORGverbatim@font\verbatim@font
97 \def\verbatim@font{\ttfamily\scshape}%
98 \verbatim}
99 {\endverbatim
100 \let\verbatim@font\ORGverbatim@font}
101 \makeatother
103 \makeatletter
104 \newenvironment{idea}
105 {\let\ORGverbatim@font\verbatim@font
106 \def\verbatim@font{\ttfamily\slshape}%
107 \verbatim}
108 {\endverbatim
109 \let\verbatim@font\ORGverbatim@font}
110 \makeatother
112 \begin{document}
114 \title{\emph{Arxana}}
116 \author{Joseph Corneli\thanks{Copyright (C) 2005-2010
117 Joseph Corneli {\tt <holtzermann17@gmail.com>}\newline
118 $\longrightarrow$ transferred to the public domain.}}
119 \date{Last revised: \today}
121 \maketitle
123 \abstract{A tool for building hackable semantic hypertext
124 platforms. Source code and mailing lists are at {\tt
125 http://common-lisp.net/project/arxana}.}
127 \tableofcontents
129 \section{Introduction}
131 \begin{notate}{What is ``Arxana''?} \label{arxana}
132 \emph{Arxana} is the name of a ``next generation''
133 hypertext system that emphasizes annotation. Every object
134 in this system is annotatable. Because of this, I
135 sometimes call Arxana's core ``the scholium system'', but
136 the name ``Arxana'' better reflects our aim: to explore
137 the mysterious world of links, attachments,
138 correspondences, and side-effects.
139 \end{notate}
141 \begin{notate}{The idea} \label{theoretical-context}
142 A scholia-based document model for commons-based peer
143 production will inform the development of our
144 system.\footnote{{\tt
145 http://www.metascholar.org/events/2005/freeculture/viewabstract.php?id=19
146 % alternate:
147 % http://br.endernet.org/~akrowne/planetmath/papers/corneli\_fcdl/corneli-krowne.pdf
148 \label{corneli-krowne}
150 In this model, texts are made up of smaller texts until
151 you get to atomic texts; user actions are built in the
152 same way. Multiple users should interact with a shared
153 persistent data-store, through functional annotation, not
154 destructive modification. We should pursue the
155 asynchronous interaction model until we arrive at live,
156 synchronous, settings, where we facilitate real-time
157 computer-mediated interactions between users, and between
158 users and running hackable programs.
159 \end{notate}
161 \begin{notate}{The data model} \label{data-model}
162 Start by storing a collection of \emph{strings}. Now add
163 in \emph{pairs} and \emph{triples} which point at 2 and 3
164 objects respectively. (We can extend to n-tuples if that
165 turns out to be convenient.) Finally, we will maintain a
166 collection of \emph{lists}, each of which points at an
167 unlimited number of objects.
168 \end{notate}
170 \begin{notate}{History}
171 Thinking about how to improve existing systems for
172 peer-based collaboration in 2004, I designed a simple
173 version of the scholium system that treated textual
174 commentary and markup as scholia.\footnote{{\tt
175 http://wiki.planetmath.org/AsteroidMeta/old\_draft\_of\_scholium\_system}}
176 In 2006, I put together a single-user version of this
177 system that ran exclusively under Emacs.\footnote{{\tt
178 http://metameso.org/files/sbdm4cbpp.tex} \label{old-version}}
179 The current system is an almost-completely rewritten
180 variant, bringing in a shared database and various other
181 enhancements to support multi-user interaction.
182 \end{notate}
184 \begin{notate}{A brisk review of the programming literature} \label{prog-lit-review}
185 Many years before I started working on this project, there
186 was something called the Emacs HyperText
187 System.\footnote{{\tt
188 http://www.aue.aau.dk/\~{}kock/Publications/HyperBase/}}
189 What we're doing here updates for modern database methods,
190 uses a more interesting data storage format, and also
191 considers multiple front-ends to the same database (for
192 example, a web interface).
194 Contemporary Emacs-based hypertext creation systems
195 include Muse and Emacs Wiki.\footnote{{\tt
196 http://mwolson.org/projects/EmacsMuse.html}}$^,$\footnote{{\tt
197 http://mwolson.org/projects/EmacsWiki.html}} The
198 browsing side features old standbys, Info and
199 Emacs/w3m\footnote{Not to be confused with Emacs-w3m,
200 which is not entirely ``Emacs-based''.}. These packages
201 provide ways to author or view what what we should now
202 call ``traditional'' hypertext documents.
204 An another legacy tool worth mentioning is
205 HyperCard\footnote{{\tt
206 http://en.wikipedia.org/wiki/HyperCard}}. This system
207 was oriented around the idea of using hypertext to create
208 software, a vision we share, but like just about everyone
209 else working in the field at the time, it used
210 uni-directional links.
212 Hypertext \emph{nouveau} is based on semantic triples.
213 The Semantic Web standard provides one specification of
214 the features we can expect from triples.\footnote{{\tt
215 http://www.w3.org/TR/2004/REC-rdf-primer-20040210/}}
216 Triples provide a framework for knowledge representation
217 with more depth and flexibility than the popular
218 ``tagging'' methodology. For example, suitable
219 collections of triples implement AI-style ``frames''. The
220 idea of using triples to organize archival material is
221 generating some interest as Semantic Web ideas
222 spread.\footnote{Cf. recent museum and library
223 conferences}$^,$\footnote{Even among academic computer
224 scientists! (Josh Grochow, p.c.)}
226 An abstractly similar project to Arxana with some grand
227 goals is being developed by Chris Hanson at MIT under the
228 name ``Web-scale Environments for Deduction
229 Systems''.\footnote{{\tt
230 http://publications.csail.mit.edu/abstracts/abstracts07/cph2/cph2.html}}
232 Another technically similar project is Freebase, a hand
233 rolled database of open content, organized on frame-based,
234 triple driven, principles. The developer of the Freebase
235 graphd database has some interesting things to say about
236 old and new ways of handling triples.\footnote{{\tt
237 http://blog.freebase.com/2008/04/09/a-brief-tour-of-graphd/}}
238 \end{notate}
240 \begin{notate}{Fitting in}
241 My current development goal is to use this system to
242 create a more flexible multiuser interaction platform than
243 those currently available to web-based collaborative
244 projects (such as PlanetMath\footnote{{\tt
245 http://planetmath.org}}). As an intermediate stage,
246 I'm using Arxana to help organize material for a book I'm
247 writing. Arxana's theoretical generality, active
248 development status, detailed documentation, and
249 superlatively liberal terms of use may make it an
250 attractive option for you to try as well!
251 \end{notate}
253 \begin{notate}{What you get}
254 Arxana has an Emacs frontend, a Common Lisp middle-end,
255 and a SQL backend. If you want to do some work, any one
256 of these components can be swapped out and replaced with
257 the engine of your choice. I've released all of the
258 implementation work on this system into the public domain,
259 and it runs on an entirely free/libre/open source software
260 platform.
261 \end{notate}
263 \begin{notate}{Acknowledgements}
264 Ted Nelson's ``Literary Machines'' and Marvin Minsky's
265 ``Society of Mind'' are cornerstones in the historical and
266 social contextualization of this work. Alfred Korzybski's
267 ``Science and Sanity'' and Gilles Deleuze's ``The Logic of
268 Sense'' provided grounding and encouragement. \TeX\ and
269 GNU Emacs have been useful not just in prototyping this
270 system, but also as exemplary projects in the genre I'm
271 aiming for. John McCarthy's Elephant 2000 was an
272 inspiring thing to look at and think about\footnote{{\tt
273 http://www-formal.stanford.edu/jmc/elephant/elephant.html}}, and of course Lisp has been a vital ingredient.
275 Thanks also to everyone who's talked about this project
276 with me!
277 \end{notate}
279 \section{Using the program}
281 \begin{notate}{Dependencies} \label{dependencies}
282 Our interface is embedded in Emacs. Backend processing is
283 done with Common Lisp. We are currently using the
284 PostgreSQL database. These packages should be available
285 to you through the usual channels. (I've been using SBCL,
286 but any Lisp should do; please make sure you are using a
287 contemporary Emacs version.)
289 We will connect Emacs to Lisp via Slime\footnote{{\tt
290 http://common-lisp.net/project/slime/}}, and Lisp to
291 PostgreSQL via CLSQL.\footnote{{\tt http://clsql.b9.com/}}
292 CLSQL also talks directly to the Sphinx search engine,
293 which we use for text-based search.\footnote{{\tt
294 http://www.sphinxsearch.com/}} Once all of these
295 things are installed and working together, you should be
296 able to begin to use Arxana.
298 Setting up all of these packages can be a somewhat
299 time-consuming and confusing task, especially if you
300 haven't done it before! See Appendix \ref{appendix-setup}
301 for help.
302 \end{notate}
304 \begin{notate}{Export code and set up the interface}
305 If you are looking at the source version of this document
306 in Emacs, evaluate the following s-expression (type
307 \emph{C-x C-e} with the cursor positioned just after its
308 final parenthesis). This exports the Common Lisp
309 components of the program to suitable files for subsequent
310 use, and prepares the Emacs environment. (The code that
311 does this is in Appendix \ref{appendix-lit}.)
312 \end{notate}
314 \begin{idea}
315 (save-excursion
316 (let ((beg (search-forward "\\begin{verbatim}"))
317 (end (progn (search-forward "\\end{verbatim}")
318 (match-beginning 0))))
319 (eval-region beg end)
320 (lit-process)))
321 \end{idea}
323 \begin{notate}{To load Common Lisp components at run-time} \label{load-at-runtime}
324 Link {\tt arxana.asd} somewhere where Lisp can find it.
325 Then run commands like these in your Lisp; if you like,
326 you can place all of this stuff in your config file to
327 automatically load Arxana when Lisp starts. The final
328 form is only necessary if you plan to use CLSQL's special
329 syntax on the Lisp command-line.
330 \end{notate}
332 \begin{idea}
333 (asdf:operate 'asdf:load-op 'clsql)
334 (asdf:operate 'asdf:load-op 'arxana)
335 (in-package arxana)
336 (connect-to-database)
337 (locally-enable-sql-reader-syntax)
338 \end{idea}
340 \begin{notate}{To connect Emacs to Lisp}
341 Either run {\tt M-x slime RET} to start and connect to
342 Lisp locally, or {\tt M-x slime-connect RET RET} after you
343 have opened a remote connection to your remote server with
344 a command like this: {\tt ssh -L 4005:127.0.0.1:4005
345 <username>@<host>} and started Lisp and the Swank server
346 on the remote machine. To have Swank start automatically
347 when you start Lisp, put commands like this in your config
348 file.
349 \end{notate}
351 \begin{idea}
352 (asdf:operate 'asdf:load-op 'swank)
353 (setf swank:*use-dedicated-output-stream* nil)
354 (setf swank:*communication-style* :fd-handler)
355 (swank:create-server :dont-close t)
356 \end{idea}
358 \begin{notate}{To define database structures}
359 If you haven't yet defined the basic database structures,
360 make sure to load them now! (Using {\tt tabledefs.lisp},
361 or the SQL code in Section \ref{sql-code})
362 \end{notate}
364 \begin{notate}{Importing this document into system}
365 You can browse this document inside Arxana: after loading
366 the code, run \emph{M-x autoimport-arxana}.
367 \end{notate}
369 %%%% START OF BACKEND
370 \input{arxana-reboot-backend}
371 %%% END OF BACKEND
373 \section{Emacs-side} \label{emacs-side}
375 \subsection{The interface to Common Lisp}
377 \begin{notate}{On `Defun'} \label{defun-interface}
378 A way to define Elisp functions whose bodies are evaluated
379 by Common Lisp. Trust me, this is a good idea. Besides,
380 it exhibits some facinating backquote and comma tricks.
381 But be careful: this definition of `Defun' did not work on
382 Emacs version 21.
384 If we want to be able to feed in a standard arglist to
385 Common Lisp (with optional elements and so forth), we'd
386 have define how these arguments are handled here!
387 \end{notate}
389 \begin{elisp}
390 (defmacro Defun (name arglist &rest body)
391 (declare (indent defun))
392 `(defun ,name ,arglist
393 (let* ((outbound-string
394 (translate-emacs-syntax-to-common-syntax
395 (format "%S"
396 (append
397 (list
398 (append (list 'lambda ',arglist)
399 ',body))
400 (mapcar
401 (lambda (arg) `',arg)
402 (list
403 ,@(remove-if
404 (lambda (testelt)
405 (eq testelt
406 '&optional))
407 arglist)))))))
408 (returned-string
409 (second
410 ;; we now specify the right package!
411 (slime-eval
412 (list 'swank:eval-and-grab-output
413 outbound-string)
414 :arxana))))
415 (process-slime-output returned-string))))
416 \end{elisp}
418 \begin{notate}{On `process-slime-output'}
419 This should downcase all constituent symbols, but for
420 expediency I'm just downcasing `NIL' at the moment. Will
421 come back for more testing and downcasing shortly. (I
422 suspect the general case is just about as easy as what
423 happens here.)
424 \end{notate}
426 \begin{elisp}
427 (defun process-slime-output (str)
428 (condition-case nil
429 (let ((read-value (read str)))
430 (if (symbolp read-value)
431 (read (downcase str)))
432 (nsubst nil 'NIL read-value))
433 (error str)))
434 \end{elisp}
436 \begin{elisp}
437 (defun translate-emacs-syntax-to-common-syntax (str)
438 (with-temp-buffer
439 (insert str)
440 (dolist (swap '(("(\\` " "`")
441 ("(\\\, " ",")))
442 (goto-char (point-min))
443 (while (search-forward (first swap) nil t)
444 (goto-char (match-beginning 0))
445 (forward-sexp)
446 (delete-char -1)
447 (goto-char (match-beginning 0))
448 (delete-region (match-beginning 0)
449 (match-end 0))
450 (insert (second swap))))
451 (buffer-substring-no-properties (point-min)
452 (point-max))))
453 \end{elisp}
455 \begin{notate}{Interactive `Defun'}
456 Note, an improved version of this macro would allow me to
457 specify that some Defuns are interactive and some are not.
458 This could be done by examining the submitted body, and
459 adjusting the defun if its car is an `interactive' form.
460 Most of the Defuns will be things that people will want to
461 use interactively, so making this change would probably be
462 a good idea. What I'm doing in the mean time is just
463 writing 2 functions each time I need to make an
464 interactive function that accesses Common Lisp data!
465 \end{notate}
467 \begin{notate}{Common Lisp evaluation of code chunks}
468 Another potentially beneficial and simple approach is to
469 write a form like `progn' that evaluates its contents on
470 Common Lisp. This saves us from having to rewrite all of
471 the `defun' facilities into `Defun' (e.g. interactivity).
472 But... the problem with \emph{this} is that Common Lisp
473 doesn't know the names of all the variables that are
474 defined in Emacs! I'm not sure how to get all of the
475 values of these variable substituted \emph{first}, before
476 the call to Common Lisp is made.
477 \end{notate}
479 \begin{notate}{Debugging `Defun'}
480 In order to make debugging go easier, it might be nice to
481 have an option to make the code that is supposed to be
482 evaluated by Defun actually \emph{print} on the REPL
483 instead of being processed through an invisible back-end.
484 There could be a couple of different ways to do that, one
485 would be to simulate just what a user might do, the other
486 would be a happy medium between that and what we're doing
487 now: just put our computery auto-generated code on the
488 REPL and evaluate it. (To some extent, I think the
489 *slime-events* buffer captures this information, but it is
490 not particularly easy to read.)
491 \end{notate}
493 \begin{notate}{Interactive Common Lisp?}
494 Suppose we set up some kind of interactive environment in
495 Common Lisp; how would we go about passing this
496 environment along to a user interacting via Emacs? (Note
497 that SLIME's presentation of the debugging loop is one
498 good example.)
499 \end{notate}
501 \subsection{Database interaction} \label{interaction}
503 \begin{notate}{The `article' function} \label{the-article-function}
504 You can use this function to create an article with a
505 given name and contents. If you like you can put it in a
506 list.
507 \end{notate}
509 \begin{elisp}
510 (Defun article (name contents &optional heading)
511 (let ((coordinates (add-triple name
512 "has content"
513 contents)))
514 (when theory (add-triple coordinates "in" heading))
515 (when place (if (numberp place)
516 (put-in-place coordinates place)
517 (put-in-place coordinates)))
518 coordinates))
519 \end{elisp}
521 \begin{notate}{The `scholium' function} \label{the-scholium-function}
522 You can use this function to link annotations to objects.
523 As with the `article' function, you can optionally
524 categorize the connection on a given list (cf. Note
525 \ref{the-article-function}).
526 \end{notate}
528 \begin{elisp}
529 (Defun scholium (beginning link end &optional heading)
530 (let ((coordinates (add-triple beginning
531 link
532 end)))
533 (when list (add-triple coordinates "in" heading))
534 (when place (if (numberp place)
535 (put-in-place coordinates place)
536 (put-in-place coordinates)))
537 coordinates))
538 \end{elisp}
540 \begin{notate}{Uses of coordinates}
541 Note that, if desired, you can feed input of the form
542 '(\meta{code} \meta{ref}) into `article' and `scholium'.
543 It's convenient to do further any processing of the object
544 we've created, while we still have ahold of the coordinates
545 returned by `add-triple' (cf. Note
546 \ref{import-code-continuations} for an example).
547 \end{notate}
549 \begin{notate}{Finding all the members of a list by type?}
550 We just narrow according to type.
551 \end{notate}
553 \begin{notate}{On `get-article'} \label{get-article}
554 Get the contents of the article named `name'. Optional
555 argument `list' lets us find and use the position on the
556 given list that holds the name, and use that instead of
557 the name itself.
559 We do not yet deal well with the ambiguous case in which
560 there are several positions that correspond to the given
561 name that appear on the same list.
563 Note also that out of the data returned by
564 `triples-given-beginning-and-middle', we should pick the
565 (hopefully just) ONE that corresponds to the given list.
567 This means we need to pick over the list of triples
568 returned here, and test each one to see if it is in our
569 heading. As to WHY there might be more than one ``has
570 content'' for a place that we know to be in our
571 heading... I'm not sure. I guess we can go with the
572 assumption that there is just one, for now.
573 \end{notate}
575 \begin{elisp}
576 (Defun get-article (name &optional heading)
577 (let* ((place-pseudonyms
578 (if heading
579 (get-places-subject-to-constraint
580 name `(nil "in" ,heading))
581 (get-places name)))
582 (goes-by (cond
583 ((eq (length place-pseudonyms) 1)
584 `(1 ,(car place-pseudonyms)))
585 ((triple-exact-match
586 name "in" heading)
587 name)
588 ((not heading) name)
589 (t nil))))
590 (when goes-by
591 ;; it might be nice to also return `goes-by'
592 ;; so we can access the appropriate place again.
593 (third (print-triple
594 (resolve-ambiguity
595 (triples-given-beginning-and-middle
596 goes-by "has content"))
597 t)))))
598 \end{elisp}
600 \begin{notate}{On `get-names'} \label{get-names}
601 This function simply gets the names of articles that have
602 names -- in other words, every triple built around the
603 ``has content'' relation.
604 \end{notate}
606 \begin{elisp}
607 (Defun get-names (&optional heading)
608 (let ((conditions (list (list nil "has content" t))))
609 (when heading
610 (setq conditions
611 (append conditions
612 (list (list nil "in" heading)))))
613 (mapcar
614 (lambda (place-or-string)
615 (cond
616 ;; place case
617 ((eq (first place-or-string) 1)
618 (print-system-object
619 (place-lookup (second place-or-string))))
620 ;; string case
621 ((eq (first place-or-string) 0)
622 (print-system-object place-or-string))))
623 (mapcar
624 (lambda (triple)
625 (isolate-beginning triple))
626 (satisfy-conditions conditions)))))
627 \end{elisp}
629 \begin{notate}{Contrasting cases} \label{contrasting-cases}
630 Consider the difference between
631 \begin{quote}
632 (? ``has author'' ``Arthur C. Clarke'') \\
633 (? ``has genre'' ``fiction'')
634 \end{quote}
636 \begin{quote}
637 (\emph{name} ``has content'' *) \\
638 (\emph{name} ``in'' ``heading'')
639 \end{quote}
640 where, in the latter case, we know \emph{who} we're
641 talking about, and we just want to limit the list of items
642 generated by the ``*'' by the second condition. This
643 should help illustrate the difference between `get-names'
644 (which is making a general query) and `get-article' (which
645 already knows the name of a specific article), and the
646 logic that they use.
647 \end{notate}
649 \begin{notate}{Placing items from Emacs} \label{place-item}
650 We periodically need to place items from within Emacs.
651 The function `place-item' is a wrapper for `put-in-place'
652 that makes this possible (it also provides the user with
653 an extra option, namely to put the place itself under a
654 given heading).
656 Notice that when the symbol is placed in some pre-existing
657 place (which can only happen when `id' is not nil), that
658 place may already be under some other heading. We will ignore
659 this case for now (since it seems that putting objects
660 into \emph{new} places will be the preferred action), but
661 later we will have to look at what to do in this other
662 case.
663 \end{notate}
665 \begin{elisp}
666 (Defun place-item (symbol &optional id heading)
667 (let ((coordinates (put-in-place symbol id)))
668 (when heading (add-triple coordinates "in" heading))
669 coordinates))
670 \end{elisp}
672 \begin{notate}{Automatic classifications} \label{classifications}
673 It will presumably make sense to offer increasingly
674 ``automatic'' classifications for new objects. At this
675 point, we've set things up so that the user can optionally
676 supply the name of \emph{one} heading that their new object
677 is a part of.
679 It may make more sense to allow an `\&rest theories'
680 argument, and add the triple to all of the specified
681 theories. This would require modifying `Defun' to
682 accommodate the `\&rest' idiom; see Note
683 \ref{defun-interface}.
684 \end{notate}
686 \begin{notate}{Postconditions and provenance}
687 After adding something to the database, we may want to do
688 something extra; perhaps generating provenance
689 information, perhaps checking or enforcing database
690 consistency, or perhaps running a hook that causes some
691 update in the frontend (cf. Note \ref{provenance}).
692 Provisions of this sort will come later, as will
693 short-hand convenience functions for making particularly
694 common complex entries.
695 \end{notate}
697 \subsection{Importing \LaTeX\ documents} \label{importing}
699 \begin{notate}{Importing sketch} \label{importing-sketch}
700 The code in this section imports a document as a
701 collection of (sub-)sections and notes. It gathers the
702 sections, sub-sections, and notes recursively and records
703 their content in a tree whose nodes are places (Note
704 \ref{places}) and whose links express the ``component-of''
705 relation described in Note \ref{order-of-order}.
707 This representation lets us see the geometric,
708 hierarchical, structure of the document we've imported.
709 It exemplifies a general principle, that geometric data
710 should be represented by relationships between places, not
711 direct relationships between strings. This is because
712 ``the same'' string often appears in ``different'' places
713 in any given document (e.g. a paper's many sub-sections
714 titled ``Introduction'' will not all have the same
715 content).
717 What goes into the places is in some sense arbitrary. The
718 key is that whatever is \emph{in} or \emph{attached} to
719 these places must tell us everything we need to know about
720 the part of the document associated with that place
721 (e.g. in the case of a note, its title and contents).
722 That's over and above the \emph{structural} links which
723 say how the places relate to one another. Finally, all of
724 these places and structural links will be added to a
725 heading that represents the document as a whole.
727 A natural convention we'll use will be to put the name
728 of any document component that's associated with a given
729 place into that place, and add all other information as
730 annotations.
731 \end{notate}
733 \begin{notate}{Ordered versus unordered data} \label{ordered-vs-unordered}
734 The code in this section is an example of one way to work
735 with ordered data (i.e. \LaTeX\ documents are not just
736 hierarchical, but the elements at each level of the
737 hierarchy are also ordered).
739 Since \emph{many} artifacts are hierachical (e.g. Lisp
740 code), we should try to be compatible with \emph{native}
741 methods for working with order (in the case of Lisp, feed
742 the code into a Lisp processor and use CDR and CAR, etc.).
744 We \emph{can} use triples such as (``rank'' ``1''
745 ``Fred'') and (``rank'' ``2'' ``Barney'') to talk about
746 order. There may be some SQL techniques that would help.
747 (FYI, order can be handled very explicitly in Elephant!)
749 In order to account for \emph{different} orderings, we
750 need one more piece of data -- some explicit treatment of
751 where the order \emph{is}; in other words, theories.
752 (This table illustrates the fact that a heading is not so
753 different from ``an additional triple''; indeed, the only
754 reason to make them different is to have the extra
755 convenience of having their elements be numbered.)
757 \begin{center}
758 \begin{tabular}{|lll|l|}
759 \hline
760 rank & 1 & Fred & Friday \\
761 rank & 2 & Barney & Friday \\
762 rank & 1 & Barney & Saturday \\
763 rank & 2 & Fred & Saturday \\
764 \hline
765 \end{tabular}
766 \end{center}
767 \end{notate}
769 \begin{notate}{The order of order} \label{order-of-order}
770 The triples (``rank'' ``1'' ``Fred'') and (``rank'' ``2''
771 ``Barney'') mentioned in Note \ref{ordered-vs-unordered}
772 are easy enough to read and understand; it might be more
773 natural in some ways for us to say (``Fred'' ``rank''
774 ``1'') -- Fred has rank 1. In this section, we're
775 concerned with talking about the ordered parts of a
776 document, and ($A$ $n$ $B$) seems like an intuitive way to
777 say ``$A$'s $n$th component is $B$''.
778 \end{notate}
780 \begin{notate}{It's not overdoing it, right?}
781 When importing \emph{this} document, we see links like the
782 following. I hope that's not ``overdoing it''. (Take a
783 look at Note \ref{get-article} and Note \ref{get-names} to
784 see how we go about getting information out of the
785 database.) We could get rid of one link if theories were
786 database objects (cf. Note
787 \ref{theories-as-database-objects}).
788 \end{notate}
790 \begin{idea}
791 "T557[P135|Web interface|.in.arxana.tex]"
792 "T558[Future plans.9.P135|Web interface|]"
793 "T559[T558[Future plans.9.P135|Web interface|].in.arxana.tex]"
794 \end{idea}
796 \begin{notate}{Importing in general} \label{importing-generally}
797 We will eventually have a collection of parsers to get
798 various kinds of documents into the system in various
799 different ways (Note \ref{parsing}). For now, this
800 section gives a simple way to get some sorts of
801 \LaTeX\ documents into the system, namely documents
802 structured along the same lines as the document you're
803 reading now!
805 An interesting approach to parsing \emph{math} documents
806 has been undertaken in the \LaTeX ML
807 project.\footnote{{\tt http://dlmf.nist.gov/LaTeXML/}}
808 Eventually it would be nice to get that level of detail
809 here, too! Emacsspeak is another example of a
810 \LaTeX\ parser that deals with large-scale textual
811 structures as well as smaller bits and
812 pieces.\footnote{{\tt
813 http://www.cs.cornell.edu/home/raman/aster/aster-thesis.ps}}
815 It would probably be useful to put together some parsers
816 for HTML and wiki code soon.
817 \end{notate}
819 \begin{notate}{On `import-buffer'}
820 This function imports \LaTeX\ documents, taking care of
821 the non-recursive aspects of this operation. It imports
822 frontmatter (everything up to the first
823 \verb+\begin{section}+), but assumes ``backmatter'' is
824 trivial, and does not import it. The imported material is
825 classified as a ``document'' with the same name as the
826 imported buffer.
827 \end{notate}
829 \begin{elisp}
830 (defun import-buffer (&optional buffername)
831 (save-excursion
832 (set-buffer (get-buffer (or buffername
833 (current-buffer))))
834 (goto-char (point-min))
835 (search-forward-regexp "\\\\begin{document}")
836 (search-forward-regexp "\\\\section")
837 (goto-char (match-beginning 0))
838 ;; other links will be made in the "heading of this
839 ;; document", but here we make a broader assertion.
840 (scholium buffername "is a" "document")
841 (scholium buffername
842 "has frontmatter"
843 (buffer-substring-no-properties
844 (point-min)
845 (point))
846 buffername)
847 ;;; These should maybe be scholia attached to
848 ;; root-coords (below), but for some reason that
849 ;; wasn't working so well -- investigate later --
850 ;; maybe it just wasn't good to run after running
851 ;; `import-within'.
852 (let* ((root-coords (place-item buffername nil
853 buffername))
854 (levels
855 '("section" "subsection" "subsubsection"))
856 (current-parent buffername)
857 (level-end nil)
858 (sections (import-within levels))
859 (index 0))
860 (while sections
861 (let ((coords (car sections)))
862 (setq index (1+ index))
863 (scholium root-coords
864 index
865 coords
866 buffername))
867 (setq sections (cdr sections))))))
868 \end{elisp}
870 \begin{notate}{On `import-within'}
871 Recurse through levels of sectioning to import
872 \LaTeX\ code.
874 It would be good if we could do something about sections
875 that contain neither subsections nor notes (for example, a
876 preface), or, more generally, about text that is not
877 contained in any environment (possibly that appears before
878 any section). We'll save things like this for another
879 editing round!
881 For the moment, we've decided to build the document
882 hierarchy with links that are blind to whether the $k$th
883 component of a section is a note or a subsection.
884 Children that are notes are attached in the subroutine
885 `import-notes' and those that are sections are attached in
886 `import-within'. Users can find out what type of object
887 they are looking at based on whether or not it ``has
888 content''.
890 Incidentally, when looking for the end of an importing
891 level, `nil' is an OK result -- if this is the \emph{last}
892 section at this level \emph{and} there is no subsequent
893 section at a higher level.
894 \end{notate}
896 \begin{elisp}
897 (defun import-within (levels)
898 (let ((this-level (car levels))
899 (next-level (car (cdr levels))) answer)
900 (while (re-search-forward
901 (concat
902 "^\\\\" this-level "{\\([^}\n]*\\)}"
903 "\\( +\\\\label{\\)?"
904 "\\([^}\n]*\\)?")
905 level-end t)
906 (let* ((name (match-string-no-properties 1))
907 (at (place-item name nil buffername))
908 (level-end
909 (or (save-excursion
910 (search-forward-regexp
911 (concat "^\\\\" this-level "{.*")
912 level-end t))
913 level-end))
914 (notes-end
915 (if next-level
916 (or (progn (point)
917 (save-excursion
918 (search-forward-regexp
919 (concat "^\\\\"
920 next-level "{.*")
921 level-end t)))
922 level-end)
923 level-end))
924 (index (let ((current-parent at))
925 (import-notes notes-end)))
926 (subsections (let ((current-parent at))
927 (import-within (cdr levels)))))
928 (while subsections
929 (let ((coords (car subsections)))
930 (setq index (1+ index))
931 (scholium at
932 index
933 coords
934 buffername)
935 (setq subsections (cdr subsections))))
936 (setq answer (cons at answer))))
937 (reverse answer)))
938 \end{elisp}
940 \begin{notate}{On `import-notes'} \label{import-notes}
941 We're going to make the daring assumption that the
942 ``textual'' portions of incoming \LaTeX\ documents are
943 contained in ``Notes''. That assumption is true, at
944 least, for the current document. The function returns the
945 count of the number of notes imported, so that
946 `import-within' knows where to start counting this
947 section's non-note children.
949 Would this same function work to import all notes from a
950 buffer without examining its sectioning structure? Not
951 quite, but close! (Could be a fun exercise to fix this.)
952 \end{notate}
954 \begin{elisp}
955 (defun import-notes (end)
956 (let ((index 0))
957 (while (re-search-forward (concat "\\\\begin{notate}"
958 "{\\([^}\n]*\\)}"
959 "\\( +\\\\label{\\)?"
960 "\\([^}\n]*\\)?")
961 end t)
962 (let* ((name
963 (match-string-no-properties 1))
964 (tag (match-string-no-properties 3))
965 (beg
966 (progn (next-line 1)
967 (line-beginning-position)))
968 (end
969 (progn (search-forward-regexp
970 "\\\\end{notate}")
971 (match-beginning 0)))
972 (coords (place-item name nil buffername)))
973 (setq index (1+ index))
974 (scholium current-parent
975 index
976 coords
977 buffername)
978 ;; not in the heading
979 (scholium coords
980 "has content"
981 (buffer-substring-no-properties
982 beg end))
983 (import-code-continuations coords)))
984 index))
985 \end{elisp}
987 \begin{notate}{On `import-code-continuations'} \label{import-code-continuations}
988 This runs within the scope of `import-notes', to turn the
989 series of Lisp chunks or other code snippets that follow a
990 given note into a scholium attached to that note. Each
991 separate snippet becomes its own annotation.
993 The ``conditional regexps'' used here only work with Emacs
994 version 23 or higher.
996 I'm noticing a problem with the way the `looking-at'
997 form behaves. It matches the expression in question,
998 but then the match-end is reported as one character
999 less than it supposed to be. Maybe `looking-at' is
1000 just not as good as `re-search-forward'? But it's
1001 what seems easiest to use.
1002 \end{notate}
1004 \begin{elisp}
1005 (defun import-code-continuations (coords)
1006 (let ((possible-environments
1007 "\\(1?:lisp\\|idea\\|common\\)"))
1008 (while (looking-at
1009 (concat "\n*?\\\\begin{"
1010 possible-environments
1011 "}"))
1012 (let* ((beg (match-end 0))
1013 (environment (match-string 1))
1014 (end (progn (search-forward-regexp
1015 (concat "\\\\end{"
1016 environment
1017 "}"))
1018 (match-beginning 0)))
1019 (content (buffer-substring-no-properties
1021 end)))
1022 (scholium (scholium coords
1023 "has attachment"
1024 content)
1025 "has type"
1026 environment)))))
1027 \end{elisp}
1029 \begin{notate}{On `autoimport-arxana'} \label{autoimport-arxana}
1030 This just calls `import-buffer', and imports this document
1031 into the system.
1032 \end{notate}
1034 \begin{elisp}
1035 (defun autoimport-arxana ()
1036 (interactive)
1037 (import-buffer "arxana.tex"))
1038 \end{elisp}
1040 \begin{notate}{Importing textual links}
1041 Of course, it would be good to import the links that users
1042 make between articles, since then we can quickly navigate
1043 from an article to the various articles that cite that
1044 article, as well as follow the usual forward-directional
1045 links. Indeed, we should be able to browse each article
1046 within a ``neighborhood'' of other related articles.
1047 (We'll need to import labels as well, of course.)
1048 \end{notate}
1050 \subsection{Browsing database contents} \label{browsing}
1052 \begin{notate}{Browsing sketch} \label{browsing-sketch}
1053 This section facilitates browsing of documents represented
1054 with structures like those created in Section
1055 \ref{importing}, and sets the ground for browsing other
1056 sorts of contents (e.g. collections of tasks, as in
1057 Section \ref{managing-tasks}).
1059 In order to facilitate general browsing, it is not enough
1060 to simply use `get-article' (Note \ref{get-article}) and
1061 `get-names' (Note \ref{get-names}), although these
1062 functions provide our defaults. We must provide the means
1063 to find and display different things differently -- for
1064 example, a section's table of contents will typically
1065 be displayed differently from its actual contents.
1067 Indeed, the ability to display and select elements of
1068 document sections (Note \ref{display-section}) is
1069 basically the core browsing deliverable. In the process
1070 we develop a re-usable article selector (Note
1071 \ref{selector}; cf. Note \ref{browsing-tasks}). This in
1072 turn relies on a flexible function for displaying
1073 different kinds of articles (Note \ref{display-article}).
1074 \end{notate}
1076 \begin{notate}{On `display-article'} \label{display-article}
1077 This function takes in the name of the article to display.
1078 Furthermore, it takes optional arguments `retriever' and
1079 `formatter', which tell it how to look up and/or format
1080 the information for display, respectively.
1082 Thus, either we make some statement up front (choosing our
1083 `formatter' based on what we already know about the
1084 article), or we decide what to display after making some
1085 investigation of information attached to the article, some
1086 of which may be retrieved and displayed (this requires
1087 that we specify a suitable `retriever' and a complementary
1088 `formatter').
1090 For example, the major mode in which to display the
1091 article's contents could be stored as a scholium attached
1092 to the article; or we might maintain some information
1093 about ``areas'' of the database that would tell us up
1094 front what which mode is associated with the current area.
1095 (The default is to simply insert the data with no markup
1096 whatsoever.)
1098 Observe that this works when no heading argument is given,
1099 because in that case `get-article' looks for \emph{all}
1100 place pseudonyms. (But of course that won't work well
1101 when we have multiple theories containing things with the
1102 same names, so we should get used to using the heading
1103 argument.)
1105 (The business about requiring the data to be a sequence
1106 before engaging in further formatting is, of course, just
1107 a matter of expediency for making things work with the
1108 current dataset.)
1109 \end{notate}
1111 \begin{elisp}
1112 (defun display-article
1113 (name &optional heading retriever formatter)
1114 (interactive "Mname: ")
1115 (let* ((data (if retriever
1116 (funcall retriever name heading)
1117 (get-article name heading))))
1118 (when (and data (sequencep data))
1119 (save-excursion
1120 (if formatter
1121 (funcall formatter data heading)
1122 (pop-to-buffer (get-buffer-create
1123 "*Arxana Display*"))
1124 (delete-region (point-min) (point-max))
1125 (insert "NAME: " name "\n\n")
1126 (insert data)
1127 (goto-char (point-min)))))))
1128 \end{elisp}
1130 \begin{notate}{An interactive article selector} \label{selector}
1131 The function `get-names' (Note \ref{get-names}) and
1132 similar functions can give us a collection of articles.
1133 The next few functions provide an interactive
1134 functionality for moving through this collection to find
1135 the article we want to look at.
1137 We define a ``display style'' that the article selector
1138 uses to determine how to display various articles. These
1139 display styles are specified by text properties attached
1140 to each option the selector provides. Similarly, when
1141 we're working within a given heading, the relevant heading
1142 is also specified as a text property.
1144 At selection time, these text properties are checked to
1145 determine which information to pass along to
1146 `display-article'.
1147 \end{notate}
1149 \begin{elisp}
1150 (defvar display-style '((nil . (nil nil))))
1152 (defun thing-name-at-point ()
1153 (buffer-substring-no-properties
1154 (line-beginning-position)
1155 (line-end-position)))
1157 (defun get-display-type ()
1158 (get-text-property (line-beginning-position)
1159 'arxana-display-type))
1161 (defun get-relevant-heading ()
1162 (get-text-property (line-beginning-position)
1163 'arxana-relevant-heading))
1165 (defun arxana-list-select ()
1166 (interactive)
1167 (apply 'display-article
1168 (thing-name-at-point)
1169 (get-relevant-heading)
1170 (cdr (assoc (get-display-type)
1171 display-style))))
1173 (define-derived-mode arxana-list-mode fundamental-mode
1174 "arxana-list" "Arxana List Mode.
1176 \\{arxana-list-mode-map}")
1178 (define-key arxana-list-mode-map (kbd "RET")
1179 'arxana-list-select)
1180 \end{elisp}
1182 \begin{notate}{On `pick-a-name'} \label{pick-a-name}
1183 Here `generate' is the name of a function to call to
1184 generate a list of items to display, and `format' is a
1185 function to put these items (including any mark-up) into
1186 the buffer from which individiual items can then be
1187 selected.
1189 One simple way to get a list of names to display would be
1190 to reuse a list that we had already produced (this would
1191 save querying the database each time). We could, in fact,
1192 store a history list of lists of names that had been
1193 displayed previously (cf. Note \ref{local-storage}).
1195 We'll eventually want versions of `generate' that provide
1196 various useful views into the data, e.g., listing all of
1197 the elements of a given section (Note
1198 \ref{display-section}).
1200 Finding all the elements that match a given search term,
1201 whether that's just normal text search or some kind of
1202 structured search would be worthwhile too. Upgrading the
1203 display to e.g. color-code listed elements according to
1204 their type would be another nice feature to add.
1205 \end{notate}
1207 \begin{elisp}
1208 (defun pick-a-name (&optional generate format heading)
1209 (interactive)
1210 (let ((items (if generate
1211 (funcall generate)
1212 (get-names heading))))
1213 (when items
1214 (set-buffer (get-buffer-create "*Arxana Articles*"))
1215 (toggle-read-only -1)
1216 (delete-region (point-min)
1217 (point-max))
1218 (if format
1219 (funcall format items)
1220 (mapc (lambda (item) (insert item "\n")) items))
1221 (toggle-read-only t)
1222 (arxana-list-mode)
1223 (goto-char (point-min))
1224 (pop-to-buffer (get-buffer "*Arxana Articles*")))))
1225 \end{elisp}
1227 \begin{notate}{On `display-section'} \label{display-section}
1228 When browsing a document, if you select a section, you
1229 should display a list of that section's constituent
1230 elements, be they notes or subsections. The question
1231 comes up: when you go to display something, how do you
1232 know whether you're looking at the name of a section, or
1233 the name of an article?
1235 When you get the section's contents out of the database
1236 (Note \ref{get-section-contents})
1237 \end{notate}
1239 \begin{elisp}
1240 (defun display-section (name heading)
1241 (interactive (list (read-string
1242 (concat
1243 "name (default "
1244 (buffer-name) "): ")
1245 nil nil (buffer-name))))
1246 ;; should this pop to the Articles window?
1247 (pick-a-name `(lambda ()
1248 (get-section-contents
1249 ,name ,heading))
1250 `(lambda (items)
1251 (format-section-contents
1252 items ,heading))))
1254 (add-to-list 'display-style
1255 '(section . (display-section
1256 nil)))
1257 \end{elisp}
1259 \begin{notate}{On `get-section-contents'} \label{get-section-contents}
1260 Sent by `display-section' (Note \ref{display-section})
1261 to `pick-a-name' as a generator for the table of contents
1262 of the section with the given name in the given heading.
1264 This function first finds the triples that begin with the
1265 (placed) name of the section, then checks to see which of
1266 these are in the heading of the document we're examinining
1267 (in other words, which of these links represent structural
1268 information about that document). It also looks at the
1269 items found at the end of these links to see if they are
1270 sections or notes (``noteness'' is determined by them
1271 having content). The links are then sorted by their
1272 middles (which show the order in which these components
1273 have in the section we're examining). After this ordering
1274 information has been used for sorting, it is deleted, and
1275 we're left with just a list of names in the apropriate
1276 order together with an indication of their noteness.
1277 \end{notate}
1279 \begin{elisp}
1280 (Defun get-section-contents (name heading)
1281 (let (contents)
1282 (dolist (triple (triples-given-beginning
1283 `(1 ,(resolve-ambiguity
1284 (get-places name)))))
1285 (when (triple-exact-match
1286 `(2 ,(car triple)) "in" heading)
1287 (let* ((number (print-middle triple))
1288 (site (isolate-end triple))
1289 (noteness
1290 (when (triples-given-beginning-and-middle
1291 site "has content")
1292 t)))
1293 (setq contents
1294 (cons (list number
1295 (print-system-object
1296 (place-contents site))
1297 noteness)
1298 contents)))))
1299 (mapcar 'cdr
1300 (sort contents
1301 (lambda (component1 component2)
1302 (< (parse-integer (car component1))
1303 (parse-integer (car component2))))))))
1304 \end{elisp}
1306 \begin{notate}{On `format-section-contents'} \label{format-section-contents}
1307 A formatter for document contents, used by
1308 `display-document' (Note \ref{display-document}) as input
1309 for `pick-a-name' (Note \ref{pick-a-name}).
1311 Instead of just printing the items one by one,
1312 like the default formatter in `pick-a-name' does,
1313 this version adds appropriate text properties, which
1314 we determine based the second component of
1315 of `items' to format.
1316 \end{notate}
1318 \begin{elisp}
1319 (defun format-section-contents (items heading)
1320 ;; just replicating the default and building on that.
1321 (mapc (lambda (item)
1322 (insert (car item))
1323 (let* ((beg (line-beginning-position))
1324 (end (1+ beg)))
1325 (unless (second item)
1326 (put-text-property beg end
1327 'arxana-display-type
1328 'section))
1329 (put-text-property beg end
1330 'arxana-relevant-heading
1331 heading))
1332 (insert "\n"))
1333 items))
1334 \end{elisp}
1336 \begin{notate}{On `display-document'} \label{display-document}
1337 When browsing a document, you should first display its
1338 top-level table of contents. (Most typically, a list of
1339 all of that document's major sections.) In order to do
1340 this, we must find the triples that are begin at the node
1341 representing this document \emph{and} that are in the
1342 heading of this document. This boils down to treating the
1343 document's root as if it was a section and using the
1344 function `display-section' (Note \ref{display-section}).
1345 \end{notate}
1347 \begin{elisp}
1348 (defun display-document (name)
1349 (interactive (list (read-string
1350 (concat
1351 "name (default "
1352 (buffer-name) "): ")
1353 nil nil (buffer-name))))
1354 (display-section name name))
1355 \end{elisp}
1357 \begin{notate}{Work with `heading' argument}
1358 We should make sure that if we know the heading we're
1359 working with (e.g. the name of the document we're
1360 browsing) that this information gets communicated in the
1361 background of the user interaction with the article
1362 selector.
1363 \end{notate}
1365 \begin{notate}{Selecting from a hierarchical display} \label{hierarchical-display}
1366 A fancier ``article selector'' would be able to display
1367 several sections with nice indenting to show their
1368 hierarchical order.
1369 \end{notate}
1371 \begin{notate}{Browser history tricks} \label{history-tricks}
1372 I want to put together (or put back together) something
1373 similar to the multihistoried browser that I had going in
1374 the previous version of Arxana and my Emacs/Lynx-based web
1375 browser, Nero\footnote{{\tt http://metameso.org/~joe/nero.el}}.
1376 The basic features are:
1377 (1) forward, back, and up inside the structure of a given
1378 document; (2) switch between tabs. More advanced features
1379 might include: (3) forward and back globally across all
1380 tabs; (4) explicit understanding of paths that loop.
1382 These sorts of features are independent of the exact
1383 details of what's printed to the screen each time
1384 something is displayed. So, for instance, you could flip
1385 between section manifests a la Note \ref{display-section},
1386 or between hierarchical displays a la Note
1387 \ref{hierarchical-display}, or some combination; the key
1388 thing is just to keep track in some sensible way of
1389 whatever's been displayed!
1390 \end{notate}
1392 \begin{notate}{Local storage for browsing purposes} \label{local-storage}
1393 Right now, in order to browse the contents of the
1394 database, you need to query the database every time. It
1395 might be handy to offer the option to cache names of
1396 things locally, and only sync with the database from time
1397 to time. Indeed, the same principle could apply in
1398 various places; however, it may also be somewhat
1399 complicated to set up. Using two systems for storage, one
1400 local and one permanent, is certainly more heavy-duty than
1401 just using one permanent storage system and the local
1402 temporary display. However, one thing in favor of local
1403 storage systems is that that's what I used in the the
1404 previous prototype of Arxana -- so some code already
1405 exists for local storage! (Caching the list of
1406 \emph{names} we just made a selection from would be one
1407 simple expedient, see Note \ref{pick-a-name}.)
1408 \end{notate}
1410 \begin{notate}{Hang onto absolute references}
1411 Since `get-article' (Note \ref{get-article}) translates
1412 strings into their ``place pseudonyms'', we may want to
1413 hang onto those pseudonyms, because they are, in fact, the
1414 absolute references to the objects we end up working with.
1415 In particular, they should probably go into the
1416 text-property background of the article selector, so it
1417 will know right away what to select!
1418 \end{notate}
1420 \subsection{Exporting \LaTeX\ documents$^*$}
1422 \begin{notate}{Roundtripping}
1423 The easiest test is: can we import a document into the
1424 system and then export it again, and find it unchanged?
1425 \end{notate}
1427 \begin{notate}{Data format}
1428 We should be able to \emph{stably} import and export a
1429 document, as well as export any modifications to the
1430 document that were generated within Arxana. This means
1431 that the exporting functions will have to read the data
1432 format that the importing functions use, \emph{and} that
1433 any functions that edit document contents (or structure)
1434 will also have to use the same format. Furthermore,
1435 \emph{browsing} functions will have to be somewhat aware
1436 of this format. So, this is a good time to ask -- did we
1437 use a good format?
1438 \end{notate}
1440 \subsection{Editing database contents$^*$} \label{editing}
1442 \begin{notate}{Roundtripping, with changes}
1443 Here, we should import a document into the system and then
1444 make some simple changes, and after exporting, check with
1445 diff to make sure the changes are correct.
1446 \end{notate}
1448 \begin{notate}{Re-importing}
1449 One nice feature would be a function to ``re-import'' a
1450 document that has changed outside of the system, and make
1451 changes in the system's version whereever changes appeared
1452 in the source version.
1453 \end{notate}
1455 \begin{notate}{Editing document structure}
1456 The way we have things set up currently, it is one thing
1457 to make a change to a document's textual components, and
1458 another to change its structure. Both types of changes
1459 must, of course, be supported.
1460 \end{notate}
1462 \section{Applications}
1464 \subsection{Managing tasks} \label{managing-tasks}
1466 \begin{notate}{What are tasks?}
1467 Each task tends to have a \emph{name}, a
1468 \emph{description}, a collection of \emph{prerequisite
1469 tasks}, a description of other \emph{material
1470 dependencies}, a \emph{status}, some \emph{justification
1471 of that status}, a \emph{creation date}, and an
1472 \emph{estimated time of completion}. There might actually
1473 be several ``estimated times of completion'', since the
1474 estimate would tend to improve over time. To really
1475 understand a task, one should keep track of revisions like
1476 this.
1477 \end{notate}
1479 \begin{notate}{On `store-task-data'} \label{store-task-data}
1480 Here, we're just filling in a frame. Since ``filling in a
1481 frame'' seems like the sort of operation that might happen
1482 over and over again in different contexts, to save space,
1483 it would probably be nice to have a macro (or similar)
1484 that would do a more general version of what this function
1485 does.
1486 \end{notate}
1488 \begin{elisp}
1489 (Defun store-task-data
1490 (name description prereqs materials status
1491 justification submitted eta)
1492 (add-triple name "is a" "task")
1493 (add-triple name "description" description)
1494 (add-triple name "prereqs" prereqs)
1495 (add-triple name "materials" materials)
1496 (add-triple name "status" status)
1497 (add-triple name "status justification" justification)
1498 (add-triple name "date submitted" submitted)
1499 (add-triple name "estimated time of completion" eta))
1500 \end{elisp}
1502 \begin{notate}{On `generate-task-data'} \label{generate-task-data}
1503 This is a simple function to create a new task matching
1504 the description above.
1505 \end{notate}
1507 \begin{elisp}
1508 (defun generate-task-data ()
1509 (interactive)
1510 (let ((name (read-string "Name: "))
1511 (description (read-string "Description: "))
1512 (prereqs (read-string
1513 "Task(s) this task depends on: "))
1514 (materials (read-string "Material dependencies: "))
1515 (status (completing-read
1516 "Status (tabled, in progress, completed):
1517 " '("tabled" "in progress" "completed")))
1518 (justification (read-string "Why this status? "))
1519 (submitted
1520 (read-string
1521 (concat "Date submitted (default "
1522 (substring (current-time-string) 0 10)
1523 "): ")
1524 nil nil (substring (current-time-string) 0 10)))
1525 (eta
1526 (read-string "Estimated date of completion:")))
1527 (store-task-data name description prereqs materials
1528 status
1529 justification submitted eta)))
1530 \end{elisp}
1532 \begin{notate}{Possible enhancements to `generate-task-data'}
1533 In order to make this function very nice, it would be good
1534 to allow ``completing read'' over known tasks when filling
1535 in the prerequisites. Indeed, it might be especially nice
1536 to offer a type of completing read that is similar in some
1537 sense to the tab-completion you get when completing a file
1538 name, i.e., quickly completing certain sub-strings of the
1539 final string (in this case, these substrings would
1540 correspond to task areas we are progressively zooming down
1541 into).
1543 As for the task description, rather than forcing the user
1544 to type the description into the minibuffer, it might be
1545 nice to pop up a separate buffer instead (a la the
1546 Emacs/w3m textarea). If we had a list of all the known
1547 tasks, we could offer completing-read over the names of
1548 existing tasks to generate the list of `prereqs'. It
1549 might be nice to systematize date data, so we could more
1550 easily e.g. sort and display task info ``by date''.
1551 (Perhaps we should be working with predefined database
1552 types for dates and so on; but see Note
1553 \ref{choice-of-database}.)
1555 Also, before storing the task, it might be nice to offer
1556 the user the chance to review the data they entered.
1557 \end{notate}
1559 \begin{notate}{On `get-filler'} \label{get-filler}
1560 Just a wrapper for `triples-given-beginning-and-middle'.
1561 (Maybe add `heading' as an option here.)
1562 \end{notate}
1564 \begin{elisp}
1565 (Defun get-filler (frame slot)
1566 (third (first
1567 (print-triples
1568 (triples-given-beginning-and-middle frame
1569 slot)))))
1570 \end{elisp}
1572 \begin{notate}{On `get-task'} \label{get-task}
1573 Uses `get-filler' (Note \ref{get-filler}) to assemble the
1574 elements of a task's frame.
1575 \end{notate}
1577 \begin{elisp}
1578 (Defun get-task (name)
1579 (when (triple-exact-match name "is a" "task")
1580 (list (get-filler name "description")
1581 (get-filler name "prereqs")
1582 (get-filler name "materials")
1583 (get-filler name "status")
1584 (get-filler name "status justification")
1585 (get-filler name "date submitted")
1586 (get-filler name
1587 "estimated time of completion"))))
1588 \end{elisp}
1590 \begin{notate}{On `review-task'} \label{review-task}
1591 This is a function to review a task by name.
1592 \end{notate}
1594 \begin{elisp}
1595 (defun review-task (name)
1596 (interactive "MName: ")
1597 (let ((task-data (get-task name)))
1598 (if task-data
1599 (display-task task-data)
1600 (message "No data."))))
1602 (defun display-task (data)
1603 (save-excursion
1604 (pop-to-buffer (get-buffer-create
1605 "*Arxana Display*"))
1606 (delete-region (point-min) (point-max))
1607 (insert "NAME: " name "\n\n")
1608 (insert "DESCRIPTION: " (first data) "\n\n")
1609 (insert "TASKS THIS TASK DEPENDS ON: "
1610 (second data) "\n\n")
1611 (insert "MATERIAL DEPENDENCIES: "
1612 (third data) "\n\n")
1613 (insert "STATUS: " (fourth data) "\n\n")
1614 (insert "WHY THIS STATUS?: " (fifth data) "\n\n")
1615 (insert "DATE SUBMITTED:" (sixth data) "\n\n")
1616 (insert "ESTIMATED TIME OF COMPLETION: "
1617 (seventh data) "\n\n")
1618 (goto-char (point-min))
1619 (fill-individual-paragraphs (point-min) (point-max))))
1620 \end{elisp}
1622 \begin{notate}{Possible enhancements to `review-task'}
1623 Breaking this down into a function to select the task and
1624 another function to display the task would be nice. Maybe
1625 we should have a generic function for selecting any object
1626 ``by name'', and then special-purpose functions for
1627 displaying objects with different properties.
1629 Using text properties, we could set up a ``field-editing
1630 mode'' that would enable you to select a particular field
1631 and edit it independently of the others. Another more
1632 complex editing mode would \emph{know} which fields the
1633 user had edited, and would store all edits back to the
1634 database properly. See Section \ref{editing} for more on
1635 editing.
1636 \end{notate}
1638 \begin{notate}{Browsing tasks} \label{browsing-tasks}
1639 The function `pick-a-name' (Note \ref{pick-a-name}) takes
1640 two functions, one that finds the names to choose from,
1641 and the other that says how to present these names. We
1642 can therefore build `pick-a-task' on top of `pick-a-name'.
1643 \end{notate}
1645 \begin{elisp}
1646 (Defun get-tasks ()
1647 (mapcar #'first
1648 (print-triples
1649 (triples-given-middle-and-end "is a" "task")
1650 t)))
1652 (defun pick-a-task ()
1653 (interactive)
1654 (pick-a-name
1655 'get-tasks
1656 (lambda (items)
1657 (mapc (lambda (item)
1658 (let ((pos (line-beginning-position)))
1659 (insert item)
1660 (put-text-property pos (1+ pos)
1661 'arxana-display-type
1662 'task)
1663 (insert "\n"))) items))))
1665 (add-to-list 'display-style
1666 '(task . (get-task display-task)))
1667 \end{elisp}
1669 \begin{notate}{Working with theories}
1670 Presumably, like other related functions, `get-tasks'
1671 should take a heading argument.
1672 \end{notate}
1674 \begin{notate}{Check display style}
1675 Check if this works, and make style consistent between
1676 this usage and earlier usage.
1677 \end{notate}
1679 \begin{notate}{Example tasks}
1680 It might be fun to add some tasks associated with
1681 improving Arxana, just to show that it can be done...
1682 maybe along with a small importer to show how importing
1683 something without a whole lot of structure can be easy.
1684 \end{notate}
1686 \subsection{Other ideas$^*$}
1688 \begin{notate}{A browser within a browser} \label{browser-within}
1689 All the stuff we're doing with triples can be superimposed
1690 over the existing web and existing web interfaces, by, for
1691 example, writing a web browser as a web app, and in this
1692 ``browser within a browser'' offer the ability to annotate
1693 and rewrite other people's web pages, produce 3rd-party
1694 redirects, and so forth, sharing these mods with other
1695 subscribers to the service. (Already websites such as the
1696 short-lived scrum.diddlyumptio.us have offered limited
1697 versions of ``web annotation'', but, so far, what one can
1698 do with such services seems quite weak compared with
1699 what's possible.)
1700 \end{notate}
1702 \begin{notate}{Improvements to the PlanetMath backend}
1703 From one point of view, the SQL tables are the main thing
1704 in Noosphere. We could say that getting the things out of
1705 SQL and storing new things there is what Noosphere mainly
1706 does. Following this line of thought, anything that
1707 adjusts these tables will do just as well, e.g., it
1708 shouldn't be terribly hard to develop an email-based
1709 front-end. But rather than making Arxana work with the
1710 Noosphere relational table system, it is probably
1711 advantageous to translate the data from these tables into
1712 the scholium system.
1713 \end{notate}
1715 \begin{notate}{A new communication platform}
1716 One of the premier applications I have in mind is a new
1717 way to handle communications in an online-forum. I have
1718 previously called this ``subchanneling'', but really,
1719 joining channels is just as important.
1720 \end{notate}
1722 \begin{notate}{Some tutorials}
1723 It would be interesting to write a tutorial for Common
1724 Lisp or just about any other topic with this system. For
1725 example, some little ``worksheets'' or ``gymnasia'' that
1726 will help solidify user knowledge in topics on which
1727 questions keep appearing.
1728 \end{notate}
1730 \section{Topics of philosophical interest}
1732 \begin{notate}{Research and development}
1733 In Note \ref{theoretical-context}, I mentioned a model
1734 that could apply in many contexts; it is an essentially
1735 metaphysical conception. I'm pretty sure that the data
1736 model of Note \ref{data-model} provides a general-enough
1737 framework to represent anything we might find ``out
1738 there''. However, even if this is the case, questions as
1739 to \emph{efficient} means of working with such data still
1740 abound (cf. Note \ref{models-of-theories}, Note
1741 \ref{use-of-views}).
1743 I propose that along with \emph{development} of Arxana as
1744 a useful system for \emph{doing} ``commons-based peer
1745 production'' should come a \emph{research} programme for
1746 understanding in much greater detail what ``commons-based
1747 peer production'' \emph{is}. Eventually we may want to
1748 change the name of the subject of study to reflect still
1749 more general ideas of resource use.
1751 While the ``frontend'' of this research project is
1752 anthropological, the ``backend'' is much closer to
1753 artificial intelligence. On this level, the project is
1754 about understanding \emph{effective} means for solving
1755 human problems. Often this will involve decomposing
1756 events and processes into constituent elements, making
1757 increasingly detailed treatments along the lines described
1758 in Note \ref{arxana}.
1759 \end{notate}
1761 \begin{notate}{The relationship between text and commentary}
1762 Text under revision might be marked up by a copyeditor: in
1763 cases like these, the interpretation is clear. However,
1764 what about marginalia with looser interpretations? These
1765 seem to become part of the copy of the text they are
1766 attached to. What about steering processes applied to a
1767 given course of action? How about the relationship of
1768 thoughts or words to perception and action? How can we
1769 lower the barrier between conception and action, while
1770 still maintaining some purchase on wisdom?
1772 You see, a lot of issues in life have to do with overlays,
1773 multi-tracking, interchange between different systems; and
1774 in these terms, a lot of philosophy reduces to ``media
1775 awareness'' which extends into more and more immediate
1776 contexts (Note \ref{theoretical-context}).
1777 \end{notate}
1779 \begin{notate}{Heuristic flow}
1780 Continuing the notion above: one does not need a
1781 fully-developed ``heading'' of work in order to do work --
1782 instead, one wants some straightforward heuristics that
1783 will enable the desired work to get done. So, even
1784 supposing the work is ``heading building'', it can progress
1785 without becoming overwhelmed in abstractions -- because
1786 theories and heuristics are different things.
1787 \end{notate}
1789 \begin{notate}{Limits of simple languages} \label{simple-languages}
1790 Triples are frequently ``subject, verb, object''
1791 statements, although with the annotation features, we can
1792 modify any part of any such statement; for example, we
1793 can apply an adverb to a given verb.
1795 ``Tags'', of course, already provide ``subject,
1796 predicate'' relationships. It will be interesting to
1797 examine the degree to which human languages can be mapped
1798 down into these sorts of simple languages. What features
1799 are needed to make such languages \emph{useful}? (Lisp's
1800 `car' and `cdr' seem related to the idea of making
1801 predicates useful.)
1803 How are triples and predicates ``enough''? What, if
1804 anything, do they lack? The difference between triples
1805 and predicates illustrates the issue. How should we
1806 characterize Arxana's additions to Lisp?
1807 \end{notate}
1809 \begin{notate}{Higher dimensions}
1810 Why stop with three components? Why not have $(A, B, C,
1811 D, T)$ represent a semantic relationship between all of
1812 $A$, $B$, $C$, and $D$ (in heading $T$, of course)?
1813 Actually, there is no reason to stop apart from the fact
1814 that I want to explore simple languages (Note
1815 \ref{simple-languages}). In real life, things are not as
1816 simple, and we should be ready to deal with the
1817 complexities! (Cf., for example, Note \ref{pointing}).
1818 \end{notate}
1820 \section{Future plans}
1822 \begin{notate}{Development pathways}
1823 To the extent that it's possible, I'd like to maintain a
1824 succinct non-linear roadmap in which tasks are outlined
1825 and prioritized, and some procedural details are made
1826 concrete. Whenever relevant this map should point into
1827 the current document. I'll begin by revising the plans
1828 I've used so far!\footnote{{\tt
1829 http://metameso.org/files/plan-arxana.pdf}} Over the
1830 next several months, I'd like to see these plans develop
1831 into a genuine production machine, and see the machine
1832 begin to stabilize its operations.
1833 \end{notate}
1835 \begin{notate}{Theories as database objects} \label{theories-as-database-objects}
1836 We're just beginning to treat theories as database
1837 objects; I expect there will be more work to do to make
1838 this work really well. We'll want to make some test
1839 cases, like building a ``theory of chess'', or even just
1840 describing a particular chess board; cf. Note
1841 \ref{partial-image}.
1842 \end{notate}
1844 \begin{notate}{Search engine/elements} \label{search-engine}
1845 One of the features that came very easy in the Emacs-only
1846 prototype was textual search. With the strings stored in
1847 a database, Sphinx seems to be the most suitable search
1848 engine to use. It is tempting to try to make our own
1849 inverted index using triples, so that text-based search
1850 can be even more directly integrated with semantic search.
1851 (Since the latest version(s) of Sphinx can act to some
1852 extent like a MySQL database, we almost have a direct
1853 connection in the backend, but since Sphinx is not
1854 \emph{the same} database, one would at least need some
1855 glue code to effect joins and so forth.)
1857 More to the point, it is important for this project that
1858 the scholia-based document model be transparently extended
1859 down to the level of words and characters. It may be
1860 helpful to think about text as \emph{always being}
1861 hypertext; a document as a heading; and a word in the
1862 inverted index as a frame.
1863 \end{notate}
1865 \begin{notate}{Pointing at database elements and other things} \label{pointing}
1866 We will want to be able to point at other tables and at
1867 other sorts of objects and make use of their contents.
1868 The plan is that our triples will provide a sort of guide
1869 or backbone superimposed over a much larger data system.
1870 \end{notate}
1872 \begin{notate}{Feature-chase}
1873 There are lots of different features that could be
1874 explored, for example: multi-dimensional history lists; a
1875 useful treatment of ``clusions''; MS Word-like colorful
1876 annotations; etc. Many of these features are already
1877 prototyped.\footnote{See footnote \ref{old-version}.}
1878 \end{notate}
1880 \begin{notate}{Regression testing}
1881 Along with any major feature chase, we should provide
1882 and maintain a regression testing suite.
1883 \end{notate}
1885 \begin{notate}{Deleting and changing things}
1886 How will we deal with unlinking, disassociating,
1887 forgetting, entropy, and the like? Changes can perhaps
1888 be modeled by an insertion following a deletion, and,
1889 as noted, we'll need effective ways to represent and
1890 manage change (Note \ref{change}).
1891 \end{notate}
1893 \begin{notate}{Tutorial}
1894 Right now the system is simple enough to be pretty much
1895 self-explanatory, but if it becomes much more complicated,
1896 it might be helpful to put together a simple guide to some
1897 likely-to-be-interesting features.
1898 \end{notate}
1900 \begin{notate}{Computing possible paths and connections}
1901 If we can find all the \emph{direct} paths from one node
1902 to another using `triples-given-beginning-and-end', can we
1903 inject some algorthms for finding longer, indirect paths
1904 into the system, and find ways to make them useful?
1906 Similarly, we can satisfy local conditions (Note
1907 \ref{satisfy-conditions}), but we'll want to deal with
1908 increasingly ``non-local'' conditions (even just using the
1909 logical operator ``or'', instead of ``and'', for example).
1910 \end{notate}
1912 \begin{notate}{Monster Mountain}
1913 In Summer 2007, we checked out the Monster Mountain MUD
1914 server\footnote{{\tt http://code.google.com/p/mmtn/}},
1915 which would enable several users to interact with one
1916 LISP, instead of just one database. This would have a
1917 number of advantages, particularly for exploring
1918 ``scholiumific programming'', but also towards fulfilling
1919 the user-to-user interaction objective stated in Note
1920 \ref{theoretical-context}. I plan to explore this after
1921 the primary goal of multi-user interaction with the
1922 database has been solidly completed.
1923 \end{notate}
1925 \begin{notate}{Web interface}
1926 A finished web interface may take a considerable amount of
1927 work (if the complexity of an interesting Emacs interface
1928 is any indication), but the basics shouldn't be hard to
1929 put together soon.
1930 \end{notate}
1932 \begin{notate}{Parsing input} \label{parsing}
1933 Complicated objects specified in long-hand (e.g. triples
1934 pointing to triples) can be read by a relatively simple
1935 parser -- which we'll have to write! The simplest goal
1936 for the parser would be to be able to distinguish between
1937 a triple and a string -- presumably that much isn't hard.
1938 And of course, building complexes of triples that
1939 represent statements from natural language is a good
1940 long-term goal. (Right now, our granularity level is set
1941 much higher.)
1942 \end{notate}
1944 \begin{notate}{Choice of database} \label{choice-of-database}
1945 I expect Elephant\footnote{{\tt
1946 http://common-lisp.net/project/elephant/}} may become
1947 our preferred database at some point in the future; we are
1948 currently awaiting changes to Elephant that make nested
1949 queries possible and efficient. Some core queries related
1950 to managing a database of semantic links with the current
1951 Elephant were constructed by Ian Eslick, Elephant's
1952 maintainer.\footnote{{\tt
1953 http://planetx.cc.vt.edu/\~{}jcorneli/arxana/variant-4.lisp}}
1955 On the other hand, it might be reasonable to use an Emacs
1956 database and redo the whole thing to work in Emacs
1957 (again), e.g. for single-user applications or users who
1958 want to work offline a lot of the time.
1959 \end{notate}
1961 \begin{notate}{Different kinds of theories}
1962 Theories or variants thereof are of course already popular
1963 in other knowledge representation contexts.\footnote{{\tt
1964 http://www.cyc.com/cycdoc/vocab/mt-expansion-vocab.html}}$^{,}$\footnote{{\tt
1965 http://www.stanford.edu/\~{}kdevlin/HHL\_SituationTheory.pdf}}
1966 We'll want to adopt some useful techniques for knowledge
1967 management as soon as the core systems are ready.
1969 Various notions of a mathematical theory
1970 exist.\footnote{{\tt
1971 http://planetmath.org/encyclopedia/Theory.html}} It
1972 would be nice to be able to assign specific logic to
1973 theories in Arxana, following the ``little theories''
1974 design of e.g. IMPS.\footnote{{\tt
1975 http://imps.mcmaster.ca/manual/node13.html}}
1976 \end{notate}
1978 \section{Conclusion} \label{conclusion}
1980 \begin{notate}{Ending and beginning again}
1981 This is the end of the Arxana system itself; the
1982 appendices provide some ancillary tools, and some further
1983 discussion. Contributions that support the development of
1984 the Arxana project are welcome.
1985 \end{notate}
1987 \appendix
1989 \section{Appendix: Auto-setup} \label{appendix-setup}
1991 \begin{notate}{Setting up auto-setup}
1992 This section provides code for satifying dependencies and
1993 setting up the program. This code assumes that you are
1994 using a Debian/APT-based system (but things are not so
1995 different using say, Fedora or Fink; writing a
1996 multi-package-manager-friendly installer shouldn't be
1997 hard). Of course, feel free to set things up differently
1998 if you have something else in mind!
1999 \end{notate}
2001 \begin{elisp}
2002 (defalias 'set-up 'shell-command)
2004 (defun alternative-set-up (string)
2005 (save-excursion
2006 (pop-to-buffer (get-buffer-create "*Arxana Help*"))
2007 (goto-char (point-max))
2008 (insert string "\n")))
2010 (defun set-up-arxana-environment ()
2011 (interactive)
2012 (if (y-or-n-p
2013 "Run commands (y) (or just show instructions)? ")
2014 (fset 'set-up 'shell-command)
2015 (fset 'set-up 'alternative-set-up))
2016 (when (y-or-n-p "Install dependencies? ")
2017 (set-up "mkdir ~/arxana")
2018 (set-up "cd arxana"))
2020 (when (y-or-n-p "Download latest Arxana? ")
2021 (set-up "wget http://metameso.org/files/arxana.tex"))
2023 (unless (y-or-n-p "Is your emacs good enough?... ")
2024 (set-up
2025 (concat "cvs -z3 -d"
2026 ":pserver:anonymous@cvs.savannah.gnu.org:"
2027 "/sources/emacs co emacs"))
2028 (set-up "mv emacs ~")
2029 (set-up "cd ~/emacs")
2030 (set-up "./configure && make bootstrap")
2031 (set-up "cd ~/arxana"))
2033 (defvar pac-man nil)
2035 (cond ((y-or-n-p
2036 "Do you use an apt-based package manager? ")
2037 (setq pac-man "apt-get"))
2038 (t (message
2039 "OK, get Lisp and SQL on your own, then!")))
2041 (when pac-man
2042 (when (y-or-n-p "Install Common Lisp? ")
2043 (set-up (concat pac-man " install sbcl")))
2045 (when (y-or-n-p "Install Postgresql? ")
2046 (set-up (concat pac-man " install postgresql"))
2047 (when (y-or-n-p "Help setting up PostgreSQL? ")
2048 (save-excursion
2049 (pop-to-buffer (get-buffer-create "*Arxana Help*"))
2050 (insert "As superuser (root),
2051 edit /etc/postgresql/7.4/main/pg_hba.conf
2052 make sure it says this:
2053 host all all 127.0.0.1 255.255.255.255 trust
2054 then edit /etc/postgresql/7.4/main/postgresql.conf
2055 and make it say
2056 tcpip_socket = true
2057 then restart:
2058 /etc/init.d/postgresql-7.4 restart
2059 su postgres
2060 createuser username
2061 exit
2062 as username, run
2063 createdb -U username\n")))))
2065 (when (y-or-n-p "Install SLIME...? ")
2066 (set-up (concat "cvs -d :pserver:anonymous"
2067 ":anonymous@common-lisp.net:"
2068 "/project/slime/cvsroot co slime"))
2069 (set-up
2070 (concat "echo \";; Added to ~/.emacs for Arxana:\n\n"
2071 "(add-to-list 'load-path \"~/slime/\")\n"
2072 "(setq inferior-lisp-program \"/usr/bin/sbcl\")\n"
2073 "(require 'slime)\n"
2074 "(slime-setup '(slime-repl))\n\n\""
2075 "| cat - ~/.emacs > ~/updated.emacs &&"
2076 "mv ~/updated.emacs ~/.emacs")))
2078 (when (y-or-n-p "Set up Common Lisp environment? ")
2079 (set-up "mkdir ~/.sbcl")
2080 (set-up "mkdir ~/.sbcl/site")
2081 (set-up "mkdir ~/.sbcl/systems")
2082 (set-up "cd ~/.sbcl/site")
2083 (set-up (concat "wget http://files.b9.com/"
2084 "clsql/clsql-latest.tar.gz"))
2085 (set-up "tar -zxf clsql-4.0.3.tar.gz")
2086 (set-up (concat "wget http://files.b9.com/"
2087 "uffi/uffi-latest.tar.gz"))
2088 (set-up "tar -zxf uffi-1.6.0.tar.gz")
2089 (set-up (concat "wget http://files.b9.com/"
2090 "md5/md5-1.8.5.tar.gz"))
2091 (set-up "tar -zxf md5-1.8.5.tar.gz")
2092 (set-up "cd ~/.sbcl/systems")
2093 (set-up "ln -s ../site/md5-1.8.5/md5.asd .")
2094 (set-up "ln -s ../site/uffi-1.6.0/uffi.asd .")
2095 (set-up "ln -s ../site/clsql-4.0.3/clsql.asd .")
2096 (set-up "ln -s ../site/clsql-4.0.3/clsql-uffi.asd .")
2097 (set-up (concat "ln -s ../site/clsql-4.0.3/"
2098 "clsql-postgresql-socket.asd ."))
2099 (set-up "ln -s ~/arxana/arxana.asd ."))
2101 (when (y-or-n-p "Modify ~/.sbclrc so CL always starts Arxana? ")
2102 (set-up
2103 (concat "echo \";; Added to ~/.sbclrc for Arxana:\n\n"
2104 "(require 'asdf)\n\n"
2105 "(asdf:operate 'asdf:load-op 'swank)\n"
2106 "(setf swank:*use-dedicated-output-stream* nil)\n"
2107 "(setf swank:*communication-style* :fd-handler)\n"
2108 "(swank:create-server :port 4006 :dont-close t)\n\n"
2109 "(asdf:operate 'asdf:load-op 'clsql)\n"
2110 "(asdf:operate 'asdf:load-op 'arxana)\n"
2111 "(in-package arxana)\n"
2112 "(connect-to-database)\n"
2113 "(locally-enable-sql-reader-syntax)\n\n\""
2114 "| cat ~/.sbclrc - > ~/updated.sbclrc &&"
2115 "mv ~/updated.sbclrc ~/.sbclrc")))
2117 (when (y-or-n-p "Install Monster Mountain? ")
2118 (set-up "cd ~/.sbcl/systems")
2119 (set-up (concat
2120 "darcs get http://common-lisp.net/project/"
2121 "bordeaux-threads/darcs/bordeaux-threads/"))
2122 (set-up (concat
2123 "svn checkout svn://common-lisp.net/project/"
2124 "usocket/svn/usocket/trunk usocket-svn"))
2125 ;; I've had problems with this approach to setting cclan
2126 ;; mirror...
2127 (set-up
2128 (concat
2129 "wget \"http://ww.telent.net/cclan-choose-mirror"
2130 "?M=http%3A%2F%2Fthingamy.com%2Fcclan%2F\""))
2131 (set-up (concat "wget http://ww.telent.net/cclan/"
2132 "split-sequence.tar.gz"))
2133 (set-up "tar -zxf split-sequence.tar.gz")
2134 (set-up
2135 (concat "svn checkout http://mmtn.googlecode.com/"
2136 "svn/trunk/ mmtn-read-only"))
2137 (set-up
2138 "ln -s ~/bordeaux-threads/bordeaux-threads.asd .")
2139 (set-up "ln -s ~/usocket-svn/usocket.asd .")
2140 (set-up "ln -s ~/split-sequence/split-sequence.asd .")
2141 (set-up "ln -s ~/mmtn/src/mmtn.asd .")))
2142 \end{elisp}
2144 \begin{notate}{Postgresql on Fedora}
2145 There are some slightly different instructions for
2146 installing postgresql on Fedora; the above will be
2147 changed to include them, but for now, check them
2148 out on the
2149 web.\footnote{{\tt http://www.flmnh.ufl.edu/linux/install\_postgresql.htm}}
2150 \end{notate}
2152 \begin{notate}{Using MySQL and CLISP instead} \label{backend-variant}
2153 Since my OS X box seems to have a variety of confusing
2154 PostgreSQL systems already installed (which I'm not sure
2155 how to configure), and CLISP is easy to install with fink,
2156 I thought I'd try a different set up for simplicity and
2157 variety.
2159 In order to make it work, I enabled root user on Mac OS X
2160 per instructions on web, and installed and configured
2161 mysql; used a slight modification of the strings table
2162 described previously; download and installed
2163 cffi\footnote{{\tt
2164 http://common-lisp.net/project/cffi/releases/cffi\_latest.tar.gz}};
2165 changed the definition of `connect-to-database' in
2166 Arxana's utilities.lisp; doctored up my ~/.clisprc.lisp;
2167 and changed how I started Lisp. Details below.
2168 \end{notate}
2170 \begin{idea}
2171 ;; on the shell prompt
2172 sudo apt-get install mysql
2173 sudo mysqld_safe --user=mysql &
2174 sudo daemonic enable mysql
2175 sudo mysqladmin -u root password root
2176 mysql --user=root --password=root -D test
2177 create database joe; grant all on joe.* to joe@localhost
2178 identified by 'joe'
2180 ;; in tabledefs.lisp
2181 (execute-command "CREATE TABLE strings (
2182 id SERIAL PRIMARY KEY,
2183 text TEXT,
2184 UNIQUE INDEX (text(255))
2185 );")
2187 ;; in ~/asdf-registry/ or whatever you've designated as
2188 ;; your asdf:*central-registry*
2189 ln -s ~/cffi_0.10.4/cffi-uffi-compat.asd .
2190 ln -s ~/cffi_0.10.4/cffi.asd .
2192 ;; In utilities.lisp
2193 (defun connect-to-database ()
2194 (connect `("localhost" "joe" "joe" "joe")
2195 :database-type :mysql))
2197 ;; In ~/.clisprc.lisp
2198 (asdf:operate 'asdf:load-op 'clsql)
2199 (push "/sw/lib/mysql/"
2200 CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS*)
2202 ;; From SLIME prompt, and not in ~/.clisprc.lisp
2203 (in-package #:arxana)
2204 (connect-to-database)
2205 (locally-enable-sql-reader-syntax)
2206 \end{idea}
2208 \begin{notate}{Installing Sphinx}
2209 Here are some tips on how to install and configure
2210 Sphinx.
2211 \end{notate}
2213 \begin{idea}
2214 ;; Fedora/Postgresql flavor
2215 yum install postgresql-devel
2216 ./configure --without-mysql
2217 --with-pgsql
2218 --with-pgsql-libs=/usr/lib/pgsql/
2219 --with-pgsql-includes=/usr/include/pgsql
2221 ;; Fink/MySQL flavor
2222 ./configure --with-mysql
2223 --with-mysql-includes=/sw/include/mysql
2224 --with-mysql-libs=/sw/lib/mysql
2225 \end{idea}
2227 \begin{notate}{Getting Sphinx set up} \label{sphinx-setup}
2228 Here are some instructions I've used to get Sphinx set
2230 \end{notate}
2232 \begin{notate}{Create a sphinx.conf}
2233 I want a very minimal sphinx.conf, this seems to work.
2234 (We should probably set this up so that it gets written
2235 to a file when the Arxana is set up.)
2236 \end{notate}
2238 \begin{idea}
2239 ## Copy this to /usr/local/etc/sphinx.conf when you want
2240 ## to use it.
2242 source strings
2244 type = mysql
2245 sql_host = localhost
2246 sql_user = joe
2247 sql_pass = joe
2248 sql_db = joe
2249 sql_query = SELECT id, text FROM strings
2252 ## index definition
2254 index strings
2256 source = strings
2257 path = /Users/planetmath/sphinx/search-testing
2258 morphology = none
2261 ## indexer settings
2263 indexer
2265 mem_limit = 32M
2268 ## searchd settings
2270 searchd
2272 listen = 3312
2273 listen = localhost:3307:mysql41
2274 log = /Users/planetmath/sphinx/searchd.log
2275 query_log = /Users/planetmath/sphinx/searchd_query.log
2276 read_timeout = 5
2277 max_children = 30
2278 pid_file = /Users/planetmath/sphinx/searchd.pid
2279 max_matches = 1000
2281 \end{idea}
2283 \begin{notate}{Working from the command line}
2284 Then you can run commands like these.
2285 \end{notate}
2287 \begin{idea}
2288 /usr/local/bin/indexer strings
2289 /usr/local/bin/search "but, then"
2291 % mysql -h 127.0.0.1 -P 3307
2292 mysql> SELECT * FROM strings WHERE MATCH('but, then');
2293 \end{idea}
2295 \begin{notate}{Integrating this with Lisp}
2296 Since we can talk to Sphinx via Mysql
2297 protocol, it seems reasonable that we should be able to talk to
2298 it from CLSQL, too. With a little fussing to get the format
2299 right, I found something that works!
2300 \end{notate}
2302 \begin{idea}
2303 (connect `("127.0.0.1" "" "" "" "3307") :database-type :mysql)
2304 (mapcar (lambda (elt) (floor (car elt)))
2305 (query "select * from strings where match('text')"))
2306 \end{idea}
2308 \begin{notate}{Some added difficulty with Postgresql}
2309 When I try to index things on the server, I get an
2310 error, as below. The question is a good one... I'm
2311 not sure \emph{how} postgresql is set up on the server,
2312 actually...
2313 \end{notate}
2315 \begin{idea}
2316 ERROR: index 'strings': sql_connect: could not connect to server:
2317 Connection refused
2318 Is the server running on host "localhost" and accepting
2319 TCP/IP connections on port 5432?
2320 \end{idea}
2322 \section{Appendix: A simple literate programming system} \label{appendix-lit}
2324 \begin{notate}{The literate programming system used in this paper}
2325 This code defines functions that grab all the Lisp
2326 portions of this document, evaluate the Emacs Lisp
2327 sections in Emacs, and save the Common Lisp sections in
2328 suitable files.\footnote{{\tt
2329 Cf. http://mmm-mode.sourceforge.net/}} It requires
2330 that the \LaTeX\ be written in a certain consistent way.
2331 The function assumes that this document is the current
2332 buffer.
2334 \begin{verbatim}
2335 (defvar lit-code-beginning-regexp
2336 "^\\\\begin{elisp}\\|^\\\\begin{common}{\\([^}\n]*\\)}")
2338 (defvar lit-code-end-regexp
2339 "^\\\\end{elisp}\\|^\\\\end{common}")
2341 (defun lit-process ()
2342 (interactive)
2343 (save-excursion
2344 (let ((to-buffer "*Lit Code*")
2345 (from-buffer (buffer-name (current-buffer)))
2346 (start-buffers (buffer-list)))
2347 (set-buffer (get-buffer-create to-buffer))
2348 (erase-buffer)
2349 (set-buffer (get-buffer-create from-buffer))
2350 (goto-char (point-min))
2351 (while (re-search-forward
2352 lit-code-beginning-regexp nil t)
2353 (let* ((file (match-string 1))
2354 (beg (match-end 0))
2355 (end (save-excursion
2356 (search-forward-regexp
2357 lit-code-end-regexp nil t)
2358 (match-beginning 0)))
2359 (match (buffer-substring-no-properties
2360 beg end)))
2361 (let ((to-buffer
2362 (if file
2363 (concat "*Lit Code*: " file)
2364 "*Lit Code*")))
2365 (save-excursion
2366 (set-buffer (get-buffer-create
2367 to-buffer))
2368 (insert match)))))
2369 (dolist
2370 (buffer (set-difference (buffer-list)
2371 start-buffers))
2372 (save-excursion
2373 (set-buffer buffer)
2374 (if (string= (buffer-name buffer)
2375 "*Lit Code*")
2376 (eval-buffer)
2377 (write-region (point-min)
2378 (point-max)
2379 (concat "~/arxana/"
2380 (substring
2381 (buffer-name
2382 buffer)
2383 12)))))
2384 (kill-buffer buffer)))))
2385 \end{verbatim}
2386 \end{notate}
2388 \begin{notate}{Emacs-export?}
2389 It wouldn't be hard to export the Elisp sections so
2390 that those who wanted to could ditch the literate
2391 wrapper.
2392 \end{notate}
2394 \begin{notate}{Bidirectional updating}
2395 Eventually it would be nice to have a code repository set
2396 up, and make it so that changes to the code can get
2397 snarfed up here.
2398 \end{notate}
2400 \begin{notate}{A literate style}
2401 Ideally, each function will have its own Note to introduce
2402 it, and will not be called before it has been defined. I
2403 sometimes make an exception to this rule, for example,
2404 functions used to form recursions may appear with no
2405 further introduction, and may be called before they are
2406 defined.
2407 \end{notate}
2409 \section{Appendix: Hypertext platforms} \label{appendix-hyper}
2411 \begin{notate}{The hypertextual canon} \label{canon}
2412 There is a core library of texts that come up in
2413 discussions of hypertext.
2414 \begin{itemize}
2415 % \item (Plato)
2416 \item The Rosetta stone
2417 \item The Talmud (Judah haNasi, Rav Ashi, and many others)
2418 \item Monadology (Wilhelm Leibniz)
2419 \item The Life and Opinions of Tristam Shandy, Gentleman
2420 (Lawrence Sterne)
2421 \item Middlemarch (George Eliot)
2422 % \item The Gay Science (Freidrich Nietzsche)
2423 % \item (Wittgenstein)
2424 % \item (Alan Turing)
2425 \item The Nova Trilogy (William S. Burroughs)
2426 \item The Logic of Sense (Gilles Deleuze)
2427 % \item Open Creation and its Enemies (Asger Jorn)
2428 \item Labyrinths (Jorge Luis Borges)
2429 \item Literary Machines (Ted Nelson)
2430 % \item Simulation and Simulacra (Jean Baudrillard)
2431 \item Lila (Robert M. Pirsig)
2432 % \item \TeX: the program (Donald Knuth)
2433 \item Dirk Gently's Holistic Detective Agency
2434 (Douglas Adams)
2435 \item Pussy, King of the Pirates (Kathy Acker)
2436 % \item Rachel Blau DuPlessis,
2437 % \item Emily Dickinson
2438 % \item Gertrude Stein
2439 % \item Zora Neale Hurston
2440 \end{itemize}
2441 At the same time, it is somewhat ironic that none of the
2442 items on this list are themselves hypertexts in the
2443 contemporary sense of the word. It's also a bit funny
2444 that certain other works (even some by the same authors)
2445 aren't on this list. Perhaps we begin to get a sense of
2446 what's going on in this quote from Kathleen
2447 Burnett:\footnote{{\tt http://www.iath.virginia.edu/pmc/text-only/issue.193/burnett.193}}
2448 \begin{quote}
2449 ``Multiplicity, as a hypertextual principle, recognizes a
2450 multiplicity of relationships beyond the canonical
2451 (hierarchical). Thus, the traditional concept of
2452 literary authorship comes under attack from two
2453 quarters--as connectivity blurs the boundary between
2454 author and reader, multiplicity problematizes the
2455 hierarchy that is canonicity.''
2456 \end{quote}
2457 It seems quite telling that non-hypertextual canons remain
2458 mostly-non-hypertextual even today, despite the existence
2459 of catalogs, indexes, and online access.\footnote{{\tt
2460 http://www.gutenberg.org/wiki/Category:Bookshelf}}
2461 \end{notate}
2463 \begin{notate}{A geek's guide to literature}
2464 This title is a riff on Slasov \v{Z}i\v{z}ek's ``A
2465 pervert's guide to cinema''. Taking Note \ref{canon} as a
2466 jumping-off point, why don't we make a survey of
2467 historical texts from the point of view of an aficionado
2468 of hypertext! Just what does one have to do to ``get on
2469 the list''? Just what is ``the hypertextual
2470 perspective''? And, if \v{Z}i\v{z}ek is correct and we're
2471 to look for the hyperreal in the world of cinematic
2472 fictions -- what's left over for the world of literature?
2473 (Or mathematics?)
2474 \end{notate}
2476 \begin{notate}{The number 3}
2477 This is the number of things present if we count carefully
2478 the items $A$, $B$, and a connection $C$ between them.
2479 [Picture of $A\xrightarrow{C} B$.]
2481 (Or even: given $A$ and $B$, we use Wittgenstein counting,
2482 and \emph{intuit} that $C$ exists as the collection $\{A,
2483 B\}$; after all,
2484 some connection must exist precisely because we were
2485 presented with $A$ and $B$ together -- and lest the
2486 connections proliferate infinitely, we lump them all
2487 together as one. [Picture of $A$, $B$,
2488 with the \emph{frame} labeled $C$.])
2489 \end{notate}
2491 \begin{notate}{Surfaces}
2492 Deleuze talks about a theory of surfaces associated with
2493 verbs and events. His surfaces represent the evanescence
2494 of events in time, and of their descriptions in language.
2495 An event is seen as a vanishingly-thin boundary between
2496 one state of being and another.
2498 Certainly, a statement that is true \emph{now} may not be
2499 true five minutes from now. It is easier to think and
2500 talk about things that are coming up and things that have
2501 already happened. ``Living in the moment'' is regarded as
2502 special or even ``Zen''.
2504 We can begin to put these musings on a more solid
2505 mathematical basis. We first examine two types of
2506 \emph{interfaces}:
2507 \begin{enumerate}
2508 \item $A\xrightarrow{C} B$, $A\xrightarrow{D} B$,
2509 $A\xrightarrow{E} B$
2510 (the interface of $A$ and $B$ across $C$, $D$, and $E$);
2511 \item $A\xrightarrow{C} B$, $D\xrightarrow{C} E$,
2512 $F\xrightarrow{C} G$
2513 (the interface of various terms across $C$).
2514 \end{enumerate}
2515 \end{notate}
2517 \begin{notate}{Comic books}
2518 No geek's guide to literature would be complete without
2519 putting comics in a hallowed place. [Framed picture of
2520 $A$, $B$ next to framed
2521 picture of $A$, $B$, $a$.] What happened?
2522 $\ddot{\smile}$
2523 \end{notate}
2525 \begin{notate}{Intersecting triples}
2526 Diagrammatically, it is tempting to portray
2527 $(ACB)_{\mathrm{mid}}DE$ as if it was closely related to
2528 $A(CDE)_{\mathrm{beg}}B$, despite the fact that they are
2529 notationally very different. I'll have to think more
2530 about what this means.
2531 \end{notate}
2533 \section{Appendix: Computational Linguistics} \label{appendix-linguistics}
2535 \begin{notate}{What is this?}
2536 It might be reasonable to make annotating sentences part
2537 of our writeup on hypertext platforms -- but I'm putting
2538 it here for now. If hypertext is what deals with language
2539 artifacts on the ``bulky'' level (saying, for example,
2540 that a subsection is part of a section, and so on), then
2541 computational linguistics is what deals with the finer
2542 levels. However, the distinction is in some ways
2543 arbitrary, and many of the techniques should be at least
2544 vaguely similar.
2545 \end{notate}
2547 \begin{notate}{Annotation sensibilities}\label{sense}
2548 We will want to be able to make at least two different
2549 kinds of annotations of verbs. For example, given the
2550 statement
2551 \begin{itemize}
2552 \item[$S$.] (``Who'' ``is on'' ``first''),
2553 \end{itemize}
2554 I'd like to be able to say
2555 \begin{itemize}
2556 \item[I.](``is on'' ``means'' ``the position of a base runner in baseball'').
2557 \end{itemize}
2558 However, I'd also like to be able to say
2559 \begin{itemize}
2560 \item[II.] (``is on'' ``because'' ``he was walked'').
2561 \end{itemize}
2562 Annotation I is meant to apply to the term ``is on''
2563 itself (in a context that might be more general than just
2564 this one sentence). If Who is also on steroids, that's
2565 another matter -- as this type of annotation helps make
2566 clear!
2568 Annotation II is meant to apply to the term ``is on''
2569 \emph{as it
2570 appears in sentence $S$}. In particular, Annotation II
2571 seems to work best in a context in which we've already
2572 accepted the ontological status of the verb-phrase ``is
2573 on first''.
2575 Whereas Annotation I should presumably exist before
2576 statement $S$ is ever made (and it certainly helps make
2577 that statement make sense), Annotation II is most properly
2578 understood with reference to the fully-formed statement
2579 $S$. However, Annotation II is different from a statement
2580 like ($S$ ``has truth value'' $F$) in that it looks into
2581 the guts of $S$.
2582 \end{notate}
2584 \begin{notate}{Comparison of places and ontological status} \label{places-and-onto-status}
2585 The difference between (I) a ``global'' annotation, and
2586 (II) the annotation of a specific sentence is analogous to
2587 the difference between (a) relationships between objects
2588 without a place, and (b) relationships between objects in
2589 specific places. (Cf. Note \ref{sense}: ``global''
2590 statements are of course made ``local'' by the theories
2591 that scope them.)
2593 For example, in a descriptive ontology of research
2594 documents, I might make the ``placeless'' statement,
2595 \begin{itemize}
2596 \item[a.] (``Introduction'' ``names'' ``a section'')
2597 \end{itemize}
2598 On the other hand, the statement
2599 \begin{itemize}
2600 \item[b.] (``Introduction'' ``has subject'' ``American
2601 History''),
2602 \end{itemize}
2603 seems likely to be about a specific Introduction. (And
2604 somewhere in the backend, this triple should be expressed
2605 in terms of places!)
2606 \end{notate}
2608 \begin{notate}{Semantics}
2609 In a sentence like
2610 \begin{quote}
2611 (((``I'' ``saw'' ``myself'')$_{\mathrm{mid}}$ ``as if''
2612 ``through a glass'')$_{\mathrm{beg}}$ ``but'' ``darkly'')
2613 \end{quote}
2614 first of all, there may be different parenthesizations,
2615 and second of all, the semantics of links like ``as if''
2616 and ``but'' may shape, to some extent, the ways in
2617 which we parethesize.
2618 \end{notate}
2620 \section{Appendix: Resource use} \label{appendix-resources}
2622 \begin{notate}{Free culture in action}
2623 I thought it worthwhile to include this quote from
2624 a joint paper with Aaron Krowne:\footnote{See Footnote
2625 \ref{corneli-krowne}.}
2626 \begin{quote}
2627 ``[F]ree content typically
2628 manifests aspects of a common resource as well as an
2629 open access resource; while anyone can do essentially
2630 whatever they wish with the content offline, in its
2631 online life, the content is managed in a
2632 socially-mediated way. In particular, rights to
2633 \emph{in situ} modification tend to be strictly
2634 controlled. [...] By finding new ways to support
2635 freedom of speech within CBPP documents, we embrace
2636 subjectivity as a way to enhance the content of an
2637 intersubjectively valued corpus. In the context of
2638 ``hackable'' media and maintenance protocols, the
2639 semantics with which scholia are handled can be improved
2640 upon indefinitely on a user-by-user basis and a
2641 resource-wide basis. This is free culture in action.''
2642 \end{quote}
2643 \end{notate}
2645 \begin{notate}{Learning}
2646 The learner, confronted with a learning resource, or the
2647 consumer of any other information resource (or indeed,
2648 practically any resource whatsoever) may want a chance to
2649 respond to the questions ``was this what you were looking
2650 for?'' and ``did you find this helpful?''. In some cases,
2651 an independent answer to that question could be generated
2652 (e.g. if a student is seen to come up with a correct
2653 answer, or not).
2654 \end{notate}
2656 \begin{notate}{Connections}
2657 A useful communication goal is to expose some of the
2658 connections between disparate resources. Some existing
2659 connections may be far more explicit than others. It's
2660 important to facilitate the making and explicating of
2661 connections by ``third parties'' (Note
2662 \ref{browser-within}). The search for connections between
2663 ostensibly unrelated things is a key part of both
2664 creativity and learning. In addition, connecting with
2665 what others are doing is an important part of being a
2666 social animal.
2667 \end{notate}
2669 \begin{notate}{Boundaries}
2670 Notice that the departmentalization of knowledge is
2671 similar to any regime that oversees and administers
2672 boundaries. In addition to bridging different areas,
2673 learning often involves pushing one's boundaries and
2674 getting out of one's comfort zone. The ``sociological
2675 imagination'' involves seeing oneself as part of something
2676 bigger; this goes along with the idea of a discourse that
2677 lowers or transcends the boundaries between participants.
2678 Imagination of any form can challenge myopic patterns of
2679 resource use, although there are also myopic fictions
2680 which neglect to look at what's going on in reality!
2681 \end{notate}
2683 \end{document}