Examples of BindingSet


Examples of org.openrdf.query.BindingSet

    }

    @Override
    public boolean equals(Object other) {
      if (other instanceof Key && other.hashCode() == hash) {
        BindingSet otherSolution = ((Key)other).bindingSet;

        for (String name : group.getGroupBindingNames()) {
          Value v1 = bindingSet.getValue(name);
          Value v2 = otherSolution.getValue(name);

          if (!ObjectUtil.nullEquals(v1, v2)) {
            return false;
          }
        }
View Full Code Here

Examples of org.openrdf.query.BindingSet

    // Use first binding name from tuple expr to compare values
    String bindingName = node.getSubQuery().getBindingNames().iterator().next();

    Cursor<BindingSet> iter = evaluate(node.getSubQuery(), bindings);
    try {
      BindingSet bindingSet;
      while (result == false && (bindingSet = iter.next()) != null) {

        Value rightValue = bindingSet.getValue(bindingName);

        result = leftValue == null && rightValue == null || leftValue != null
            && leftValue.equals(rightValue);
      }
    }
View Full Code Here

Examples of org.openrdf.query.BindingSet

    // Use first binding name from tuple expr to compare values
    String bindingName = node.getSubQuery().getBindingNames().iterator().next();

    Cursor<BindingSet> iter = evaluate(node.getSubQuery(), bindings);
    try {
      BindingSet bindingSet;
      while (result == false && (bindingSet = iter.next()) != null) {

        Value rightValue = bindingSet.getValue(bindingName);

        try {
          result = QueryEvaluationUtil.compare(leftValue, rightValue, node.getOperator());
        }
        catch (ValueExprEvaluationException e) {
View Full Code Here

Examples of org.openrdf.query.BindingSet

    // Use first binding name from tuple expr to compare values
    String bindingName = node.getSubQuery().getBindingNames().iterator().next();

    Cursor<BindingSet> iter = evaluate(node.getSubQuery(), bindings);
    try {
      BindingSet bindingSet;
      while (result == true && (bindingSet = iter.next()) != null) {

        Value rightValue = bindingSet.getValue(bindingName);

        try {
          result = QueryEvaluationUtil.compare(leftValue, rightValue, node.getOperator());
        }
        catch (ValueExprEvaluationException e) {
View Full Code Here

Examples of org.openrdf.query.BindingSet

  @Override
  public BindingSet next()
    throws StoreException
  {
    BindingSet result = super.next();

    // Ignore all results that are not compatible with the input bindings
    while (result != null && !QueryResultUtil.bindingSetsCompatible(inputBindings, result)) {
      result = super.next();
    }

    if (result != null) {
      // Make sure the provided problemVars are part of the returned results
      // (necessary in case of e.g. LeftJoin and Union arguments)
      QueryBindingSet extendedResult = null;

      for (String problemVar : problemVars) {
        if (!result.hasBinding(problemVar)) {
          if (extendedResult == null) {
            extendedResult = new QueryBindingSet(result);
          }
          extendedResult.addBinding(problemVar, inputBindings.getValue(problemVar));
        }
View Full Code Here

Examples of org.openrdf.query.BindingSet

  protected Cursor<BindingSet> createCursor()
    throws StoreException
  {
    List<BindingSet> list = new ArrayList<BindingSet>(1024);

    BindingSet next;
    while ((next = cursor.next()) != null) {
      list.add(next);
    }
    cursor.close();
View Full Code Here

Examples of org.openrdf.query.BindingSet

        + "  qt = <http://www.w3.org/2001/sw/DataAccess/tests/test-query#>";

    TupleResult manifestResults = con.prepareTupleQuery(QueryLanguage.SERQL, query, MANIFEST_FILE).evaluate();

    while (manifestResults.hasNext()) {
      BindingSet bindingSet = manifestResults.next();
      String manifestFile = bindingSet.getValue("manifestFile").toString();
      suite.addTest(SPARQLQueryTest.suite(manifestFile, factory));
    }

    manifestResults.close();
    con.close();
View Full Code Here

Examples of org.openrdf.query.BindingSet

    logger.info("Searching for sub-manifests");
    List<String> subManifestList = new ArrayList<String>();

    TupleResult subManifests = con.prepareTupleQuery(QueryLanguage.SERQL, SUBMANIFEST_QUERY).evaluate();
    while (subManifests.hasNext()) {
      BindingSet bindings = subManifests.next();
      subManifestList.add(bindings.getValue("subManifest").toString());
    }
    subManifests.close();

    logger.info("Found {} sub-manifests", subManifestList.size());

    for (String subManifest : subManifestList) {
      logger.info("Loading sub manifest {}", subManifest);
      con.clear();

      URL subManifestURL = new URL(subManifest);
      ManifestTest.addTurtle(con, subManifestURL, subManifest);

      TestSuite subSuite = new TestSuite(subManifest.substring(HOST.length()));

      logger.info("Creating test cases for {}", subManifest);
      TupleResult tests = con.prepareTupleQuery(QueryLanguage.SERQL, TESTCASE_QUERY).evaluate();
      while (tests.hasNext()) {
        BindingSet bindingSet = tests.next();

        String testURI = bindingSet.getValue("TestURI").toString();
        String testName = bindingSet.getValue("Name").toString();
        String testAction = bindingSet.getValue("Action").toString();
        boolean positiveTest = bindingSet.getValue("Type").toString().equals(
            "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#PositiveSyntaxTest");

        subSuite.addTest(factory.createSPARQLSyntaxTest(testURI, testName, testAction, positiveTest));
      }
      tests.close();
View Full Code Here

Examples of org.openrdf.query.BindingSet

    TupleQuery laxCardinalityQuery = con.prepareTupleQuery(QueryLanguage.SERQL, query.toString());

    logger.debug("evaluating query..");
    TupleResult testCases = testCaseQuery.evaluate();
    while (testCases.hasNext()) {
      BindingSet bindingSet = testCases.next();

      URI testURI = (URI)bindingSet.getValue("testURI");
      String testName = bindingSet.getValue("testName").toString();
      String resultFile = bindingSet.getValue("resultFile").toString();
      String queryFile = bindingSet.getValue("queryFile").toString();
      URI defaultGraphURI = (URI)bindingSet.getValue("defaultGraph");
      Value action = bindingSet.getValue("action");

      logger.debug("found test case : {}", testName);

      // Query named graphs
      namedGraphsQuery.setBinding("action", action);
      TupleResult namedGraphs = namedGraphsQuery.evaluate();

      DatasetImpl dataset = null;

      if (defaultGraphURI != null || namedGraphs.hasNext()) {
        dataset = new DatasetImpl();

        if (defaultGraphURI != null) {
          dataset.addDefaultGraph(defaultGraphURI);
        }

        while (namedGraphs.hasNext()) {
          BindingSet graphBindings = namedGraphs.next();
          URI namedGraphURI = (URI)graphBindings.getValue("graph");
          dataset.addNamedGraph(namedGraphURI);
        }
      }

      // Check for lax-cardinality conditions
View Full Code Here

Examples of org.openrdf.query.BindingSet

        List<String> headers = tr.getBindingNames();

        boolean nsrRetrieved = false;
        boolean animaliaRetrieved = false;
        while (tr.hasNext()) {
          BindingSet bs = tr.next();

          for (String header : headers) {
            Value value = bs.getValue(header);

            if (!nsrRetrieved && RNA_NSR.equals(value.stringValue())) {
              nsrRetrieved = true;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.