Search in sources :

Example 1 with Argument

use of de.tudarmstadt.ukp.clarin.webanno.brat.render.model.Argument in project webanno by webanno.

the class RelationTest method toJsonTest.

@Test
public void toJsonTest() throws IOException {
    MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
    String json = JSONUtil.toPrettyJsonString(jsonConverter, new Relation(new VID(1, 2), "type", asList(new Argument("arg1", 1), new Argument("arg2", 2)), "label", "color"));
    assertEquals("[ \"1.2\", \"type\", [ [ \"arg1\", \"1\" ], [ \"arg2\", \"2\" ] ], \"label\", \"color\" ]", json);
}
Also used : VID(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.VID) MappingJackson2HttpMessageConverter(org.springframework.http.converter.json.MappingJackson2HttpMessageConverter) Relation(de.tudarmstadt.ukp.clarin.webanno.brat.render.model.Relation) Argument(de.tudarmstadt.ukp.clarin.webanno.brat.render.model.Argument) Test(org.junit.Test)

Aggregations

VID (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.VID)1 Argument (de.tudarmstadt.ukp.clarin.webanno.brat.render.model.Argument)1 Relation (de.tudarmstadt.ukp.clarin.webanno.brat.render.model.Relation)1 Test (org.junit.Test)1 MappingJackson2HttpMessageConverter (org.springframework.http.converter.json.MappingJackson2HttpMessageConverter)1