Examples of IProperty


Examples of edu.pitt.ontology.IProperty

   
    // 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.IProperty

    for(IProperty sp : src.getProperties()){
      String name = sp.getName();
      // skip properties that are incorrectly named
      if(!name.matches("\\w+"))
        continue;
      IProperty tp = target.getProperty(name);
      if(tp == null && !target.hasResource(name)){
        tp = target.createProperty(name,sp.getPropertyType());
       
        // notify of progress
        String msg = "Copying property "+name+" ...";
        pcs.firePropertyChange(PROPERTY_PROGRESS_MSG, progressMessage, msg);
        progressMessage = msg;
       
       
       
        // copy stuff
        copyResourceInfo(sp,tp);
       
        // copy booleans
        tp.setFunctional(sp.isFunctional());
        tp.setTransitive(sp.isTransitive());
        tp.setSymmetric(sp.isSymmetric());
       
        // copy domain and ranges
        tp.setDomain((IResource []) convertResources(target,sp.getDomain(),IResource.class));
        tp.setRange(convertResources(target,sp.getRange()));
      }
    }
   
    // set rest of properties properties
    for(IProperty sp : src.getProperties()){
      String name = sp.getName();
      // skip properties that are incorrectly named
      if(!name.matches("\\w+"))
        continue;
     
      IProperty tp = target.getProperty(name);
      if(tp != null){
        tp.setInverseProperty((IProperty)convertResource(target,sp.getInverseProperty()));
        IProperty [] sub = sp.getSubProperties();
        if(sub != null && sub.length > 0){
          for(IProperty p: (IProperty []) convertResources(target,sub,IProperty.class)){
            tp.addSubProperty(p);
          }
        }
        IProperty [] sup = sp.getSuperProperties();
        if(sup != null && sup.length > 0){
          for(IProperty p: (IProperty []) convertResources(target,sup,IProperty.class)){
            tp.addSuperProperty(p);
          }
        }
       
      }
    }
View Full Code Here

Examples of edu.pitt.ontology.IProperty

    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())
                i.setPropertyValue(tp,convertResource(ont,inst.getPropertyValue(sp)));
              else
                i.setPropertyValues(tp,convertResources(ont,inst.getPropertyValues(sp)));
            }
          }
View Full Code Here

Examples of edu.pitt.ontology.IProperty

      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

Examples of edu.pitt.ontology.IProperty

        }
        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

Examples of edu.pitt.ontology.IProperty

    pcs.firePropertyChange(ONTOLOGY_LOAD_STAGE,null,ONTOLOGY_LOAD_STAGE_BUILDHIERARCHY);
    pcs.firePropertyChange(ONTOLOGY_LOADING_EVENT,null,"Creating Hierarchy ...");
   
   
    // create some important properties
    IProperty partOf = target.getProperty(PART_OF);
    if(partOf == null){
      partOf = target.createProperty(PART_OF,IProperty.OBJECT);
      partOf.setDomain(new IClass [] {target.getRoot()});
      partOf.setRange(new IClass [] {target.getRoot()});
    }
   
    IProperty hasPart = target.getProperty(HAS_PART);
    if(hasPart == null){
      hasPart = target.createProperty(HAS_PART,IProperty.OBJECT);
      hasPart.setDomain(new IClass [] {target.getRoot()});
      hasPart.setRange(new IClass [] {target.getRoot()});
    }
    // make them inverses of eachother
    hasPart.setInverseProperty(partOf);
    partOf.setInverseProperty(hasPart);
   
    // now that we have all classes, build a tree, since classes only have the superclasses set
    IResourceIterator it = target.getAllClasses();
    while(it.hasNext()){
      IClass cls = (IClass) it.next();
     
      long time = System.currentTimeMillis();
     
      // now copy equivalent classes classes
      IProperty p = target.getProperty(EQUIVALENT_CLASS);
      if(p != null){
        for(IClass sibling: getClassList(target,cls.getPropertyValues(p))){
          cls.addEquivalentClass(sibling);
        }
        // remove temporary property
View Full Code Here

Examples of edu.pitt.ontology.IProperty

        // do not dispose of content
      }
    }else{
     
      // create some important properties
      IProperty partOf = target.getProperty(PART_OF);
      if(partOf == null){
        partOf = target.createProperty(PART_OF,IProperty.OBJECT);
        partOf.setDomain(new IClass [] {target.getRoot()});
        partOf.setRange(new IClass [] {target.getRoot()});
      }
     
      IProperty hasPart = target.getProperty(HAS_PART);
      if(hasPart == null){
        hasPart = target.createProperty(HAS_PART,IProperty.OBJECT);
        hasPart.setDomain(new IClass [] {target.getRoot()});
        hasPart.setRange(new IClass [] {target.getRoot()});
      }
      // make them inverses of eachother
      hasPart.setInverseProperty(partOf);
      partOf.setInverseProperty(hasPart);
     
     
      // if we have last processed page
      int lastPageCount = 0;
View Full Code Here

Examples of edu.pitt.ontology.IProperty

      for(IProperty sp : src.getProperties()){
        // skip PartOf, and has_PART
        if(HAS_PART.equals(sp.getName()) || PART_OF.equals(sp.getName()))
          continue;
       
        IProperty dp = target.getProperty(sp.getName());
       
        // create unknown property for the first time
        if(dp == null && !target.hasResource(sp.getName())){
          dp = target.createProperty(sp.getName(),IProperty.ANNOTATION_DATATYPE);
          dp.setRange(new String [0]);
        }
       
        // copy string values
        dst.setPropertyValues(dp,src.getPropertyValues(sp));
       
View Full Code Here

Examples of edu.pitt.ontology.IProperty

    for(IProperty sp : src.getProperties()){
      // skip PartOf, and has_PART
      if(HAS_PART.equals(sp.getName()) || PART_OF.equals(sp.getName()))
        continue;
   
      IProperty dp = target.getProperty(sp.getName());
     
      // create unknown property for the first time
      if(dp == null && !target.hasResource(sp.getName())){
        dp = target.createProperty(sp.getName(),IProperty.ANNOTATION_DATATYPE);
        dp.setRange(new String [0]);
      }
     
      // copy string values if not there
      dst.setPropertyValues(dp,src.getPropertyValues(sp));
    }
View Full Code Here

Examples of edu.pitt.ontology.IProperty

   * @param dst
   * @param relation
   */
  private void copyClassRelations(BClass src, IClass dst, String relation){
    // get or create temp property
    IProperty dp = dst.getOntology().getProperty(relation);
    if(dp == null){
      dp = dst.getOntology().createProperty(relation,IProperty.ANNOTATION_DATATYPE);
      dp.setRange(new String [0]);
    }
   
    // remove prefix
    if(relation.startsWith("annotation_")){
      relation = relation.substring("annotation_".length());
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.