NeuroMLImporter.cpp

Go to the documentation of this file.
00001 #include "NeuroMLImporter.h" 
00002 #include <iostream>
00003 
00004 NeuroMLImporter::NeuroMLImporter(std::string schema_location) :
00005     schema_location(schema_location)
00006 {
00007     connect_parsers();
00008     this->env = new PCSIMParserEnvironment();
00009     setSimulationEnvironment();
00010 }
00011 
00012 NeuroMLImporter::~NeuroMLImporter()
00013 {
00014     delete this->env;
00015 }
00016 
00017 void NeuroMLImporter::load(std::string filename, SimNetwork &net)
00018 {
00019 
00020     ::xml_schema::document neuroml_doc_p(NeuroMLLevel3_p, "http://morphml.org/neuroml/schema", "neuroml");
00021 
00022     ::xml_schema::properties propneuro;
00023     propneuro.schema_location("http://morphml.org/neuroml/schema", schema_location);
00024 
00025     env->net = &net;
00026 
00027     try {
00028         NeuroMLLevel3_p.pre();
00029         neuroml_doc_p.parse(filename, 0, propneuro);
00030         NeuroMLLevel3_p.post_NeuroMLLevel3();
00031     }
00032     catch (::xml_schema::exception& xmle)
00033     {
00034         std::cerr << filename << ": XML parsing failure: " << xmle << std::endl;
00035         throw;
00036     }
00037     catch (std::ios_base::failure&)
00038     {
00039         std::cerr << filename << ": IO failure: " << std::endl;
00040         throw;
00041     }
00042 }
00043 
00044 void NeuroMLImporter::setSimulationEnvironment()
00045 {
00046 NeuroMLLevel3_p.setenv(env);
00047 Notes_p.setenv(env);
00048 Properties_p.setenv(env);
00049 Property_p.setenv(env);
00050 Annotation_p.setenv(env);
00051 Group_p.setenv(env);
00052 Authors_p.setenv(env);
00053 Person_p.setenv(env);
00054 Publication_p.setenv(env);
00055 NeuronDBReference_p.setenv(env);
00056 ModelDBReference_p.setenv(env);
00057 Level3Cells_p.setenv(env);
00058 Level3Cell_p.setenv(env);
00059 cellBody_p.setenv(env);
00060 Polygon_p.setenv(env);
00061 Point_p.setenv(env);
00062 Polyhedron_p.setenv(env);
00063 polygons_p.setenv(env);
00064 Sphere_p.setenv(env);
00065 segments_p.setenv(env);
00066 Segment_p.setenv(env);
00067 SegmentIdInCell_p.setenv(env);
00068 FreePoints_p.setenv(env);
00069 spines_p.setenv(env);
00070 Spine_p.setenv(env);
00071 SpineShape_p.setenv(env);
00072 cables_p.setenv(env);
00073 Cable_p.setenv(env);
00074 ZeroToOne_p.setenv(env);
00075 CableGroup_p.setenv(env);
00076 cable_p.setenv(env);
00077 InhomogeneousParam_p.setenv(env);
00078 metric_p.setenv(env);
00079 proximal_p.setenv(env);
00080 distal_p.setenv(env);
00081 Level3Biophysics_p.setenv(env);
00082 Mechanism_p.setenv(env);
00083 NamedParameter_p.setenv(env);
00084 VariableNamedParameter_p.setenv(env);
00085 InhomogeneousValue_p.setenv(env);
00086 MechanismType_p.setenv(env);
00087 SpecCapacitance_p.setenv(env);
00088 UnnamedParameter_p.setenv(env);
00089 VariableParameter_p.setenv(env);
00090 SpecAxialResistance_p.setenv(env);
00091 InitialMembPotential_p.setenv(env);
00092 IonProperties_p.setenv(env);
00093 Units_p.setenv(env);
00094 PotentialSynapticLocation_p.setenv(env);
00095 SynapseDirection_p.setenv(env);
00096 Level3Connectivity_p.setenv(env);
00097 PotentialSynLoc_p.setenv(env);
00098 ChannelML_p.setenv(env);
00099 Ion_p.setenv(env);
00100 VoltageValue_p.setenv(env);
00101 IonRole_p.setenv(env);
00102 ChannelType_p.setenv(env);
00103 Status_p.setenv(env);
00104 StatusValue_p.setenv(env);
00105 CurrentVoltageRelation_p.setenv(env);
00106 Ohmic_p.setenv(env);
00107 conductance_p.setenv(env);
00108 RateAdjustments_p.setenv(env);
00109 q10_settings_p.setenv(env);
00110 TemperatureValue_p.setenv(env);
00111 offset_p.setenv(env);
00112 Gate_p.setenv(env);
00113 state_p.setenv(env);
00114 ConductanceDensityValue_p.setenv(env);
00115 IntegrateAndFire_p.setenv(env);
00116 TimeValue_p.setenv(env);
00117 ConductanceValue_p.setenv(env);
00118 HHGate_p.setenv(env);
00119 Transition_p.setenv(env);
00120 VoltageGate_p.setenv(env);
00121 RateConstantEqnChoice_p.setenv(env);
00122 AkdEquation_p.setenv(env);
00123 Parameter_p.setenv(env);
00124 GenericEquation_p.setenv(env);
00125 VoltageConcGate_p.setenv(env);
00126 ConcDependence_p.setenv(env);
00127 ConcentrationValue_p.setenv(env);
00128 RateConstVoltConcDep_p.setenv(env);
00129 KSGate_p.setenv(env);
00130 KSState_p.setenv(env);
00131 ImplementationPrefs_p.setenv(env);
00132 table_settings_p.setenv(env);
00133 YesNo_p.setenv(env);
00134 SynapseType_p.setenv(env);
00135 ElectricalSynapse_p.setenv(env);
00136 DoubleExponentialSynapse_p.setenv(env);
00137 TimeConstantValueIncZero_p.setenv(env);
00138 TimeConstantValue_p.setenv(env);
00139 BlockingSynapse_p.setenv(env);
00140 Block_p.setenv(env);
00141 MultiDecaySynapse_p.setenv(env);
00142 FacDepSynapse_p.setenv(env);
00143 FacDep_p.setenv(env);
00144 IonConcentration_p.setenv(env);
00145 IonSpecies_p.setenv(env);
00146 DecayingPoolModel_p.setenv(env);
00147 InvTimeConstantValue_p.setenv(env);
00148 PoolVolumeInfo_p.setenv(env);
00149 LengthValue_p.setenv(env);
00150 FixedPoolInfo_p.setenv(env);
00151 Populations_p.setenv(env);
00152 Population_p.setenv(env);
00153 Instances_p.setenv(env);
00154 CellInstance_p.setenv(env);
00155 Point3D_p.setenv(env);
00156 PopulationLocation_p.setenv(env);
00157 RandomArrangement_p.setenv(env);
00158 RectangularBox_p.setenv(env);
00159 size_p.setenv(env);
00160 GridArrangement_p.setenv(env);
00161 spacing_p.setenv(env);
00162 NonSpatialGrid_p.setenv(env);
00163 Projections_p.setenv(env);
00164 Projection_p.setenv(env);
00165 GlobalSynapticProperties_p.setenv(env);
00166 SynapticDelayValue_p.setenv(env);
00167 NonNegativeDouble_p.setenv(env);
00168 SynapseInternalProperties_p.setenv(env);
00169 Connections_p.setenv(env);
00170 Connection_p.setenv(env);
00171 SynapticLocation_p.setenv(env);
00172 LocalSynapticProperties_p.setenv(env);
00173 ConnectivityPattern_p.setenv(env);
00174 all_to_all_p.setenv(env);
00175 fixed_probability_p.setenv(env);
00176 PerCellConnection_p.setenv(env);
00177 direction_p.setenv(env);
00178 PositiveDouble_p.setenv(env);
00179 Inputs_p.setenv(env);
00180 Input_p.setenv(env);
00181 PulseInput_p.setenv(env);
00182 CurrentValue_p.setenv(env);
00183 RandomStim_p.setenv(env);
00184 FrequencyValue_p.setenv(env);
00185 InputTarget_p.setenv(env);
00186 InputSites_p.setenv(env);
00187 InputSite_p.setenv(env);
00188 CellIdInNetwork_p.setenv(env);
00189 InputSitePattern_p.setenv(env);
00190 all_cells_p.setenv(env);
00191 percentage_cells_p.setenv(env);
00192 Percentage_p.setenv(env);
00193 LengthUnits_p.setenv(env);
00194 VolumeUnits_p.setenv(env);
00195 }
00196 
00197 void NeuroMLImporter::connect_parsers()
00198 {
00199     // Connect the parsers together.
00200     //
00201     NeuroMLLevel3_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Authors_p, Publication_p, NeuronDBReference_p, ModelDBReference_p, Level3Cells_p,
00202             ChannelML_p, Populations_p, Projections_p, Inputs_p, string_p, LengthUnits_p, VolumeUnits_p);
00203 
00204     Properties_p.parsers(Property_p);
00205 
00206     Property_p.parsers(string_p, string_p, string_p, string_p);
00207 
00208     Authors_p.parsers(Person_p, Person_p);
00209 
00210     Person_p.parsers(string_p, string_p, string_p, string_p);
00211 
00212     Publication_p.parsers(string_p, string_p);
00213 
00214     NeuronDBReference_p.parsers(string_p, string_p);
00215 
00216     ModelDBReference_p.parsers(string_p, string_p);
00217 
00218     Level3Cells_p.parsers(Level3Cell_p);
00219 
00220     Level3Cell_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Authors_p, Publication_p, NeuronDBReference_p, ModelDBReference_p, cellBody_p,
00221             segments_p, FreePoints_p, spines_p, cables_p, string_p, Level3Biophysics_p, Level3Connectivity_p);
00222 
00223     cellBody_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Polygon_p, Polyhedron_p, Sphere_p);
00224 
00225     Point_p.parsers(double_p, double_p, double_p, double_p);
00226 
00227     Polyhedron_p.parsers(polygons_p);
00228 
00229     polygons_p.parsers(Polygon_p);
00230 
00231     Sphere_p.parsers(Point_p, string_p);
00232 
00233     segments_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Segment_p, string_p);
00234 
00235     Segment_p.parsers(Point_p, Point_p, Properties_p, SegmentIdInCell_p, string_p, SegmentIdInCell_p, non_negative_integer_p);
00236 
00237     spines_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Spine_p);
00238 
00239     Spine_p.parsers(Point_p, Point_p, SegmentIdInCell_p, double_p, double_p, SpineShape_p);
00240 
00241     cables_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Cable_p, CableGroup_p);
00242 
00243     Cable_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, non_negative_integer_p, string_p, non_negative_integer_p, ZeroToOne_p, ZeroToOne_p);
00244 
00245     CableGroup_p.parsers(cable_p, InhomogeneousParam_p, string_p);
00246 
00247     cable_p.parsers(non_negative_integer_p);
00248 
00249     InhomogeneousParam_p.parsers(metric_p, proximal_p, distal_p, string_p, string_p);
00250 
00251     proximal_p.parsers(double_p);
00252 
00253     distal_p.parsers(double_p);
00254 
00255     Level3Biophysics_p.parsers(Mechanism_p, SpecCapacitance_p, SpecCapacitance_p, SpecAxialResistance_p, SpecAxialResistance_p, InitialMembPotential_p,
00256             InitialMembPotential_p, IonProperties_p, IonProperties_p, Units_p, PotentialSynapticLocation_p);
00257 
00258     Mechanism_p.parsers(NamedParameter_p, VariableNamedParameter_p, string_p, MechanismType_p, boolean_p, boolean_p);
00259 
00260     NamedParameter_p.parsers(string_p, string_p, double_p);
00261 
00262     VariableNamedParameter_p.parsers(string_p, InhomogeneousValue_p, string_p);
00263 
00264     InhomogeneousValue_p.parsers(string_p, string_p);
00265 
00266     SpecCapacitance_p.parsers(UnnamedParameter_p, VariableParameter_p);
00267 
00268     UnnamedParameter_p.parsers(string_p, double_p);
00269 
00270     VariableParameter_p.parsers(string_p, InhomogeneousValue_p, string_p);
00271 
00272     SpecAxialResistance_p.parsers(UnnamedParameter_p, VariableParameter_p);
00273 
00274     InitialMembPotential_p.parsers(UnnamedParameter_p, VariableParameter_p);
00275 
00276     IonProperties_p.parsers(NamedParameter_p, string_p);
00277 
00278     PotentialSynapticLocation_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, string_p, SynapseDirection_p, string_p);
00279 
00280     Level3Connectivity_p.parsers(PotentialSynLoc_p);
00281 
00282     PotentialSynLoc_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, string_p, string_p, SynapseDirection_p);
00283 
00284     ChannelML_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Ion_p, ChannelType_p, SynapseType_p, IonConcentration_p, Units_p);
00285 
00286     Ion_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, string_p, VoltageValue_p, positive_integer_p, IonRole_p);
00287 
00288     ChannelType_p.parsers(Status_p, Notes_p, Properties_p, Annotation_p, Group_p, Authors_p, Publication_p, NeuronDBReference_p, ModelDBReference_p,
00289             CurrentVoltageRelation_p, HHGate_p, KSGate_p, ImplementationPrefs_p, string_p, YesNo_p);
00290 
00291     Status_p.parsers(string_p, string_p, Person_p, StatusValue_p);
00292 
00293     CurrentVoltageRelation_p.parsers(Ohmic_p, IntegrateAndFire_p, string_p);
00294 
00295     Ohmic_p.parsers(conductance_p, string_p);
00296 
00297     conductance_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, RateAdjustments_p, Gate_p, ConductanceDensityValue_p);
00298 
00299     RateAdjustments_p.parsers(q10_settings_p, offset_p);
00300 
00301     q10_settings_p.parsers(string_p, double_p, double_p, TemperatureValue_p);
00302 
00303     offset_p.parsers(VoltageValue_p);
00304 
00305     Gate_p.parsers(state_p, non_negative_integer_p);
00306 
00307     state_p.parsers(string_p, ZeroToOne_p);
00308 
00309     IntegrateAndFire_p.parsers(VoltageValue_p, TimeValue_p, VoltageValue_p, ConductanceValue_p);
00310 
00311     HHGate_p.parsers(Transition_p, string_p);
00312 
00313     Transition_p.parsers(VoltageGate_p, VoltageConcGate_p, string_p, string_p);
00314 
00315     VoltageGate_p.parsers(RateConstantEqnChoice_p, RateConstantEqnChoice_p, RateConstantEqnChoice_p, RateConstantEqnChoice_p, RateConstantEqnChoice_p,
00316             RateConstantEqnChoice_p);
00317 
00318     RateConstantEqnChoice_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, AkdEquation_p, GenericEquation_p);
00319 
00320     AkdEquation_p.parsers(Parameter_p, string_p, string_p);
00321 
00322     Parameter_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, string_p, double_p);
00323 
00324     GenericEquation_p.parsers(string_p);
00325 
00326     VoltageConcGate_p.parsers(ConcDependence_p, RateConstVoltConcDep_p, RateConstVoltConcDep_p, RateConstantEqnChoice_p, RateConstantEqnChoice_p,
00327             RateConstVoltConcDep_p, RateConstVoltConcDep_p);
00328 
00329     ConcDependence_p.parsers(string_p, string_p, string_p, ConcentrationValue_p, ConcentrationValue_p);
00330 
00331     RateConstVoltConcDep_p.parsers(GenericEquation_p);
00332 
00333     KSGate_p.parsers(KSState_p, Transition_p);
00334 
00335     KSState_p.parsers(string_p);
00336 
00337     ImplementationPrefs_p.parsers(string_p, table_settings_p);
00338 
00339     table_settings_p.parsers(double_p, double_p, positive_integer_p);
00340 
00341     SynapseType_p.parsers(Status_p, Notes_p, Properties_p, Annotation_p, Group_p, Authors_p, Publication_p, NeuronDBReference_p, ModelDBReference_p,
00342             ElectricalSynapse_p, DoubleExponentialSynapse_p, BlockingSynapse_p, MultiDecaySynapse_p, FacDepSynapse_p, string_p);
00343 
00344     ElectricalSynapse_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, ConductanceValue_p);
00345 
00346     DoubleExponentialSynapse_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, ConductanceValue_p, TimeConstantValueIncZero_p, TimeConstantValue_p,
00347             VoltageValue_p);
00348 
00349     BlockingSynapse_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, ConductanceValue_p, TimeConstantValueIncZero_p, TimeConstantValue_p,
00350             VoltageValue_p, Block_p);
00351 
00352     Block_p.parsers(string_p, ConcentrationValue_p, double_p, double_p);
00353 
00354     MultiDecaySynapse_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, ConductanceValue_p, TimeConstantValueIncZero_p, TimeConstantValue_p,
00355             VoltageValue_p, ConductanceValue_p, TimeConstantValue_p, ConductanceValue_p, TimeConstantValue_p);
00356 
00357     FacDepSynapse_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, ConductanceValue_p, TimeConstantValueIncZero_p, TimeConstantValue_p, VoltageValue_p,
00358             ConductanceValue_p, TimeConstantValue_p, ConductanceValue_p, TimeConstantValue_p, FacDep_p);
00359 
00360     FacDep_p.parsers(double_p, TimeConstantValue_p, TimeConstantValue_p);
00361 
00362     IonConcentration_p.parsers(Status_p, Notes_p, Properties_p, Annotation_p, Group_p, Authors_p, Publication_p, NeuronDBReference_p, ModelDBReference_p,
00363             IonSpecies_p, DecayingPoolModel_p, string_p);
00364 
00365     IonSpecies_p.parsers(string_p);
00366 
00367     DecayingPoolModel_p.parsers(ConcentrationValue_p, TimeConstantValue_p, InvTimeConstantValue_p, ConcentrationValue_p, PoolVolumeInfo_p, FixedPoolInfo_p,
00368             ConcentrationValue_p, TimeConstantValue_p, InvTimeConstantValue_p, ConcentrationValue_p);
00369 
00370     PoolVolumeInfo_p.parsers(LengthValue_p, LengthValue_p);
00371 
00372     FixedPoolInfo_p.parsers(double_p);
00373 
00374     Populations_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Population_p);
00375 
00376     Population_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, string_p, Instances_p, PopulationLocation_p, string_p, string_p);
00377 
00378     Instances_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, CellInstance_p, non_negative_integer_p);
00379 
00380     CellInstance_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Point3D_p, non_negative_integer_p, non_negative_integer_p);
00381 
00382     Point3D_p.parsers(double_p, double_p, double_p);
00383 
00384     PopulationLocation_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, RandomArrangement_p, GridArrangement_p, string_p);
00385 
00386     RandomArrangement_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, non_negative_integer_p, Sphere_p, RectangularBox_p);
00387 
00388     RectangularBox_p.parsers(Point_p, size_p, string_p);
00389 
00390     size_p.parsers(double_p, double_p, double_p);
00391 
00392     GridArrangement_p.parsers(RectangularBox_p, spacing_p, Notes_p, Properties_p, Annotation_p, Group_p, NonSpatialGrid_p);
00393 
00394     spacing_p.parsers(double_p, double_p, double_p);
00395 
00396     NonSpatialGrid_p.parsers(positive_integer_p, positive_integer_p, positive_integer_p);
00397 
00398     Projections_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Projection_p, Units_p);
00399 
00400     Projection_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, string_p, string_p, GlobalSynapticProperties_p, Connections_p, ConnectivityPattern_p,
00401             string_p, string_p, string_p);
00402 
00403     GlobalSynapticProperties_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, SynapticDelayValue_p, SynapticDelayValue_p, SynapticDelayValue_p,
00404             SynapticDelayValue_p, NonNegativeDouble_p, VoltageValue_p, string_p, SynapseInternalProperties_p, string_p);
00405 
00406     SynapseInternalProperties_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, SynapticDelayValue_p, SynapticDelayValue_p, SynapticDelayValue_p,
00407             SynapticDelayValue_p, NonNegativeDouble_p, VoltageValue_p);
00408 
00409     Connections_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Connection_p);
00410 
00411     Connection_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, SynapticLocation_p, SynapticLocation_p, LocalSynapticProperties_p, integer_p, integer_p,
00412             integer_p, ZeroToOne_p, integer_p, integer_p, ZeroToOne_p);
00413 
00414     SynapticLocation_p.parsers(integer_p, integer_p, ZeroToOne_p);
00415 
00416     LocalSynapticProperties_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, SynapticDelayValue_p, SynapticDelayValue_p, SynapticDelayValue_p,
00417             SynapticDelayValue_p, NonNegativeDouble_p, VoltageValue_p, string_p);
00418 
00419     ConnectivityPattern_p.parsers(all_to_all_p, fixed_probability_p, PerCellConnection_p);
00420 
00421     fixed_probability_p.parsers(ZeroToOne_p);
00422 
00423     PerCellConnection_p.parsers(direction_p, PositiveDouble_p, positive_integer_p);
00424 
00425     Inputs_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, Input_p, Units_p);
00426 
00427     Input_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, PulseInput_p, RandomStim_p, InputTarget_p, string_p);
00428 
00429     PulseInput_p.parsers(TimeValue_p, TimeValue_p, CurrentValue_p);
00430 
00431     RandomStim_p.parsers(FrequencyValue_p, string_p);
00432 
00433     InputTarget_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, InputSites_p, InputSitePattern_p, string_p);
00434 
00435     InputSites_p.parsers(Notes_p, Properties_p, Annotation_p, Group_p, InputSite_p);
00436 
00437     InputSite_p.parsers(CellIdInNetwork_p, SegmentIdInCell_p, ZeroToOne_p);
00438 
00439     InputSitePattern_p.parsers(all_cells_p, percentage_cells_p);
00440 
00441     percentage_cells_p.parsers(Percentage_p);
00442 }

Generated on Wed Jul 9 16:34:37 2008 for PCSIM by  doxygen 1.5.5