Package org.mindswap.pellet.exceptions

Examples of org.mindswap.pellet.exceptions.InternalReasonerException


        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

                return dt.getValue( n );
            else
                n -= dt.size();
        }
       
        throw new InternalReasonerException( "No values for this datatype" );
    }
View Full Code Here

    }
    else if( kb.isDatatype( term ) )
      obj = factory.getOWLDataType( uri );

    if( obj == null )
      throw new InternalReasonerException( "Ontology does not contain: " + term );
  }
View Full Code Here

    public String getURI() {
         return null;
    }

    public ATermAppl getValue( int i ) {
        throw new InternalReasonerException( "No values for this datatype" );
   
View Full Code Here

          .getName() ) );
    if( kb.isIndividual( t ) )
      return factory.getSWRLAtomIndividualObject( (OWLIndividual) conceptConverter
          .convert( t ) );

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

          .getName() ) );
    else if( ATermUtils.isLiteral( t ) ) {
      return factory.getSWRLAtomConstantObject( (OWLConstant) conceptConverter.convert( 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.