当前位置: 首页>>代码示例>>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;未经允许,请勿转载。