Class ScriptParser
The ScriptParser can create schemas and load data from a set of commands in a sparksee script.
A SPARKSEE script contains an ordered list of commands. ScriptParser will execute each one of them in order. Commands may create schemas, define nodes and edges, and load data into a previous defined SPARKSEE schema.
Check out the 'Scripting' chapter in the SPARKSEE User Manual for a comprehensive explanation on the grammar of the SPARKSEE commands and how they work.
- Author:
- Sparsity Technologies http://www.sparsity-technologies.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidgenerateSchemaScript(String path, Database db) Writes an script with the schema definition for the given database.static voidmain()Executes ScriptParser for the given file path.booleanParses the given input file.voidsetErrorLog(String path) Sets the error log.voidsetOutputLog(String path) Sets the output log.
-
Constructor Details
-
ScriptParser
public ScriptParser()Constructor.
-
-
Method Details
-
setErrorLog
Sets the error log.If not set, error log corresponds to standard error output.
- Parameters:
path- [in] Path of the error log.- Throws:
IOException- If bad things happen opening the file.
-
generateSchemaScript
Writes an script with the schema definition for the given database.- Parameters:
path- [in] Filename of the script to be writen.db- [in] Database.- Throws:
IOException- If bad things happen opening or writing the file.
-
parse
Parses the given input file.- Parameters:
path- [in] Input file path.execute- [in] If TRUE the script is executed, if FALSE it is just parsed.localeStr- [in] The locale string for reading the input file. See CSVReader.- Returns:
- TRUE if ok, FALSE in case of error.
- Throws:
IOException- If bad things happen opening the file.
-
main
public static void main()Executes ScriptParser for the given file path.One argument is required, a file path which contains the script to be parsed.
A second argument may be given, a boolean to set if the script must be executed or just parsed.If not given, the script will be executed.
-
setOutputLog
Sets the output log.If not set, output log corresponds to standard output.
- Parameters:
path- [in] Path of the output log.- Throws:
IOException- If bad things happen opening the file.
-