1STAG-DB(1)            User Contributed Perl Documentation           STAG-DB(1)
2
3
4

NAME

6       stag-db - persistent storage and retrieval for stag data (xml, sxpr,
7       itext)
8

SYNOPSIS

10         stag-db -r person -k social_security_no -i ./person-idx myrecords.xml
11         stag-db -i ./person-idx -q 999-9999-9999 -q 888-8888-8888
12

DESCRIPTION

14       Builds a simple file-based database for persistent storage and
15       retrieval of nodes from a stag compatible document.
16
17       Imagine you have a very large file of data, in a stag compatible format
18       such as XML. You want to index all the elements of type person; each
19       person can be uniquely identified by social_security_no, which is a
20       direct subnode of person
21
22       The first thing to do is to build an index file, which will be stored
23       in your current directory:
24
25         stag-db -r person -k social_security_no -i ./person-idx myrecords.xml
26
27       You can then use the index "person-idx" to retrieve person nodes by
28       their social security number
29
30         stag-db -i ./person-idx -q 999-9999-9999 > some-person.xml
31
32       You can export using different stag formats
33
34         stag-db -i ./person-idx -q 999-9999-9999 -w sxpr > some-person.xml
35
36       You can retrieve multiple nodes (although these need to be rooted to
37       make a valid file)
38
39         stag-db -i ./person-idx -q 999-9999-9999 -q 888-8888-8888 -top personset
40
41       Or you can use a list of IDs from a file (newline delimited)
42
43         stag-db -i ./person-idx -qf my_ss_nmbrs.txt -top personset
44
45   ARGUMENTS
46       -i INDEXFILE
47
48       This file will be used as the persistent index for storage/retrieval
49
50       -r RELATION-NAME
51
52       This is the name of the stag node (XML element) that will be stored in
53       the index; for example, with the XML below you may want to use the node
54       name person and the unique key id
55
56         <person_set>
57           <person>
58             <id>...</id>
59           </person>
60           <person>
61             <id>...</id>
62           </person>
63           ...
64         </person_set>
65
66       This flag should only be used when you want to store data
67
68       -k UNIQUE-KEY
69
70       This node will be used as the unique/primary key for the data
71
72       This node should be nested directly below the node that is being stored
73       in the index - if it is more that one below, specify a path
74
75       This flag should only be used when you want to store data
76
77       -u UNIQUE-KEY
78
79       Synonym for -k
80
81       -p PARSER
82
83       This can be the name of a stag supported format (xml, sxpr, itext) -
84       XML is assumed by default
85
86       It can also be a module name - this module is used to parse the input
87       file into a stag stream; see Data::Stag::BaseGenerator for details on
88       writing your own parsers/event generators
89
90       This flag should only be used when you want to store data
91
92       -q QUERY-ID
93
94       Fetches the relation/node with unique key value equal to query-id
95
96       Multiple arguments can be passed by specifying -q multple times
97
98       This flag should only be used when you want to query data
99
100       -top NODE-NAME
101
102       If this is specified in conjunction with -q or -qf then all the query
103       result nodes will be nested inside a node with this name (ie this
104       provides a root for the resulting document tree)
105
106       -qf QUERY-FILE
107
108       This is a file of newline-seperated IDs; this is useful for querying
109       the index in batch
110
111       -keys
112
113       This will write a list of all primary keys in the index
114
115       -w WRITER
116
117       This format will be used to write the data; can be any stag format
118       (xml, sxpr, itext) - default XML.
119
120       Can also be a module that catches the incoming stag event stream and
121       does something with it (for example, this could be a module you write
122       yourself that transforms the stag events into HTML)
123

SEE ALSO

125       Data::Stag
126
127       For more complex stag to database mapping, see DBIx::DBStag and the
128       scripts
129
130       stag-storenode
131
132       selectall_xml
133
134
135
136perl v5.30.1                      2020-01-29                        STAG-DB(1)
Impressum