Package org.mindswap.pellet.exceptions

Examples of org.mindswap.pellet.exceptions.InternalReasonerException


  }
   
  void addType(ATermAppl c, DependencySet ds, boolean checkForPruned ) {
    if( checkForPruned ) {
        if( isPruned() )
            throw new InternalReasonerException( "Adding type to a pruned node " + this + " " + c );
        else if( isMerged() )
            return;
    }
    else if( isMerged() ) {
      modifiedAfterMerge = true;
    }
   
    if( depends.containsKey( c ) ) {
      if( !checkForPruned && ds.isIndependent() ) {
        depends.put( c, ds );
      }
       
      return;   
    }
       
//        if( ABox.log.isLoggable( Level.FINE ) )
//            ABox.log.fine( "TYPE: " + this + " " + c );       
   
    // if we are checking entailment using a precompleted ABox, abox.branch
    // is set to -1. however, since applyAllValues is done automatically
    // and the edge used in applyAllValues may depend on a branch we want
    // this type to be deleted when that edge goes away, i.e. we backtrack
    // to a position before the max dependency of this type
    int b = abox.getBranch();
    int max = ds.max();
    if(b == -1 && max != 0)
        b = max + 1;
   
    ds = ds.copy( b );
   
    depends.put(c, ds);

    abox.setChanged( true );


      // add to effected list
      if( abox.getBranch() >= 0 && PelletOptions.TRACK_BRANCH_EFFECTS )
      abox.getBranchEffectTracker().add( abox.getBranch(), this.getName() );   
   
    //create new queue element
    QueueElement qElement = new QueueElement(this, c);
   
    ATermAppl notC = ATermUtils.negate( c );
    DependencySet clashDepends = depends.get( notC );
    if( clashDepends != null ) {
      ATermAppl positive = ATermUtils.isNot( notC )
        ? c
        : notC;
      clashDepends = clashDepends.union( ds, abox.doExplanation() );
      clashDepends = clashDepends.copy( abox.getBranch() );
      abox.setClash( Clash.atomic( this, clashDepends, positive ) );
    }
   
    if (ATermUtils.isPrimitive(c)) {
      setChanged(ATOM);
      types[ATOM].add(c);

      if(PelletOptions.USE_COMPLETION_QUEUE){
        //update completion queue
        abox.getCompletionQueue().add(qElement, NodeSelector.ATOM );
      }
    }
    else {
      if (c.getAFun().equals(ATermUtils.ANDFUN)){
        for(ATermList cs = (ATermList) c.getArgument(0); !cs.isEmpty(); cs = cs.getNext()) {
          ATermAppl conj = (ATermAppl) cs.getFirst();
         
          addType(conj, ds, checkForPruned);
        }     
      }
      else if (c.getAFun().equals(ATermUtils.ALLFUN)) {
        setChanged(ALL);     
        types[ALL].add(c);     

        if(PelletOptions.USE_COMPLETION_QUEUE){
          //update completion queue
          abox.getCompletionQueue().add( qElement, NodeSelector.UNIVERSAL );
        }
      }
      else if (c.getAFun().equals(ATermUtils.MINFUN)) {
        if(!isRedundantMin(c)) {
          types[MIN].add(c);
          setChanged(MIN);
         
          if(PelletOptions.USE_COMPLETION_QUEUE){   
            //update completion queue
            abox.getCompletionQueue().add(qElement, NodeSelector.MIN_NUMBER );
          }
         
          // check min clash after concept is added to the type
          // list. otherwise a clash found will prevent the
          // addition to the type list and term will be only in the
          // dependency map. smart restore may not remove the cardinality
          // from dependency map leaving the node in an invalid state.
          checkMinClash(c, ds);
        }       
      }
      else if(c.getAFun().equals(ATermUtils.NOTFUN)) {
        ATermAppl x = (ATermAppl) c.getArgument(0);
        if(ATermUtils.isAnd(x)) {
          setChanged(OR);
          types[OR].add(c);
         
          if(PelletOptions.USE_COMPLETION_QUEUE){
            //update completion queue
            abox.getCompletionQueue().add( qElement, NodeSelector.DISJUNCTION );
          }
        }
        else if(ATermUtils.isAllValues(x)) {
          setChanged(SOME);
          types[SOME].add(c);
         
          if(PelletOptions.USE_COMPLETION_QUEUE){
            //update completion queue         
            abox.getCompletionQueue().add( qElement, NodeSelector.EXISTENTIAL );
          }
        }
        else if(ATermUtils.isMin(x)) {
          if(!isRedundantMax(x)) {
            types[MAX].add(c);
            setChanged(MAX);
           
            if(PelletOptions.USE_COMPLETION_QUEUE){
              //update completion queue           
              abox.getCompletionQueue().add( qElement, NodeSelector.MAX_NUMBER );
              abox.getCompletionQueue().add( qElement, NodeSelector.CHOOSE );
              abox.getCompletionQueue().add( qElement, NodeSelector.GUESS );
            }
           
            // check max clash after concept is added to the type
            // list. otherwise a clash found will prevent the
            // addition to the type list and term will be only in the
            // dependency map. smart restore may not remove the cardinality
            // from depdendency map leaving the node in an invalid state.
            checkMaxClash(c, ds);
          }
        }
        else if(ATermUtils.isNominal(x)) {
          setChanged(ATOM);
          types[ATOM].add(c);
           
          if(PelletOptions.USE_COMPLETION_QUEUE){
            //update completion queue         
            abox.getCompletionQueue().add( qElement, NodeSelector.ATOM );
          }
        }
        else if (ATermUtils.isSelf(x)) {
                ATermAppl p = (ATermAppl) x.getArgument( 0 );
                Role role = abox.getRole( p );
                // during loading role would be null
                if( role != null ) {
                  EdgeList selfEdges = outEdges.getEdges(role).getEdgesTo( this );
                  if( !selfEdges.isEmpty() ) {                   
                    abox.setClash(Clash.unexplained( this, selfEdges.getDepends( abox.doExplanation() )));
                  }
                }
              }
        else if(x.getArity() == 0) {
          setChanged(ATOM);
          types[ATOM].add(c);
         
          if(PelletOptions.USE_COMPLETION_QUEUE){
            //update completion queue         
            abox.getCompletionQueue().add( qElement, NodeSelector.ATOM );
          }
        }
        else
            throw new InternalReasonerException( "Invalid type " +  c + " for individual " + name);
      }
      else if (c.getAFun().equals(ATermUtils.VALUEFUN)) {
        setChanged(NOM);
        types[NOM].add(c);
     
        if(PelletOptions.USE_COMPLETION_QUEUE){
          //update completion queue       
          abox.getCompletionQueue().add( qElement, NodeSelector.NOMINAL );
        }
      }   
            else if (ATermUtils.isSelf(c)) {
              setChanged( ATOM );
                types[ATOM].add(c);
            }
      else {
        throw new InternalReasonerException("Warning: Adding invalid class constructor - " + c);
      }       
    }   
  }
View Full Code Here


        }
        else if(ATermUtils.isSelf(x)) {
          // do nothing
        }
        else
            throw new InternalReasonerException( "Invalid type " +  c + " for individual " + name);       
      }
      else if(c.getAFun().equals(ATermUtils.VALUEFUN))
        types[NOM].remove(c);
      else
        throw new RuntimeException("Invalid concept " + c);
View Full Code Here

            hasValue = Bool.FALSE;
        } catch( DatatypeReasonerException e ) {
          final String msg = "Unexpected datatype reasoner exception while checking property value: "
              + e.getMessage();
          log.severe( msg );
          throw new InternalReasonerException( msg );
        }
      }
        else if( value == null || value.equals( literalValue ) ) {
            if( ds.isIndependent() )
                return Bool.TRUE;
View Full Code Here

          log.fine( "EDGE: " + this + " -> " + r + " -> " + x + ": " + ds + " " + getRNeighborEdges( r ).getEdgesTo( x ) );
        return null;
    }   
         
      if( isPruned() )
          throw new InternalReasonerException( "Adding edge to a pruned node " + this + " " + r + " " + x );
      else if( isMerged() )
          return null;

    abox.setChanged( true );
    setChanged(ALL);
View Full Code Here

 
  final public boolean removeEdge(Edge edge) {
    boolean removed = outEdges.removeEdge(edge);
   
    if( !removed )
            throw new InternalReasonerException(
                "Trying to remove a non-existing edge " + edge);
   
    return true;
  }
View Full Code Here

        simp = ATermUtils.makeSomeValues( p, qSimp );
      }
    }
    else if( !ATermUtils.isPrimitive( elConcept ) && !ATermUtils.isBottom( elConcept )
        && !ATermUtils.isTop( elConcept ) ) {
      throw new InternalReasonerException( "Concept " + elConcept + " is not an EL concept" );
    }

    return simp;
  }
View Full Code Here

        Rule rule = new Rule( name, consequent, antecedent );
        kb.addRule( rule );
      }
    }
    else {
      throw new InternalReasonerException( "Unknown axiom " + axiom );
    }
  }
View Full Code Here

        kb.addDatatypeProperty( p );
        AtomDObject do2 = convertAtomDObject( i2 );
        atom = new DatavaluedPropertyAtom( p, io1, do2 );
      }
      else {
        throw new InternalReasonerException( "Unknown property " + p );
      }
    }
    else if( term.getAFun().equals( ATermUtils.SAMEASFUN ) ) {
      ATermAppl i1 = (ATermAppl) term.getArgument( 0 );
      ATermAppl i2 = (ATermAppl) term.getArgument( 1 );
      AtomIObject io1 = convertAtomIObject( i1 );
      AtomIObject io2 = convertAtomIObject( i2 );
     
      atom = new SameIndividualAtom( io1, io2 );     
    }
    else if( term.getAFun().equals( ATermUtils.DIFFERENTFUN ) ) {
      ATermAppl i1 = (ATermAppl) term.getArgument( 0 );
      ATermAppl i2 = (ATermAppl) term.getArgument( 1 );
      AtomIObject io1 = convertAtomIObject( i1 );
      AtomIObject io2 = convertAtomIObject( i2 );
     
      atom = new DifferentIndividualsAtom( io1, io2 );     
    }
    else if( term.getAFun().equals( ATermUtils.BUILTINFUN ) ) {
      ATermList args = (ATermList) term.getArgument( 0 );
      ATermAppl builtin = (ATermAppl) args.getFirst();
      List<AtomDObject> list = new ArrayList<AtomDObject>();
      for( args = args.getNext(); !args.isEmpty(); args = args.getNext() ) {
        ATermAppl arg = (ATermAppl) args.getFirst();
        list.add( convertAtomDObject( arg ) );
      }
     
      atom = new BuiltInAtom( builtin.toString(), list );     
    }
    else {
      throw new InternalReasonerException( "Unknown rule atom " + term );
    }

    return atom;
  }
View Full Code Here

    else if( kb.isIndividual( t ) )
      return new AtomIConstant( t );
    else if( ATermUtils.isAnon( t ) )
      return new AtomIConstant( t );

    throw new InternalReasonerException( "Unrecognized term: " + t );
  }
View Full Code Here

    if( ATermUtils.isVar( t ) )
      return new AtomDVariable( ((ATermAppl) t.getArgument( 0 )).getName() );
    else if( ATermUtils.isLiteral( t ) )
      return new AtomDConstant( t );   

    throw new InternalReasonerException( "Unrecognized term: " + t );
 
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.exceptions.InternalReasonerException

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.