Examples of IOntology


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

    for(IOntology o: repository.getOntologies())
      System.out.println(o+" "+o.getResourceProperties().getProperty("id"));
    System.out.println("--");
    IOntology [] onts = repository.getOntologies("NCI_Thesaurus");
    if(onts.length > 0){
      IOntology ont = onts[0];
      System.out.println(ont.getRoot()+" : "+Arrays.toString(ont.getRootClasses()));
      IClass [] clses = new IClass [] { ont.getClass("Melanoma") };
      for(IClass cls :clses){
        System.out.println(cls+" "+cls.getLocation());
        Concept c = cls.getConcept();
        c.printInfo(System.out);
      }
View Full Code Here

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

  public IResource getResource(URI path) {
    String uri = path.toASCIIString();
    int i = uri.lastIndexOf("#");
    uri = (i > -1)?uri.substring(0,i):uri;
    // get ontology
    IOntology ont = getOntology(URI.create(uri));
    // if ontology is all you want, fine Girish
    if(i == -1)
      return ont;
    //

    if(ont != null){
      uri = path.toASCIIString();
      return ont.getResource(uri.substring(i+1));
    }
    return null;
  }
View Full Code Here

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

      pmap.put("hierarchySources",hsrc);
      terminology.loadRRF(f,pmap);
      name = (name == null)?f.getName():name;
    }else if(owl != null){
      log("Loading OWL terminology from "+owl+"...");
      IOntology ont = OOntology.loadOntology(owl);
      if(ont != null){
        terminology.loadOntology(ont,name,false,abbreviateURI);
      }
      name = (name == null)?ont.getName():name;
    }else if(obo != null){
      log("Loading OBO terminology from "+obo+"...");
      if(name == null){
        name = (new File(obo)).getName();
        if(name.endsWith(".obo"))
          name = name.substring(0,name.length()-4);
      }
      terminology.load(name);
      ConceptImporter.getInstance().addPropertyChangeListener(this);
      ConceptImporter.getInstance().loadOBO(terminology,new File(obo));
      ConceptImporter.getInstance().removePropertyChangeListener(this);
      terminology.save();
    }else if(bioportal != null){
      log("Loading BioPortal terminology from "+bioportal+"...");
      BioPortalRepository r = new BioPortalRepository();
      IOntology ont = r.getOntology(URI.create(bioportal));
      if(ont != null){
        ont.addPropertyChangeListener(this);
        terminology.loadOntology(ont,name);
      }
      name = (name == null)?ont.getName():name;
    }else if(txt != null){
      log("Loading Text terminology from "+txt+"...");
      File f = new File(txt);
      terminology.loadText(f,name);
      name = (name == null)?f.getName():name;
View Full Code Here

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

    }else if(IOntology.ONTOLOGY_LOADING_EVENT.equals(cmd)){
      pcs.firePropertyChange(PROPERTY_PROGRESS_MSG,progressMessage,evt.getNewValue());
      progressMessage = ""+evt.getNewValue();
    }else if(IOntology.ONTOLOGY_LOADED_EVENT.equals(cmd)){
      // after it is loaded stop listening to the ontology
      IOntology ont = (IOntology) evt.getSource();
      ont.removePropertyChangeListener(this);
    }
  }
View Full Code Here

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

  }


 
  private void doAdd(){
    final IOntology ont = getSelectedOntology();
    if(ont == null)
      return;
   
    if(ontologyExplorer != null){
      ontologyExplorer.removePropertyChangeListener(this);
    }
    ontologyExplorer = new OntologyExplorer();
    ontologyExplorer.addPropertyChangeListener(this);
   
    JOptionPane explorer = new JOptionPane(ontologyExplorer,
    JOptionPane.PLAIN_MESSAGE,JOptionPane.OK_CANCEL_OPTION);
    JDialog d = explorer.createDialog(wizard,"Ontology Explorer ["+getSelectedOntology()+"]");
    d.setModal(true);
    d.setResizable(true);
    ontologyExplorer.setBusy(true);
    (new Thread(new Runnable(){
      public void run(){
        /*
        try{
          Thread.sleep(500);
        }catch(Exception ex){}
        */
        ontologyExplorer.setRoot(ont.getRoot());
        ontologyExplorer.setBusy(false);
      }
    })).start();
    d.setVisible(true);
   
 
View Full Code Here

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

  /**
   * get selected classes
   * @return
   */
  public IClass [] getSelectedClasses(){
    IOntology ont = getSelectedOntology();
    if(ont == null)
      return new IClass [0];
    IClass [] cls = new IClass [rootList.getModel().getSize()];
    for(int i=0;i<cls.length;i++)
      cls[i] = (IClass) rootList.getModel().getElementAt(i);
    return (cls.length > 0)?cls:ont.getRootClasses();
  }
View Full Code Here

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

  public void valueChanged(ListSelectionEvent e) {
    if(e.getSource() == ontologyList && !e.getValueIsAdjusting()){
      Object obj = ontologyList.getSelectedValue();
      if(obj != null && obj instanceof IOntology){
        IOntology ont = (IOntology) obj;
        String name = ont.getName();
        String [] labels = ont.getLabels();
        if(labels.length > 0)
          name = labels[0];
        ontologyInfo.setText(
            "<b>"+name+"</b> "+ont.getVersion()+"<br><a>"+ont.getURI()+"</a><br>"+
            "<hr>"+ont.getDescription());
      }
    }
  }
View Full Code Here

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

   * @param root
   */
  public void copy(IClass [] sourceRoots, IClass targetRoot){
    // preload ontology
    if(isPreLoad() && sourceRoots.length > 0){
      IOntology ont = sourceRoots[0].getOntology();
      try{
        ont.addPropertyChangeListener(this);
        ont.load();
      }catch(IOntologyException ex){
        System.out.println("Error: Could not load ontology "+ont);
        ex.printStackTrace();
      }
    }
   
    // copy all classes
    for(IClass c: sourceRoots){
      try{
        copyClass(targetRoot, c);
      }catch(Exception ex){
        System.out.println("Error: Could not copy class "+c);
        ex.printStackTrace();
      }
    }
   
    // copy metadata for ontologies
    if(sourceRoots.length > 0){
      IOntology src = sourceRoots[0].getOntology();
      IOntology dst = targetRoot.getOntology();
      copyResourceInfo(src, dst);     
    }
   
    // do deep copy
    /*
 
View Full Code Here

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

    pcs.firePropertyChange(PROPERTY_PROGRESS_MSG, progressMessage, msg);
    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);
View Full Code Here

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

        Thread.sleep(500);
      }catch(Exception ex){}
    }
    if(importer.isSelected()){
      //IOntology source = POntology.loadOntology(new File("/home/tseytlin/Work/curriculum/owl/skin/UPMC/Alopecia.owl"));
      IOntology source = importer.getSelectedOntology();
      source.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
          if(IOntology.ONTOLOGY_LOADED_EVENT.equals(e.getPropertyName())){
            System.out.println("preload time "+((System.currentTimeMillis()-time2)/1000)+" s");
         
        }
      });
      IClass [] scls = importer.getSelectedClasses();
     
      IOntology ont = OOntology.createOntology(URI.create("http://www.ontologies.com/Test.owl"));
      System.out.println("start time "+new Date());
      long time = System.currentTimeMillis();
      time2 = System.currentTimeMillis();
      importer.copyClasses(scls,ont.getRoot());
      importer.copyValues(scls,ont.getRoot());
      System.out.println("total import time "+((System.currentTimeMillis()-time)/1000)+" s");
      System.out.println("end time "+new Date());
      ont.save();
      //,new File(System.getProperty("user.home")
      showOntology(ont);
     
    }else
      System.exit(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.