Package edu.pitt.ontology

Examples of edu.pitt.ontology.LogicExpression


   * @param dpatterns
   * @return
   */
  public static ILogicExpression getMatchingPatterns(IClass dx, IInstance inst){
    // check for multi-pattern
    ILogicExpression result = new LogicExpression(ILogicExpression.OR);
    ILogicExpression exp = dx.getEquivalentRestrictions();
    if(exp.getExpressionType() == ILogicExpression.OR){
      for(int i=0;i<exp.size();i++){
        if(exp.get(i) instanceof ILogicExpression){
          ILogicExpression e = (ILogicExpression) exp.get(i);
          // if this pattern matches
          if(e.evaluate(inst)){
            result.add(exp.get(i));
          }
        }
      }
    }
    return result;
View Full Code Here


  /**
   * get direct restrictions associated with a given class
   * @return
   */
  public ILogicExpression getNecessaryRestrictions(){
    ILogicExpression exp = new LogicExpression(ILogicExpression.AND);
    if(cls instanceof OWLNamedClass){
      Collection list = cls.getEquivalentClasses();
      for(Object o: ((OWLNamedClass) cls).getSuperclasses(true)){
        RDFSClass c = (RDFSClass) o;
        if(c.isAnonymous() && !list.contains(c)){
          exp.add(convertParameter(c));
        }
      }
    }
    return exp;
  }
View Full Code Here

  /**
   * get direct restrictions associated with a given class
   * @return
   */
  public ILogicExpression getDirectNecessaryRestrictions(){
    ILogicExpression exp = new LogicExpression(ILogicExpression.AND);
    if(cls instanceof OWLNamedClass){
      Collection list = cls.getEquivalentClasses();
      for(Object o: ((OWLNamedClass) cls).getSuperclasses(false)){
        RDFSClass c = (RDFSClass) o;
        if(c.isAnonymous() && !list.contains(c)){
          exp.add(convertParameter(c));
        }
      }
    }
    return exp;
 
View Full Code Here

   */
  public ILogicExpression getLogicExpression(){
   
    // if we have a union or intersection class
    if(resource instanceof OWLNAryLogicalClass){
      ILogicExpression exp = new LogicExpression(
          (resource instanceof OWLUnionClass)?ILogicExpression.OR:ILogicExpression.AND);
      for(Object c: (Collection) ((OWLNAryLogicalClass) resource).getOperands() ){
        if(c instanceof RDFSClass){
          exp.add(convertParameter((RDFSClass)c));
        }else if(c instanceof RDFList){
          RDFList l = (RDFList) c;
          System.err.println("WARNING: unexpected list "+l.getBrowserText()+" in logic expression for "+getName());
        }
      }
      return exp;
    // we might have a complement
    }else if(resource instanceof OWLComplementClass){
      RDFSClass c = ((OWLComplementClass)resource).getComplement();
      return new LogicExpression(ILogicExpression.NOT,convertParameter(c));
    }
    // default just container that contains this
    return super.getLogicExpression();
  }
View Full Code Here

   * @param obj if Array or Collection, fill multiple params
   * @return
   */
  public ILogicExpression createLogicExpression(int type, Object param){
    if(param instanceof Collection)
      return new LogicExpression(type,(Collection) param);
    else if(param instanceof Object [])
      return new LogicExpression(type,(Object []) param);
    else
      return new LogicExpression(type,param);
  }
View Full Code Here

   * @param type
   * @param obj if Array or Collection, fill multiple params
   * @return
   */
  public ILogicExpression createLogicExpression(){
    return new LogicExpression(ILogicExpression.EMPTY);
  }
View Full Code Here

    throw new IOntologyException("BioPortal is read-only");
  }

  public ILogicExpression createLogicExpression(int type, Object param) {
    if (param instanceof Collection)
      return new LogicExpression(type, (Collection) param);
    else if (param instanceof Object[])
      return new LogicExpression(type, (Object[]) param);
    else
      return new LogicExpression(type, param);
  }
View Full Code Here

    else
      return new LogicExpression(type, param);
  }

  public ILogicExpression createLogicExpression() {
    return new LogicExpression(ILogicExpression.EMPTY);
  }
View Full Code Here

  public String[] getLabels() {
    return getList(LABELS).toArray(new String[0]);
  }

  public ILogicExpression getLogicExpression() {
    return new LogicExpression(this);
  }
View Full Code Here

  public IClass[] getEquivalentClasses() {
    return getClassList(EQUIVALENT_CLASS).toArray(new IClass [0]);
  }

  public ILogicExpression getEquivalentRestrictions() {
    return new LogicExpression(ILogicExpression.EMPTY);
  }
View Full Code Here

TOP

Related Classes of edu.pitt.ontology.LogicExpression

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.