Skip to content

[Workbench] Configuration Files for Dynamic Class Template Selection

Tom Wong edited this page Mar 1, 2017 · 6 revisions

To support the dynamic class template selection in the Workbench, two XML Configuration files were created.

  1. BaseTemplateConfig.xml

BaseTemplateConfig.xml stores the information of the base template, which is the container for all the parameter classes. A sample BaseTemplateConfig.xml is shown below.


<?xml version="1.0" encoding="UTF-8"?\>
<BaseTemplateConfig templatePath="BaseTemplates/BaseTemplateDefault.xml" allParamsClassesConfigFilePath="ParamsClassTemplateConfig/AllParamsClasses.xml"\>
    <ParamsClassesType name = "NeuronsParamsClasses" nodePath="/BGSimParams/ModelParams/NeuronsParams"/>
    <ParamsClassesType name = "SynapsesParamsClasses" nodePath="/BGSimParams/ModelParams/SynapsesParams"/>
    <ParamsClassesType name = "ConnectionsParamsClasses" nodePath="/BGSimParams/ModelParams/ConnectionsParams"/>
    <ParamsClassesType name = "LayoutParamsClasses" nodePath="/BGSimParams/ModelParams/LayoutParams"/>
</BaseTemplateConfig>

"BaseTemplateConfig" node is the root node. The "templatePath" attribute defines the relative path to the base template. The "allParamsClassesConfigFilePath" attribute stores the relative path to the parameter classes configuration file which contains all parameter class types, names and template file paths.

The subnode "ParamsClassesType" defines what parameter class types are in the base template. The "name" attribute is the name of the class type, which is also in the parameter classes configuration file. The "nodePath" attribute defines the node location in the base template file to place the param class template. The node location is the absolute location path in XML Path Language (XPath) format (Reference: https://www.w3.org/TR/1999/REC-xpath-19991116/).

  1. AllParamsClasses.xml

AllParamsClasses.xml is the parameter classes configuration file mentioned in BaseTemplateConfig.xml. It stores all the Parameter classes information. A sample AllParamsClasses.xml is shown below.


<?xml version="1.0" encoding="UTF-8"?>
<AllParamsClasses
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xsi:noNamespaceSchemaLocation='AllParamsClasses.xsd'>
    <NeuronsParamsClasses name="NeuronsParamsClasses" templateDirectory="ParamsClassTemplateConfig/NeuronsParamsClass/">
        <ParamsClass name="ALLLIFNeurons" templateFileName="AllLIFNeurons.xml"/>
        <ParamsClass name="NeuronsParamsClass1" templateFileName="NeuronsParamsClass1.xml"/>
        <ParamsClass name="NeuronsParamsClass2" templateFileName="NeuronsParamsClass2.xml"/>
    </NeuronsParamsClasses>
    <SynapsesParamsClasses name="SynapsesParamsClasses" templateDirectory="ParamsClassTemplateConfig/SynapsesParamsClass/">
        <ParamsClass name="AllDSSynapses" templateFileName="AllDSSynapses.xml"/>
        <ParamsClass name="SynapsesParamsClass1" templateFileName="SynapsesParamsClass1.xml"/>
        <ParamsClass name="SynapsesParamsClass2" templateFileName="SynapsesParamsClass2.xml"/>
    </SynapsesParamsClasses>
    <ConnectionsParamsClasses name="ConnectionsParamsClasses" templateDirectory="ParamsClassTemplateConfig/ConnectionsParamsClass/">
        <ParamsClass name="ConnGrowth" templateFileName="ConnGrowth.xml"/>
        <ParamsClass name="ConnectionsParamsClass1" templateFileName="ConnectionsParamsClass1.xml"/>
        <ParamsClass name="ConnectionsParamsClass2" templateFileName="ConnectionsParamsClass2.xml"/>
    </ConnectionsParamsClasses>
    <LayoutParamsClasses name="LayoutParamsClasses" templateDirectory="ParamsClassTemplateConfig/LayoutParamsClass/">
        <ParamsClass name="FixedLayout" templateFileName="FixedLayout.xml"/>
        <ParamsClass name="LayoutParamsClass1" templateFileName="LayoutParamsClass1.xml"/>
        <ParamsClass name="LayoutParamsClass2" templateFileName="LayoutParamsClass2.xml"/>
    </LayoutParamsClasses>
</AllParamsClasses>

"AllParamsClasses" node is the root node, whose sub-nodes are the parameter class types - NeuronsParamsClasses, SynapsesParamsClasses, ConnectionParamsClasses and LayoutParamsClasses. The "templateDirectory" attribute defines the relative path of the directory, containing all the classes in a parameter class type. The "name" attribute in the "ParamClass" node defines the name of the parameter class. The "templateFileName" attribute is the file name of the template in the "templateDirectory".