Package org.mindswap.pellet.exceptions

Examples of org.mindswap.pellet.exceptions.InternalReasonerException


            } catch( DatatypeReasonerException e ) {
              final String msg = format(
                  "Unexpected datatype reasoner exception while fetching property values (%s,%s,%s): %s",
                  s, role, datatype, e.getMessage() );
              log.severe( msg );
              throw new InternalReasonerException( msg );
            }
          }
        }

        if( isIndependent && ds.isIndependent() ) {
View Full Code Here


    return lit;
  }

  public Literal addLiteral(ATermAppl dataValue, DependencySet ds) {
    if( dataValue == null || !ATermUtils.isLiteral( dataValue ) ) {
          throw new InternalReasonerException( "Invalid value to create a literal. Value: "
          + dataValue );
        }

    return createLiteral( dataValue, ds );
  }
View Full Code Here

        if (PelletOptions.INVALID_LITERAL_AS_INCONSISTENCY) {
          log.fine( msg );
          name = dataValue;
        } else {
          log.severe( msg );
          throw new InternalReasonerException( msg, e );
        }
      } catch( UnrecognizedDatatypeException e ) {
        final String msg = format(
            "Attempt to create a literal with an unrecognized datatype (%s): %s",
            dataValue, e.getMessage() );
        log.severe( msg );
        throw new InternalReasonerException( msg, e );
      }
    }

    Node node = getNode( name );
    if( node != null ) {
      if( node instanceof Literal ) {

        if( ((Literal) node).getValue() == null && PelletOptions.USE_COMPLETION_QUEUE ) {
          // added for completion queue
          QueueElement newElement = new QueueElement( node );
          this.completionQueue.add( newElement, NodeSelector.LITERAL );
        }

        if( getBranch() >= 0 && PelletOptions.TRACK_BRANCH_EFFECTS ) {
                  branchEffects.add( getBranch(), node.getName() );
                }

        return (Literal) node;
      }
            else {
              throw new InternalReasonerException(
            "Same term refers to both a literal and an individual: " + name );
            }
    }

    int remember = branch;
View Full Code Here

    return ind;
  }

  private Individual addIndividual(ATermAppl x, Individual parent, DependencySet ds) {
    if( nodes.containsKey( x ) ) {
          throw new InternalReasonerException( "adding a node twice " + x );
        }

    setChanged( true );

    Individual n = new Individual( x, this, parent );
View Full Code Here

            }
      ATermAppl notA = (ATermAppl) a.getArgument( 0 );

      if( node.hasType( notA ) ) {
        if( !node.hasType( a ) ) {
                  throw new InternalReasonerException( "Invalid type found: " + node + " "
              + " " + a + " " + node.debugString() + " " + node.depends );
                }
        throw new InternalReasonerException( "Clash found: " + node + " " + a + " "
            + node.debugString() + " " + node.depends );
      }
    }
  }
View Full Code Here

   
    if( !node.isRoot() ) {
      EdgeList preds = node.getInEdges();
      boolean validPred = preds.size() == 1 || (preds.size() == 2 && preds.hasEdgeFrom( node ));
      if( !validPred ) {
              throw new InternalReasonerException( "Invalid blockable node: " + node + " "
            + node.getInEdges() );
            }

    }
    else if( node.isNominal() ) {
      ATermAppl nominal = ATermUtils.makeValue( node.getName() );
      if( !ATermUtils.isAnonNominal( node.getName() ) && !node.hasType( nominal ) ) {
              throw new InternalReasonerException( "Invalid nominal node: " + node + " "
            + node.getTypes() );
            }
    }

    for( Iterator<ATermAppl> i = node.getDepends().keySet().iterator(); i.hasNext(); ) {
      ATermAppl c = i.next();
      DependencySet ds = node.getDepends( c );
      if( ds.max() > branch || (!PelletOptions.USE_SMART_RESTORE && ds.getBranch() > branch) ) {
              throw new InternalReasonerException( "Invalid ds found: " + node + " " + c + " "
            + ds + " " + branch );
      // if( c.getAFun().equals( ATermUtils.VALUEFUN ) ) {
      // if( !PelletOptions.USE_PSEUDO_NOMINALS ) {
      // Individual z = getIndividual(c.getArgument(0));
      // if(z == null)
      // throw new InternalReasonerException("Nominal to non-existing
      // node: " + node + " " + c + " " + ds + " " + branch);
      // }
      // }
            }
    }
    for( Iterator<Node> i = node.getDifferents().iterator(); i.hasNext(); ) {
      Node ind = i.next();
      DependencySet ds = node.getDifferenceDependency( ind );
      if( ds.max() > branch || ds.getBranch() > branch ) {
              throw new InternalReasonerException( "Invalid ds: " + node + " != " + ind + " "
            + ds );
            }
      if( ind.getDifferenceDependency( node ) == null ) {
              throw new InternalReasonerException( "Invalid difference: " + node + " != " + ind
            + " " + ds );
            }
    }
    EdgeList edges = node.getOutEdges();
    for( int e = 0; e < edges.size(); e++ ) {
      Edge edge = edges.edgeAt( e );
      Node succ = edge.getTo();
      if( nodes.get( succ.getName() ) != succ ) {
              throw new InternalReasonerException( "Invalid edge to a non-existing node: " + edge
            + " " + nodes.get( succ.getName() ) + "("
            + nodes.get( succ.getName() ).hashCode() + ")" + succ + "("
            + succ.hashCode() + ")" );
            }
      if( !succ.getInEdges().hasEdge( edge ) ) {
              throw new InternalReasonerException( "Invalid edge: " + edge );
            }
      if( succ.isMerged() ) {
              throw new InternalReasonerException( "Invalid edge to a removed node: " + edge
            + " " + succ.isMerged() );
            }
      DependencySet ds = edge.getDepends();
      if( ds.max() > branch || ds.getBranch() > branch ) {
              throw new InternalReasonerException( "Invalid ds: " + edge + " " + ds );
            }
      EdgeList allEdges = node.getEdgesTo( succ );
      if( allEdges.getRoles().size() != allEdges.size() ) {
              throw new InternalReasonerException( "Duplicate edges: " + allEdges );
            }
    }
    edges = node.getInEdges();
    for( int e = 0; e < edges.size(); e++ ) {
      Edge edge = edges.edgeAt( e );
      DependencySet ds = edge.getDepends();
      if( ds.max() > branch || ds.getBranch() > branch ) {
              throw new InternalReasonerException( "Invalid ds: " + edge + " " + ds );
            }
    }
  }
View Full Code Here

      System.err.println( " -> " + node.getMergedTo() + " "
          + node.getMergeDependency( false ) );
      return;
    }
    else if( node.isPruned() ) {
          throw new InternalReasonerException( "Pruned node: " + node );
        }


    System.err.print( " = " );
    for(int i = 0; i < Node.TYPES; i++) {
View Full Code Here

  private DependencySet  ds;
  private List<T>      elements;

  public Tuple(DependencySet ds, T... elementArgs) {
    if ( ds == null ) {
      throw new InternalReasonerException( "Null dependencyset argument to rete tuple" );
    }
    this.ds = ds;
    this.elements = Collections.unmodifiableList( Arrays.asList( elementArgs ) );
  }
View Full Code Here

        }
      }
    }

    if( best == -1 ) {
      throw new InternalReasonerException( "Cannot find a valid atom in " + atoms
          + " where explored=" + explored );
    }

    explored.add( best );
View Full Code Here

          break;
        case ALLFAST:
          execAllFastCore( oldQuery, binding, distVars, core.getUndistVars() );
          break;
        default:
          throw new InternalReasonerException( "Unknown core strategy." );
        }
      }

      break;
           
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.