本文整理汇总了C#中libsbmlcs.XMLAttributes.clear方法的典型用法代码示例。如果您正苦于以下问题:C# XMLAttributes.clear方法的具体用法?C# XMLAttributes.clear怎么用?C# XMLAttributes.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbmlcs.XMLAttributes
的用法示例。
在下文中一共展示了XMLAttributes.clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static int Main(string[] args)
{
if (args.Length != 2)
{
Console.WriteLine(" usage: addingEvidenceCodes_2 <input-filename> <output-filename>");
Console.WriteLine(" Adds controlled vocabulary term to a species");
Console.WriteLine();
return 2;
}
SBMLDocument d = libsbml.readSBML(args[0]);
long errors = d.getNumErrors();
if (errors > 0)
{
Console.WriteLine("Read Error(s):");
d.printErrors();
Console.WriteLine("Correct the above and re-run.");
}
else
{
long n = d.getModel().getNumSpecies();
if (n <= 0)
{
Console.WriteLine("Model has no species.\n Cannot add CV terms\n");
}
else
{
Species s = d.getModel().getSpecies(0);
/* check that the species has a metaid
* no CVTerms will be added if there is no metaid to reference
*/
if (!s.isSetMetaId())
s.setMetaId("metaid_0000052");
CVTerm cv1 = new CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
cv1.setBiologicalQualifierType(libsbml.BQB_OCCURS_IN);
cv1.addResource("urn:miriam:obo.go:GO%3A0005764");
s.addCVTerm(cv1);
// now create the additional annotation
//<rdf:Statement>
// <rdf:subject rdf:resource="#metaid_0000052"/>
// <rdf:predicate rdf:resource="http://biomodels.net/biology-qualifiers/occursIn"/>
// <rdf:object rdf:resource="urn:miriam:obo.go:GO%3A0005764"/>
// <bqbiol:isDescribedBy>
// <rdf:Bag>
// <rdf:li rdf:resource="urn:miriam:obo.eco:ECO%3A0000004"/>
// <rdf:li rdf:resource="urn:miriam:pubmed:7017716"/>
// </rdf:Bag>
// </bqbiol:isDescribedBy>
//</rdf:Statement>
/* attributes */
XMLAttributes blank_att = new XMLAttributes();
XMLAttributes resource_att = new XMLAttributes();
/* create the outer statement node */
XMLTriple statement_triple = new XMLTriple("Statement",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdf");
XMLToken statement_token = new XMLToken(statement_triple, blank_att);
XMLNode statement = new XMLNode(statement_token);
/*create the subject node */
XMLTriple subject_triple = new XMLTriple("subject",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdf");
resource_att.clear();
resource_att.add("rdf:resource", "#" + s.getMetaId());
XMLToken subject_token = new XMLToken(subject_triple, resource_att);
XMLNode subject = new XMLNode(subject_token);
/*create the predicate node */
XMLTriple predicate_triple = new XMLTriple("predicate",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdf");
resource_att.clear();
resource_att.add("rdf:resource",
"http://biomodels.net/biology-qualifiers/occursIn");
XMLToken predicate_token = new XMLToken(predicate_triple, resource_att);
XMLNode predicate = new XMLNode(predicate_token);
/*create the object node */
XMLTriple object_triple = new XMLTriple("object",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
//.........这里部分代码省略.........
示例2: test_XMLAttributes_clear1
public void test_XMLAttributes_clear1()
{
XMLAttributes xa = new XMLAttributes();
XMLTriple xt2 = new XMLTriple("name2", "http://name2.org/", "p2");
int i = xa.add( "name1", "val1", "http://name1.org/", "p1");
i = xa.add(xt2, "val2");
i = xa.add( "noprefix", "val3");
assertTrue( xa.getLength() == 3 );
assertTrue( xa.isEmpty() == false );
i = xa.clear();
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( xa.getLength() == 0 );
assertTrue( xa.isEmpty() == true );
xa = null;
xt2 = null;
}