Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Topic Database System

32 views
Skip to first unread message

Mike Sanders

unread,
Jan 2, 2017, 12:29:20 PM1/2/17
to
#!/bin/sh

<<MSG

TOPIC DATABASE SYSTEM [c]2016 Michael Sanders

setup...

. save this script as: 'topic'
. flip on script's executable bit: 'chmod +x /path/topic'
. for help, invoke script without arguments...
. to stream index, invoke as: 'topic -i'
. to stream a given block, invoke as (for instance): 'topic fruit'

MSG

[ $# -eq 0 ] && {
awk 'q;/^:EMBED:/{q++}' $0 | less
exit
}

awk 'q;/^:EMBED:/{q++}' $0 | awk -v TPC="$*" '

BEGIN{

TAG = "^tag:"
NDX = (TPC == "-i")
RGX = "(" TAG "|,)[[:space:]]*" tolower(TPC) "[[:space:]]*(,|$)"

}

{INP = tolower($0); FND = (INP ~ TAG)}
FND {BLK = (INP ~ RGX)}
(NDX && FND) || BLK'

exit # be alert (the world need more lerts...)

:EMBED:


TOPIC DATABASE SYSTEM MANUAL


TAG: 1, SYNOPSIS


This document serves as the canonical reference describing the
TOPIC DATABASE SYSTEM (hereafter referred to as 'markup') and is
itself formatted as such.

TOPIC markup provides a contextual grammar for demarcating blocks
of plaintext that when taken together form a TOPIC database. Such
a database can be read/modified by virtually any text editor,
easily parsed, and perhaps most importantly, preserves blocks of
data without change.

Uses include: knowledge-bases, glossaries, apropos, notes...


TAG: 2, KEY CONCEPTS


TOPIC markup has the following core attributes...

. Written and read as standard ASCII.

. Minimal grammar for convenience.

. Associations linking blocks of data.

. Self-indexing.

. OS neutral.


TAG: 3, TAGS


. Tag lines are always prefixed with the case insensitive
reserved phrase 'TAG:'.

. A tag line is always located above the block it describes,
alone on a single line.

. Tags only contain alpha/numeric characters A-Z/a-z/0-9,
and optionally spaces.

. A tag can be either a single word, or a group of words.

. Multiple tags on a single line are comma ',' delimited.

. A given tag can be used any number of times.


TAG: 4, BLOCKS


. A block is always located below its tag line.

. A block never contains the reserved phrase 'TAG:'
(case insensitive) beginning at column 1.

. Blocks may contain any number of lines.

. Empty lines within a block are valid.


TAG: 5, PARSING


. Queries are case insensitive.

. Per query, a file is read in its entirety, line-by-line
sequentially top-to-bottom, and each tag line left-to-right.

. Every tag line is tested for equivalence against the current
query and if a match occurs, the 1st block beneath the matching
tag line is streamed to standard output up to and excluding the
next tag line.


TAG: 6, ASSOCIATIONS


Using multiple tags per tag line can establish associations
between otherwise unrelated blocks. As shown in the following two
blocks, the 1st block has a tag named 'Apples', the 2nd block has
a tag named 'Oranges', and both have a common tag named 'Fruit'...


TAG: 7, Apples, Fruit


Block line 1
Block line 2
Block line n...


TAG: 8, Oranges, Fruit


Block line 1
Block line 2
Block line n...


This means you can stream the 1st block with the 'Apples' tag,
stream the 2nd block with the 'Oranges' tag, or stream both
blocks via the 'Fruit' tag. The advantage gained is that your
data can be filtered in an arbitrary manner. For instance, you
could have twelve blocks, each with differing month tags, and a
common year tag allowing you to scrutinize your data by month as
well as by year...


TAG: 9, LEGALESE


TOPIC DATABASE SYSTEM
[c]2016 Michael Sanders <echo moc....@ytt.emorhc | rev>
All rights reserved.

License: Reprint freely so long as nothing is modified.


eof

luser- -droog

unread,
Jan 6, 2017, 1:52:15 AM1/6/17
to
On Monday, January 2, 2017 at 11:29:20 AM UTC-6, Mike Sanders wrote:
> #!/bin/sh
>
> <<MSG
>
> TOPIC DATABASE SYSTEM [c]2016 Michael Sanders
>

Brilliant! Thanks for sharing!

Mike Sanders

unread,
Jan 29, 2017, 6:20:14 AM1/29/17
to
On 2017-01-06, luser- -droog <mij...@yahoo.com> wrote:

>> TOPIC DATABASE SYSTEM [c]2016 Michael Sanders
>>
>
> Brilliant! Thanks for sharing!

Excuse the delayed reply (work...)

Thank you kind sir & I hope you can put that pup to good use!

--
later on,
Mike

http://busybox.hypermart.net
0 new messages