Package edu.pitt.terminology.lexicon

Examples of edu.pitt.terminology.lexicon.Source


    sb.append("offset: " + c.getOffset() + "\n");
    sb.append("conceptClass: " + c.getConceptClass() + "\n");
    sb.append("content: " + c.getContent() + "\n");
    sb.append("matchedTerm: " + c.getMatchedTerm() + "\n");
    sb.append("score: " + c.getScore() + "\n");
    String conceptCode = c.getCode(new Source("NCI"));
    sb.append("conceptCode (NCI): " + conceptCode + "\n");
    conceptCode = c.getCode(new Source("LNC"));
    sb.append("conceptCode (LNC): " + conceptCode + "\n");
    conceptCode = c.getCode(new Source("MSH"));
    sb.append("conceptCode (MSH): " + conceptCode + "\n");

    // Todo

    sb.append("preferredTerm: " + c.getPreferredTerm() + "\n");
View Full Code Here


              if("org.LexGrid.concepts.Presentation".equals(m.get("name"))){
                String pt = ""+m.get("_isPreferred");
                String text = null;
                String lang = (String) m.get("_language");
                String form = (String) m.get("_representationalForm");
                Source src = null;
               
                // get content
                Map tm = ((List<Map>) m.get("_value")).get(0);
                if("org.LexGrid.commonTypes.Text".equals(tm.get("name"))){
                  text = ""+tm.get("_content");
                  synonyms.add(text.trim());
                }
               
                // get source
                List<Map> sl = (List<Map>) m.get("_sourceList");
                if(sl != null && !sl.isEmpty()){
                  Map sm = sl.get(0);
                  if("org.LexGrid.commonTypes.Source".equals(sm.get("name"))){
                    String s = (String) sm.get("_content");
                    if(s != null){
                      src = new Source(s);
                      sources.add(src);
                    }
                  }
                }
               
                if(text != null){
                  Term term = new Term(text);
                  term.setPreferred(Boolean.parseBoolean(pt));
                  term.setLanguage(lang);
                  term.setForm(form);
                  if(src != null)
                    term.setSource(src);
                  terms.add(term);
                }
              }
            }
          }
         
          // set definitions and terms
          List<Definition> defs = new ArrayList<Definition>();
          if(content.containsKey("_definitionList")){
            for(Map m: (List<Map>) content.get("_definitionList")){
              if("org.LexGrid.concepts.Definition".equals(m.get("name"))){
                String text = null;
                Source src = null;
               
                Map tm = ((List<Map>) m.get("_value")).get(0);
                if("org.LexGrid.commonTypes.Text".equals(tm.get("name"))){
                  text = ""+tm.get("_content");
                }
                // get source
                List<Map> sl = (List<Map>) m.get("_sourceList");
                if(sl != null && !sl.isEmpty()){
                  Map sm = sl.get(0);
                  if("org.LexGrid.commonTypes.Source".equals(sm.get("name"))){
                    String s = (String) sm.get("_content");
                    if(s != null){
                      src = new Source(s);
                    }
                  }
                }
               
                if(text != null){
View Full Code Here

        ResultSet result =  st.executeQuery();
        while(result.next()){
          String src  = result.getString("rsab");
          String text = result.getString("son");
         
          Source source = Source.getSource(src);
          source.setDescription(text);
         
          srcs.add(source);

        }
        result.close();
View Full Code Here

        String text = result.getString("str");
        String lang = result.getString("lat");
        String form = result.getString("tty");
        String code = result.getString("code");
        String pref = result.getString("ispref");
        Source source = Source.getSource(src);
       
        Term term = new Term(text);
        term.setForm(form);
        term.setLanguage(lang);
        term.setSource(source);
View Full Code Here

  private Source[] iOntologiesToSource(IOntology[] iontologies) {
    Source[] sources = new Source[iontologies.length];

    for (int i = 0; i < iontologies.length; i++)
      sources[i] = new Source(iontologies[i].getName());

    return sources;
  }
View Full Code Here

    // 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");
View Full Code Here

          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

   
    // 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);
View Full Code Here

      if(properties.containsKey(CODE)){
        Object val = properties.get(CODE);
        int i = 0;
        if(val instanceof Collection){
          for(Object o :(Collection) val)
            concept.addCode(""+o,new Source("SOURCE"+(i++)));
        }else
          concept.addCode(""+val,new Source("SOURCE"+i));
      }
     
      // add semantic types
      if(properties.containsKey(SEMANTIC_TYPE)){
        Object val = properties.get(SEMANTIC_TYPE);
View Full Code Here

  /**
   * Return list of all sources in this terminology
   * @return
   */
  public Source [] getSources(){
    return new Source [] { new Source(getName(),getDescription(),""+getURI())};
  }
View Full Code Here

TOP

Related Classes of edu.pitt.terminology.lexicon.Source

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.