Skip to content

Commit

Permalink
Merge branch 'master' into feature/1239-simple-relation-recommender
Browse files Browse the repository at this point in the history
* master:
  #1852 - Default ElasticSearch document repository settings do not work
  #1830 - Upgrade to Wicket 9
  #1848 - Documentation-improvements
  #1830 - Upgrade to Wicket 9
  #1830 - Upgrade to Wicket 9
  #1830 - Upgrade to Wicket 9
  #1830 - Upgrade to Wicket 9
  #1832 - Display project ID in developer mode
  #1830 - Upgrade to Wicket 9
  • Loading branch information
reckart committed Nov 21, 2020
2 parents a93c133 + 9ee5b9d commit c17729c
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
| Linux (64bit), macOS (64bit), Windows (64bit)

| Java Runtime Environment
| version 8 or higher
| version 11 or higher
|===

.Requirements run the server version
Expand All @@ -40,7 +40,7 @@
| Linux (64bit), macOS (64bit), Windows (64bit)

| Java Runtime Environment
| version 8 or higher
| version 11 or higher

| Apache Tomcat (or compatible)
| version 9.0 or higher (Servlet API 4.0.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This section covers setting up a development environment.
== Source code management

We use git as our source code management system and collaborate via the {product-name}
repository on Github.
repository on https://github.com/inception-project/inception[Github].

=== Development workflow

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ In order to understand what you read in this guide, it makes sense to have an an
image::getting_started_download_example_project.png[align="center"]


*Step 1 - Download:* For this guide, we use the _Interactive Concept Linking_ project. Please download it from the https://inception-project.github.io/example-projects/[Example Projects] section on our website. It consists of two documents about pets. The first one contains some annotations as an example, the second one is meant to be your playground. It has originally been created for concept linking annotation but in every project, you can create any kind of annotations. We will use it for Named Entity Recognition.
*Step 1 - Download:* For this guide, we use the _Interactive Concept Linking_ project. Please download it from the https://inception-project.github.io/example-projects/[Example Projects] section on our website and save it without extracting it first. It consists of two documents about pets. The first one contains some annotations as an example, the second one is meant to be your playground. It has originally been created for concept linking annotation but in every project, you can create any kind of annotations. We will use it for Named Entity Recognition.

[[named_entity_recognition_in_getting_started]]
NOTE: *Named Entity Recognition:* This is a certain kind of annotation. In _Getting Started_, we use it to tell whether the annotated text part refers to a person (in {product-name}, the buit-in tag for person is PER), organization (ORG), location (LOC) or any other (OTH). +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class ElasticSearchProviderTraits

private String searchPath = "_search";

private String objectType = "texts";
private String objectType = "_doc";

private String defaultField = "doc.text";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,78 @@ when querying the document repository. The possible result sizes lie between 1 a
If the default **Field** setting `doc.text` is used, then the JSON structure for indexed documents
should look as follows:

```
[source,json]
----
{
"metadata": {
"language": "en",
"source": "My favourite document collection",
"timestamp": "2011/11/11 11:11",
"uri": "http://the.internet.com/my/document/collection/document1.txt",
"title": "Cool Document Title"
},
"doc": {
"text": "Here goes the document text."
"text": "This is a test document"
}
}
```
----

== Setting up a simple ElasticSearch document repository

In this example, we use link:https://www.docker.com[Docker] to get ElasticSearch and link:https://elasticvue.com[ElasticVue] up and running very quickly. Note, that the docker containers we start
here will not save any data permanently. It is just for you to get an idea of how the setup works.
In a productive environment, you need to use a proper installation of ElasticSearch.

1. Open a terminal and run ElasticSearch as a Docker service
+
[source,sh]
----
$ docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "http.cors.enabled=true" -e "http.cors.allow-origin=http://localhost:9090" docker.elastic.co/elasticsearch/elasticsearch-oss:7.9.3-amd64
----
2. Open a second terminal and run ElasticVue as a Docker service
+
[source,sh]
----
$ docker run -p 9090:8080 cars10/elasticvue
----
3. Open a browser and access ElasticVue at `http://localhost:9090`
4. Switch to the Indices tab in ElasticVue
5. Create an index named "test"
6. Switch to the REST tab in ElasticVue
7. Set the HTTP Method to "POST" and enter `test/_doc/1` as the Path (means "create a new document with ID 1 in collection test)
8. Put the following JSON into the request body field
+
[source,json]
----
{
"metadata": {
"language": "en",
"source": "My favourite document collection",
"timestamp": "2011/11/11 11:11",
"uri": "http://the.internet.com/my/document/collection/document1.txt",
"title": "Cool Document Title"
},
"doc": {
"text": "This is a test document"
}
}
----
9. Click *Run Query*
10. Start up INCEpTION
11. Create a new project
12. Add a document repository with the following settings (and click save):
* Name: `My ElasticSearch Document Repository`
* Type: `Elastic Search`
* Remote URL: `http://localhost:9200`
* Index name: `test`
* Search path: `_search`
* Object type: `_doc`
* Field: `doc.text`
* Result Size: `1000`
* Random ordering: `false`
13. Switch to the *Dashboard* and from there to the *Search* page
14. Select the repository `test`
15. Enter `document` into the search field and press the *Search* button
16. You should get result for the document you posted to the ElasticSearch index in step 8
17. Click on *Import*
18. The import button should change to *Open* now - click on it to open the documen in the annotation editor
4 changes: 0 additions & 4 deletions inception-external-search-pubannotation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-util</artifactId>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-spring</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import java.util.List;

import org.apache.wicket.util.SlowTests;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand All @@ -30,6 +29,7 @@
import de.tudarmstadt.ukp.inception.externalsearch.model.DocumentRepository;
import de.tudarmstadt.ukp.inception.externalsearch.pubannotation.model.PubAnnotationDocumentHandle;
import de.tudarmstadt.ukp.inception.externalsearch.pubannotation.traits.PubAnnotationProviderTraits;
import nl.ru.test.category.SlowTests;

@Category(SlowTests.class)
public class PubAnnotationProviderTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package de.tudarmstadt.ukp.inception.recommendation.api.model;

import static java.util.Arrays.asList;
import static java.util.Collections.newSetFromMap;
import static java.util.Comparator.comparingInt;
import static java.util.stream.Collectors.toList;

Expand All @@ -34,7 +35,6 @@
import java.util.stream.Collectors;

import org.apache.commons.lang3.Validate;
import org.apache.wicket.util.collections.ConcurrentHashSet;

import de.tudarmstadt.ukp.clarin.webanno.api.DocumentService;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.VID;
Expand All @@ -58,7 +58,7 @@ public class Predictions
private static final long serialVersionUID = -1598768729246662885L;

private Map<ExtendedId, AnnotationSuggestion> predictions = new ConcurrentHashMap<>();
private Set<String> seenDocumentsForPrediction = new ConcurrentHashSet<>();
private Set<String> seenDocumentsForPrediction = newSetFromMap(new ConcurrentHashMap<>());

private final Project project;
private final User user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<div class="list-group-item-text">
<div class="text-right">
<small class="text-muted" wicket:enclosure="created">Created: <wicket:container wicket:id="created"/></small>
<small class="text-muted" wicket:enclosure="id">ID: <wicket:container wicket:id="id"/></small>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@
*/
package de.tudarmstadt.ukp.inception.ui.core.dashboard.projectlist;

import static de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst.PAGE_PARAM_PROJECT_ID;
import static de.tudarmstadt.ukp.clarin.webanno.security.model.Role.ROLE_ADMIN;
import static de.tudarmstadt.ukp.clarin.webanno.security.model.Role.ROLE_PROJECT_CREATOR;
import static de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaBehavior.visibleWhen;
import static de.tudarmstadt.ukp.clarin.webanno.ui.project.ProjectPage.NEW_PROJECT_ID;
import static java.lang.String.join;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
import static org.apache.wicket.RuntimeConfigurationType.DEVELOPMENT;
import static org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy.authorize;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand All @@ -53,7 +56,6 @@

import de.agilecoders.wicket.core.markup.html.bootstrap.behavior.CssClassNameAppender;
import de.tudarmstadt.ukp.clarin.webanno.api.ProjectService;
import de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst;
import de.tudarmstadt.ukp.clarin.webanno.api.export.ProjectExportService;
import de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
Expand All @@ -80,6 +82,7 @@ public class ProjectsOverviewPage
private static final String MID_ROLE_FILTER = "roleFilter";
private static final String MID_PROJECTS = "projects";
private static final String MID_PROJECT = "project";
private static final String MID_ID = "id";
private static final String MID_IMPORT_PROJECT_PANEL = "importProjectPanel";
private static final String MID_NEW_PROJECT = "newProject";
private static final String MID_LEAVE_PROJECT = "leaveProject";
Expand Down Expand Up @@ -189,6 +192,10 @@ protected void populateItem(ListItem<Project> aItem)
createdLabel.add(visibleWhen(() -> createdLabel.getModelObject() != null));
aItem.add(createdLabel);
aItem.add(createRoleBadges(aItem.getModelObject()));
Label projectId = new Label(MID_ID, () -> aItem.getModelObject().getId());
projectId.add(visibleWhen(() ->
DEVELOPMENT.equals(getApplication().getConfigurationType())));
aItem.add(projectId);
}

@Override
Expand Down Expand Up @@ -327,14 +334,13 @@ private List<Project> listProjects()
projectService.getProjectPermissionLevels(currentUser, proj)
.stream()
.anyMatch(activeRoleFilters.getObject()::contains))
.collect(Collectors.toList());
.collect(toList());
}

private void actionCreateProject(AjaxRequestTarget aTarget)
{
PageParameters params = new PageParameters();
params.set(WebAnnoConst.PAGE_PARAM_PROJECT_ID, ProjectPage.NEW_PROJECT_ID);
params.set(PAGE_PARAM_PROJECT_ID, NEW_PROJECT_ID);
setResponsePage(ProjectPage.class, params);
}

}
4 changes: 4 additions & 0 deletions inception-ui-kb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>wicket-kendo-ui</artifactId>
</dependency>
<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-sass</artifactId>
</dependency>
<dependency>
<groupId>org.danekja</groupId>
<artifactId>jdk-serializable-functional</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
package de.tudarmstadt.ukp.inception.ui.kb.sass;

import de.tudarmstadt.ukp.clarin.webanno.support.sass.SassResourceReference;
import de.agilecoders.wicket.sass.SassResourceReference;

public class KnowledgeBasePageLRR extends SassResourceReference {

Expand Down
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@
</distributionManagement>
<properties>
<maven.surefire.heap>6g</maven.surefire.heap>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
<dkpro.core.testCachePath>${session.executionRootDirectory}/cache/dkpro-core-datasets</dkpro.core.testCachePath>
<excludedTestCategories>nl.ru.test.category.SlowTests</excludedTestCategories>

<mockito.version>3.3.3</mockito.version>
<assertj.version>3.15.0</assertj.version>
<spring.version>5.2.6.RELEASE</spring.version>
<spring.boot.version>2.3.0.RELEASE</spring.boot.version>
<spring.security.version>5.3.3.RELEASE</spring.security.version>
<wicket.version>8.8.0</wicket.version>
<wicketstuff.version>8.8.0</wicketstuff.version>
<wicket-jquery-ui.version>8.8.0</wicket-jquery-ui.version>
<spring.version>5.2.7.RELEASE</spring.version>
<spring.boot.version>2.3.4.RELEASE</spring.boot.version>
<spring.security.version>5.4.1</spring.security.version>
<wicket.version>9.1.0</wicket.version>
<wicketstuff.version>9.1.0</wicketstuff.version>
<wicket-jquery-ui.version>9.0.0</wicket-jquery-ui.version>
<dkpro.version>2.1.0</dkpro.version>
<uima.version>3.1.1</uima.version>
<log4j.version>2.13.2</log4j.version>
Expand Down

0 comments on commit c17729c

Please sign in to comment.