public class ScriptParser
extends java.lang.Object
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.
Constructor and Description |
---|
ScriptParser()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
generateSchemaScript(java.lang.String path,
Database db)
Writes an script with the schema definition for the given database.
|
static void |
main()
Executes ScriptParser for the given file path.
|
boolean |
parse(java.lang.String path,
boolean execute,
java.lang.String localeStr)
Parses the given input file.
|
void |
setErrorLog(java.lang.String path)
Sets the error log.
|
void |
setOutputLog(java.lang.String path)
Sets the output log.
|
public void setErrorLog(java.lang.String path) throws java.io.IOException
If not set, error log corresponds to standard error output.
path
- [in] Path of the error log.java.io.IOException
- If bad things happen opening the file.public static void generateSchemaScript(java.lang.String path, Database db) throws java.io.IOException
path
- [in] Filename of the script to be writen.db
- [in] Database.java.io.IOException
- If bad things happen opening or writing the file.public boolean parse(java.lang.String path, boolean execute, java.lang.String localeStr) throws java.io.IOException
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.java.io.IOException
- If bad things happen opening the file.public static void main()
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.
public void setOutputLog(java.lang.String path) throws java.io.IOException
If not set, output log corresponds to standard output.
path
- [in] Path of the output log.java.io.IOException
- If bad things happen opening the file.