-
Notifications
You must be signed in to change notification settings - Fork 0
CliInterface
#CLI interface
The command line interface is presently the main user interface of the minerule system. It is composed of a main minerule command (the mr
) command and several subcommands. Each command (and subcommand) has its own help that can be activated using the -h
option. For instance, by issuing mr -h
at the command line, the following text is displayed:
Usage:
mr -h - shows this message.
mr <sub-command> [-h] [options] - executes a sub-command. Use the -h option for further information.
Available sub-commands are: print, catalogue, defaults, match, query.
Note: Sub-commands can be shortened at will, e.g.: 'mr pr' is equivalent to 'mr print'
By issuing mr <sub-command>
at the shell prompt, the mr
program will search for a program named mr-<sub-command>
in the current search path and invoke that command with the options following the sub-command. As an additional feature mr
allows the user to abbreviate the sub-command as much as he feels comfortable. For instance, mr cat -C
is totally equivalent to invoking mr-catalogue -C
.
mr-defaults
prints a minerule options file to the standard output and exits.
Usage: mr-defaults [-h] [-v] [-f optionfile] [-O optionstring] [optfile]
If -v is given, the program outputs its version number and exits
If an option file is specified, the program reads it and outputs the resulting options immediately afterwards (useful to check that the file syntax is correct and that the minerule correctly parses it).
If more than one option file is specified, latter options override former ones. The same holds with the options
given using the -O
flag.
NOTE: all options regarding streams will be either commented or set to default values (for implementation reasons it is not possible to retrieve the file name they point to and printing a number representing a pointer in memory is likely to lead to some kind of misunderstanding).
Usage:
mr-catalogue [-v] [-h] [-f <optionfile>] [-C] [-I] [-U] [-n <queryname>] [-l] [-d] [-a <ori>,<der>][-c] [-F <formatSpecs>]
Handles the minerule catalogue.
Program Information
-v - Output the version message and exits.
-h - Output this message and returns NOTHING_TO_DO.
Option Handling
-f - file name of the option file (if omitted the program will)
look for a file named 'option.txt' in the current directory
Installation
-C - Checks if the optimizer catalogue is installed correctly and exits.
-I - Installs the optimizer catalogue and exits.
-U - Uninstall the catalogue (be careful, this cannot be undone!).
dbms must be either 'mysql' or 'postgres'.
Dealing with Catalogue Entries
-n - Look in the catalogue for the specified query.
it returns QUERY_NAME_FOUND, or QUERY_NAME_NOT_FOUND
accordingly to whether the query could be found.
-l - Print the list of already executed queries, returns
SUCCESS upon completion.
-d - Delete the given minerule from the system (notice that
the safety options in the option file must be setted
in such a way to allow the deletion.
-a - Adds a derived result set. You must provide the name <ori> of the original
minerule and the name <der> of the derived result. The database must then
contain a table named <der> and two additional tables <der>_body_elems and
<der>_head_elems
Output Handling
-c - Disables color output.
-F - Format specifiers for printing the list of queries (-l)
Valid specifiers: s - Print the size of the result set
t - Print the text of the original mr
r - Print the result set table names
the default is '', i.e.: print onlty the qry name.
Return Values:
SUCCESS = 0
NOTHING_TO_DO = 1
QUERY_NAME_FOUND = 2
CATALOGUE_NOT_INSTALLED = 4
QUERY_NAME_NOT_FOUND = 3
ERROR_OPTION_PARSING = 5
ERROR_CANNOT_OPEN_OPTION_FILE = 6
You should specify at least one -f option or provide ./options.txt
Usage:
mr-query [-c] [-i <mineruletextfile>] [-m '<mineruletext>']
-f <mineruleoptionfile> -O <optionlist> -v -h
-c -- disable colors in messages
-i -- specify a file name containing the text of the minerule
-m -- the argument is the text of the minerule
-f -- specify a file name containing the Options to be used.
more than one is allowed and later ones override the options
read from previous ones
-O -- Allows to specify some options from the command line
whether those options overrides or not the ones given by -f
commands depends on which comes first
-v -- version informations
-h -- this message
exit codes:
0 - MR_ERROR_NO_ERROR
1 - MR_ERROR_UNKNOWN
2 - MR_ERROR_INTERNAL
3 - MR_ERROR_INPUT_FILE_NOT_FOUND
4 - MR_ERROR_OUTPUT_FILE_PROBLEM
5 - MR_ERROR_NO_MINERULE_SPECIFIED
6 - MR_ERROR_NO_OPTIONFILE_SPECIFIED
7 - MR_ERROR_OPTION_CONFIGURATION
8 - MR_ERROR_MINERULE_ALREADY_EXISTS
9 - MR_ERROR_DATABASE_ERROR
10 - MR_ERROR_OPTION_PARSING
11 - MR_ERROR_MINERULETEXT_PARSING
12 - MR_ERROR_CATALOGUE_ERROR
13 - MR_ERROR_OPTIMIZER_ERROR
14 - MR_ERROR_INSTALLATION_PROBLEM
15 - MR_ERROR_SAFETY_PROBLEM
Usage:
mr-print [-h] [-f <optionfile>] [-0] [-c] [-n minerule-number] [-s <order>] resultsetname
The program allows printing results of minerule queries.
-h - prints this message
-f - Specifies a minerule option file (default: 'options.txt')
-c - suppress colors
-0 - suppresses logging artifacts
-l - do not filter out rules having low confidence
-n - specifies a query number to be printed (this is an alternative to
specifying the query name)
-s - sorts the rules in a specified order.
supported orders are:
'no' -> no particular order (fastest display)
'scbh' -> order is support, confidence, body, head
'bhsc' -> order is body, head, supp, conf
'hbsc' -> order is head, body, supp, conf
'csbh' -> order is conf, supp, body, head
'cbhs' -> order is conf, body, head, supp
'cbsh' -> order is conf, body, supp, head
the default is 'no'
Usage:
mr-match [-h] [-c] [-n <num query>] [-O <optionlist>] [-f <optionfile>] [-d <outputtable>] [-t <table name>] [-s <sort order>] [<query name>]
-h - prints this message.
-c - suppress colors.
-n - specifies a query number (instead of a query name).
-O - specifies a minerule option on the command line (overrides those read from file).
-f - specify a file name containing the Options to be used.
default is 'optins.txt'
-d - redirect the output onto the database. The output table must
be specified as the argument to this option
-t - specify a table name for the match (the table *must* have the
same schema as the mining table used for the query)
-s - sets the output sorting order. The parameter can be set to:
RuleGids, to produce an output with the format: 'rule -> list of matching gids'
GidRules, to produce an output with the format: 'gid -> list of matching rules'.
default is 'RuleGids'. You can shorten the parameters as you