Package org.mmisw.mmiorr.client.test

Source Code of org.mmisw.mmiorr.client.test.QueryTest

package org.mmisw.mmiorr.client.test;

import org.apache.commons.httpclient.HttpStatus;
import org.junit.Test;
import org.mmisw.mmiorr.client.RetrieveOntology;
import org.mmisw.mmiorr.client.RetrieveOntology.RetrieveResult;

/**
* See build.xml for the way some parameters are passed
*
* @author Carlos Rueda
*/
public class QueryTest extends BaseTestCase {

  /**
   * <a href="http://ci.oceanobservatories.org/tasks/browse/CIDEVDM-47">CIDEVDM-47</a>
   * Demonstrattion of some SPARQL queries
   * @throws Exception
   */
  @Test
  public void test47() throws Exception {
    System.out.println("** test47");
   
    String format = "csv";
   
    String[] queries = {
       
        "SELECT ?p ?o " +
        "WHERE { " +
        "  <http://motherlode.ucar.edu:8080/thredds/fileServer/station/metar/Surface_METAR_20091106_0000.nc> " +
        "  ?p ?o }" ,
       
        "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " +
        "SELECT ?s " +
        "WHERE {?s rdfs:isDefinedBy <http://xmlns.com/foaf/0.1/>. } ",
       
        "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
        "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " +
        "SELECT ?comment " +
        "WHERE { <http://www.w3.org/2003/01/geo/wgs84_pos#> rdfs:comment ?comment } ",
    };
   
    for ( String query : queries ) {
      RetrieveResult result = RetrieveOntology.queryGet(query, format);
      assertEquals(HttpStatus.SC_OK, result.status);
      assertNotNull(result.body);

      System.out.println(result.body);
    }
   
  }

}
TOP

Related Classes of org.mmisw.mmiorr.client.test.QueryTest

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.