Package com.hp.hpl.jena.query

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


    // Try to select language appropriately here based on the model content
    // type
    Lang lang = WebContent.contentTypeToLang(actualContentType);
    if (!RDFLanguages.isTriples(lang))
      throw new QueryException("Endpoint <" + endpointURL +
          "> returned Content Type: " + actualContentType
          + " which is not a supported RDF graph syntax");
    RDFDataMgr.read(model, in, lang);

    // Skip prefixes ns1, ns2, etc, which are usually
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

            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

            int col = parser.token.endColumn ;
            int line = parser.token.endLine ;
            throw new QueryParseException(tErr.getMessage(), line, col) ; }

        catch (UpdateException 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.fatal(this, "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) ;
//        }
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(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(ParserSPARQL11.class, "Unexpected throwable: ",th) ;
            throw new QueryException(th.getMessage(), th) ;
        }
    }
View Full Code Here

          //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;
          this.lineNum++;
      }
      catch (IOException e)
      { throw new QueryException("Error parsing CSV 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 at Line %d - The result row had 0/1 values when %d were expected", this.lineNum, 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(String.format("Error Parsing CSV results at Line %d  - Unterminated quoted string", this.lineNum));
                if ( idx < line.length() )
                {
                    ch = line.charAt(idx) ;
                    if ( ch != ',' )
                        throw new QueryException(String.format("Error Parsing CSV results at Line %d - Expected comma after quote", this.lineNum)) ;
                }
            }
            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(String.format("Error Parsing CSV results at Line %d - The result row '%s' has %d items when %d was expected", this.lineNum, line, terms.size(), vars.size())) ;
        for ( int i = 0 ; i < vars.size() ; i++ )
            binding.add(vars.get(i), NodeFactory.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.