Package virtuoso.jena.driver

Examples of virtuoso.jena.driver.VirtuosoQueryExecution$VResultSet


  private QueryResult _executeQuery(_Conn _conn, String sparqlQuery, String form) throws Exception {
    log.debug(" _executeQuery called.");
   
    Query query = QueryFactory.create(sparqlQuery);
    VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create(query, _conn._graph);
   
    try {
      QueryResult queryResult = Sparql.executeQuery(query, vqe, sparqlQuery, form);
      return queryResult;
    }
    finally {
      vqe.close();
    }
   
    // NOTE
    // Since we're using Virtuoso, we could allow possible extensions in the query by
    // passing the string directly to VirtuosoQueryExecutionFactory:
View Full Code Here


    buffer.append("SELECT DISTINCT ?m COUNT (?s)").append(SPACE);
    buffer.append("FROM ").append(RICORDO).append(SPACE);
    buffer.append("WHERE { ?s rcmd:elementOf ?m . ?s ?p <").append(miriumUrn).append("> } GROUP BY ?m");

    System.out.println(buffer.toString());
    VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (buffer.toString(), graph);
    return vqe.execSelect();
  }
View Full Code Here

    buffer.append(RCMD).append(SPACE);
    buffer.append("SELECT DISTINCT ?s ?p").append(SPACE);
    buffer.append("FROM ").append(RICORDO).append(SPACE);
    buffer.append("WHERE { ?s rcmd:elementOf <").append(modelName).append("> . ?s ?p <").append(miriumUrn).append("> }");
       
    VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (buffer.toString(), graph);
    return vqe.execSelect();
  }
View Full Code Here

    buffer.append(RCMD).append(SPACE);
    buffer.append("SELECT DISTINCT ?s").append(SPACE);
    buffer.append("FROM ").append(RICORDO).append(SPACE);
    buffer.append("WHERE { ?s rcmd:elementOf <").append(modelName).append("> }");
       
    VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (buffer.toString(), graph);
    return vqe.execSelect();
  }
View Full Code Here

    buffer.append(INFERANCE).append(SPACE);
    buffer.append(RCMD).append(SPACE);
    buffer.append("SELECT DISTINCT ?p ?o").append(SPACE);
    buffer.append("FROM ").append(RICORDO).append(SPACE);
    buffer.append("WHERE { <").append(variableName).append("> ?p ?o . FILTER regex(str(?p), \"biology\")} ");
        VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (buffer.toString(), graph);
    return vqe.execSelect();
  }
View Full Code Here

    VirtGraph _graph = new VirtGraph (TEST_GRAPH, _host, _username, _password);
    Query sparql = QueryFactory.create(
        "PREFIX skos: <http://www.w3.org/2004/02/skos/core#> " +
        "SELECT * WHERE { ?s skos:exactMatch ?o } ");

    VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, _graph);

    ResultSet results = vqe.execSelect();
    System.out.println("RESULT:");
    while (results.hasNext()) {
      QuerySolution result = results.nextSolution();
        RDFNode s = result.get("s");
        RDFNode o = result.get("o");
        System.out.println("  " + s + " " + "skos:exactMatch" + " " + o);
    }
   
    vqe.close();
    _graph.close();

  }
View Full Code Here

   
    // with the OPTION(TRANSITIVE) above, Jena triggers syntax error here:
//    Query sparql = QueryFactory.create(queryString);
   
    // but passing the string directly to Virtuoso is fine:
    VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create(
//        sparql,
        queryString,
        _graph);
   
    // and the result includes the inferred triples:
//    RESULT:
//       http://example.org/vocres/BBB
//       http://example.org/vocres/CCC
//       http://example.org/vocres/DDD
        
    ResultSet results = vqe.execSelect();
    System.out.println("RESULT:");
    while (results.hasNext()) {
      QuerySolution result = results.nextSolution();
      RDFNode o = result.get("o");
      System.out.println(" "+ o );
    }
   
    vqe.close();
    _graph.close();
  }
View Full Code Here

TOP

Related Classes of virtuoso.jena.driver.VirtuosoQueryExecution$VResultSet

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.