Package no.priv.garshol.duke.datasources

Examples of no.priv.garshol.duke.datasources.Column


    testSingleRecord2();
  }

  @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();
View Full Code Here


    testSingleRecord2Spaces();
  }

  @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" +
View Full Code Here

    testTwoRecords();
  }
 
  @Test
  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" +
View Full Code Here

    testTypeFiltering();
  }

  @Test
  public void testSingleRecordDoubleProp() {
    source.addColumn(new Column("?uri", "ID", null, null));
    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"));
View Full Code Here

    RegexpCleaner birthcleaner = new RegexpCleaner();
    birthcleaner.setRegexp("^(\\d\\d\\d\\d)-");
    RegexpCleaner deathcleaner = new RegexpCleaner();
    deathcleaner.setRegexp("-(\\d\\d\\d\\d)$");
   
    source.addColumn(new Column("?uri", "ID", null, null));   
    source.addColumn(new Column("http://xmlns.com/foaf/0.1/name", "NAME",
                                null, new FamilyCommaGivenCleaner()));
    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",
View Full Code Here

    assertFalse(it.hasNext());
  }

  @Test
  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

    assertFalse(it.hasNext());
  }

  @Test
  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

    assertFalse(it.hasNext());
  }
 
  @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

    assertTrue(!it.hasNext());
  }

  @Test
  public void testSingleRecord() throws IOException {
    source.addColumn(new Column("F1", null, null, null));
    source.addColumn(new Column("F2", null, null, null));
    source.addColumn(new Column("F3", null, null, null));

    RecordIterator it = read("F1,F2,F3\na,b,c");

    Record r = it.next();
    assertEquals("a", r.getValue("F1"));
View Full Code Here

    assertEquals("c", r.getValue("F3"));
  }

  @Test
  public void testSingleRecordWithComment() throws IOException {
    source.addColumn(new Column("F1", null, null, null));
    source.addColumn(new Column("F2", null, null, null));
    source.addColumn(new Column("F3", null, null, null));
    source.setSkipLines(1);

    RecordIterator it = read("# this is a comment\nF1,F2,F3\na,b,c");

    Record r = it.next();
View Full Code Here

TOP

Related Classes of no.priv.garshol.duke.datasources.Column

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.