Package no.priv.garshol.duke

Examples of no.priv.garshol.duke.RecordIterator


  @Test
  public void testSingleRecord() {
    source.addColumn(new Column("?uri", "ID", null, null));
    source.addColumn(new Column("http://b", "PROP", null, null));
   
    RecordIterator it = read("<http://a> <http://b> \"foo\" .\n");

    Record r = it.next();
    assertEquals("http://a", r.getValue("ID"));
    assertEquals("foo", r.getValue("PROP"));

    assertFalse(it.hasNext());
  }
View Full Code Here


  @Test
  public void testSingleRecord2() {
    source.addColumn(new Column("?uri", "ID", null, null));
    source.addColumn(new Column("http://b", "PROP", null, null));
   
    RecordIterator it = read("<http://a> <http://b> \"foo\" .\n" +
                             "<http://a> <http://c> \"foo\" .\n");

    Record r = it.next();
    assertEquals("http://a", r.getValue("ID"));
    assertEquals("foo", r.getValue("PROP"));

    assertFalse(it.hasNext());
  }
View Full Code Here

  @Test
  public void testSingleRecord2Spaces() {
    source.addColumn(new Column("?uri", "ID", null, null));
    source.addColumn(new Column("http://b", "PROP", null, null));
   
    RecordIterator it = read("\n<http://a> <http://b> \"foo\" .\n\n" +
                             "<http://a> <http://c> \"foo\" .\n\n");

    Record r = it.next();
    assertEquals("http://a", r.getValue("ID"));
    assertEquals("foo", r.getValue("PROP"));

    assertFalse(it.hasNext());
  }
View Full Code Here

  @Test
  public void testTwoRecords() {
    source.addColumn(new Column("?uri", "ID", null, null));
    source.addColumn(new Column("http://b", "PROP", null, null));
   
    RecordIterator it = read("<http://a> <http://b> \"foo\" .\n" +
                             "<http://a> <http://c> \"foo\" .\n" +
                             "<http://a> <" + RDF_TYPE + "> \"http://d\" .\n" +
                             "<http://e> <http://b> \"bar\" .\n" +
                             "<http://e> <http://c> \"foo\" .\n" +
                             "<http://e> <" + RDF_TYPE + "> \"http://f\" .\n");

    Record r = it.next();
    checkAorE(r); // we don't know the order
    assertTrue("second record not found", it.hasNext());
    r = it.next();
    checkAorE(r);
  }
View Full Code Here

  public void testTypeFiltering() {
    source.addColumn(new Column("?uri", "ID", null, null));
    source.addColumn(new Column("http://b", "PROP", null, null));
    source.setAcceptTypes("http://d");
   
    RecordIterator it = read("<http://a> <http://b> \"foo\" .\n" +
                             "<http://a> <http://c> \"foo\" .\n" +
                             "<http://a> <" + RDF_TYPE + "> \"http://d\" .\n" +
                             "<http://e> <http://b> \"bar\" .\n" +
                             "<http://e> <http://c> \"foo\" .\n" +
                             "<http://e> <" + RDF_TYPE + "> \"http://f\" .\n");

    Record r = it.next();
    assertEquals("http://a", r.getValue("ID"));
    assertEquals("foo", r.getValue("PROP"));

    assertFalse("e record not filtered out", it.hasNext());
  }
View Full Code Here

    source.addColumn(new Column("http://b", "PROP", null, null));
    // yes, we map b two times. might be necessary to split a compound
    // value into two different properties.
    source.addColumn(new Column("http://b", "PROP2", null, null));
   
    RecordIterator it = read("<http://a> <http://b> \"foo\" .\n");

    Record r = it.next();
    assertEquals("http://a", r.getValue("ID"));
    assertEquals("foo", r.getValue("PROP"));
    assertEquals("foo", r.getValue("PROP2"));

    assertFalse(it.hasNext());
  }
View Full Code Here

    source.addColumn(new Column("http://data.deichman.no/lifespan",
                                "YEAROFBIRTH", null, birthcleaner));
    source.addColumn(new Column("http://data.deichman.no/lifespan",
                                "YEAROFDEATH", null, deathcleaner));

    RecordIterator it = read(data);
    Record r = it.next();
    assertEquals("http://data.deichman.no/person/ahlgren_ernst_1850-1888",
                 r.getValue("ID"));
    assertEquals("ernst ahlgren", r.getValue("NAME"));
    assertEquals("1850", r.getValue("YEAROFBIRTH"));
    assertEquals("1888", r.getValue("YEAROFDEATH"));

    assertFalse(it.hasNext());
  }
View Full Code Here

  public void testCleanedNullIsDiscarded() {
    source.addColumn(new Column("?uri", "ID", null, null));
    source.addColumn(new Column("http://b", "PROP", null,
                                new NullCleaner()));
   
    RecordIterator it = read("<http://a> <http://b> \"foo\" .\n");

    assertFalse(it.hasNext());
  }
View Full Code Here

  public void testCleanedEmptyIsDiscarded() {
    source.addColumn(new Column("?uri", "ID", null, null));
    source.addColumn(new Column("http://b", "PROP", null,
                                new EmptyCleaner()));
   
    RecordIterator it = read("<http://a> <http://b> \"foo\" .\n");

    assertFalse(it.hasNext());
  }
View Full Code Here

  @Test
  public void testEmptyRecord() {
    source.addColumn(new Column("?uri", "ID", null, null));
    source.addColumn(new Column("http://b", "PROP", null, null));
   
    RecordIterator it = read("<http://a> <http://c> \"foo\" .\n");

    assertFalse("failed to filter out empty records",
                it.hasNext());
  }
View Full Code Here

TOP

Related Classes of no.priv.garshol.duke.RecordIterator

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.