Package org.openrdf.sail

Examples of org.openrdf.sail.SailConnection.evaluate()


            // s ?p o SELECT
            // TODO: commented out languages for now
            queryStr = "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n" + "SELECT ?p WHERE { <" + prefix + "thor> ?p \"Thor\"@en }";
            query = parser.parseQuery(queryStr, baseURI);
            URI foafNameUri = sail.getValueFactory().createURI("http://xmlns.com/foaf/0.1/name");
            results = sc.evaluate(query.getTupleExpr(), query.getDataset(), bindings, false);
            count = 0;
            while (results.hasNext()) {
                count++;
                BindingSet set = results.next();
                URI p = (URI) set.getValue("p");
View Full Code Here


            assertTrue(count > 0);

            // context-specific SELECT
            queryStr = "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" + "SELECT ?z\n" + "FROM <" + prefix + "ctx1>\n" + "WHERE { <" + prefix + "thor> foaf:name ?z }";
            query = parser.parseQuery(queryStr, baseURI);
            results = sc.evaluate(query.getTupleExpr(), query.getDataset(), bindings, false);
            count = 0;
            languages = new HashSet<String>();
            while (results.hasNext()) {
                count++;
                BindingSet set = results.next();
View Full Code Here

            assertEquals(2, languages.size());
            assertTrue(languages.contains("en"));
            assertTrue(languages.contains("is"));
            queryStr = "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" + "SELECT ?z\n" + "FROM <http://example.org/emptycontext>\n" + "WHERE { <" + prefix + "thor> foaf:name ?z }";
            query = parser.parseQuery(queryStr, baseURI);
            results = sc.evaluate(query.getTupleExpr(), query.getDataset(), bindings, false);
            count = 0;
            while (results.hasNext()) {
                count++;
                results.next();
            }
View Full Code Here

                    "SELECT ?foaf WHERE {\n" +
                    "    :ford foaf:knows ?friend .\n" +
                    "    ?friend foaf:knows ?foaf .\n" +
                    "}";
            ParsedQuery query = parser.parseQuery(queryStr, baseURI);
            results = sc.evaluate(query.getTupleExpr(), query.getDataset(), bindings, false);
            count = 0;
            while (results.hasNext()) {
                count++;
                BindingSet set = results.next();
                URI foaf = (URI) set.getValue("foaf");
View Full Code Here

                CloseableIteration<? extends BindingSet, QueryEvaluationException> sparqlResults;
                String queryString = "SELECT ?x ?y WHERE { ?x <http://tinkerpop.com#knows> ?y }";
                ParsedQuery query = parser.parseQuery(queryString, "http://tinkerPop.com");

                System.out.println("\nSPARQL: " + queryString);
                sparqlResults = sc.evaluate(query.getTupleExpr(), query.getDataset(), new EmptyBindingSet(), false);
                try {
                    while (sparqlResults.hasNext()) {
                        System.out.println(sparqlResults.next());
                    }
                } finally {
View Full Code Here

  {
    TupleExpr tupleExpr = getParsedQuery().getTupleExpr();

    try {
      SailConnection sailCon = getConnection().getSailConnection();
      CloseableIteration<? extends BindingSet, QueryEvaluationException> bindingsIter = sailCon.evaluate(
          tupleExpr, getActiveDataset(), getBindings(), getIncludeInferred());

      // Filters out all partial and invalid matches
      bindingsIter = new FilterIteration<BindingSet, QueryEvaluationException>(bindingsIter) {
View Full Code Here

    }

    try {
      SailConnection sailCon = getConnection().getSailConnection();

      CloseableIteration<? extends BindingSet, QueryEvaluationException> bindingsIter = sailCon.evaluate(
          tupleExpr, dataset, getBindings(), getIncludeInferred());

      try {
        return bindingsIter.hasNext();
      }
View Full Code Here

    ParsedTupleQuery query = QueryParserUtil.parseTupleQuery(QueryLanguage.SERQL,
        "SELECT X, P, Y FROM {X} P {Y}", null);
    TupleExpr tupleExpr = query.getTupleExpr();

    CloseableIteration<? extends BindingSet, QueryEvaluationException> iter = con.evaluate(tupleExpr, null,
        EmptyBindingSet.getInstance(), false);

    BindingSet bindingSet = iter.next();

    assertEquals(bindingSet.getValue("X"), foo);
View Full Code Here

    foo = factory.createURI("http://www.foo.example/foo");
    bar = factory.createURI("http://www.foo.example/bar");

    con = store.getConnection();

    iter = con.evaluate(tupleExpr, null, EmptyBindingSet.getInstance(), false);

    bindingSet = iter.next();

    assertEquals(bindingSet.getValue("X"), foo);
    assertEquals(bindingSet.getValue("P"), RDF.TYPE);
View Full Code Here

  {
    TupleExpr tupleExpr = getParsedQuery().getTupleExpr();

    try {
      SailConnection sailCon = getConnection().getSailConnection();
      CloseableIteration<? extends BindingSet, QueryEvaluationException> bindingsIter = sailCon.evaluate(
          tupleExpr, getActiveDataset(), getBindings(), getIncludeInferred());

      return new TupleQueryResultImpl(new ArrayList<String>(tupleExpr.getBindingNames()), bindingsIter);
    }
    catch (SailException e) {
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.