示例#1
0
        public void test_Event_addEventAssignment2()
        {
            Event           e  = new  Event(2, 2);
            EventAssignment ea = new  EventAssignment(2, 3);

            ea.setVariable("f");
            ea.setMath(libsbml.parseFormula("a-n"));
            int i = e.addEventAssignment(ea);

            assertTrue(i == libsbml.LIBSBML_VERSION_MISMATCH);
            assertTrue(e.getNumEventAssignments() == 0);
            ea = null;
            e  = null;
        }
        public void test_EventAssignment_parent_add()
        {
            Event           e  = new Event(2, 4);
            EventAssignment ea = new EventAssignment(2, 4);

            ea.setVariable("c");
            ea.setMath(libsbml.parseFormula("K+L"));
            e.addEventAssignment(ea);
            ea = null;
            ListOf lo = e.getListOfEventAssignments();

            assertTrue(lo == e.getEventAssignment(0).getParentSBMLObject());
            assertTrue(e == lo.getParentSBMLObject());
        }
示例#3
0
    printEventAssignmentMath(int n, EventAssignment ea)
    {
        string variable;
        string formula;


        if (ea.isSetMath())
        {
            variable = ea.getVariable();
            formula  = libsbml.formulaToString(ea.getMath());

            Console.Write("  EventAssignment " + n
                          + ", trigger: " + variable + " = " + formula + Environment.NewLine);
        }
    }
        public void TestSerializationEventAssignment()
        {
            EventAssignment x1 = CreateObject <EventAssignment>().WithName("Eva").WithDimension(DimensionLength);

            x1.ParentContainer = C0;
            x1.UseAsValue      = true;
            x1.ObjectPath      = ObjectPathFactory.CreateAbsoluteObjectPath(P);
            x1.Formula         = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(23.4);
            x1.ResolveChangedEntity();

            IEventAssignment x2 = SerializeAndDeserialize(x1);

            x2.ParentContainer = C0;
            x2.ResolveChangedEntity();
            AssertForSpecs.AreEqualEventAssignment(x2, x1);
        }
示例#5
0
        public void test_Event_addEventAssignment1()
        {
            Event           e  = new  Event(2, 2);
            EventAssignment ea = new  EventAssignment(2, 2);
            int             i  = e.addEventAssignment(ea);

            assertTrue(i == libsbml.LIBSBML_INVALID_OBJECT);
            ea.setVariable("f");
            i = e.addEventAssignment(ea);
            assertTrue(i == libsbml.LIBSBML_INVALID_OBJECT);
            ea.setMath(libsbml.parseFormula("a-n"));
            i = e.addEventAssignment(ea);
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(e.getNumEventAssignments() == 1);
            ea = null;
            e  = null;
        }
示例#6
0
        public void test_EventAssignment_ancestor_add()
        {
            Event           e  = new Event(2, 4);
            EventAssignment ea = new EventAssignment(2, 4);

            ea.setVariable("c");
            ea.setMath(libsbml.parseFormula("K+L"));
            e.addEventAssignment(ea);
            ea = null;
            ListOf          lo  = e.getListOfEventAssignments();
            EventAssignment obj = e.getEventAssignment(0);

            assertTrue(obj.getAncestorOfType(libsbml.SBML_EVENT) == e);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null);
        }
示例#7
0
        public void test_EventAssignment_ancestor_create()
        {
            Event           e  = new Event(2, 4);
            EventAssignment ea = e.createEventAssignment();
            ListOf          lo = e.getListOfEventAssignments();

            assertTrue(ea.getAncestorOfType(libsbml.SBML_EVENT) == e);
            assertTrue(ea.getAncestorOfType(libsbml.SBML_LIST_OF) == lo);
            assertTrue(ea.getAncestorOfType(libsbml.SBML_DOCUMENT) == null);
            assertTrue(ea.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null);
            EventAssignment obj = e.getEventAssignment(0);

            assertTrue(obj.getAncestorOfType(libsbml.SBML_EVENT) == e);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null);
        }
示例#8
0
        public void test_EventAssignment_copyConstructor()
        {
            EventAssignment o1 = new EventAssignment(2, 4);

            o1.setVariable("c2");
            assertTrue(o1.getVariable() == "c2");
            ASTNode node = new ASTNode(libsbml.AST_CONSTANT_PI);

            o1.setMath(node);
            node = null;
            assertTrue(o1.getMath() != null);
            EventAssignment o2 = new EventAssignment(o1);

            assertTrue(o2.getVariable() == "c2");
            assertTrue(o2.getMath() != null);
            assertTrue(o2.getParentSBMLObject() == o1.getParentSBMLObject());
            o2 = null;
            o1 = null;
        }
示例#9
0
        public void test_Event_full()
        {
            ASTNode         math1   = libsbml.parseFormula("0");
            Trigger         trigger = new  Trigger(2, 4);
            ASTNode         math    = libsbml.parseFormula("0");
            Event           e       = new  Event(2, 4);
            EventAssignment ea      = new  EventAssignment(2, 4);

            ea.setVariable("k");
            ea.setMath(math);
            trigger.setMath(math1);
            e.setTrigger(trigger);
            e.setId("e1");
            e.setName("Set k2 to zero when P1 <= t");
            e.addEventAssignment(ea);
            assertTrue(e.getNumEventAssignments() == 1);
            assertNotEquals(e.getEventAssignment(0), ea);
            math = null;
            e    = null;
        }
        public void test_EventAssignment_createWithNS()
        {
            XMLNamespaces xmlns = new  XMLNamespaces();

            xmlns.add("http://www.sbml.org", "testsbml");
            SBMLNamespaces sbmlns = new  SBMLNamespaces(2, 1);

            sbmlns.addNamespaces(xmlns);
            EventAssignment object1 = new  EventAssignment(sbmlns);

            assertTrue(object1.getTypeCode() == libsbml.SBML_EVENT_ASSIGNMENT);
            assertTrue(object1.getMetaId() == "");
            assertTrue(object1.getNotes() == null);
            assertTrue(object1.getAnnotation() == null);
            assertTrue(object1.getLevel() == 2);
            assertTrue(object1.getVersion() == 1);
            assertTrue(object1.getNamespaces() != null);
            assertTrue(object1.getNamespaces().getLength() == 2);
            object1 = null;
        }
        public void test_Event_parent_NULL()
        {
            SBMLDocument    d  = new SBMLDocument(2, 4);
            Model           m  = d.createModel();
            Event           c  = m.createEvent();
            EventAssignment ea = c.createEventAssignment();
            Trigger         t  = new Trigger(2, 4);

            t.setMath(new ASTNode());
            Delay dy = new Delay(2, 4);

            dy.setMath(new ASTNode());
            c.setTrigger(t);
            c.setDelay(dy);
            assertTrue(c.getAncestorOfType(libsbml.SBML_MODEL) == m);
            assertTrue(c.getTrigger().getParentSBMLObject() == c);
            assertEquals(c.getDelay().getSBMLDocument(), d);
            assertTrue(ea.getAncestorOfType(libsbml.SBML_EVENT) == c);
            Event c1 = c.clone();

            d = null;
            assertTrue(c1.getAncestorOfType(libsbml.SBML_MODEL) == null);
            assertTrue(c1.getParentSBMLObject() == null);
            assertEquals(c1.getSBMLDocument(), null);
            assertTrue(c1.getEventAssignment(0).getAncestorOfType(libsbml.SBML_MODEL) == null);
            assertTrue(c1.getEventAssignment(0).getAncestorOfType(libsbml.SBML_EVENT) == c1);
            assertTrue(c1.getEventAssignment(0).getParentSBMLObject() != null);
            assertEquals(c1.getEventAssignment(0).getSBMLDocument(), null);
            assertTrue(c1.getTrigger().getAncestorOfType(libsbml.SBML_MODEL) == null);
            assertTrue(c1.getTrigger().getAncestorOfType(libsbml.SBML_EVENT) == c1);
            assertTrue(c1.getTrigger().getParentSBMLObject() != null);
            assertEquals(c1.getTrigger().getSBMLDocument(), null);
            assertTrue(c1.getDelay().getAncestorOfType(libsbml.SBML_MODEL) == null);
            assertTrue(c1.getDelay().getAncestorOfType(libsbml.SBML_EVENT) == c1);
            assertTrue(c1.getDelay().getParentSBMLObject() != null);
            assertEquals(c1.getDelay().getSBMLDocument(), null);
            c1 = null;
        }
示例#12
0
        static void testListOfRemove(ListOf lof, SBase s)
        {
            string ename = s.getElementName();

            lof.append(s);
            SBase c = lof.get(0);

            if (c is CompartmentType)
            {
                CompartmentType x = (lof as ListOfCompartmentTypes).remove(0); c = x;
            }
            else if (c is Compartment)
            {
                Compartment x = (lof as ListOfCompartments).remove(0); c = x;
            }
            else if (c is Constraint)
            {
                Constraint x = (lof as ListOfConstraints).remove(0); c = x;
            }
            else if (c is EventAssignment)
            {
                EventAssignment x = (lof as ListOfEventAssignments).remove(0); c = x;
            }
            else if (c is Event)
            {
                Event x = (lof as ListOfEvents).remove(0); c = x;
            }
            else if (c is FunctionDefinition)
            {
                FunctionDefinition x = (lof as ListOfFunctionDefinitions).remove(0); c = x;
            }
            else if (c is InitialAssignment)
            {
                InitialAssignment x = (lof as ListOfInitialAssignments).remove(0); c = x;
            }
            else if (c is Parameter)
            {
                Parameter x = (lof as ListOfParameters).remove(0); c = x;
            }
            else if (c is Reaction)
            {
                Reaction x = (lof as ListOfReactions).remove(0); c = x;
            }
            else if (c is Rule)
            {
                Rule x = (lof as ListOfRules).remove(0); c = x;
            }
            else if (c is Species)
            {
                Species x = (lof as ListOfSpecies).remove(0); c = x;
            }
            else if (c is SpeciesReference)
            {
                SimpleSpeciesReference x = (lof as ListOfSpeciesReferences).remove(0); c = x;
            }
            else if (c is SpeciesType)
            {
                SpeciesType x = (lof as ListOfSpeciesTypes).remove(0); c = x;
            }
            else if (c is UnitDefinition)
            {
                UnitDefinition x = (lof as ListOfUnitDefinitions).remove(0); c = x;
            }
            else if (c is Unit)
            {
                Unit x = (lof as ListOfUnits).remove(0); c = x;
            }
            else
            {
                ERR("[testListOfRemove] Error: (" + ename + ") : ListOfXXX::remove() failed.");
                return;
            }

            if (c == null)
            {
                ERR("[testListOfRemove] Error: (" + ename + ") : ListOfXXX::remove() failed.");
                return;
            }

            string enameGet = c.getElementName();

            if (ename == enameGet)
            {
                //Console.Out.WriteLine("[testListOfRemove] OK: (" + ename + ") remove(" + enameGet + ") : type match.");
                OK();
            }
            else
            {
                ERR("[testListOfRemove] Error: (" + ename + ") remove(" + enameGet + ") : type mismatch.");
            }
        }
示例#13
0
        static void testClone(SBase s)
        {
            string ename = s.getElementName();
            SBase  c     = s.clone();

            if (c is Compartment)
            {
                Compartment x = (s as Compartment).clone(); c = x;
            }
            else if (c is CompartmentType)
            {
                CompartmentType x = (s as CompartmentType).clone(); c = x;
            }
            else if (c is Constraint)
            {
                Constraint x = (s as Constraint).clone(); c = x;
            }
            else if (c is Delay)
            {
                Delay x = (s as Delay).clone(); c = x;
            }
            else if (c is Event)
            {
                Event x = (s as Event).clone(); c = x;
            }
            else if (c is EventAssignment)
            {
                EventAssignment x = (s as EventAssignment).clone(); c = x;
            }
            else if (c is FunctionDefinition)
            {
                FunctionDefinition x = (s as FunctionDefinition).clone(); c = x;
            }
            else if (c is InitialAssignment)
            {
                InitialAssignment x = (s as InitialAssignment).clone(); c = x;
            }
            else if (c is KineticLaw)
            {
                KineticLaw x = (s as KineticLaw).clone(); c = x;
            }
            // currently return type of ListOf::clone() is SBase
            else if (c is ListOf)
            {
                SBase x = (s as ListOf).clone(); c = x;
            }
            else if (c is Model)
            {
                Model x = (s as Model).clone(); c = x;
            }
            else if (c is Parameter)
            {
                Parameter x = (s as Parameter).clone(); c = x;
            }
            else if (c is Reaction)
            {
                Reaction x = (s as Reaction).clone(); c = x;
            }
            else if (c is AlgebraicRule)
            {
                AlgebraicRule x = (s as AlgebraicRule).clone(); c = x;
            }
            else if (c is AssignmentRule)
            {
                AssignmentRule x = (s as AssignmentRule).clone(); c = x;
            }
            else if (c is RateRule)
            {
                RateRule x = (s as RateRule).clone(); c = x;
            }
            else if (c is SBMLDocument)
            {
                SBMLDocument x = (s as SBMLDocument).clone(); c = x;
            }
            else if (c is Species)
            {
                Species x = (s as Species).clone(); c = x;
            }
            else if (c is SpeciesReference)
            {
                SpeciesReference x = (s as SpeciesReference).clone(); c = x;
            }
            else if (c is SpeciesType)
            {
                SpeciesType x = (s as SpeciesType).clone(); c = x;
            }
            else if (c is SpeciesReference)
            {
                SpeciesReference x = (s as SpeciesReference).clone(); c = x;
            }
            else if (c is StoichiometryMath)
            {
                StoichiometryMath x = (s as StoichiometryMath).clone(); c = x;
            }
            else if (c is Trigger)
            {
                Trigger x = (s as Trigger).clone(); c = x;
            }
            else if (c is Unit)
            {
                Unit x = (s as Unit).clone(); c = x;
            }
            else if (c is UnitDefinition)
            {
                UnitDefinition x = (s as UnitDefinition).clone(); c = x;
            }
            else if (c is ListOfCompartmentTypes)
            {
                ListOfCompartmentTypes x = (s as ListOfCompartmentTypes).clone(); c = x;
            }
            else if (c is ListOfCompartments)
            {
                ListOfCompartments x = (s as ListOfCompartments).clone(); c = x;
            }
            else if (c is ListOfConstraints)
            {
                ListOfConstraints x = (s as ListOfConstraints).clone(); c = x;
            }
            else if (c is ListOfEventAssignments)
            {
                ListOfEventAssignments x = (s as ListOfEventAssignments).clone(); c = x;
            }
            else if (c is ListOfEvents)
            {
                ListOfEvents x = (s as ListOfEvents).clone(); c = x;
            }
            else if (c is ListOfFunctionDefinitions)
            {
                ListOfFunctionDefinitions x = (s as ListOfFunctionDefinitions).clone(); c = x;
            }
            else if (c is ListOfInitialAssignments)
            {
                ListOfInitialAssignments x = (s as ListOfInitialAssignments).clone(); c = x;
            }
            else if (c is ListOfParameters)
            {
                ListOfParameters x = (s as ListOfParameters).clone(); c = x;
            }
            else if (c is ListOfReactions)
            {
                ListOfReactions x = (s as ListOfReactions).clone(); c = x;
            }
            else if (c is ListOfRules)
            {
                ListOfRules x = (s as ListOfRules).clone(); c = x;
            }
            else if (c is ListOfSpecies)
            {
                ListOfSpecies x = (s as ListOfSpecies).clone(); c = x;
            }
            else if (c is ListOfSpeciesReferences)
            {
                ListOfSpeciesReferences x = (s as ListOfSpeciesReferences).clone(); c = x;
            }
            else if (c is ListOfSpeciesTypes)
            {
                ListOfSpeciesTypes x = (s as ListOfSpeciesTypes).clone(); c = x;
            }
            else if (c is ListOfUnitDefinitions)
            {
                ListOfUnitDefinitions x = (s as ListOfUnitDefinitions).clone(); c = x;
            }
            else if (c is ListOfUnits)
            {
                ListOfUnits x = (s as ListOfUnits).clone(); c = x;
            }
            else
            {
                ERR("[testClone] Error: (" + ename + ") : clone() failed.");
                return;
            }

            if (c == null)
            {
                ERR("[testClone] Error: (" + ename + ") : clone() failed.");
                return;
            }

            string enameClone = c.getElementName();

            if (ename == enameClone)
            {
                //Console.Out.WriteLine("[testClone] OK: (" + ename + ") clone(" + enameClone + ") : type match.");
                OK();
            }
            else
            {
                ERR("[testClone] Error: (" + ename + ") clone(" + enameClone + ") : type mismatch.");
            }
        }
    public static int Main(string[] args)
    {
        if (args.Length != 1)
        {
            Console.WriteLine("Usage: printUnits filename");
            return(1);
        }

        string       filename = args[0];
        SBMLDocument document = libsbml.readSBML(filename);

        if (document.getNumErrors() > 0)
        {
            Console.Error.WriteLine("Encountered the following SBML errors:");
            document.printErrors();
            return(1);
        }

        Model model = document.getModel();

        if (model == null)
        {
            Console.WriteLine("No model present.");
            return(1);
        }

        int i, j;

        for (i = 0; i < model.getNumSpecies(); i++)
        {
            Species s = model.getSpecies(i);
            Console.WriteLine("Species " + i + ": "
                              + UnitDefinition.printUnits(s.getDerivedUnitDefinition()));
        }

        for (i = 0; i < model.getNumCompartments(); i++)
        {
            Compartment c = model.getCompartment(i);
            Console.WriteLine("Compartment " + i + ": "
                              + UnitDefinition.printUnits(c.getDerivedUnitDefinition()))
            ;
        }

        for (i = 0; i < model.getNumParameters(); i++)
        {
            Parameter p = model.getParameter(i);
            Console.WriteLine("Parameter " + i + ": "
                              + UnitDefinition.printUnits(p.getDerivedUnitDefinition()))
            ;
        }


        for (i = 0; i < model.getNumInitialAssignments(); i++)
        {
            InitialAssignment ia = model.getInitialAssignment(i);
            Console.WriteLine("InitialAssignment " + i + ": "
                              + UnitDefinition.printUnits(ia.getDerivedUnitDefinition()));
            Console.WriteLine("        undeclared units: ");
            Console.WriteLine((ia.containsUndeclaredUnits() ? "yes\n" : "no\n"));
        }

        for (i = 0; i < model.getNumEvents(); i++)
        {
            Event e = model.getEvent(i);
            Console.WriteLine("Event " + i + ": ");

            if (e.isSetDelay())
            {
                Console.WriteLine("Delay: "
                                  + UnitDefinition.printUnits(e.getDelay().getDerivedUnitDefinition()));
                Console.WriteLine("        undeclared units: ");
                Console.WriteLine((e.getDelay().containsUndeclaredUnits() ? "yes\n" : "no\n"));
            }

            for (j = 0; j < e.getNumEventAssignments(); j++)
            {
                EventAssignment ea = e.getEventAssignment(j);
                Console.WriteLine("EventAssignment " + j + ": "
                                  + UnitDefinition.printUnits(ea.getDerivedUnitDefinition()));
                Console.WriteLine("        undeclared units: ");
                Console.WriteLine((ea.containsUndeclaredUnits() ? "yes\n" : "no\n"));
            }
        }

        for (i = 0; i < model.getNumReactions(); i++)
        {
            Reaction r = model.getReaction(i);

            Console.WriteLine("Reaction " + i + ": ");

            if (r.isSetKineticLaw())
            {
                Console.WriteLine("Kinetic Law: "
                                  + UnitDefinition.printUnits(r.getKineticLaw().getDerivedUnitDefinition()));
                Console.WriteLine("        undeclared units: ");
                Console.WriteLine((r.getKineticLaw().containsUndeclaredUnits() ? "yes\n" : "no\n"));
            }

            for (j = 0; j < r.getNumReactants(); j++)
            {
                SpeciesReference sr = r.getReactant(j);

                if (sr.isSetStoichiometryMath())
                {
                    Console.WriteLine("Reactant stoichiometryMath" + j + ": "
                                      + UnitDefinition.printUnits(sr.getStoichiometryMath().getDerivedUnitDefinition()));
                    Console.WriteLine("        undeclared units: ");
                    Console.WriteLine((sr.getStoichiometryMath().containsUndeclaredUnits() ? "yes\n" : "no\n"));
                }
            }

            for (j = 0; j < r.getNumProducts(); j++)
            {
                SpeciesReference sr = r.getProduct(j);

                if (sr.isSetStoichiometryMath())
                {
                    Console.WriteLine("Product stoichiometryMath" + j + ": "
                                      + UnitDefinition.printUnits(sr.getStoichiometryMath().getDerivedUnitDefinition()));
                    Console.WriteLine("        undeclared units: ");
                    Console.WriteLine((sr.getStoichiometryMath().containsUndeclaredUnits() ? "yes\n" : "no\n"));
                }
            }
        }

        for (i = 0; i < model.getNumRules(); i++)
        {
            Rule r = model.getRule(i);
            Console.WriteLine("Rule " + i + ": "
                              + UnitDefinition.printUnits(r.getDerivedUnitDefinition()));
            Console.WriteLine("        undeclared units: ");
            Console.WriteLine((r.containsUndeclaredUnits() ? "yes\n" : "no\n"));
        }

        return(0);
    }
示例#15
0
    public static int Main(string[] args)
    {
        if (args.Length != 1)
        {
            Console.WriteLine("Usage: printNotes filename");
            return(1);
        }

        int          i, j;
        string       filename = args[0];
        SBMLDocument document;


        document = libsbml.readSBML(filename);

        int errors = (int)document.getNumErrors();

        Console.WriteLine();
        Console.WriteLine("filename: " + filename);
        Console.WriteLine();

        if (errors > 0)
        {
            document.printErrors();

            return(errors);
        }

        /* Model */

        Model m = document.getModel();

        printNotes(m);

        for (i = 0; i < m.getNumReactions(); i++)
        {
            Reaction re = m.getReaction(i);
            printNotes(re);

            /* SpeciesReference (Reacatant) */

            for (j = 0; j < re.getNumReactants(); j++)
            {
                SpeciesReference rt = re.getReactant(j);
                if (rt.isSetNotes())
                {
                    Console.WriteLine("   ");
                }
                printNotes(rt, (rt.isSetSpecies() ? rt.getSpecies() : ""));
            }

            /* SpeciesReference (Product) */

            for (j = 0; j < re.getNumProducts(); j++)
            {
                SpeciesReference rt = re.getProduct(j);
                if (rt.isSetNotes())
                {
                    Console.WriteLine("   ");
                }
                printNotes(rt, (rt.isSetSpecies() ? rt.getSpecies() : ""));
            }

            /* ModifierSpeciesReference (Modifier) */

            for (j = 0; j < re.getNumModifiers(); j++)
            {
                ModifierSpeciesReference md = re.getModifier(j);
                if (md.isSetNotes())
                {
                    Console.WriteLine("   ");
                }
                printNotes(md, (md.isSetSpecies() ? md.getSpecies() : ""));
            }

            /* Kineticlaw */

            if (re.isSetKineticLaw())
            {
                KineticLaw kl = re.getKineticLaw();
                if (kl.isSetNotes())
                {
                    Console.WriteLine("   ");
                }
                printNotes(kl);

                /* Parameter */

                for (j = 0; j < kl.getNumParameters(); j++)
                {
                    Parameter pa = kl.getParameter(j);
                    if (pa.isSetNotes())
                    {
                        Console.WriteLine("   ");
                    }
                    printNotes(pa);
                }
            }
        }

        /* Species */

        for (i = 0; i < m.getNumSpecies(); i++)
        {
            Species sp = m.getSpecies(i);
            printNotes(sp);
        }

        /* Compartment */

        for (i = 0; i < m.getNumCompartments(); i++)
        {
            Compartment sp = m.getCompartment(i);
            printNotes(sp);
        }

        /* FunctionDefinition */

        for (i = 0; i < m.getNumFunctionDefinitions(); i++)
        {
            FunctionDefinition sp = m.getFunctionDefinition(i);
            printNotes(sp);
        }

        /* UnitDefinition */

        for (i = 0; i < m.getNumUnitDefinitions(); i++)
        {
            UnitDefinition sp = m.getUnitDefinition(i);
            printNotes(sp);
        }

        /* Parameter */

        for (i = 0; i < m.getNumParameters(); i++)
        {
            Parameter sp = m.getParameter(i);
            printNotes(sp);
        }

        /* Rule */

        for (i = 0; i < m.getNumRules(); i++)
        {
            Rule sp = m.getRule(i);
            printNotes(sp);
        }

        /* InitialAssignment */

        for (i = 0; i < m.getNumInitialAssignments(); i++)
        {
            InitialAssignment sp = m.getInitialAssignment(i);
            printNotes(sp);
        }

        /* Event */

        for (i = 0; i < m.getNumEvents(); i++)
        {
            Event sp = m.getEvent(i);
            printNotes(sp);

            /* Trigger */

            if (sp.isSetTrigger())
            {
                Trigger tg = sp.getTrigger();
                if (tg.isSetNotes())
                {
                    Console.WriteLine("   ");
                }
                printNotes(tg);
            }

            /* Delay */

            if (sp.isSetDelay())
            {
                Delay dl = sp.getDelay();
                if (dl.isSetNotes())
                {
                    Console.WriteLine("   ");
                }
                printNotes(dl);
            }

            /* EventAssignment */

            for (j = 0; j < sp.getNumEventAssignments(); j++)
            {
                EventAssignment ea = sp.getEventAssignment(j);
                if (ea.isSetNotes())
                {
                    Console.WriteLine("   ");
                }
                printNotes(ea);
            }
        }

        /* SpeciesType */

        for (i = 0; i < m.getNumSpeciesTypes(); i++)
        {
            SpeciesType sp = m.getSpeciesType(i);
            printNotes(sp);
        }

        /* Constraint */

        for (i = 0; i < m.getNumConstraints(); i++)
        {
            Constraint sp = m.getConstraint(i);
            printNotes(sp);
        }

        return(errors);
    }
    public static int Main(string[] args)
    {
        if (args.Length != 2)
        {
            Console.Write(Environment.NewLine + "Usage: unsetAnnotation <input-filename> <output-filename>" + Environment.NewLine + Environment.NewLine);
            return 1;
        }

        int i, j;
        string filename = args[0];
        SBMLDocument document;


        document = libsbml.readSBML(filename);


        int errors = (int)document.getNumErrors();

        if (errors > 0)
        {
            document.printErrors();


            return errors;
        }

        Model m = document.getModel();
        m.unsetAnnotation();

        for (i = 0; i < m.getNumReactions(); i++)
        {
            Reaction re = m.getReaction(i);
            re.unsetAnnotation();

            for (j = 0; j < re.getNumReactants(); j++)
            {
                SpeciesReference rt = re.getReactant(j);
                rt.unsetAnnotation();
            }

            for (j = 0; j < re.getNumProducts(); j++)
            {
                SpeciesReference rt = re.getProduct(j);
                rt.unsetAnnotation();
            }

            for (j = 0; j < re.getNumModifiers(); j++)
            {
                ModifierSpeciesReference md = re.getModifier(j);
                md.unsetAnnotation();
            }

            if (re.isSetKineticLaw())
            {
                KineticLaw kl = re.getKineticLaw();
                kl.unsetAnnotation();

                for (j = 0; j < kl.getNumParameters(); j++)
                {
                    Parameter pa = kl.getParameter(j);
                    pa.unsetAnnotation();
                }
            }

        }

        for (i = 0; i < m.getNumSpecies(); i++)
        {
            Species sp = m.getSpecies(i);
            sp.unsetAnnotation();
        }

        for (i = 0; i < m.getNumCompartments(); i++)
        {
            Compartment sp = m.getCompartment(i);
            sp.unsetAnnotation();
        }

        for (i = 0; i < m.getNumFunctionDefinitions(); i++)
        {
            FunctionDefinition sp = m.getFunctionDefinition(i);
            sp.unsetAnnotation();
        }

        for (i = 0; i < m.getNumUnitDefinitions(); i++)
        {
            UnitDefinition sp = m.getUnitDefinition(i);
            sp.unsetAnnotation();
        }

        for (i = 0; i < m.getNumParameters(); i++)
        {
            Parameter sp = m.getParameter(i);
            sp.unsetAnnotation();
        }

        for (i = 0; i < m.getNumRules(); i++)
        {
            Rule sp = m.getRule(i);
            sp.unsetAnnotation();
        }

        for (i = 0; i < m.getNumInitialAssignments(); i++)
        {
            InitialAssignment sp = m.getInitialAssignment(i);
            sp.unsetAnnotation();
        }

        for (i = 0; i < m.getNumEvents(); i++)
        {
            Event sp = m.getEvent(i);
            sp.unsetAnnotation();

            for (j = 0; j < sp.getNumEventAssignments(); j++)
            {
                EventAssignment ea = sp.getEventAssignment(j);
                ea.unsetAnnotation();
            }
        }

        for (i = 0; i < m.getNumSpeciesTypes(); i++)
        {
            SpeciesType sp = m.getSpeciesType(i);
            sp.unsetAnnotation();
        }

        for (i = 0; i < m.getNumConstraints(); i++)
        {
            Constraint sp = m.getConstraint(i);
            sp.unsetAnnotation();
        }

        libsbml.writeSBML(document, args[1]);

        return errors;
    }
示例#17
0
文件: Reader.cs 项目: dorchard/mucell
        public void EventAssignmentElement(Hashtable attrs)
        {
            String variable;
            SBase parameter = null;

            if (attrs.Contains("variable"))
            {
            variable = (String)attrs["variable"];

            if (this.model.findObject(variable) != null)
                parameter = (SBase)this.model.findObject(variable);
            }

            EventAssignment eventAssignment = new EventAssignment(this.model, parameter);

            Event eventNode = (Event)elementStack.Peek();
            eventNode.listOfEventAssignments.Add(eventAssignment);

            elementStack.Push(eventAssignment);
        }
        public static void Initialize(SchoolContext context)
        {
            //context.Database.EnsureCreated();

            // Look for any Athletes.
            if (context.Athletes.Any())
            {
                return;   // DB has been seeded
            }

            var Athletes = new Athlete[]
            {
                new Athlete {
                    FirstName = "Carson", LastName = "Alexander", Gender = Gender.Male, Dob = DateTime.Parse("1995-05-30"), Weight = 140, Height = 50
                },
                new Athlete {
                    FirstName = "Meredith", LastName = "Alonso", Gender = Gender.Male, Dob = DateTime.Parse("1992-07-5"), Weight = 160, Height = 60
                },
                new Athlete {
                    FirstName = "Arturo", LastName = "Anand", Gender = Gender.Male, Dob = DateTime.Parse("1993-02-15"), Weight = 165, Height = 55
                },
                new Athlete {
                    FirstName = "Gytis", LastName = "JELLISON", Gender = Gender.Female, Dob = DateTime.Parse("1992-02-27"), Weight = 125, Height = 47
                },
                new Athlete {
                    FirstName = "Yan", MiddleName = "Lee", LastName = "Li", Gender = Gender.Male, Dob = DateTime.Parse("1992-08-24"), Weight = 140, Height = 73
                },
                new Athlete {
                    FirstName = "Peggy", MiddleName = "Laura", LastName = "Justice", Gender = Gender.Female, Dob = DateTime.Parse("1991-08-03"), Weight = 230, Height = 73
                },
                new Athlete {
                    FirstName = "Laura", MiddleName = "Nicole", LastName = "Norman", Gender = Gender.Female, Dob = DateTime.Parse("1993-04-03"), Weight = 135, Height = 67
                },
                new Athlete {
                    FirstName = "Tom", MiddleName = "Marvolo", LastName = "Riddle", Gender = Gender.Male, Dob = DateTime.Parse("1995-04-11"), Weight = 145, Height = 76
                },
                new Athlete {
                    FirstName = "Carl", LastName = "Gibbons", Gender = Gender.Male, Dob = DateTime.Parse("1969-05-30"), Weight = 212, Height = 70
                },
                new Athlete {
                    FirstName = "Jackson ", LastName = "Smith ", Gender = Gender.Male, Dob = DateTime.Parse("1995-05-30"), Weight = 140, Height = 50
                },
                new Athlete {
                    FirstName = "Sebastian ", LastName = "Smith ", Gender = Gender.Male, Dob = DateTime.Parse("1992-07-5"), Weight = 160, Height = 60
                },
                new Athlete {
                    FirstName = "Aiden ", LastName = "Smith ", Gender = Gender.Male, Dob = DateTime.Parse("1991-02-15"), Weight = 165, Height = 55
                },
                new Athlete {
                    FirstName = "Matthew ", LastName = "Smith ", Gender = Gender.Female, Dob = DateTime.Parse("1992-02-20"), Weight = 125, Height = 47
                },
                new Athlete {
                    FirstName = "Samuel ", MiddleName = "Colt   ", LastName = "CarolsunlutzenBurhSchmity", Gender = Gender.Male, Dob = DateTime.Parse("1992-08-29"), Weight = 140, Height = 73
                },
                new Athlete {
                    FirstName = "David ", MiddleName = "Archer ", LastName = "Wheat", Gender = Gender.Female, Dob = DateTime.Parse("1998-08-03"), Weight = 230, Height = 73
                },
                new Athlete {
                    FirstName = "Joseph ", MiddleName = "Omar ", LastName = "Desk", Gender = Gender.Female, Dob = DateTime.Parse("1997-04-03"), Weight = 135, Height = 67
                },
                new Athlete {
                    FirstName = "Tom", MiddleName = "Aidan ", LastName = "Oliveoil", Gender = Gender.Male, Dob = DateTime.Parse("1995-04-11"), Weight = 145, Height = 76
                },
                new Athlete {
                    FirstName = "Carter ", LastName = "Gibbons", Gender = Gender.Male, Dob = DateTime.Parse("1969-05-30"), Weight = 212, Height = 70
                },
                new Athlete {
                    FirstName = "Harper", LastName = "WhiteHouse", Gender = Gender.Male, Dob = DateTime.Parse("1995-05-30"), Weight = 140, Height = 50
                },
                new Athlete {
                    FirstName = "Meredith", LastName = "Ammoury", Gender = Gender.Male, Dob = DateTime.Parse("1992-07-5"), Weight = 160, Height = 60
                },
                new Athlete {
                    FirstName = "Evelyn", LastName = "Swartzburg", Gender = Gender.Male, Dob = DateTime.Parse("1993-02-13"), Weight = 165, Height = 55
                },
                new Athlete {
                    FirstName = "Abigail", LastName = "Disndy", Gender = Gender.Female, Dob = DateTime.Parse("1992-02-17"), Weight = 125, Height = 47
                },
                new Athlete {
                    FirstName = "Emily", MiddleName = "Ememin", LastName = "Li", Gender = Gender.Male, Dob = DateTime.Parse("1992-08-21"), Weight = 140, Height = 73
                },
                new Athlete {
                    FirstName = "Elizabeth", LastName = "Kalifia", Gender = Gender.Female, Dob = DateTime.Parse("1991-08-03"), Weight = 230, Height = 73
                },
                new Athlete {
                    FirstName = "Mila", LastName = "Prettyman", Gender = Gender.Female, Dob = DateTime.Parse("1993-04-23"), Weight = 135, Height = 67
                },
                new Athlete {
                    FirstName = "Ella", LastName = "Larson", Gender = Gender.Male, Dob = DateTime.Parse("1995-04-22"), Weight = 145, Height = 76
                },
                new Athlete {
                    FirstName = "Avery", LastName = "Thayne", Gender = Gender.Male, Dob = DateTime.Parse("1969-05-02"), Weight = 212, Height = 70
                },
                new Athlete {
                    FirstName = "Riley", LastName = "Ocean", Gender = Gender.Male, Dob = DateTime.Parse("1995-05-03"), Weight = 140, Height = 50
                },
                new Athlete {
                    FirstName = "Nora", LastName = "Excalaber", Gender = Gender.Male, Dob = DateTime.Parse("1992-07-15"), Weight = 160, Height = 60
                },
                new Athlete {
                    FirstName = "Eleanor", LastName = "Ansley", Gender = Gender.Male, Dob = DateTime.Parse("1993-02-15"), Weight = 165, Height = 55
                },
                new Athlete {
                    FirstName = "Hannah", LastName = "Barzee", Gender = Gender.Female, Dob = DateTime.Parse("1992-02-26"), Weight = 125, Height = 47
                },
                new Athlete {
                    FirstName = "Mason ", MiddleName = "Bryson ", LastName = "Li", Gender = Gender.Male, Dob = DateTime.Parse("1992-08-14"), Weight = 167, Height = 72
                },
                new Athlete {
                    FirstName = "Damian ", MiddleName = "Sawyer ", LastName = "Jenson", Gender = Gender.Female, Dob = DateTime.Parse("1991-08-05"), Weight = 213, Height = 73
                },
                new Athlete {
                    FirstName = "Silas ", MiddleName = "Nicole", LastName = "Raia", Gender = Gender.Female, Dob = DateTime.Parse("1993-04-03"), Weight = 189, Height = 78
                },
                new Athlete {
                    FirstName = "Chase ", MiddleName = "Declan ", LastName = "Riddle", Gender = Gender.Male, Dob = DateTime.Parse("1995-04-11"), Weight = 202, Height = 76
                },
                new Athlete {
                    FirstName = "Carl ", LastName = "Gibbons", Gender = Gender.Male, Dob = DateTime.Parse("1969-05-30"), Weight = 200, Height = 70
                }
            };

            foreach (Athlete s in Athletes)
            {
                context.Athletes.Add(s);
            }
            context.SaveChanges();

            var Coachs = new Coach[]
            {
                new Coach {
                    FirstName = "Kim", MiddleName = "Amber", LastName = "Abercrombie", HireDate = DateTime.Parse("1995-03-11")
                },
                new Coach {
                    FirstName = "Fadi", MiddleName = "Aliku", LastName = "Fakhouri", HireDate = DateTime.Parse("2002-07-06")
                },
                new Coach {
                    FirstName = "Tim", LastName = "Thayne", HireDate = DateTime.Parse("1998-07-01")
                },
                new Coach {
                    FirstName = "Candace", LastName = "Kapoor", HireDate = DateTime.Parse("2001-01-15")
                },
                new Coach {
                    FirstName = "Roger", LastName = "Zheng", HireDate = DateTime.Parse("2004-02-12")
                }
            };

            foreach (Coach i in Coachs)
            {
                context.Coaches.Add(i);
            }
            context.SaveChanges();

            var Fields = new Field[]
            {
                new Field {
                    Name      = "Running", Budget = 357000,
                    StartDate = DateTime.Parse("2007-09-01"),
                    CoachID   = Coachs.Single(i => i.LastName == "Thayne").ID
                },
                new Field {
                    Name      = "Throwing", Budget = 0909000,
                    StartDate = DateTime.Parse("2007-09-01"),
                    CoachID   = Coachs.Single(i => i.LastName == "Fakhouri").ID
                },
                new Field {
                    Name      = "Jumping", Budget = 250000,
                    StartDate = DateTime.Parse("2007-09-01"),
                    CoachID   = Coachs.Single(i => i.LastName == "Thayne").ID
                }
            };

            foreach (Field d in Fields)
            {
                context.Fields.Add(d);
            }
            context.SaveChanges();

            var Events = new Event[]
            {
                new Event {
                    EventID = 1001, Title = "100 Meters", FieldID = Fields.Single(s => s.Name == "Running").FieldID
                },
                new Event {
                    EventID = 1002, Title = "200 Meters", FieldID = Fields.Single(s => s.Name == "Running").FieldID
                },
                new Event {
                    EventID = 1003, Title = "400 Meters", FieldID = Fields.Single(s => s.Name == "Running").FieldID
                },
                new Event {
                    EventID = 1004, Title = "1500 Meters", FieldID = Fields.Single(s => s.Name == "Running").FieldID
                },
                new Event {
                    EventID = 1005, Title = "3000 Meters", FieldID = Fields.Single(s => s.Name == "Running").FieldID
                },
                new Event {
                    EventID = 1006, Title = "400 Meters", FieldID = Fields.Single(s => s.Name == "Running").FieldID
                },
                new Event {
                    EventID = 1007, Title = "100 Meter Hurdles", FieldID = Fields.Single(s => s.Name == "Running").FieldID
                },
                new Event {
                    EventID = 1008, Title = "400 Meters Hurdles", FieldID = Fields.Single(s => s.Name == "Running").FieldID
                },
                new Event {
                    EventID = 1009, Title = "4X100 Meter Relay", FieldID = Fields.Single(s => s.Name == "Running").FieldID
                },
                new Event {
                    EventID = 1010, Title = "4X400 Meters Relay", FieldID = Fields.Single(s => s.Name == "Running").FieldID
                },
                new Event {
                    EventID = 2001, Title = "High Jump", FieldID = Fields.Single(s => s.Name == "Jumping").FieldID
                },
                new Event {
                    EventID = 2002, Title = "Pole Vault", FieldID = Fields.Single(s => s.Name == "Jumping").FieldID
                },
                new Event {
                    EventID = 2003, Title = "Triple Jump", FieldID = Fields.Single(s => s.Name == "Jumping").FieldID
                },
                new Event {
                    EventID = 3001, Title = "Discus Throw", FieldID = Fields.Single(s => s.Name == "Throwing").FieldID
                },
                new Event {
                    EventID = 3002, Title = "Hammer Throw", FieldID = Fields.Single(s => s.Name == "Throwing").FieldID
                },
                new Event {
                    EventID = 3003, Title = "Shot Put", FieldID = Fields.Single(s => s.Name == "Throwing").FieldID
                },
                new Event {
                    EventID = 3004, Title = "Javelin Throw", FieldID = Fields.Single(s => s.Name == "Throwing").FieldID
                }
            };

            foreach (Event c in Events)
            {
                context.Events.Add(c);
            }
            context.SaveChanges();

            var EventCoach = new EventAssignment[]
            {
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "100 Meters").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Kapoor").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "200 Meters").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Kapoor").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "400 Meters").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Kapoor").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "1500 Meters").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Abercrombie").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "3000 Meters").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Abercrombie").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "100 Meter Hurdles").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Zheng").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "400 Meters Hurdles").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Zheng").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "4X100 Meter Relay").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Zheng").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "4X400 Meter Relay").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Zheng").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "High Jump").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Fakhouri").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "Pole Vault").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Fakhouri").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "Triple Jump").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Fakhouri").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "Discus Throw").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Thayne").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "Hammer Throw").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Thayne").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "Shot Put").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Thayne").ID
                },
                new EventAssignment {
                    EventID = Events.Single(c => c.Title == "Javelin Throw").EventID,
                    CoachID = Coachs.Single(i => i.LastName == "Thayne").ID
                }
            };



            foreach (EventAssignment ci in EventCoach)
            {
                context.EventAssignments.Add(ci);
            }
            context.SaveChanges();

            var trials = new Trial[]
            {
                //first
                new Trial {
                    AthleteID = 35, EventID = 1001, Place = Place.First
                },
                new Trial {
                    AthleteID = 35, EventID = 1002, Place = Place.First
                },
                new Trial {
                    AthleteID = 35, EventID = 1003, Place = Place.First
                },
                new Trial {
                    AthleteID = 33, EventID = 1004, Place = Place.First
                },
                new Trial {
                    AthleteID = 5, EventID = 1005, Place = Place.First
                },
                new Trial {
                    AthleteID = 24, EventID = 1006, Place = Place.First
                },
                new Trial {
                    AthleteID = 13, EventID = 1007, Place = Place.First
                },
                new Trial {
                    AthleteID = 23, EventID = 1008, Place = Place.First
                },
                new Trial {
                    AthleteID = 14, EventID = 1009, Place = Place.First
                },
                new Trial {
                    AthleteID = 13, EventID = 1010, Place = Place.First
                },
                new Trial {
                    AthleteID = 10, EventID = 2001, Place = Place.First
                },
                new Trial {
                    AthleteID = 31, EventID = 2002, Place = Place.First
                },
                new Trial {
                    AthleteID = 27, EventID = 2003, Place = Place.First
                },
                new Trial {
                    AthleteID = 9, EventID = 3001, Place = Place.First
                },
                new Trial {
                    AthleteID = 5, EventID = 3002, Place = Place.First
                },
                new Trial {
                    AthleteID = 7, EventID = 3003, Place = Place.First
                },
                new Trial {
                    AthleteID = 16, EventID = 3004, Place = Place.First
                },
                new Trial {
                    AthleteID = 35, EventID = 1001, Place = Place.Second
                },
                new Trial {
                    AthleteID = 35, EventID = 1002, Place = Place.Second
                },
                new Trial {
                    AthleteID = 35, EventID = 1003, Place = Place.Second
                },
                new Trial {
                    AthleteID = 35, EventID = 1004, Place = Place.Second
                },
                new Trial {
                    AthleteID = 35, EventID = 1005, Place = Place.Second
                },
                new Trial {
                    AthleteID = 24, EventID = 1006, Place = Place.Second
                },
                new Trial {
                    AthleteID = 8, EventID = 1007, Place = Place.Second
                },
                new Trial {
                    AthleteID = 33, EventID = 1008, Place = Place.Second
                },
                new Trial {
                    AthleteID = 12, EventID = 1009, Place = Place.Second
                },
                new Trial {
                    AthleteID = 10, EventID = 1010, Place = Place.Second
                },
                new Trial {
                    AthleteID = 11, EventID = 2001, Place = Place.Second
                },
                new Trial {
                    AthleteID = 12, EventID = 2002, Place = Place.Second
                },
                new Trial {
                    AthleteID = 13, EventID = 2003, Place = Place.Second
                },
                new Trial {
                    AthleteID = 14, EventID = 3001, Place = Place.Second
                },
                new Trial {
                    AthleteID = 15, EventID = 3002, Place = Place.Second
                },
                new Trial {
                    AthleteID = 16, EventID = 3003, Place = Place.Second
                },
                new Trial {
                    AthleteID = 16, EventID = 3004, Place = Place.Second
                },
                new Trial {
                    AthleteID = 35, EventID = 1001, Place = Place.Third
                },
                new Trial {
                    AthleteID = 35, EventID = 1002, Place = Place.Third
                },
                new Trial {
                    AthleteID = 35, EventID = 1003, Place = Place.Third
                },
                new Trial {
                    AthleteID = 35, EventID = 1004, Place = Place.Third
                },
                new Trial {
                    AthleteID = 35, EventID = 1005, Place = Place.Third
                },
                new Trial {
                    AthleteID = 24, EventID = 1006, Place = Place.Third
                },
                new Trial {
                    AthleteID = 27, EventID = 1007, Place = Place.Third
                },
                new Trial {
                    AthleteID = 33, EventID = 1008, Place = Place.Third
                },
                new Trial {
                    AthleteID = 23, EventID = 1009, Place = Place.Third
                },
                new Trial {
                    AthleteID = 10, EventID = 1010, Place = Place.Third
                },
                new Trial {
                    AthleteID = 11, EventID = 2001, Place = Place.Third
                },
                new Trial {
                    AthleteID = 12, EventID = 2002, Place = Place.Third
                },
                new Trial {
                    AthleteID = 13, EventID = 2003, Place = Place.Third
                },
                new Trial {
                    AthleteID = 14, EventID = 3001, Place = Place.Third
                },
                new Trial {
                    AthleteID = 15, EventID = 3002, Place = Place.Third
                },
                new Trial {
                    AthleteID = 16, EventID = 3003, Place = Place.Third
                },
                new Trial {
                    AthleteID = 16, EventID = 3004, Place = Place.Third
                },
                new Trial {
                    AthleteID = 35, EventID = 1001
                },
                new Trial {
                    AthleteID = 35, EventID = 1002
                },
                new Trial {
                    AthleteID = 35, EventID = 1003
                },
                new Trial {
                    AthleteID = 35, EventID = 1004
                },
                new Trial {
                    AthleteID = 35, EventID = 1005
                },
                new Trial {
                    AthleteID = 24, EventID = 1006
                },
                new Trial {
                    AthleteID = 25, EventID = 1007
                },
                new Trial {
                    AthleteID = 33, EventID = 1008
                },
                new Trial {
                    AthleteID = 25, EventID = 1009
                },
                new Trial {
                    AthleteID = 10, EventID = 1010
                },
                new Trial {
                    AthleteID = 11, EventID = 2001
                },
                new Trial {
                    AthleteID = 12, EventID = 2002
                },
                new Trial {
                    AthleteID = 13, EventID = 2003
                },
                new Trial {
                    AthleteID = 14, EventID = 3001
                },
                new Trial {
                    AthleteID = 15, EventID = 3002
                },
                new Trial {
                    AthleteID = 16, EventID = 3003
                },
                new Trial {
                    AthleteID = 16, EventID = 3004
                }
            };

            foreach (Trial e in trials)
            {
                var enrollmentInDataBase = context.Trials.Where(
                    s =>
                    s.Athlete.ID == e.AthleteID &&
                    s.Event.EventID == e.EventID).SingleOrDefault();
                if (enrollmentInDataBase == null)
                {
                    context.Trials.Add(e);
                }
            }
            context.SaveChanges();
        }
 public void tearDown()
 {
     EA = null;
 }