Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: None  |  size: 1.24 KB  |  hits: 40  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public ArrayList getIDs()
  2.         {
  3.             ArrayList idpairs = new ArrayList();
  4.  
  5.             if (File.Exists(owlpath))
  6.             {
  7.                 XDocument doc = XDocument.Load(owlpath);
  8.                 uint dummy;
  9.  
  10.                 var tmp = from c in doc.Root.Elements()
  11.                           where c.FirstAttribute.Name.ToString().Equals("{http://www.w3.org/1999/02/22-rdf-syntax-ns#}about") && c.FirstAttribute.Value.ToString().Contains("#") && UInt32.TryParse(new Uri(c.FirstAttribute.Value.ToString()).Fragment.Substring(1), out dummy)
  12.                           select new Tuple<XElement, uint>(c, UInt32.Parse(new Uri(c.FirstAttribute.Value.ToString()).Fragment.Substring(1)));
  13.  
  14.                 foreach (var t in tmp)
  15.                 {
  16.                     uint id = t.Item2;
  17.                     var q = from moo in t.Item1.Descendants()
  18.                             where moo.Name.ToString().EndsWith("hasLabelDe")
  19.                             select moo.Value.ToString();
  20.                     string name = q.ToArray()[0];
  21.                     TestWriteLog(id.ToString() + " " + name);
  22.                     idpairs.Add(new Tuple<uint, string>(id, name));
  23.                 }
  24.             }
  25.             return idpairs;
  26.  
  27.         }