Package spark.api

Examples of spark.api.Command.executeQuery()


 
  public static void testQuery() throws Exception {
    DataSource myDS = new ProtocolDataSource("http://DBpedia.org/sparql");
    Connection conn = myDS.getConnection(NoCredentials.INSTANCE);
    Command query = conn.createCommand("SELECT ?p ?o WHERE { <http://dbpedia.org/resource/Terry_Gilliam> ?p ?o }");   
    Solutions solutions = query.executeQuery();
   
    showMetadata(solutions);
    logger.debug("vars = {}", solutions.getVariables());
    int row = 0;
    while(solutions.next()) {
View Full Code Here


 
  public static void testQuery2() throws Exception {
    DataSource myDS = new ProtocolDataSource("http://DBpedia.org/sparql");
    Connection conn = myDS.getConnection(NoCredentials.INSTANCE);
    Command query = conn.createCommand("SELECT ?p ?o WHERE { <http://dbpedia.org/resource/Terry_Gilliam> ?p ?o }");   
    Solutions solutions = query.executeQuery();
   
    showMetadata(solutions);
    logger.debug("vars = {}", solutions.getVariables());
    int row = 0;
    for(Map<String, RDFNode> solution : solutions) {
View Full Code Here

      public void run() {
        Connection c = f.getSource().getConnection(NoCredentials.INSTANCE);
        Command cmd = c.createCommand("SELECT ?p ?o WHERE { <http://dbpedia.org/resource/Terry_Gilliam> ?p ?o }");
        cmd.setTimeout(30);
        try {
          Solutions s = cmd.executeQuery();
          Assert.assertNotNull(s);
          try {
            Assert.assertEquals(Arrays.asList("p", "o"), s.getVariables());
            int count = 0;
            while (s.next()) {
View Full Code Here

    Connection conn = ds.getConnection(NoCredentials.INSTANCE);
    Command command = conn.createCommand(query);
    command.setTimeout(120000);
   
    System.out.println("Executing query....");
    Solutions results = command.executeQuery();
   
    System.out.println("\nResults:");
    int count = 0;
    Iterator<Map<String,RDFNode>> iter = results.iterator();
    for (; iter.hasNext(); ) {
View Full Code Here

        serverAddress.getPort());
    Connection conn = ds.getConnection(NoCredentials.INSTANCE);
    Command command = conn
        .createCommand("SELECT ?x ?y WHERE { this should be a real query but the test doesn't actually do anything real.");
    ((SHPCommand) command).setBatchSize(batchSize);
    return command.executeQuery();
  }
 
  public void helpTestQueryCursor(int resultRows, int batchSize) {
    DummySherpaServer server = new DummySherpaServer(resultRows);
View Full Code Here

    try {
      DataSource ds = new SHPDataSource(serverAddress.getHostName(), serverAddress.getPort());
      Connection conn = ds.getConnection(NoCredentials.INSTANCE);
      Command command = conn.createCommand("SELECT ?x ?y WHERE { this should be a real query but the test doesn't actually do anything real. }");
      command.setTimeout(1234);
      command.executeQuery();
     
      // Kind of tricky here - the keys and values are now Avro Utf8 instances which don't compare equal to Strings
      Map<CharSequence,CharSequence> serverProps = (Map<CharSequence,CharSequence>)results.get(0);
      Assert.assertEquals(new Utf8("1234"), serverProps.get(new Utf8(QueryExecution.TIMEOUT)));
     
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.