Posted By

TopcatSoftware on 01/18/11


Tagged

database


Versions (?)

TOPIC database format


 / Published in: Pseudocode
 

URL: http://www.topcat.hypermart.net/index.html

Specifications of the TOPIC database format, a standardized structure for plain text databases that's easy to read and edit in most text editors, and easy to programmatically parse as well.

  1. +SYNOPSIS
  2.  
  3.  
  4. This document describes the formal specifications of the TOPIC
  5. database format and serves as its canonical reference.
  6.  
  7. Designed for humans first and machines second, the TOPIC format
  8. attempts to provide a standardized structure for plain text
  9. databases that's easy to read and edit in most text editors, and
  10. easy to programmatically parse as well [i].
  11.  
  12. Uses include: knowledge-bases, glossaries, apropos, notes...
  13.  
  14.  
  15. +KEY CONCEPTS
  16.  
  17.  
  18. - TOPIC databases are OS neutral.
  19.  
  20. - TOPIC databases are self-indexing.
  21.  
  22. - TOPIC databases provide associations linking blocks of data.
  23.  
  24. - TOPIC databases are written and read as standard ASCII [ii], so
  25. virtually any plain text editor is suitable for editing chores.
  26.  
  27. - TOPIC databases use fundamentally simple markup [iii] employing
  28. only the plus ('+') and comma (',') characters to delimit content.
  29.  
  30. - TOPIC databases allow the end user to label data in a straight
  31. foreword, intuitive manner.
  32.  
  33.  
  34. +TAGS
  35.  
  36.  
  37. - A tag line always begins with a single + character [HEX:2B] [iv].
  38.  
  39. - Tags are always located above the block it describes, alone on a
  40. single line.
  41.  
  42. - Tags only contain alpha/numeric characters A-Z, a-z, 0-9, and
  43. optionally spaces [HEX:20] [iv].
  44.  
  45. - A tag can be either a single word, or a group of words.
  46.  
  47. - Multiple tags are comma delimited [HEX:2C] [iv].
  48.  
  49.  
  50. +BLOCKS
  51.  
  52.  
  53. - A block is always located below the tags that describe it.
  54.  
  55. - Block lines never begin with a + character [HEX:2B] [iv].
  56.  
  57. - A block may contain any number of lines.
  58.  
  59. - Empty lines within a block are valid.
  60.  
  61.  
  62. +LINES
  63.  
  64.  
  65. - Lines are terminated with one of CR [HEX:0D], LF [HEX:0A], or a
  66. CR/LF pair [iv].
  67.  
  68. - No limits are imposed on the length of a given line [v].
  69.  
  70.  
  71. +ASSOCIATIONS
  72.  
  73.  
  74. Using multiple tags establishes associations between otherwise
  75. unrelated blocks. In the example below, the first block has a tag
  76. named 'Apples', the second block has a tag named 'Oranges', and both
  77. blocks have a common tag named 'Fruit' as shown in the next two
  78. blocks:
  79.  
  80.  
  81. +Apples, Fruit
  82.  
  83.  
  84. Block line 1
  85. Block line 2
  86. Block line n...
  87.  
  88.  
  89. +Oranges, Fruit
  90.  
  91.  
  92. Block line 1
  93. Block line 2
  94. Block line n...
  95.  
  96.  
  97. This means you can stream the first block with the 'Apples' tag,
  98. stream the second block with the 'Oranges' tag, or stream both
  99. blocks via the 'Fruit' tag. The advantage gained is that your data
  100. can be filtered in an arbitrary manner. For instance, you could have
  101. twelve blocks, each with differing month tags, and a common year tag
  102. allowing you to scrutinize your data by month as well as year...
  103.  
  104.  
  105. +PARSING
  106.  
  107.  
  108. - TOPIC databases are parsed line-by-line sequentially from top to
  109. bottom, and left to right.
  110.  
  111. - Parsing ignores blocks, seeking only tags matching the current
  112. query, and when a match is found, outputs the associated block.
  113.  
  114. - Because a given tag can define multiple blocks, the data should
  115. be parsed in its entirety 'per query'.
  116.  
  117.  
  118. +MODIFICATIONS
  119.  
  120.  
  121. There are no formally sanctioned modifications to the TOPIC database
  122. specification. However, the user is free to extend and alter the
  123. format as best fits the need provided all legalese is observed.
  124.  
  125.  
  126. +UPDATES
  127.  
  128.  
  129. Updates, parsing examples, and other resources are located at:
  130.  
  131. http://www.topcat.hypermart.net/index.html
  132.  
  133.  
  134. +NOTES
  135.  
  136.  
  137. i. Parse: To scan/analyze data looking for a desired pattern.
  138.  
  139. ii. ASCII: American Standard Code for Information Interchange.
  140.  
  141. iii. Markup: A system for annotating text.
  142.  
  143. iv. See topic 'HEX TABLE' for ASCII/hexadecimal equivalents.
  144.  
  145. v. Caveat: The user should recognize the constraints governing
  146. both the hardware and software rendering the data.
  147.  
  148.  
  149. +HEX TABLE
  150.  
  151.  
  152. ASCII/hexadecimal equivalents used in this document:
  153.  
  154. 0 1 2 3 4 5 6 7 8 9 A B C D E F
  155.  
  156. 0 ^@ ^A ^B ^C ^D ^E ^F ^G ^H ^I ^J ^K ^L ^M ^N ^O
  157. 1 ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z ^[ ^\ ^] ^^ ^_
  158. 2 SPC ! " # $ % & ' ( ) * + , - . /
  159. 3 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
  160. 4 @ A B C D E F G H I J K L M N O
  161. 5 P Q R S T U V W X Y Z [ \ ] ^ _
  162. 6 ` a b c d e f g h i j k l m n o
  163. 7 p q r s t u v w x y z { | } ~ DEL
  164.  
  165.  
  166. +LEGALESE
  167.  
  168.  
  169. The TOPIC database specification is copyright Topcat Software LLC.
  170. and is absolutely free for anyone to use for any reason in
  171. perpetuity. A single line citation is requested in the form of:
  172.  
  173. TOPIC database specification by Topcat Software LLC.
  174.  
  175. eof

Report this snippet  

You need to login to post a comment.