Class NCSqlModelGenerator


  • public class NCSqlModelGenerator
    extends Object
    Command line utility to generate YAML/JSON NLPCraft model stub from given SQL RDBMS.

    This command line utility take several parameters like JDBC URL and driver, database schema, and optional set of tables and columns for which it will generate YAML/JSON NLPCraft model stub. Run this class with --help parameter to get a full up-to-date documentation:

     java -cp apache-nlpcraft-incubating-x.x.x-all-deps.jar org.apache.nlpcraft.model.tools.sqlgen.NCSqlModelGenerator --help
     

    After the model stub is generated:

    • Load generated YAML/JSON-based model using NCModelFileAdapter class to instantiate model from this file.
    • Modify and extend generated model stub to your own needs. In most cases, you'll need to add, remove or modify auto-generated synonyms, add intents, etc. Note, however, that generated model is fully complete and can be used as is.
    • Use NCSqlSchemaBuilder.makeSchema(NCModel) method to get an object representation of the SQL data schema for the model. You can use this object representation along with many utility methods in NCSqlExtractor class to efficiently auto-generate SQL queries against the source RDBMS.
    See Also:
    NCModelFileAdapter, NCSqlSchemaBuilder, NCSqlExtractor
    • Constructor Detail

      • NCSqlModelGenerator

        public NCSqlModelGenerator()
    • Method Detail

      • main

        public static void main​(String[] args)
        Runs SQL model generator with given command line parameters.
        Parameters:
        args - Command line parameters. Execute with --help parameter to get a full documentation.
        Throws:
        org.apache.nlpcraft.common.NCException - Thrown in case of any errors.