Package org.mindswap.pellet.exceptions

Examples of org.mindswap.pellet.exceptions.UnsupportedQueryException


      double minCost = chooseOrdering( new ArrayList<QueryAtom>( query.getAtoms() ),
          new ArrayList<QueryAtom>( size ), new HashSet<ATermAppl>(), false,
          Double.POSITIVE_INFINITY );

      if( sortedAtoms == null ) {
        throw new UnsupportedQueryException( "No safe ordering for query: " + query );
      }

      if( log.isLoggable( Level.FINE ) ) {
        log.log( Level.FINE, "WINNER : Cost=" + minCost + " ,atoms=" + sortedAtoms );
      }
View Full Code Here


                kb.addIndividual(ind1);
                kb.addIndividual(ind2);
                kb.addDifferent(ind1, ind2);
                break;
              default:
              throw new UnsupportedQueryException( "Unsupported atom type : " + queryAtom.getPredicate().toString() );
            }             
        }
       
        kb.isConsistent();
       
View Full Code Here

      final ATermAppl s = arguments.get( 0 );
      final ATermAppl p = arguments.get( 1 );
      final ATermAppl o = arguments.get( 2 );
     
      if( ATermUtils.isVar( p ) ) {
        throw new UnsupportedQueryException(
            "NegativePropertyValue atom with a variable property not supported" );
      }
      if( ATermUtils.isVar( o ) && kb.isDatatypeProperty( p ) ) {
        throw new UnsupportedQueryException(
            "NegativePropertyValue atom with a datatype property and variable object not supported" );
      }
     
      if( ATermUtils.isVar( s ) ) {
        Set<ATermAppl> oValues = ATermUtils.isVar( o )
          ? kb.getIndividuals()
          : Collections.singleton( o );
         
        for( ATermAppl oValue : oValues ) {         
          Set<ATermAppl> sValues = kb.getInstances( not( hasValue( p, oValue ) ) );
          for( ATermAppl sValue : sValues ) {
            runNext( binding, arguments, sValue, p, oValue )
          }   
        }
      }
      else if( ATermUtils.isVar( o ) ) {
        Set<ATermAppl> oValues = kb.getInstances( not( hasValue( inv( p ), o ) ) );
        for( ATermAppl oValue : oValues ) {
          runNext( binding, arguments, s, p, oValue )
        }                 
      }
      else {
        if( kb.isType( s, hasValue( p, o ) ) ) {
                  exec( binding );
                }
      }
     
      break
    }
     
    case NotKnown: {
      Query newQuery = new QueryImpl( kb, true );
      for( QueryAtom atom : ((NotKnownQueryAtom) current).getAtoms() ) {
        newQuery.add( atom.apply( binding ) );
      }
     
      for( ATermAppl var : newQuery.getUndistVars() ) {
        newQuery.addDistVar( var, VarType.INDIVIDUAL );
      }
     
      QueryExec newEngine = new CombinedQueryEngine();
     
      boolean isNegationTrue = newEngine.exec( newQuery ).isEmpty();
     
      if( isNegationTrue ) {
              exec( binding );
            }

      break;
    }
   
    case Union: {
      for( List<QueryAtom> atoms : ((UnionQueryAtom) current).getUnion() ) {
        Query newQuery = new QueryImpl( kb, true );     
        for( QueryAtom atom : atoms ) {
          newQuery.add( atom.apply( binding ) );
        }     
        for( ATermAppl var : newQuery.getUndistVars() ) {
          newQuery.addDistVar( var, VarType.INDIVIDUAL );
          newQuery.addResultVar( var );
        }
       
        QueryExec newEngine = new CombinedQueryEngine();
       
        QueryResult newResult = newEngine.exec( newQuery )
        for( ResultBinding newBinding : newResult ) {
          newBinding.setValues( binding );
          exec( newBinding );
        }
      }
      break;
    }
   
    case Datatype:
      throw new UnsupportedQueryException( "Datatype atom not ground: "
          + current );
   
    case propertyDisjointWith:
      final ATermAppl dwLHSp = arguments.get( 0 );
      final ATermAppl dwRHSp = arguments.get( 1 );

      if( !dwLHSp.equals( dwRHSp ) ) {
        // TODO optimizeTBox
        for( final ATermAppl known : getSymmetricCandidates( VarType.PROPERTY, dwLHSp,
            dwRHSp ) ) {
          for( final Set<ATermAppl> dependents : kb.getDisjointProperties( known ) ) {
            for( final ATermAppl dependent : dependents ) {
              runSymetricCheck( current, dwLHSp, known, dwRHSp, dependent, binding );
            }
          }
        }
      }
      else {
        log.finer( "Atom " + current
            + "cannot be satisfied in any consistent ontology." );
      }
      break;
    default:
      throw new UnsupportedQueryException( "Unknown atom type '"
          + current.getPredicate() + "'." );

    }   
  }
View Full Code Here

TOP

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

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.