Package org.openrdf.rio

Examples of org.openrdf.rio.RDFHandlerException


        predicateStack.push(pred);
        nodeStack.push(new Node(obj));
      }
    }
    catch (IOException e) {
      throw new RDFHandlerException(e);
    }
  }
View Full Code Here


        if (con.getNamespace(prefix) == null) {
          con.setNamespace(prefix, name);
        }
      }
      catch (StoreException e) {
        throw new RDFHandlerException(e);
      }
    }

    namespaceMap.clear();
    bNodesMap.clear();
View Full Code Here

      else {
        con.add(subj, pred, obj, ctxt);
      }
    }
    catch (StoreException e) {
      throw new RDFHandlerException(e);
    }
  }
View Full Code Here

    try {
      writer.flush();
    }
    catch (IOException e) {
      throw new RDFHandlerException(e);
    }
    finally {
      writingStarted = false;
    }
  }
View Full Code Here

      writer.write(" .");
      writeNewLine();
    }
    catch (IOException e) {
      throw new RDFHandlerException(e);
    }
  }
View Full Code Here

      writer.write("# ");
      writer.write(comment);
      writeNewLine();
    }
    catch (IOException e) {
      throw new RDFHandlerException(e);
    }
  }
View Full Code Here

  public void endRDF()
    throws RDFHandlerException
  {
    Set<Resource> resultSetNodes = model.filter(null, RDF.TYPE, RESULTSET).subjects();
    if (resultSetNodes.size() != 1) {
      throw new RDFHandlerException("Expected 1 subject of type ResultSet, found: "
          + resultSetNodes.size());
    }

    Resource resultSetNode = resultSetNodes.iterator().next();

    Set<Value> resultValues = model.filter(resultSetNode, BOOLEAN, null).objects();
    if (resultValues.size() != 1) {
      throw new RDFHandlerException("Expected 1 boolean result value, found: " + resultValues.size());
    }

    Value booleanLit = resultValues.iterator().next();

    if (booleanLit.equals(DAWGTestResultSetSchema.TRUE)) {
      value = true;
    }
    else if (booleanLit.equals(DAWGTestResultSetSchema.FALSE)) {
      value = false;
    }
    else {
      throw new RDFHandlerException("Invalid boolean value: " + booleanLit);
    }
  }
View Full Code Here

  public void endRDF()
    throws RDFHandlerException
  {
    Set<Resource> resultSetNodes = model.filter(null, RDF.TYPE, RESULTSET).subjects();
    if (resultSetNodes.size() != 1) {
      throw new RDFHandlerException("Expected 1 subject of type ResultSet, found: "
          + resultSetNodes.size());
    }

    Resource resultSetNode = resultSetNodes.iterator().next();

    try {
      List<String> bindingNames = getBindingNames(resultSetNode);
      tqrHandler.startQueryResult(bindingNames);

      for (Value solutionNode : model.filter(resultSetNode, SOLUTION, null).objects()) {
        if (solutionNode instanceof Resource) {
          reportSolution((Resource)solutionNode, bindingNames);
        }
        else {
          throw new RDFHandlerException("Value for " + SOLUTION + " is not a resource: " + solutionNode);
        }
      }

      tqrHandler.endQueryResult();
    }
    catch (TupleQueryResultHandlerException e) {
      throw new RDFHandlerException(e.getMessage(), e);
    }
  }
View Full Code Here

      if (varName instanceof Literal) {
        bindingNames.add(((Literal)varName).getLabel());
      }
      else {
        throw new RDFHandlerException("Value for " + RESULTVARIABLE + " is not a literal: " + varName);
      }
    }

    return bindingNames;
  }
View Full Code Here

      if (bindingNode instanceof Resource) {
        Binding binding = getBinding((Resource)bindingNode);
        bindingSet.addBinding(binding);
      }
      else {
        throw new RDFHandlerException("Value for " + BINDING + " is not a resource: " + bindingNode);
      }
    }

    try {
      tqrHandler.handleSolution(bindingSet);
    }
    catch (TupleQueryResultHandlerException e) {
      throw new RDFHandlerException(e.getMessage(), e);
    }
  }
View Full Code Here

TOP

Related Classes of org.openrdf.rio.RDFHandlerException

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.