Search in sources :

Example 6 with TableEntry

use of infoeval.main.mysql.TableEntry in project Info-Evaluation by TechnionYP5777.

the class TableEntryTest method test4.

@Test
@SuppressWarnings("deprecation")
public void test4() {
    TableEntry te = new TableEntry("bla", "bla", "bla", "bla", new Date(1, 1, 1), new Date(1, 1, 1), "", "", "", "", "");
    te.setUrl("url");
    te.setName("name");
    te.setDeathPlace("deathPlace");
    te.setBirthPlace("birthPlace");
    te.setBirthDate(new Date(2000, 10, 21));
    te.setDeathDate(new Date(2015, 10, 21));
    te.setOverview("An interesting overview");
    assertEquals(te.getBirthDate(), new Date(2000, 10, 21));
    assertEquals(te.getDeathDate(), new Date(2015, 10, 21));
    assertEquals("birthPlace", te.getBirthPlace());
    assertEquals("deathPlace", te.getDeathPlace());
    assertEquals("url", te.getUrl());
    assertEquals("name", te.getName());
    assertEquals("An interesting overview", te.getOverview());
}
Also used : TableEntry(infoeval.main.mysql.TableEntry) Date(java.sql.Date) Test(org.junit.Test)

Example 7 with TableEntry

use of infoeval.main.mysql.TableEntry in project Info-Evaluation by TechnionYP5777.

the class TableEntryTest method test1.

@Test
public void test1() {
    TableEntry te = new TableEntry();
    assertNull(te.getBirthDate());
    assertNull(te.getDeathDate());
    assertEquals("", te.getBirthPlace());
    assertEquals("", te.getDeathPlace());
    assertEquals("", te.getUrl());
    assertEquals("", te.getName());
}
Also used : TableEntry(infoeval.main.mysql.TableEntry) Test(org.junit.Test)

Example 8 with TableEntry

use of infoeval.main.mysql.TableEntry in project Info-Evaluation by TechnionYP5777.

the class InfoevalServiceImp method differentDeathPlace.

@Override
@RequestMapping(path = "Queries/Query1", method = RequestMethod.GET)
public ArrayList<TableEntry> differentDeathPlace() throws Exception {
    logger.log(Level.INFO, "Born and died in different place was called");
    //ArrayList<TableEntry> $ = new ArrayList<>();
    //
    //java.sql.Date utilDate1 = java.sql.Date.valueOf( LocalDate.of(1912, 6, 23) );
    //	java.sql.Date utilDate2 = java.sql.Date.valueOf( LocalDate.of(1954, 6, 7) );
    //
    //	TableEntry entry = new TableEntry(null, "Alan Turing", "Maida Vale", "Wilmslow", utilDate1, utilDate2,"","","");
    //$.add(entry);
    //
    //utilDate1 = java.sql.Date.valueOf((LocalDate.of(1886, 10, 16)));
    //utilDate2 = java.sql.Date.valueOf(LocalDate.of(1973, 12, 1));
    //
    //entry = new TableEntry(null, "David Ben-Gurion", "plonsk", "Ramat Gan", utilDate1, utilDate2,"","","");
    //$.add(entry);
    //return $;
    //This is the code that should really run. The code above is just a stub. We don't run the actual Java code to find real resultsbecause the server is too slow for now ...
    /*
		 * TODO: DO NOT REMOVE THE CODE BELOW !!!! @MOSHIKO
		 * 
		 */
    SqlRunner runner = new SqlRunner();
    ArrayList<TableEntry> $ = runner.getDifferentDeathPlace();
    logger.log(Level.INFO, "list size:" + $.size());
    return $;
}
Also used : TableEntry(infoeval.main.mysql.TableEntry) SqlRunner(infoeval.main.mysql.SqlRunner) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with TableEntry

use of infoeval.main.mysql.TableEntry in project Info-Evaluation by TechnionYP5777.

the class SqlRunnerTest method getPersonalInfoTest.

@Ignore
@Test
public void getPersonalInfoTest() throws Exception {
    String name = "yasuhiro takato";
    TableEntry te = querun.getPersonalInfo(name);
    System.out.println("Name is " + te.getName());
    System.out.println("Birth Place is " + te.getBirthPlace());
    System.out.println("Birth Place is " + te.getDeathPlace());
    Date birthDate = te.getBirthDate();
    if (birthDate != null)
        System.out.println("Birth Date is " + birthDate);
    Date deathDate = te.getDeathDate();
    if (deathDate != null)
        System.out.println("Death Date is " + deathDate);
    System.out.println("Occupation is " + te.getOccupation());
    System.out.println("Spouse Name is " + te.getSpouseName());
    System.out.println("Spouse Occupation is " + te.getSpouseOccupation());
    System.out.println("PhotoLink is " + te.getPhotoLink());
    System.out.println("Abstract is " + te.getOverview());
}
Also used : TableEntry(infoeval.main.mysql.TableEntry) Date(java.sql.Date) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 10 with TableEntry

use of infoeval.main.mysql.TableEntry in project Info-Evaluation by TechnionYP5777.

the class SqlRunnerTest method getOccupationBetweenYearsTest.

@Ignore
@Test
public void getOccupationBetweenYearsTest() throws Exception {
    for (TableEntry te : querun.getOccupationBetweenYears("1840", "1920", "Politician")) {
        assertEquals(te.getOccupation(), "Politician");
        java.sql.Date birthDate = te.getBirthDate();
        SimpleDateFormat formatYear = new SimpleDateFormat("yyyy");
        String birthYear = formatYear.format(birthDate);
        int bYear = Integer.parseInt(birthYear);
        assert bYear >= 1840;
        java.sql.Date deathDate = te.getDeathDate();
        formatYear.format(deathDate);
        assert Integer.parseInt(birthYear) <= 1920;
    }
}
Also used : TableEntry(infoeval.main.mysql.TableEntry) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.sql.Date) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

TableEntry (infoeval.main.mysql.TableEntry)12 Test (org.junit.Test)9 Date (java.sql.Date)8 Ignore (org.junit.Ignore)5 SimpleDateFormat (java.text.SimpleDateFormat)3 SqlRunner (infoeval.main.mysql.SqlRunner)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 Row (infoeval.main.mysql.Row)1 QuerySolution (org.apache.jena.query.QuerySolution)1 RDFNode (org.apache.jena.rdf.model.RDFNode)1