Package edu.pitt.dbmi.nlp.noble.ontology

Examples of edu.pitt.dbmi.nlp.noble.ontology.IClass


      return c1;
    if(c2.hasSubClass(c1))
      return c2;
   
    // if direct parents were not found, recurse further
    IClass parent = null;
    for(IClass c : c1.getDirectSuperClasses()){
      IClass p = getCommonParent(c,c2);
      // keep the most specific parent
      if(parent == null || parent.hasSubClass(p) || (branch != null && branch.hasSubClass(p)))
        parent = p;
    }
   
View Full Code Here


      i++;
      // skip if we have an offset left over from previous load
      //if(i< offset)
      //  continue;
     
      IClass cls = (IClass)it.next();
      String code = getCode(cls,truncateURI);
      if(storage.getConceptMap().containsKey(code))
        continue;
     
      Concept concept = cls.getConcept();
      concept.setCode(code);
     
      // fix sources
      for(Source sr: concept.getSources())
        sr.setCode(getCode(sr.getCode(),truncateURI));
     
      // add relations to concept
      for(IClass c: cls.getDirectSuperClasses()){
        concept.addRelatedConcept(Relation.BROADER,getCode(c,truncateURI));
      }
     
      // add relations to concept
      for(IClass c: cls.getDirectSubClasses()){
        concept.addRelatedConcept(Relation.NARROWER,getCode(c,truncateURI));
      }
           
      // add concept
      term.addConcept(concept);
View Full Code Here

    progressMessage = msg;
   
   
    //check if name exits
    IOntology ont = parent.getOntology();
    IClass cls = ont.getClass(name);
    ///IClass [] children = source.getDirectSubClasses();
   
    if(cls == null){
      cls = parent.createSubClass(name);
      copyResourceInfo(source,cls);
    }else if(!cls.hasSuperClass(parent)){
      cls.addSuperClass(parent);
      // don't visit this branch, since we've probably been there
      if(freshCopy)
        return;
    }
   
View Full Code Here

      }
      return t;
    }else if(value instanceof IProperty){
      return ont.getProperty(((IProperty) value).getName());
    }else if(value instanceof IClass){
      IClass c = (IClass) value;
      if(c.isAnonymous())
        return convertResource(ont,c.getLogicExpression());
      return ont.getClass(c.getName());
    }else if(value instanceof IInstance){
      return ont.getInstance(((IInstance) value).getName());
    }else if(value instanceof IResource){
      return ont.getResource(((IResource) value).getName());
    }
View Full Code Here

    pcs.firePropertyChange(PROPERTY_PROGRESS_MSG, progressMessage, msg);
    progressMessage = msg;
   
   
    //check if name exits
    IClass cls = ont.getClass(name);
    // if exists, then do the magic
    if(cls != null){
      // copy property values
      for(IProperty sp: source.getProperties()){
        IProperty tp = (IProperty) convertResource(ont,sp);
        if(tp != null){
          // set property values
          if(tp.isFunctional())
            cls.setPropertyValue(tp,convertResource(ont,source.getPropertyValue(sp)));
          else
            cls.setPropertyValues(tp,convertResources(ont,source.getPropertyValues(sp)));
         
       
      }
     
      // copy disjoints
      for(IClass c: source.getDisjointClasses()){
        cls.addDisjointClass((IClass)convertResource(ont,c));
      }
     
      // copy necessary restrictions
      ILogicExpression exp = source.getNecessaryRestrictions();
      if(exp.getExpressionType() == ILogicExpression.OR){
        cls.addSuperClass(ont.createClass((ILogicExpression) convertResource(ont,exp)));
      }else{
        for(Object c: exp){
          if(c instanceof IRestriction)
            cls.addNecessaryRestriction((IRestriction)convertResource(ont,c));
          else if(c instanceof IClass)
            cls.addSuperClass((IClass) convertResource(ont,c));
          else if(c instanceof ILogicExpression)
            cls.addSuperClass(ont.createClass((ILogicExpression) convertResource(ont,exp)));   
        }
      }
     
      // copy equivalent restrictions
      exp = source.getEquivalentRestrictions();
      if(exp.getExpressionType() == ILogicExpression.OR){
        cls.addEquivalentClass(ont.createClass((ILogicExpression) convertResource(ont,exp)));
      }else{
        for(Object c: exp){
          if(c instanceof IRestriction)
            cls.addEquivalentRestriction((IRestriction)convertResource(ont,c));
          else if(c instanceof IClass)
            cls.addEquivalentClass((IClass) convertResource(ont,c));
          else if(c instanceof ILogicExpression)
            cls.addEquivalentClass(ont.createClass((ILogicExpression) convertResource(ont,exp)));
         
        }
      }
           
      // copy instances
      for(IInstance inst: source.getDirectInstances()){
        IInstance i = ont.getInstance(inst.getName());
        if(i == null){
          i = cls.createInstance(inst.getName());
          // copy property values
          for(IProperty sp : inst.getProperties()){
            IProperty tp = (IProperty) convertResource(ont,sp);
            if(tp != null){
              if(tp.isFunctional())
View Full Code Here

      buffer.append("<b>"+e.getName()+"</b><br>");
      buffer.append("(<i>"+e.getURI()+"</i>)<br>");
      buffer.append("<hr>");
      buffer.append("<b>Definition: </b> "+e.getDescription()+"<br>");
      if(e instanceof IClass){
        IClass cls = (IClass) e;
        buffer.append("<b>Equivalent: </b> "+Arrays.asList(cls.getEquivalentClasses())+"<br>");
        buffer.append("<b>Disjoint: </b> "+Arrays.asList(cls.getDisjointClasses())+"<br>");
      }else if(e instanceof IProperty){
        IProperty cls = (IProperty) e;
        buffer.append("<b>Domain: </b> "+Arrays.asList(cls.getDomain())+"<br>");
        buffer.append("<b>Range: </b> "+Arrays.asList(cls.getRange())+"<br>");
      }else if(e instanceof IInstance){
        IInstance cls = (IInstance) e;
        buffer.append("<b>Types: </b> "+Arrays.asList(cls.getTypes())+"<br>");
      }
      buffer.append("<b>Properties:</b>");
      IProperty[] p = e.getProperties();
      if(p.length > 0){
        buffer.append("<ul>");
View Full Code Here

  /**
   * display specific instance (path to root)
   * @param i
   */
  public void setInstance(IInstance i){
    IClass c = i.getDirectTypes()[0];
    // get path
    List<ClassPath> paths = OntologyUtils.getRootPaths(c);
    // set first path
    if(!paths.isEmpty()){
      ExplorerPanel panel = root;
View Full Code Here

    if(e.getLabels().length > 0)
      buffer.append("<tr valign=top><td><b>Labels:</b></td><td>"+toHTML(e.getLabels())+"</td></tr>");
    if(e.getComments().length > 0)
      buffer.append("<tr valign=top><td><b>Comments: </b></td><td> "+toHTML(e.getComments())+"</td></tr>");
    if(e instanceof IClass){
      IClass cls = (IClass) e;
      if(cls.getDirectSuperClasses().length > 0)
        buffer.append("<tr valign=top><td><b>Super Classes: </b></td><td>"+
          toHTML(cls.getDirectSuperClasses())+"</td></tr>");
      if(cls.getEquivalentClasses() != null && cls.getEquivalentClasses().length > 0)
        buffer.append("<tr valign=top><td><b>Equivalent Classes: </b></td><td>"+
            toHTML(cls.getEquivalentClasses())+"</td></tr>");
      if(cls.getDisjointClasses() != null && cls.getDisjointClasses().length > 0)
        buffer.append("<tr valign=top><td><b>Disjoint Classes: </b></td><td>"+
            toHTML(cls.getDisjointClasses())+"</td></tr>");
      ILogicExpression exp = cls.getEquivalentRestrictions();
      if(exp != null && !exp.isEmpty() )
        buffer.append("<tr valign=top><td><b>Equivalent Restrictions: </b></td><td>"+
            toHTML(exp)+"</td></tr>");
      exp = cls.getDirectNecessaryRestrictions();
      if(exp != null && !exp.isEmpty() )
        buffer.append("<tr valign=top><td><b>Necessary Restrictions: </b></td><td>"+
            toHTML(exp)+"</td></tr>");
      // do paths to root
      List<ClassPath> paths = getRootPaths(cls);
      if(!paths.isEmpty() ){
        buffer.append("<tr valign=top><td><b>Path(s) to Root: </b></td><td>");
        for(List<IClass> p: paths){
          buffer.append(toHTML(p)+"<br>");
        }
        buffer.append("</td></tr>");
      }
     
    }else if(e instanceof IProperty){
      IProperty cls = (IProperty) e;
      buffer.append("<tr valign=top><td><b>Domain: </b></td><td>"+
          toHTML(cls.getDomain())+"</td></tr>");
      buffer.append("<tr valign=top><td><b>Range: </b></td><td>"+
          toHTML(cls.getRange())+"</td></tr>");
    }else if(e instanceof IInstance){
      IInstance cls = (IInstance) e;
      buffer.append("<tr valign=top><td><b>Types: </b></td><td>"+
          toHTML(cls.getDirectTypes())+"</td></tr>");
    }
   
    IProperty[] p = e.getProperties();
    if(p.length > 0){
      buffer.append("<tr valign=top><td><b>Properties:</b>");
View Full Code Here

      if(entry instanceof Concept){
        try{
          return ((Concept)entry).getChildrenConcepts().length > 0;
        }catch(TerminologyException ex){}
      }else if(entry instanceof IClass){
        IClass cls = (IClass) entry;
        return cls.getDirectSubClasses().length > 0 || cls.getDirectInstances().length > 0;
      }
      return false;
    }
View Full Code Here

TOP

Related Classes of edu.pitt.dbmi.nlp.noble.ontology.IClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.