Search in sources :

Example 21 with Datable

use of nl.knaw.huygens.timbuctoo.model.Datable in project timbuctoo by HuygensING.

the class DatableTest method convertYear_month_range.

@Test
public void convertYear_month_range() {
    Assert.assertTrue(EdtfPattern.YEAR_MONTH_RANGE.matches("2010-??"));
    Assert.assertFalse(EdtfPattern.YEAR_MONTH_RANGE.matches("201?"));
    Assert.assertFalse(EdtfPattern.YEAR_MONTH_RANGE.matches("2010-02-13"));
    testDatable("2010-01-01:12", "2010-12-31:12", Datable.Certainty.MEDIUM, new Datable("2010-??"));
}
Also used : Datable(nl.knaw.huygens.timbuctoo.model.Datable) Test(org.junit.Test)

Example 22 with Datable

use of nl.knaw.huygens.timbuctoo.model.Datable in project timbuctoo by HuygensING.

the class DatableTest method convertYear_month_day_h.

@Test
public void convertYear_month_day_h() {
    String edtf = "1648-05-15";
    Assert.assertTrue(EdtfPattern.YEAR_MONTH_DAY_H.matches(edtf));
    testDatable("1648-05-15:12", "1648-05-15:12", Datable.Certainty.HIGH, new Datable(edtf));
}
Also used : Datable(nl.knaw.huygens.timbuctoo.model.Datable) Test(org.junit.Test)

Example 23 with Datable

use of nl.knaw.huygens.timbuctoo.model.Datable in project timbuctoo by HuygensING.

the class DatableTest method convertYear_range_q3.

@Test
public void convertYear_range_q3() {
    Assert.assertTrue(EdtfPattern.YEAR_RANGE_Q3.matches("2???"));
    Assert.assertFalse(EdtfPattern.YEAR_RANGE_Q3.matches("2010"));
    Assert.assertFalse(EdtfPattern.YEAR_RANGE_Q3.matches("2???-02-13"));
    testDatable("2000-01-01:12", "2999-12-31:12", Datable.Certainty.LOW, new Datable("2???"));
}
Also used : Datable(nl.knaw.huygens.timbuctoo.model.Datable) Test(org.junit.Test)

Example 24 with Datable

use of nl.knaw.huygens.timbuctoo.model.Datable in project timbuctoo by HuygensING.

the class DatableTest method testCompareToSmaller.

@Test
public void testCompareToSmaller() {
    Datable first = new Datable("20131010");
    Datable second = new Datable("20131011");
    assertEquals(-1, first.compareTo(second));
}
Also used : Datable(nl.knaw.huygens.timbuctoo.model.Datable) Test(org.junit.Test)

Example 25 with Datable

use of nl.knaw.huygens.timbuctoo.model.Datable in project timbuctoo by HuygensING.

the class DatableTest method convertYear_q.

@Test
public void convertYear_q() {
    Assert.assertTrue(EdtfPattern.YEAR_Q.matches("2010?"));
    Assert.assertFalse(EdtfPattern.YEAR_Q.matches("2010"));
    Assert.assertFalse(EdtfPattern.YEAR_Q.matches("2010-02-13?"));
    testDatable("2010-01-01:12", "2010-12-31:12", Datable.Certainty.LOW, new Datable("2010?"));
}
Also used : Datable(nl.knaw.huygens.timbuctoo.model.Datable) Test(org.junit.Test)

Aggregations

Datable (nl.knaw.huygens.timbuctoo.model.Datable)32 Test (org.junit.Test)29 Range (com.google.common.collect.Range)2 ParseException (java.text.ParseException)2 Date (java.util.Date)2 DateRangeFacetValue (nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.DateRangeFacetValue)2 Strings (com.google.common.base.Strings)1 SimpleDateFormat (java.text.SimpleDateFormat)1 List (java.util.List)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 FacetValue (nl.knaw.huygens.timbuctoo.search.FacetValue)1 Facet (nl.knaw.huygens.timbuctoo.search.description.facet.Facet)1 DatableRangeFacetGetter (nl.knaw.huygens.timbuctoo.search.description.facet.helpers.DatableRangeFacetGetter)1 RelatedPropertyValueGetter (nl.knaw.huygens.timbuctoo.search.description.facet.helpers.RelatedPropertyValueGetter)1 StringUtils (org.apache.commons.lang.StringUtils)1 P (org.apache.tinkerpop.gremlin.process.traversal.P)1 GraphTraversal (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal)1 org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__ (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__)1 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)1