Package com.hp.hpl.jena.query

Examples of com.hp.hpl.jena.query.QueryException


        raiseException(new RiotParseException(msg, line, col)) ;
    }
   
    protected final void raiseException(RiotParseException ex)
    {
        throw new QueryException("Error passing SPARQL JSON results", ex);
    }
View Full Code Here


public class ModelUtils
{
    public static RDFNode convertGraphNodeToRDFNode(Node n, Model model)
    {
        if ( n.isVariable() )
            throw new QueryException("Variable: "+n) ;

        // Best way.
        if ( model != null )
             return model.asRDFNode(n) ;
       
View Full Code Here

            int col = parser.token.endColumn ;
            int line = parser.token.endLine ;
            throw new QueryParseException(tErr.getMessage(), line, col) ; }
       
        catch (QueryException ex) { throw ex ; }
        catch (JenaException ex)  { throw new QueryException(ex.getMessage(), ex) ; }
        catch (Error err)
        {
            // The token stream can throw errors.
            throw new QueryParseException(err.getMessage(), err, -1, -1) ;
        }
        catch (Throwable th)
        {
            Log.warn(ParserSPARQL11.class, "Unexpected throwable: ",th) ;
            throw new QueryException(th.getMessage(), th) ;
        }
    }
View Full Code Here

public class ModelUtils
{
    public static RDFNode convertGraphNodeToRDFNode(Node n, Model model)
    {
        if ( n.isVariable() )
            throw new QueryException("Variable: "+n) ;

        // Best way.
        if ( model != null )
             return model.asRDFNode(n) ;
       
View Full Code Here

            int col = parser.token.endColumn ;
            int line = parser.token.endLine ;
            throw new QueryParseException(tErr.getMessage(), line, col) ; }
       
        catch (QueryException ex) { throw ex ; }
        catch (JenaException ex)  { throw new QueryException(ex.getMessage(), ex) ; }
        catch (Error err)
        {
            // The token stream can throw errors.
            throw new QueryParseException(err.getMessage(), err, -1, -1) ;
        }
        catch (Throwable th)
        {
            Log.warn(ParserSPARQL11.class, "Unexpected throwable: ",th) ;
            throw new QueryException(th.getMessage(), th) ;
        }
    }
View Full Code Here

          line = this.reader.readLine();
          //Once EOF has been reached we'll see null for this call so we can return false because there are no further bindings
          if (line == null) return false;
      }
      catch (IOException e)
      { throw new QueryException("Error parsing TSV results - " + e.getMessage()); }

      if ( line.isEmpty() )
      {
          // Empty input line - no bindings.
        // Only valid when we expect zero/one values as otherwise we should get a sequence of tab characters
        // which means a non-empty string which we handle normally
        if (expectedItems > 1) throw new QueryException(String.format("Error Parsing TSV results - A result row had 0/1 values when %d were expected", expectedItems));
          this.binding = BindingFactory.create() ;
          return true ;
      }
     
        String[] tokens = TSVInput.pattern.split(line, -1);
     
        if (tokens.length != expectedItems)
           throw new QueryException(String.format("Error Parsing TSV results - A result row had %d values instead of the expected %d.", tokens.length, expectedItems));

        this.binding = BindingFactory.create();
       
        for ( int i = 0; i < tokens.length; i++ )
        {
View Full Code Here

            int col = parser.token.endColumn ;
            int line = parser.token.endLine ;
            throw new QueryParseException(tErr.getMessage(), line, col) ;
        }
        catch (QueryException ex) { throw ex ; }
        catch (JenaException ex)  { throw new QueryException(ex.getMessage(), ex) ; }
        catch (Error err)
        {
            // The token stream can throw errors.
            throw new QueryParseException(err.getMessage(), err, -1, -1) ;
        }
        catch (Throwable th)
        {
            Log.warn(PathParser.class, "Unexpected throwable: ",th) ;
            throw new QueryException(th.getMessage(), th) ;
        }
    }
View Full Code Here

            int col = parser.token.endColumn ;
            int line = parser.token.endLine ;
            throw new QueryParseException(tErr.getMessage(), line, col) ; }
       
        catch (QueryException ex) { throw ex ; }
        catch (JenaException ex)  { throw new QueryException(ex.getMessage(), ex) ; }
        catch (Error err)
        {
            // The token stream can throw errors.
            throw new QueryParseException(err.getMessage(), err, -1, -1) ;
        }
        catch (Throwable th)
        {
            Log.warn(ParserSPARQL10.class, "Unexpected throwable: ",th) ;
            throw new QueryException(th.getMessage(), th) ;
        }
    }
View Full Code Here

          line = this.reader.readLine();
          //Once EOF has been reached we'll see null for this call so we can return false because there are no further bindings
          if (line == null) return false;
      }
      catch (IOException e)
      { throw new QueryException("Error parsing TSV results - " + e.getMessage()); }

      if ( line.isEmpty() )
      {
          // Empty input line - no bindings.
        // Only valid when we expect zero/one values as otherwise we should get a sequence of tab characters
        // which means a non-empty string which we handle normally
        if (expectedItems > 1)
            throw new QueryException(String.format("Error Parsing CSV results - A result row had 0/1 values when %d were expected", expectedItems));
          binding = BindingFactory.create() ;
          if ( expectedItems == 1 )
              binding.add(vars.get(0), NodeConst.emptyString) ;
          return true ;
      }
View Full Code Here

                        break ;
                    // escapes??
                    s.append(ch) ;
                }
                if ( ch != qCh )
                    throw new QueryException("Error Parsing CSV results - Unterminated quoted string");
                if ( idx < line.length() )
                {
                    ch = line.charAt(idx) ;
                    if ( ch != ',' )
                        throw new QueryException("Error Parsing CSV results - Expected comma after quote") ;
                }
            }
            else
            {
                while(idx < line.length() )
                {
                    ch = line.charAt(idx) ;
                    if ( ch == ',' )
                        break ;
                    idx++ ;
                    // escapes
                    s.append(ch) ;
                }
            }
           
            terms.add(s.toString()) ;
            // At end of per-term processing, we are looking at "," or EOL. 

            // Looking at , or EOL.
            if ( ch == ',' && idx==line.length()-1 )
            {
                //EOL
                terms.add("") ;
                break ;
            }
            // Skip ","
            idx++ ;
        }
       
        if ( terms.size() != vars.size() )
            throw new QueryException("Error Parsing CSV results - Number of items does not match number of variables: "+StrUtils.strjoin(",", terms)) ;
        for ( int i = 0 ; i < vars.size() ; i++ )
            binding.add(vars.get(i), Node.createLiteral(terms.get(i))) ;
        return binding ;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.query.QueryException

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.