Package org.openrdf.query

Examples of org.openrdf.query.BindingSet


    return currentIndex < bindingSets.size();
  }

  public BindingSet next() {
    if (hasNext()) {
      BindingSet result = get(currentIndex);
      lastReturned = currentIndex;
      currentIndex++;
      return result;
    }
View Full Code Here


    return currentIndex > 0;
  }

  public BindingSet previous() {
    if (hasPrevious()) {
      BindingSet result = bindingSets.get(currentIndex - 1);
      currentIndex--;
      lastReturned = currentIndex;
      return result;
    }
View Full Code Here

    lastReturned = -1;
  }

  public BindingSet remove(int index) {
    BindingSet result = bindingSets.remove(index);

    if (currentIndex > index) {
      currentIndex--;
    }
View Full Code Here

    try {
      CloseableIteration<? extends Resource, RepositoryException> contextIter = repositoryCon.getContextIDs();

      try {
        while (contextIter.hasNext()) {
          BindingSet bindingSet = new ListBindingSet(columnNames, contextIter.next());
          contexts.add(bindingSet);
        }
      }
      finally {
        contextIter.close();
View Full Code Here

          Namespace ns = iter.next();

          Literal prefix = new LiteralImpl(ns.getPrefix());
          Literal namespace = new LiteralImpl(ns.getName());

          BindingSet bindingSet = new ListBindingSet(columnNames, prefix, namespace);
          namespaces.add(bindingSet);
        }
      }
      finally {
        iter.close();
View Full Code Here

    TupleQueryResult queryResult = con.prepareTupleQuery(QueryLanguage.SERQL, query).evaluate();

    // Add all positive parser tests to the test suite
    while (queryResult.hasNext()) {
      BindingSet bindingSet = queryResult.next();
      testName = ((Literal)bindingSet.getValue("testName")).getLabel();
      inputURL = ((URI)bindingSet.getValue("inputURL")).toString();
      outputURL = ((URI)bindingSet.getValue("outputURL")).toString();

      baseURL = BASE_URL + testName + ".ttl";

      suite.addTest(new PositiveParserTest(testName, inputURL, outputURL, baseURL));
    }

    queryResult.close();

    // Add the manifest for negative test cases to a repository and query it
    con.clear();
    url = TurtleParserTest.class.getResource(MANIFEST_BAD_URL);
    con.add(url, url.toExternalForm(), RDFFormat.TURTLE);

    query = "SELECT testName, inputURL " + "FROM {} mf:name {testName}; "
        + "        mf:action {} qt:data {inputURL} " + "USING NAMESPACE "
        + "  mf = <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>, "
        + "  qt = <http://www.w3.org/2001/sw/DataAccess/tests/test-query#>";
    queryResult = con.prepareTupleQuery(QueryLanguage.SERQL, query).evaluate();

    // Add all negative parser tests to the test suite
    while (queryResult.hasNext()) {
      BindingSet bindingSet = queryResult.next();
      testName = ((Literal)bindingSet.getValue("testName")).toString();
      inputURL = ((URI)bindingSet.getValue("inputURL")).toString();

      baseURL = BASE_URL + testName + ".ttl";

      suite.addTest(new NegativeParserTest(testName, inputURL, baseURL));
    }
View Full Code Here

      }
  }
    }
   
    void processSubsumptionStatements(TupleQueryResult sss) throws QueryEvaluationException {
  BindingSet bs;
  while (sss.hasNext()){
      bs = sss.next();
      Value aSubType = bs.getValue(X_var);
      Value aType = bs.getValue(Y_var);
      if (aSubType instanceof URI && aType instanceof URI){
    String classURI = aType.toString();
    String subTypeURI = aSubType.toString();
    Vector v;
    if (tmpHierarchy.containsKey(subTypeURI)){
View Full Code Here

            writeError("Unable to find context information for repository '" + id + "'");
            logger.warn("Multiple contexts found for repository '{}'", id);
            return;
          }

          BindingSet bindings = queryResult.next();
          context = (Resource)bindings.getValue("C");

          if (queryResult.hasNext()) {
            writeError("Multiple contexts found for repository '" + id + "'");
            logger.error("Multiple contexts found for repository '{}'", id);
            return;
View Full Code Here

            writeln("--no repositories found--");
          }
          else {
            writeln("+----------");
            while (queryResult.hasNext()) {
              BindingSet bindings = queryResult.next();
              String id = bindings.getValue("ID").stringValue();
              String title = bindings.getValue("Title").stringValue();

              write("|" + id);
              if (title != null) {
                write(" (\"" + title + "\")");
              }
View Full Code Here

          writeln(separatorLine);

          // Write table rows

          while (tupleQueryResult.hasNext()) {
            BindingSet bindingSet = tupleQueryResult.next();
            resultCount++;

            sb.setLength(0);
            for (String bindingName : bindingNames) {
              Value value = bindingSet.getValue(bindingName);
              String valueStr = getStringRepForValue(value, namespaces);

              sb.append("| ").append(valueStr);
              StringUtil.appendN(' ', columnWidth - valueStr.length(), sb);
            }
View Full Code Here

TOP

Related Classes of org.openrdf.query.BindingSet

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.