APISonar


ai.grakn.concept.ResourceType.DataType.DATE

> ai > grakn > concept > ResourceType > DataType > DATE
ai APIs grakn APIs concept APIs ResourceType APIs DataType APIs DATE APIs

Example 1
public void whenSavingDateIntoResource_DateIsReturnedInSameFormat(){
        LocalDateTime date = LocalDateTime.now();
        ResourceType<LocalDateTime> resourceType = graknGraph.putResourceType("My Birthday", ResourceType.DataType.DATE);
        Resource<LocalDateTime> myBirthday = resourceType.putResource(date);

        assertEquals(date, myBirthday.getValue());
        assertEquals(myBirthday, resourceType.getResource(date));
        assertThat(graknGraph.getResourcesByValue(date), containsInAnyOrder(myBirthday));
    }
Example 2
public void whenCreatingDateResource_EnsureDateCanBeRetrieved(){
        GraknTitanGraph graph = new TitanInternalFactory("case", Grakn.IN_MEMORY, TEST_PROPERTIES).open(GraknTxType.WRITE);
        ResourceType<LocalDateTime> dateType = graph.putResourceType("date", ResourceType.DataType.DATE);
        LocalDateTime now = LocalDateTime.now();
        Resource<LocalDateTime> date = dateType.putResource(now);
        assertEquals(now, date.getValue());
    }