Package com.hp.hpl.jena.sparql

Examples of com.hp.hpl.jena.sparql.ARQException


      String str = null;
      try
      {
        //First try to parse the header
        str = reader.readLine();
        if (str == null) throw new ARQException("CSV Boolean Results malformed, input is empty");
        str = str.trim(); //Remove extraneous white space
       
        //Expect a header row with single _askResult variable
        if (!str.equals("_askResult")) throw new ARQException("CSV Boolean Results malformed, did not get expected ?_askResult header row");
       
        //Then try to parse the boolean result
        str = reader.readLine();
        if (str == null) throw new ARQException("CSV Boolean Results malformed, unexpected end of input after header row");
        str = str.trim();
       
        if (str.equalsIgnoreCase("true") || str.equalsIgnoreCase("yes")) {
          return true;
        } else if (str.equalsIgnoreCase("false") || str.equalsIgnoreCase("no")) {
          return false;
        } else {
          throw new ARQException("CSV Boolean Results malformed, expected one of - true yes false no - but got " + str);
        }
      }
      catch (IOException ex)
      {
        throw new ARQException(ex);
      }
    }
View Full Code Here


                w.write(NL) ;
            }
            w.flush() ;
        } catch (IOException ex)
        {
            throw new ARQException(ex) ;
        }
    }
View Full Code Here

        try
        {
          //Here we try to parse only the Header Row
          str = reader.readLine();
          if (str == null )
              throw new ARQException("TSV Results malformed, input is empty (no header row)") ;
          if ( ! str.isEmpty() )
          {
              String[] tokens = pattern.split(str,-1);
              for ( String token : tokens )
              {
                  Node v ;
                  try {
                      v = NodeFactoryExtra.parseNode(token) ;
                      if ( v == null || ! v.isVariable())
                          throw new ResultSetException("TSV Results malformed, not a variable: "+token);
                  } catch (RiotException ex)
                  { throw new ResultSetException("TSV Results malformed, variable names must begin with a ? in the header: "+token); }

                  Var var = Var.alloc(v);
                  vars.add(var);
                  varNames.add(var.getName());
              }
          }
        }
        catch ( IOException ex )
        {
          throw new ARQException(ex) ;
        }

        //Generate an instance of ResultSetStream using TSVInputIterator
        //This will parse actual result rows as needed thus minimising memory usage
        return new ResultSetStream(varNames, null, new TSVInputIterator(reader, vars));
View Full Code Here

      String str = null;
      try
      {
        //First try to parse the header
        str = reader.readLine();
        if (str == null) throw new ARQException("TSV Boolean Results malformed, input is empty");
        str = str.trim(); //Remove extraneous white space
       
        //Expect a header row with single ?_askResult variable
        if (!str.equals("?_askResult")) throw new ARQException("TSV Boolean Results malformed, did not get expected ?_askResult header row");
       
        //Then try to parse the boolean result
        str = reader.readLine();
        if (str == null) throw new ARQException("TSV Boolean Results malformed, unexpected end of input after header row");
        str = str.trim();
       
        if (str.equalsIgnoreCase("true") || str.equalsIgnoreCase("yes")) {
          return true;
        } else if (str.equalsIgnoreCase("false") || str.equalsIgnoreCase("no")) {
          return false;
        } else {
          throw new ARQException("TSV Boolean Results malformed, expected one of - true yes false no - but got " + str);
        }
      }
      catch (IOException ex)
      {
        throw new ARQException(ex);
      }
    }
View Full Code Here

            mbs.registerMBean(bean, objName) ;
            // remember ...
            mgtObjects.put(objName, bean) ;
        } catch (NotCompliantMBeanException ex) {
            log.warn("Failed to register (NotCompliantMBeanException)'" + objName.getCanonicalName() + "': " + ex.getMessage()) ;
            throw new ARQException("Failed to register '" + objName.getCanonicalName() + "': " + ex.getMessage(), ex) ;
        } catch (InstanceAlreadyExistsException ex) {
            log.warn("Failed to register (InstanceAlreadyExistsException)'" + objName.getCanonicalName() + "': " + ex.getMessage()) ;
            throw new ARQException("Failed to register '" + objName.getCanonicalName() + "': " + ex.getMessage(), ex) ;
        } catch (MBeanRegistrationException ex) {
            log.warn("Failed to register (MBeanRegistrationException)'" + objName.getCanonicalName() + "': " + ex.getMessage()) ;
            throw new ARQException("Failed to register '" + objName.getCanonicalName() + "': " + ex.getMessage(), ex) ;
        }
    }
View Full Code Here

    }

    private static ObjectName objectName(String name) {
        try { return new ObjectName(name) ; }
        catch (MalformedObjectNameException ex) {
            throw new ARQException("Failed to create name '" + name + "': " + ex.getMessage(), ex) ;
        }
    }
View Full Code Here

            else
                out.write(noBytes) ;
            out.write(NLBytes) ;
        } catch (IOException ex)
        {
            throw new ARQException(ex) ;
        }
    }
View Full Code Here

    }

    private static void checkTarget(Target target)
    {
        if ( ! target.isDefault() && ! target.isOneNamedGraph() )
            throw new ARQException("Illegal target: must identify a single graph: "+target) ;
    }
View Full Code Here

                out.print(s) ;
            }
            else
            {
                out.print("Target BROKEN") ;
                throw new ARQException("Malformed Target") ;
            }
        }
View Full Code Here

                out.print(s) ;
            }
            else
            {
                out.print("Target BROKEN / Update2") ;
                throw new ARQException("Malformed Target / Update2") ;
            }
        }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.ARQException

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.