Search in sources :

Example 1 with SpanBox

use of org.corpus_tools.annis.gui.flatquerybuilder.SpanBox in project ANNIS by korpling.

the class FlatQueryBuilderTest method twoTokenInSentence.

@Test
void twoTokenInSentence() throws InterruptedException {
    initQueryBuilder(0);
    // Add a two tokens
    queryBuilder.addLinguisticSequenceBox("tok");
    queryBuilder.addLinguisticSequenceBox("tok");
    List<SearchBox> searchBoxes = _find(queryBuilder, SearchBox.class);
    assertEquals(2, searchBoxes.size());
    _get(searchBoxes.get(0), ComboBox.class).setValue("Feigenblatt");
    _get(searchBoxes.get(1), ComboBox.class).setValue("Die");
    // Add a scope
    queryBuilder.addSpanBox("Sent");
    SpanBox spanBox = _get(queryBuilder, SpanBox.class);
    _get(spanBox, ComboBox.class).setValue("s");
    // Create the AQL query
    _click(_get(queryBuilder, Button.class, spec -> spec.withCaption("Create AQL Query")));
    assertEquals("tok=/Feigenblatt/ & tok=/Die/\n& Sent = \"s\"\n& #1 . #2\n" + "& #3_i_#1\n" + "& #3_i_#2", ui.getQueryState().getAql().getValue());
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) MenuItem(com.vaadin.ui.MenuBar.MenuItem) CheckBox(com.vaadin.v7.ui.CheckBox) EdgeBox(org.corpus_tools.annis.gui.flatquerybuilder.EdgeBox) Assertions.assertNotEquals(org.junit.jupiter.api.Assertions.assertNotEquals) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) QueryBuilderChooser(org.corpus_tools.annis.gui.querybuilder.QueryBuilderChooser) Autowired(org.springframework.beans.factory.annotation.Autowired) FlatQueryBuilder(org.corpus_tools.annis.gui.flatquerybuilder.FlatQueryBuilder) ActiveProfiles(org.springframework.test.context.ActiveProfiles) LocatorJ._find(com.github.mvysny.kaributesting.v8.LocatorJ._find) ArrayList(java.util.ArrayList) SpanBox(org.corpus_tools.annis.gui.flatquerybuilder.SpanBox) SingletonBeanStoreRetrievalStrategy(org.corpus_tools.annis.gui.SingletonBeanStoreRetrievalStrategy) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) Sets(org.mockito.internal.util.collections.Sets) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) MetaBox(org.corpus_tools.annis.gui.flatquerybuilder.MetaBox) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) SearchBox(org.corpus_tools.annis.gui.flatquerybuilder.SearchBox) MenuBar(com.vaadin.ui.MenuBar) TextChangeEvent(com.vaadin.v7.event.FieldEvents.TextChangeEvent) AnnisUI(org.corpus_tools.annis.gui.AnnisUI) ComboBox(com.vaadin.v7.ui.ComboBox) Collection(java.util.Collection) LocatorJ._click(com.github.mvysny.kaributesting.v8.LocatorJ._click) Mockito.when(org.mockito.Mockito.when) ValueField(org.corpus_tools.annis.gui.flatquerybuilder.ValueField) SensitiveComboBox(org.corpus_tools.annis.gui.flatquerybuilder.SensitiveComboBox) Test(org.junit.jupiter.api.Test) Button(com.vaadin.ui.Button) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) VerticalNode(org.corpus_tools.annis.gui.flatquerybuilder.VerticalNode) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) BeanFactory(org.springframework.beans.factory.BeanFactory) Mockito.mock(org.mockito.Mockito.mock) Button(com.vaadin.ui.Button) ComboBox(com.vaadin.v7.ui.ComboBox) SensitiveComboBox(org.corpus_tools.annis.gui.flatquerybuilder.SensitiveComboBox) SpanBox(org.corpus_tools.annis.gui.flatquerybuilder.SpanBox) SearchBox(org.corpus_tools.annis.gui.flatquerybuilder.SearchBox) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with SpanBox

use of org.corpus_tools.annis.gui.flatquerybuilder.SpanBox in project ANNIS by korpling.

the class FlatQueryBuilderTest method regularExpressionScope.

@Test
void regularExpressionScope() {
    initQueryBuilder(0);
    // Add a token
    queryBuilder.addLinguisticSequenceBox("tok");
    _get(queryBuilder, SearchBox.class).setValue("Feigenblatt");
    // Add a scope and add a regular expression as value
    queryBuilder.addSpanBox("Sent");
    SpanBox spanBox = _get(queryBuilder, SpanBox.class);
    // Set first to regex mode (so the value is not escaped)
    _get(spanBox, CheckBox.class).setValue(true);
    spanBox.setValue(".*");
    // Create the AQL query
    _click(_get(queryBuilder, Button.class, spec -> spec.withCaption("Create AQL Query")));
    assertEquals("tok=/Feigenblatt/\n& Sent = /.*/\n& #2_i_#1", ui.getQueryState().getAql().getValue());
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) MenuItem(com.vaadin.ui.MenuBar.MenuItem) CheckBox(com.vaadin.v7.ui.CheckBox) EdgeBox(org.corpus_tools.annis.gui.flatquerybuilder.EdgeBox) Assertions.assertNotEquals(org.junit.jupiter.api.Assertions.assertNotEquals) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) QueryBuilderChooser(org.corpus_tools.annis.gui.querybuilder.QueryBuilderChooser) Autowired(org.springframework.beans.factory.annotation.Autowired) FlatQueryBuilder(org.corpus_tools.annis.gui.flatquerybuilder.FlatQueryBuilder) ActiveProfiles(org.springframework.test.context.ActiveProfiles) LocatorJ._find(com.github.mvysny.kaributesting.v8.LocatorJ._find) ArrayList(java.util.ArrayList) SpanBox(org.corpus_tools.annis.gui.flatquerybuilder.SpanBox) SingletonBeanStoreRetrievalStrategy(org.corpus_tools.annis.gui.SingletonBeanStoreRetrievalStrategy) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) Sets(org.mockito.internal.util.collections.Sets) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) MetaBox(org.corpus_tools.annis.gui.flatquerybuilder.MetaBox) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) SearchBox(org.corpus_tools.annis.gui.flatquerybuilder.SearchBox) MenuBar(com.vaadin.ui.MenuBar) TextChangeEvent(com.vaadin.v7.event.FieldEvents.TextChangeEvent) AnnisUI(org.corpus_tools.annis.gui.AnnisUI) ComboBox(com.vaadin.v7.ui.ComboBox) Collection(java.util.Collection) LocatorJ._click(com.github.mvysny.kaributesting.v8.LocatorJ._click) Mockito.when(org.mockito.Mockito.when) ValueField(org.corpus_tools.annis.gui.flatquerybuilder.ValueField) SensitiveComboBox(org.corpus_tools.annis.gui.flatquerybuilder.SensitiveComboBox) Test(org.junit.jupiter.api.Test) Button(com.vaadin.ui.Button) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) VerticalNode(org.corpus_tools.annis.gui.flatquerybuilder.VerticalNode) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) BeanFactory(org.springframework.beans.factory.BeanFactory) Mockito.mock(org.mockito.Mockito.mock) Button(com.vaadin.ui.Button) CheckBox(com.vaadin.v7.ui.CheckBox) SpanBox(org.corpus_tools.annis.gui.flatquerybuilder.SpanBox) SearchBox(org.corpus_tools.annis.gui.flatquerybuilder.SearchBox) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

LocatorJ._click (com.github.mvysny.kaributesting.v8.LocatorJ._click)2 LocatorJ._find (com.github.mvysny.kaributesting.v8.LocatorJ._find)2 LocatorJ._get (com.github.mvysny.kaributesting.v8.LocatorJ._get)2 MockVaadin (com.github.mvysny.kaributesting.v8.MockVaadin)2 UIScopeImpl (com.vaadin.spring.internal.UIScopeImpl)2 Button (com.vaadin.ui.Button)2 MenuBar (com.vaadin.ui.MenuBar)2 MenuItem (com.vaadin.ui.MenuBar.MenuItem)2 TextChangeEvent (com.vaadin.v7.event.FieldEvents.TextChangeEvent)2 CheckBox (com.vaadin.v7.ui.CheckBox)2 ComboBox (com.vaadin.v7.ui.ComboBox)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 List (java.util.List)2 AnnisUI (org.corpus_tools.annis.gui.AnnisUI)2 SingletonBeanStoreRetrievalStrategy (org.corpus_tools.annis.gui.SingletonBeanStoreRetrievalStrategy)2 EdgeBox (org.corpus_tools.annis.gui.flatquerybuilder.EdgeBox)2 FlatQueryBuilder (org.corpus_tools.annis.gui.flatquerybuilder.FlatQueryBuilder)2 MetaBox (org.corpus_tools.annis.gui.flatquerybuilder.MetaBox)2 SearchBox (org.corpus_tools.annis.gui.flatquerybuilder.SearchBox)2