Examples of IOntology


Examples of edu.pitt.ontology.IOntology

public class FMAConcept extends Concept {
  public FMAConcept(IClass cls) {
    super(cls);
   
    // not lets do NCI Thesaurus specifics
    IOntology ont = cls.getOntology();
   
    // do codes
    IProperty code_p = ont.getProperty("FMAID");
    if(code_p != null){
      Object [] val = cls.getPropertyValues(code_p);
      if(val.length > 0)
        addCode(val[0].toString(),new Source("FMA"));
    }
    IProperty umls_p = ont.getProperty("UMLS_ID");
    if(umls_p != null){
      Object [] val = cls.getPropertyValues(umls_p);
      if(val.length > 0)
        addCode(val[0].toString(),new Source("UMLS"));
    }
   
    // do definitions
    List<Definition> deflist = new ArrayList<Definition>();
    IProperty def_p = ont.getProperty("definition");
    if(def_p != null){
      for(Object val : cls.getPropertyValues(def_p)){
        Definition d = new Definition(val.toString());
        deflist.add(d);
      }
View Full Code Here

Examples of edu.pitt.ontology.IOntology

public class ThesaurusConcept extends Concept {
  public ThesaurusConcept(IClass cls){
    super(cls);
   
    // not lets do NCI Thesaurus specifics
    IOntology ont = cls.getOntology();
   
    // do preferred name
    IProperty pn_p = ont.getProperty("Preferred_Name");
    if(pn_p != null){
      Object [] val = cls.getPropertyValues(pn_p);
      if(val.length > 0)
        setName(val[0].toString());
    }
   
    // do synonyms
    IProperty syn_p = ont.getProperty("FULL_SYN");
    if(syn_p != null){
      List<Term> terms = new ArrayList<Term>();
      Set<String> syns = new LinkedHashSet<String>();
      Collections.addAll(syns,getSynonyms());
      for(Object val : cls.getPropertyValues(syn_p)){
        Pattern pt = Pattern.compile(".*<.*:term-name>(.*)</.*:term-name><.*:term-group>(.*)</.*:term-group><.*:term-source>(.*)</.*:term-source>.*");
        Matcher mt = pt.matcher(val.toString());
        if(mt.matches()){
          String text  = mt.group(1);
          String group = mt.group(2);
          String src   = mt.group(3);
         
          Term term = new Term(text);
          term.setForm(group);
          term.setSource(new Source(src));
         
          terms.add(term);
          syns.add(text);
        }
      }
      setTerms(terms.toArray(new Term [0]));
      setSynonyms(syns.toArray(new String [0]));
    }
       
    // do definitions
    List<Definition> deflist = new ArrayList<Definition>();
    IProperty def_p = ont.getProperty("DEFINITION");
    if(def_p != null){
      for(Object val : cls.getPropertyValues(def_p)){
        Pattern pt = Pattern.compile(".*<.*:def-definition>(.*)</.*:def-definition><.*:def-source>(.*)</.*:def-source>.*");
        Matcher mt = pt.matcher(val.toString());
        if(mt.matches()){
          String text  = mt.group(1);
          String src   = mt.group(2);
         
          Definition d = new Definition(text);
          d.setSource(new Source(src));
          deflist.add(d);
        }
      }
    }
   
    IProperty adef_p = ont.getProperty("ALT_DEFINITION");
    if(adef_p != null){
      for(Object val : cls.getPropertyValues(adef_p)){
        Pattern pt = Pattern.compile(".*<.*:def-definition>(.*)</.*:def-definition><.*:def-source>(.*)</.*:def-source>.*");
        Matcher mt = pt.matcher(val.toString());
        if(mt.matches()){
          String text  = mt.group(1);
          String src   = mt.group(2);
         
          Definition d = new Definition(text);
          d.setSource(new Source(src));
          deflist.add(d);
        }
      }
    }
   
    setDefinitions(deflist.toArray(new Definition [0]));
   
    // do semantic type
    IProperty sem_p = ont.getProperty("Semantic_Type");
    if(sem_p != null){
      Object [] val = cls.getPropertyValues(sem_p);
      SemanticType [] types = new SemanticType [val.length];
      for(int i=0;i<val.length;i++){
        types[i] = new SemanticType(val[i].toString());
      }
      setSemanticTypes(types);
    }
   
    // do codes
    IProperty code_p = ont.getProperty("code");
    if(code_p != null){
      Object [] val = cls.getPropertyValues(code_p);
      if(val.length > 0){
        addCode(val[0].toString(),new Source("NCI"));
      }
    }
   
    IProperty umls_p = ont.getProperty("UMLS_CUI");
    if(umls_p != null){
      Object [] val = cls.getPropertyValues(umls_p);
      if(val.length > 0){
        addCode(val[0].toString(),new Source("UMLS"));
      }
    }
   
    IProperty nci_p = ont.getProperty("NCI_META_CUI");
    if(nci_p != null){
      Object [] val = cls.getPropertyValues(nci_p);
      if(val.length > 0){
        addCode(val[0].toString(),new Source("NCI_META"));
      }
View Full Code Here

Examples of edu.pitt.ontology.IOntology

public class BioPortalConcept extends Concept {
  public BioPortalConcept(IClass cls) {
    super(cls);
   
    // not lets do NCI Thesaurus specifics
    IOntology ont = cls.getOntology();
   
    // do code
    IProperty code_p = ont.getProperty(BioPortalHelper.CODE);
    if(code_p != null){
      for(Object val : cls.getPropertyValues(code_p)){
        addCode(val.toString(),new Source(val.toString()));
      }
    }
   
    // do sem type
    IProperty sem_p = ont.getProperty(BioPortalHelper.SEMANTIC_TYPE);
    if(sem_p != null){
      Object [] val = cls.getPropertyValues(sem_p);
      SemanticType [] types = new SemanticType [val.length];
      for(int i=0;i<val.length;i++){
        types[i] = new SemanticType(val[i].toString());
View Full Code Here

Examples of edu.pitt.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.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.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.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.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.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.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
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.