Let M be a semantic network retrieval model. Let o be an input object
with X as its set of labels. T is a table mapping the ids of objects in to
the scores representing their similarity with the query object, i.e., reals. Initially, T
maps each id to 0. Let V be the vector representation of T, i.e., , where
for all i . Let E be a table mapping expectations to tokens. If e is
an expectation, then key(e, E) denotes the token to which E
maps e. The procedure retrieve
returns M(o). The
procedure spread
activates nodes with at least one completed sequence. A
callback is an arbitrary piece of code that can be associated with a node in a network.
Callbacks are helpful in book-keeping, e.g., keeping track of how many times a given node
has been referenced by a given input. The procedure run
is a primitive that
takes a callback and executes it.
0 procedure retrieve(o, M, T) 1 for each [s] in X 2 T = spread(o, [s], T); 3 convert T to V; 4 sort V's entries by similarity 5 in nonincreasing order; 6 sort V's entries with equal similarity 7 by id in increasing order; 8 return the sequence of ids as they occur 9 in V from left to right; 10 procedure spread(o, [s], T) 11 for each e in [s] 12 activate(e, T); 13 return T; 14 procedure activate(e, T) 15 for each abstraction a of e 16 for each expectation e keyed on a 17 advance(e, T); 18 for each callback c of a 19 run(c); 20 procedure advance(x, T) 21 if null(ecseq(x)) 22 then 23 y = f(g([s], o), g(eseq(x), eobj(x))); 24 if ( T[eobj(x)] < y ) 25 then T[eobj(x)] = y; 26 activate(eobj(x)); 27 else 28 [v] = tail(ecseq(x)); 29 ne = newexp(eobj(x), eseq(x), [v]); 30 key(ne, E) = head([v]); 31 procedure newexp(o, [x], [v]) 32 return a new expectation [o, [x], [v]];