Package com.data2semantics.yasgui.shared.exceptions

Examples of com.data2semantics.yasgui.shared.exceptions.SparqlEmptyException


 
  private void storeVariables(JSONObject queryResult) throws SparqlParseException, SparqlEmptyException {
    JSONObject head = getAsObject(queryResult.get("head"));
    JSONArray variables = getAsArray(head, "vars");
    if (variables.size() == 0) {
      throw new SparqlEmptyException("Vars missing from json object");
    }
    for (int i = 0; i < variables.size(); i++) {
      this.variables.add(variables.get(i).isString().stringValue());
    }
  }
View Full Code Here


 
  private void storeBindings(JSONObject queryResult) throws SparqlParseException, SparqlEmptyException {
    JSONObject results = getAsObject(queryResult.get("results"));
    JSONArray bindingsArray = getAsArray(results, "bindings");
    if (bindingsArray.size() == 0) {
      throw new SparqlEmptyException("No results");
    }
    //Loop through binding array
    for (int i = 0; i < bindingsArray.size(); i++) {
      JSONObject bindingObject = getAsObject(bindingsArray.get(i));
      Set<String> keys = bindingObject.keySet();
View Full Code Here

   * @throws SparqlParseException When json string is not valid
   * @throws SparqlEmptyException When json string is valid, but contains no results
   */
  public void processResults(String jsonString) throws SparqlParseException, SparqlEmptyException {
    if (jsonString == null || jsonString.length() == 0) {
      throw new SparqlEmptyException("Unable to parse empty " + (separator.equals(",")? "CSV": "TSV") + " string");
    }
    DlvWrapper dlv;
    try {
      dlv = JsMethods.getDlv(jsonString, separator);
    } catch (Throwable e) {
      throw new SparqlParseException("Unable to parse " + (separator.equals(",")? "CSV": "TSV") + " string", e);
    }
    if (dlv.length() < 2) { //first row contains vars
      throw new SparqlEmptyException("No results");
    }
    if (queryMode == ResultType.Table) {
      storeTable(dlv);
    } else if (queryMode == ResultType.Boolean) {
      storeBooleanResult(dlv);
View Full Code Here

  }
 
  private void storeVariables(Document xmlDoc) throws SparqlParseException, SparqlEmptyException {
    NodeList variables = xmlDoc.getElementsByTagName("variable");
    if (variables.getLength() == 0) {
      throw new SparqlEmptyException("Variables missing from xml");
    }
    for (int i = 0; i < variables.getLength(); i++) {
      Node variable = variables.item(i);
      if (variable == null) {
        throw new SparqlParseException("Variable in head parsed as null");
View Full Code Here

  }
 
  private void storeBindings(Document xmlDoc) throws SparqlParseException, SparqlEmptyException {
    NodeList xmlSolutions = xmlDoc.getElementsByTagName("result");
    if (xmlSolutions.getLength() == 0) {
      throw new SparqlEmptyException("No results");
    }
    //Loop through results
    for (int i = 0; i < xmlSolutions.getLength(); i++) {
      bindings.add(getSolutionFromNode(xmlSolutions.item(i)));
    }
View Full Code Here

TOP

Related Classes of com.data2semantics.yasgui.shared.exceptions.SparqlEmptyException

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.