Package org.mindswap.pellet.exceptions

Examples of org.mindswap.pellet.exceptions.InternalReasonerException


   * Walk through the super nodes of the given node and when a cycle is
   * detected merge all the nodes in that path
   */
  public void removeCycles(TaxonomyNode<T> node) {
    if( !nodes.get( node.getName() ).equals( node ) )
      throw new InternalReasonerException( "This node does not exist in the taxonomy: "
          + node.getName() );
    removeCycles( node, new ArrayList<TaxonomyNode<T>>() );
  }
View Full Code Here


        degrees.put( node, Integer.valueOf( degree ) );
    }

    for( int i = 0, size = nodesLeft.size(); i < size; i++ ) {
      if( nodesPending.isEmpty() )
        throw new InternalReasonerException( "Cycle detected in the taxonomy!" );

      TaxonomyNode<T> node = nodesPending.values().iterator().next();

      int deg = degrees.get( node );
      if( deg != 0 )
        throw new InternalReasonerException( "Cycle detected in the taxonomy " + node + " "
            + deg + " " + nodesSorted.size() + " " + nodes.size() );

      nodesPending.remove( node.getName() );
      nodesLeft.remove( node );
      if( includeEquivalents )
        nodesSorted.addAll( node.getEquivalents() );
      else
        nodesSorted.add( node.getName() );

      for( TaxonomyNode<T> sub : node.getSubs() ) {
        int degree = degrees.get( sub );
        if( degree == 1 ) {
          nodesPending.put( sub.getName(), sub );
          degrees.put( sub, 0 );
        }
        else
          degrees.put( sub, degree - 1 );
      }
    }

    if( !nodesLeft.isEmpty() )
      throw new InternalReasonerException( "Failed to sort elements: " + nodesLeft );

    log.fine( "done" );

    return nodesSorted;
  }
View Full Code Here

        return factory.getOWLAnonymousIndividual(((ATermAppl) term.getArgument(0)).getName());
      else
        return factory.getOWLNamedIndividual(iri);
    }
    else {
      throw new InternalReasonerException("Cannot convert individual: " + term);
    }
  }
View Full Code Here

    }
    else if( kb.isDatatype( term ) )
      obj = factory.getOWLDatatype( iri );

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

      Set<OWLLiteral> set = new HashSet<OWLLiteral>();

      for( ; !list.isEmpty(); list = list.getNext() ) {   
        ATermAppl first = (ATermAppl) list.getFirst();
        if (!ATermUtils.isLiteral((ATermAppl) first.getArgument(0)))
          throw new InternalReasonerException("Conversion error, expecting literal but found: " + first);
        visitLiteral((ATermAppl) first.getArgument(0));
        set.add( (OWLLiteral) obj );
      }

      obj = factory.getOWLDataOneOf( set );
View Full Code Here

  private void addToldSubsumer(ATermAppl c, ATermAppl d, Set<ATermAppl> explanation) {
    TaxonomyNode<ATermAppl> cNode = toldTaxonomy.getNode( c );
    TaxonomyNode<ATermAppl> dNode = toldTaxonomy.getNode( d );

    if( cNode == null ) {
          throw new InternalReasonerException( c + " is not in the definition order" );
        }

    if( dNode == null ) {
          throw new InternalReasonerException( d + " is not in the definition order" );
        }

    if( cNode.equals( dNode ) ) {
          return;
        }
View Full Code Here

      else if( type instanceof OWLDataRange ) {
        SWRLDArgument io = parseToAtomDObject( i )
        atom = factory.getSWRLDataRangeAtom( (OWLDataRange) type, io );
      }
      else {
        throw new InternalReasonerException( "Cannot convert to SWRL atom: "
            + ATermUtils.toString( term ) );
      }
    }
    else if( term.getAFun().equals( ATermUtils.PROPFUN ) ) {
      ATermAppl p = (ATermAppl) term.getArgument( 0 );
View Full Code Here

        }
    if( kb.isIndividual( t ) ) {
      return factory.getSWRLIndividualArgument(conceptConverter.convertIndividual(t));
        }

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

        }
        else if( ATermUtils.isLiteral( t ) ) {
      return factory.getSWRLLiteralArgument( (OWLLiteral) conceptConverter.convert( t ) );
    }

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

    // this code is not unreachable. if there are no branches left restore
    // does not call this
    // function, and the loop immediately returns when there are no branches
    // left in this
    // disjunction. If this exception is thrown it shows a bug in the code.
    throw new InternalReasonerException( "This exception should not be thrown!" );
  }
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.