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

Untitled

By: a guest on Apr 26th, 2012  |  syntax: None  |  size: 1.05 KB  |  hits: 22  |  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. rowlex api - how to find owlSubClasses of a class?
  2. string baseClassUri = "http://myontology/2012/10#mybaseclass";
  3. Assembly asm = GetMyAssemblyGeneratedByOwlGrinder();
  4.  
  5. Type[] subClasses = (from type in asm.GetTypes()
  6.                      where type.IsSubclassOf(typeof(NC3A.SI.Rowlex.OwlThing))
  7.                      // selecting subclasses only
  8.                      let attributes = type.GetCustomAttributes(typeof(NC3A.SI.Rowlex.SubClassOfAttribute), false)
  9.                      from attr in attributes
  10.                      let subClassAttr = attr as NC3A.SI.Rowlex.SubClassOfAttribute
  11.                      where subClassAttr.TypeUri == baseClassUri
  12.                      // selecting light classes only
  13.                      let lightAttributes = type.GetCustomAttributes(typeof(NC3A.SI.Rowlex.LightVersionAttribute), false)
  14.                      from lightAttr in lightAttributes
  15.                      let lightAttr_ = lightAttr as NC3A.SI.Rowlex.LightVersionAttribute
  16.                      where lightAttr_.LightVersion == true
  17.                      select type).ToArray();