Skip to content

Commit 7b03898

Browse files
committed
Merge branch 'main' into refactoring/Upgrade-to-Spring-Boot-3
* main: (95 commits) #4556 - Unable to access PMC BioC service #4554 - Allow displaying comments from annotators on hover when curating using curation sidebar on the annotation page #4552 - No details shown when hovering over annotations in lower part of the curation page #4550 - Clean up code #4550 - Clean up code #4547 - Cannot create long-distance relation in PDF editor #4545 - Upgrade dependencies #4545 - Upgrade dependencies #4543 - UI for creating new concept or properties has broken layout #4541 - Upgrade dependencies #4538 - Lazy details and selecting annotations my break after opening a read-only document and not performing actions for a short time #4537 - Ability to group annotations by layer #4533 - BioC exported from INCEpTION cannot be imported again due to missing mandatory metadata [maven-release-plugin] prepare for next development iteration [maven-release-plugin] prepare release inception-31.1 #4530 - Keyboard shortcuts for feature values may not work in certain editors #4528 - Display key bindings in radio group string feature editor #4525 - Support recommendations for non-string primitive features #4523 - Factor endpoint-specific FTS code out into adapter classes #4523 - Factor endpoint-specific FTS code out into adapter classes ... % Conflicts: % inception/inception-dependencies/pom.xml % inception/inception-imls-weblicht/pom.xml % inception/inception-kb/src/main/java/de/tudarmstadt/ukp/inception/kb/KnowledgeBaseServiceImpl.java % inception/inception-project-export/src/test/resources/log4j2-test.xml % inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/tasks/PredictionTask.java % inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/tasks/SelectionTask.java % inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/tasks/TrainingTask.java % inception/inception-ui-curation/pom.xml % inception/inception-ui-dashboard-activity/pom.xml % inception/inception-ui-kb/src/main/java/de/tudarmstadt/ukp/inception/ui/kb/initializers/NamedEntityIdentifierFeatureInitializer.java % inception/inception-ui-scheduling/pom.xml % inception/inception-ui-scheduling/src/main/java/de/tudarmstadt/ukp/inception/ui/scheduling/TaskMonitorPanel.java % pom.xml
2 parents eb2bd66 + e093169 commit 7b03898

File tree

601 files changed

+47955
-16233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

601 files changed

+47955
-16233
lines changed

inception/inception-active-learning/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
2222
<artifactId>inception-app</artifactId>
23-
<version>31.0-SNAPSHOT</version>
23+
<version>32.0-SNAPSHOT</version>
2424
<relativePath>..</relativePath>
2525
</parent>
2626
<artifactId>inception-active-learning</artifactId>

inception/inception-active-learning/src/main/java/de/tudarmstadt/ukp/inception/active/learning/ActiveLearningServiceImpl.java

+31-3
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,26 @@
2828
import java.io.IOException;
2929
import java.io.Serializable;
3030
import java.lang.invoke.MethodHandles;
31+
import java.util.Collection;
3132
import java.util.List;
3233
import java.util.Optional;
3334

35+
import org.apache.commons.lang3.ClassUtils;
36+
import org.apache.uima.cas.CAS;
3437
import org.slf4j.Logger;
3538
import org.slf4j.LoggerFactory;
3639
import org.springframework.beans.factory.annotation.Autowired;
3740
import org.springframework.context.ApplicationEventPublisher;
3841
import org.springframework.transaction.annotation.Transactional;
3942

43+
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
4044
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
4145
import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument;
4246
import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
4347
import de.tudarmstadt.ukp.clarin.webanno.security.model.User;
4448
import de.tudarmstadt.ukp.inception.active.learning.config.ActiveLearningAutoConfiguration;
4549
import de.tudarmstadt.ukp.inception.active.learning.event.ActiveLearningRecommendationEvent;
4650
import de.tudarmstadt.ukp.inception.active.learning.strategy.ActiveLearningStrategy;
47-
import de.tudarmstadt.ukp.inception.annotation.layer.span.SpanAdapter;
4851
import de.tudarmstadt.ukp.inception.documents.api.DocumentService;
4952
import de.tudarmstadt.ukp.inception.recommendation.api.LearningRecordService;
5053
import de.tudarmstadt.ukp.inception.recommendation.api.RecommendationService;
@@ -54,6 +57,7 @@
5457
import de.tudarmstadt.ukp.inception.recommendation.api.model.SuggestionGroup.Delta;
5558
import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService;
5659
import de.tudarmstadt.ukp.inception.schema.api.adapter.AnnotationException;
60+
import de.tudarmstadt.ukp.inception.schema.api.feature.FeatureSupport;
5761
import de.tudarmstadt.ukp.inception.schema.api.feature.FeatureSupportRegistry;
5862

5963
/**
@@ -191,7 +195,6 @@ public void acceptSpanSuggestion(SourceDocument aDocument, User aDataOwner,
191195
.orElseThrow(() -> new IllegalArgumentException(
192196
"No such layer: [" + aSuggestion.getLayerId() + "]"));
193197
var feature = schemaService.getFeature(aSuggestion.getFeature(), layer);
194-
var adapter = (SpanAdapter) schemaService.getAdapter(layer);
195198

196199
// Load CAS in which to create the annotation. This might be different from the one that
197200
// is currently viewed by the user, e.g. if the user switched to another document after
@@ -202,7 +205,8 @@ public void acceptSpanSuggestion(SourceDocument aDocument, User aDataOwner,
202205

203206
// Create AnnotationFeature and FeatureSupport
204207
var featureSupport = featureSupportRegistry.findExtension(feature).orElseThrow();
205-
var label = (String) featureSupport.unwrapFeatureValue(feature, cas, aValue);
208+
209+
var label = unwrapLabel(aValue, feature, cas, featureSupport);
206210

207211
// Clone of the original suggestion with the selected by the user
208212
var suggestionWithUserSelectedLabel = aSuggestion.toBuilder().withLabel(label).build();
@@ -236,6 +240,30 @@ public void acceptSpanSuggestion(SourceDocument aDocument, User aDataOwner,
236240
suggestionWithUserSelectedLabel.getFeature(), action, alternativeSuggestions));
237241
}
238242

243+
private String unwrapLabel(Object aValue, AnnotationFeature feature, CAS cas,
244+
FeatureSupport<Object> featureSupport)
245+
{
246+
Object rawLabel = featureSupport.unwrapFeatureValue(feature, cas, aValue);
247+
if (rawLabel instanceof Collection collectionValue) {
248+
rawLabel = collectionValue.iterator().next();
249+
}
250+
251+
if (rawLabel == null) {
252+
return null;
253+
}
254+
255+
if (ClassUtils.isPrimitiveOrWrapper(rawLabel.getClass())) {
256+
return String.valueOf(rawLabel);
257+
}
258+
259+
if (rawLabel instanceof String) {
260+
return (String) rawLabel;
261+
}
262+
263+
throw new IllegalArgumentException(
264+
"Non-primitive suggestions are not supported: [" + rawLabel.getClass() + "]");
265+
}
266+
239267
@Override
240268
@Transactional
241269
public void rejectSpanSuggestion(String aSessionOwner, User aDataOwner, AnnotationLayer aLayer,

inception/inception-active-learning/src/main/java/de/tudarmstadt/ukp/inception/active/learning/sidebar/ActiveLearningSidebar.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<div class="card-header">
2525
<wicket:message key="activeLearning"/>
2626
</div>
27-
<div class="card-body flex-v-container">
27+
<div class="scrolling card-body flex-v-container">
2828

2929
<form wicket:id="sessionControlForm">
3030
<div class="input-group">
@@ -41,9 +41,9 @@
4141
<div wicket:id="mainContainer" class="flex-content flex-v-container flex-gutter flex-only-internal-gutter">
4242
<span class="flex-content no-data-notice" wicket:id="noRecommenders">no Recommenders</span>
4343

44-
<div class="card mt-3" wicket:enclosure="noRecommendationLabel">
45-
<div class="card-body">
46-
<span class="no-data-notice" wicket:id="noRecommendationLabel"></span>
44+
<div class="card flex-content mt-3" wicket:enclosure="noRecommendationLabel">
45+
<div class="card-body d-flex">
46+
<span class="no-data-notice flex-fill" wicket:id="noRecommendationLabel"></span>
4747
</div>
4848
</div>
4949

@@ -54,7 +54,7 @@
5454
</div>
5555
</form>
5656

57-
<form class="card" wicket:id="recommendationForm">
57+
<form class="card flex-content" wicket:id="recommendationForm">
5858
<div class="card-header small">
5959
<wicket:message key="recommendation"/>
6060
</div>
@@ -111,7 +111,7 @@
111111
</div>
112112
</form>
113113

114-
<form class="card flex-content"
114+
<form class="card flex-content" style="min-height: 10em;"
115115
wicket:id="learningHistoryForm">
116116
<div class="card-header small">
117117
<wicket:message key="history"/>

inception/inception-active-learning/src/main/java/de/tudarmstadt/ukp/inception/active/learning/sidebar/ActiveLearningSidebar.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -863,10 +863,7 @@ private void loadSuggestionInActiveLearningSidebar(AjaxRequestTarget aTarget,
863863

864864
private Form<?> createLearningHistory()
865865
{
866-
Form<?> learningHistoryForm = new Form<Void>(CID_LEARNING_HISTORY_FORM)
867-
{
868-
private static final long serialVersionUID = -961690443085882064L;
869-
};
866+
var learningHistoryForm = new Form<Void>(CID_LEARNING_HISTORY_FORM);
870867
learningHistoryForm.add(LambdaBehavior.onConfigure(
871868
component -> component.setVisible(alStateModel.getObject().isSessionActive())));
872869
learningHistoryForm.setOutputMarkupPlaceholderTag(true);
@@ -878,8 +875,7 @@ private Form<?> createLearningHistory()
878875

879876
private ListView<LearningRecord> createLearningHistoryListView()
880877
{
881-
ListView<LearningRecord> learningHistory = new ListView<LearningRecord>(
882-
CID_HISTORY_LISTVIEW)
878+
var learningHistory = new ListView<LearningRecord>(CID_HISTORY_LISTVIEW)
883879
{
884880
private static final long serialVersionUID = 5594228545985423567L;
885881

@@ -1385,7 +1381,7 @@ private void refreshAvailableSuggestions()
13851381
public void onDocumentOpenedEvent(DocumentOpenedEvent aEvent)
13861382
{
13871383
// If active learning is not active, update the sidebar in case the session auto-terminated
1388-
ActiveLearningUserState alState = alStateModel.getObject();
1384+
var alState = alStateModel.getObject();
13891385
if (!alState.isSessionActive()) {
13901386
aEvent.getRequestTarget().ifPresent(target -> target.add(alMainContainer));
13911387
return;

inception/inception-agreement/pom.xml

+21-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<parent>
2121
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
2222
<artifactId>inception-app</artifactId>
23-
<version>31.0-SNAPSHOT</version>
23+
<version>32.0-SNAPSHOT</version>
2424
</parent>
2525
<artifactId>inception-agreement</artifactId>
2626
<name>INCEpTION - Core - Agreement</name>
@@ -52,6 +52,10 @@
5252
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
5353
<artifactId>inception-support</artifactId>
5454
</dependency>
55+
<dependency>
56+
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
57+
<artifactId>inception-annotation-storage</artifactId>
58+
</dependency>
5559
<dependency>
5660
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
5761
<artifactId>inception-model</artifactId>
@@ -60,6 +64,10 @@
6064
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
6165
<artifactId>inception-security</artifactId>
6266
</dependency>
67+
<dependency>
68+
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
69+
<artifactId>inception-scheduling</artifactId>
70+
</dependency>
6371
<dependency>
6472
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
6573
<artifactId>inception-project-api</artifactId>
@@ -76,6 +84,10 @@
7684
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
7785
<artifactId>inception-support-bootstrap</artifactId>
7886
</dependency>
87+
<dependency>
88+
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
89+
<artifactId>inception-annotation-storage-api</artifactId>
90+
</dependency>
7991

8092
<dependency>
8193
<groupId>org.dkpro.statistics</groupId>
@@ -86,6 +98,10 @@
8698
<groupId>org.apache.commons</groupId>
8799
<artifactId>commons-csv</artifactId>
88100
</dependency>
101+
<dependency>
102+
<groupId>commons-io</groupId>
103+
<artifactId>commons-io</artifactId>
104+
</dependency>
89105

90106
<!-- Spring dependencies -->
91107
<dependency>
@@ -110,10 +126,6 @@
110126
<groupId>org.apache.wicket</groupId>
111127
<artifactId>wicket-core</artifactId>
112128
</dependency>
113-
<dependency>
114-
<groupId>org.apache.wicket</groupId>
115-
<artifactId>wicket-util</artifactId>
116-
</dependency>
117129
<dependency>
118130
<groupId>org.apache.wicket</groupId>
119131
<artifactId>wicket-spring</artifactId>
@@ -126,6 +138,10 @@
126138
<groupId>com.googlecode.wicket-jquery-ui</groupId>
127139
<artifactId>wicket-jquery-ui-core</artifactId>
128140
</dependency>
141+
<dependency>
142+
<groupId>org.wicketstuff</groupId>
143+
<artifactId>wicketstuff-annotationeventdispatcher</artifactId>
144+
</dependency>
129145
<dependency>
130146
<groupId>org.danekja</groupId>
131147
<artifactId>jdk-serializable-functional</artifactId>

0 commit comments

Comments
 (0)