Package com.google.refine.org.deri.reconcile.rdf.factories

Examples of com.google.refine.org.deri.reconcile.rdf.factories.PreviewResourceCannedQuery


public class PreviewResourceCannedQueryTest {

  @Test
  public void testSparqlQuery()throws Exception{
    String uri = "http://example.org/resource/1";
    PreviewResourceCannedQuery cannedQuery = new PreviewResourceCannedQuery(this.getClass().getResourceAsStream("files/preview_properties.properties"));
    String sparql = cannedQuery.getPreviewQueryForResource(uri);
   
    String expected =
      "SELECT ?en_label0 ?label0 ?en_label1 ?label1 ?en_label2 ?label2 ?en_desc0 ?desc0 ?en_desc1 ?desc1 ?en_desc2 ?desc2 ?img0 " +
      "WHERE{ " +
      "OPTIONAL { <http://example.org/resource/1> <http://www.w3.org/2004/02/skos/core#prefLabel> ?en_label0 FILTER langMatches(lang(?en_label0),'en') } " +
View Full Code Here


  public void testWrapping()throws Exception{
    Model model = ModelFactory.createDefaultModel();
    InputStream in = this.getClass().getResourceAsStream("files/sample.rdf");
    model.read(in,null);
    String uri = "http://www.deri.ie/about/team/member/renaud_delbru#me";
    PreviewResourceCannedQuery cannedQuery = new PreviewResourceCannedQuery(this.getClass().getResourceAsStream("files/preview_properties.properties"));
    String sparql = cannedQuery.getPreviewQueryForResource(uri);

    Query query = QueryFactory.create(sparql, Syntax.syntaxSPARQL_11);
    QueryExecution qExec = QueryExecutionFactory.create(query, model);
   
    ResultSet res = qExec.execSelect();
    Multimap<String, String> map = cannedQuery.wrapResourcePropertiesMapResultSet(res);
    assertEquals(map.size(),2);
    assertEquals(map.get("labels"), Collections.singletonList("EN-Renaud"));
  }
View Full Code Here

TOP

Related Classes of com.google.refine.org.deri.reconcile.rdf.factories.PreviewResourceCannedQuery

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.