(BLOCK (PARA (TEXT "A context directive calculates the ") (FORMAT-EMPH () (TEXT "context")) (TEXT " of a list of zettel identifier.") (SOFT) (TEXT "It starts with the keyword ") (LITERAL-INPUT () "CONTEXT") (TEXT ".")) (PARA (TEXT "Optionally you may specify some context details, after the keyword ") (LITERAL-INPUT () "CONTEXT") (TEXT ", separated by space characters.") (SOFT) (TEXT "These are:")) (UNORDERED (INLINE (LITERAL-INPUT () "FULL") (TEXT ": additionally search for zettel with the same tags,")) (INLINE (LITERAL-INPUT () "BACKWARD") (TEXT ": search for context only though backward links,")) (INLINE (LITERAL-INPUT () "FORWARD") (TEXT ": search for context only through forward links,")) (INLINE (LITERAL-INPUT () "COST") (TEXT ": one or more space characters, and a positive integer: set the maximum ") (FORMAT-EMPH () (TEXT "cost")) (TEXT " (default: 17),")) (INLINE (LITERAL-INPUT () "MAX") (TEXT ": one or more space characters, and a positive integer: set the maximum number of context zettel (default: 200)."))) (PARA (TEXT "If no ") (LITERAL-INPUT () "BACKWARD") (TEXT " and ") (LITERAL-INPUT () "FORWARD") (TEXT " is specified, a search for context zettel will be done though backward and forward links.")) (PARA (TEXT "The cost of a context zettel is calculated iteratively:")) (UNORDERED (INLINE (TEXT "Each of the specified zettel hast a cost of one.")) (INLINE (TEXT "A zettel found as a single folge zettel or single precursor zettel has the cost of the originating zettel, plus 0.1.")) (INLINE (TEXT "A zettel found as a single sequel zettel or single prequel zettel has the cost of the originating zettel, plus 1.0.")) (INLINE (TEXT "A zettel found as a single successor zettel or single predecessor zettel has the cost of the originating zettel, plus seven.")) (INLINE (TEXT "A zettel found via another link without being part of a ") (LINK-ZETTEL () "00001006032500" (TEXT "set of zettel identifier")) (TEXT ", has the cost of the originating zettel, plus two.")) (INLINE (TEXT "A zettel which is part of a set of zettel identifier, has the cost of the originating zettel, plus one of the four choices above and multiplied with roughly a linear-logarithmic value based on the size of the set.")) (INLINE (TEXT "A zettel with the same tag, has the cost of the originating zettel, plus a linear-logarithmic number based on the number of zettel with this tag.") (SOFT) (TEXT "If a zettel belongs to more than one tag compared with the current zettel, there is a discount of 90% per additional tag.") (SOFT) (TEXT "This only applies if the ") (LITERAL-INPUT () "FULL") (TEXT " directive was specified."))) (PARA (TEXT "The maximum cost is only checked for all zettel that are not directly reachable from the initial, specified list of zettel.") (SOFT) (TEXT "This ensures that initial zettel that have only a highly used tag, will also produce some context zettel.")) (PARA (TEXT "Despite its possibly complicated structure, this algorithm ensures in practice that the zettel context is a list of zettel, where the first elements are ") (FORMAT-QUOTE () (TEXT "near")) (TEXT " to the specified zettel and the last elements are more ") (FORMAT-QUOTE () (TEXT "distant")) (TEXT " to the specified zettel.") (SOFT) (TEXT "It also penalties zettel that acts as a ") (FORMAT-QUOTE () (TEXT "hub")) (TEXT " to other zettel, to make it more likely that only relevant zettel appear on the context list.")) (PARA (TEXT "This directive may be specified only once as a query directive.") (SOFT) (TEXT "A second occurence of ") (LITERAL-INPUT () "CONTEXT") (TEXT " is interpreted as a ") (LINK-ZETTEL () "00001007701000" (TEXT "search expression")) (TEXT ".") (SOFT) (TEXT "In most cases it is easier to adjust the maximum cost than to perform another context search, which is relatively expensive in terms of retrieving effort.")))