當前位置: 首頁>>代碼示例>>C#>>正文


C# SBMLDocument.getNamespaces方法代碼示例

本文整理匯總了C#中libsbmlcs.SBMLDocument.getNamespaces方法的典型用法代碼示例。如果您正苦於以下問題:C# SBMLDocument.getNamespaces方法的具體用法?C# SBMLDocument.getNamespaces怎麽用?C# SBMLDocument.getNamespaces使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在libsbmlcs.SBMLDocument的用法示例。


在下文中一共展示了SBMLDocument.getNamespaces方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: createExampleInvolvingUnits

    /**
     *
     * Creates an SBML model represented in "7.2 Example involving units"
     * in the SBML Level 2 Version 4 Specification.
     *
     */
    private static SBMLDocument createExampleInvolvingUnits()
    {
        int level = Level;
        int version = Version;

        //---------------------------------------------------------------------------
        //
        // Creates an SBMLDocument object
        //
        //---------------------------------------------------------------------------

        SBMLDocument sbmlDoc = new SBMLDocument(level, version);

        // Adds the namespace for XHTML to the SBMLDocument object.  We need this
        // because we will add notes to the model.  (By default, the SBML document
        // created by SBMLDocument only declares the SBML XML namespace.)

        sbmlDoc.getNamespaces().add("http://www.w3.org/1999/xhtml", "xhtml");

        //---------------------------------------------------------------------------
        //
        // Creates a Model object inside the SBMLDocument object.
        //
        //---------------------------------------------------------------------------

        Model model = sbmlDoc.createModel();
        model.setId("unitsExample");

        //---------------------------------------------------------------------------
        //
        // Creates UnitDefinition objects inside the Model object.
        //
        //---------------------------------------------------------------------------

        // Temporary pointers (reused more than once below).

        UnitDefinition unitdef;
        Unit unit;

        //---------------------------------------------------------------------------
        // (UnitDefinition1) Creates an UnitDefinition object ("substance").
        //
        // This has the effect of redefining the default unit of subtance for the
        // whole model.
        //---------------------------------------------------------------------------

        unitdef = model.createUnitDefinition();
        unitdef.setId("substance");

        //  Creates an Unit inside the UnitDefinition object

        unit = unitdef.createUnit();
        unit.setKind(libsbml.UNIT_KIND_MOLE);
        unit.setScale(-3);

        //--------------------------------------------------------------------------------
        // (UnitDefinition2) Creates an UnitDefinition object ("mmls")
        //--------------------------------------------------------------------------------

        // Note that we can reuse the pointers 'unitdef' and 'unit' because the
        // actual UnitDefinition object (along with the Unit objects within it)
        // is already attached to the Model object.

        unitdef = model.createUnitDefinition();
        unitdef.setId("mmls");

        //  Creates an Unit inside the UnitDefinition object ("mmls")

        unit = unitdef.createUnit();
        unit.setKind(libsbml.UNIT_KIND_MOLE);
        unit.setScale(-3);

        //  Creates an Unit inside the UnitDefinition object ("mmls")

        unit = unitdef.createUnit();
        unit.setKind(libsbml.UNIT_KIND_LITRE);
        unit.setExponent(-1);

        //  Creates an Unit inside the UnitDefinition object ("mmls")

        unit = unitdef.createUnit();
        unit.setKind(libsbml.UNIT_KIND_SECOND);
        unit.setExponent(-1);

        //--------------------------------------------------------------------------------
        // (UnitDefinition3) Creates an UnitDefinition object ("mml")
        //--------------------------------------------------------------------------------

        unitdef = model.createUnitDefinition();
        unitdef.setId("mml");

        //  Creates an Unit inside the UnitDefinition object ("mml")

        unit = unitdef.createUnit();
//.........這裏部分代碼省略.........
開發者ID:sys-bio,項目名稱:libroadrunner-deps,代碼行數:101,代碼來源:createExampleSBML.cs

示例2: test_SBase_appendNotesWithGlobalNamespace

        public void test_SBase_appendNotesWithGlobalNamespace()
        {
            string notes = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version4\" xmlns:html=\"http://www.w3.org/1999/xhtml\" level=\"2\" version=\"4\">\n" + "  <model id=\"test\" name=\"name\">\n" + "    <notes>\n" + "      <html:p>DATE: 2010/12/08 13:00:00</html:p>\n" + "      <html:p>VERSION: 0.99</html:p>\n" + "      <html:p>TAXONOMY: 9606</html:p>\n" + "    </notes>\n" + "  </model>\n" + "</sbml>\n";
            SBMLDocument sbmlDoc = new SBMLDocument (2, 4);
            sbmlDoc.getNamespaces ()[email protected] ("http://www.w3.org/1999/xhtml", "html");
            Model sbmlModel = sbmlDoc.createModel ();
            sbmlModel.setId ("test");
            sbmlModel.setName ("name");
            setOrAppendNotes (sbmlModel, "<html:p>DATE: 2010/12/08 13:00:00</html:p>");
            setOrAppendNotes (sbmlModel, "<html:p>VERSION: 0.99</html:p>");
            setOrAppendNotes (sbmlModel, "<html:p>TAXONOMY: 9606</html:p>");

            SBMLWriter ttt = new SBMLWriter ();
            string documentString = ttt.writeToString (sbmlDoc);
            assertTrue ((notes == documentString));
        }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:16,代碼來源:TestSBase.cs


注:本文中的libsbmlcs.SBMLDocument.getNamespaces方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。