Skip to content

Commit

Permalink
Merge branch 'main' into refactoring/Upgrade-to-Spring-Boot-3
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
reckart committed Feb 25, 2024
2 parents eb2bd66 + e093169 commit 7b03898
Show file tree
Hide file tree
Showing 601 changed files with 47,955 additions and 16,233 deletions.
2 changes: 1 addition & 1 deletion inception/inception-active-learning/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-app</artifactId>
<version>31.0-SNAPSHOT</version>
<version>32.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>inception-active-learning</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,26 @@
import java.io.IOException;
import java.io.Serializable;
import java.lang.invoke.MethodHandles;
import java.util.Collection;
import java.util.List;
import java.util.Optional;

import org.apache.commons.lang3.ClassUtils;
import org.apache.uima.cas.CAS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.transaction.annotation.Transactional;

import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument;
import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
import de.tudarmstadt.ukp.clarin.webanno.security.model.User;
import de.tudarmstadt.ukp.inception.active.learning.config.ActiveLearningAutoConfiguration;
import de.tudarmstadt.ukp.inception.active.learning.event.ActiveLearningRecommendationEvent;
import de.tudarmstadt.ukp.inception.active.learning.strategy.ActiveLearningStrategy;
import de.tudarmstadt.ukp.inception.annotation.layer.span.SpanAdapter;
import de.tudarmstadt.ukp.inception.documents.api.DocumentService;
import de.tudarmstadt.ukp.inception.recommendation.api.LearningRecordService;
import de.tudarmstadt.ukp.inception.recommendation.api.RecommendationService;
Expand All @@ -54,6 +57,7 @@
import de.tudarmstadt.ukp.inception.recommendation.api.model.SuggestionGroup.Delta;
import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService;
import de.tudarmstadt.ukp.inception.schema.api.adapter.AnnotationException;
import de.tudarmstadt.ukp.inception.schema.api.feature.FeatureSupport;
import de.tudarmstadt.ukp.inception.schema.api.feature.FeatureSupportRegistry;

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

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

// Create AnnotationFeature and FeatureSupport
var featureSupport = featureSupportRegistry.findExtension(feature).orElseThrow();
var label = (String) featureSupport.unwrapFeatureValue(feature, cas, aValue);

var label = unwrapLabel(aValue, feature, cas, featureSupport);

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

private String unwrapLabel(Object aValue, AnnotationFeature feature, CAS cas,
FeatureSupport<Object> featureSupport)
{
Object rawLabel = featureSupport.unwrapFeatureValue(feature, cas, aValue);
if (rawLabel instanceof Collection collectionValue) {
rawLabel = collectionValue.iterator().next();
}

if (rawLabel == null) {
return null;
}

if (ClassUtils.isPrimitiveOrWrapper(rawLabel.getClass())) {
return String.valueOf(rawLabel);
}

if (rawLabel instanceof String) {
return (String) rawLabel;
}

throw new IllegalArgumentException(
"Non-primitive suggestions are not supported: [" + rawLabel.getClass() + "]");
}

@Override
@Transactional
public void rejectSpanSuggestion(String aSessionOwner, User aDataOwner, AnnotationLayer aLayer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div class="card-header">
<wicket:message key="activeLearning"/>
</div>
<div class="card-body flex-v-container">
<div class="scrolling card-body flex-v-container">

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

<div class="card mt-3" wicket:enclosure="noRecommendationLabel">
<div class="card-body">
<span class="no-data-notice" wicket:id="noRecommendationLabel"></span>
<div class="card flex-content mt-3" wicket:enclosure="noRecommendationLabel">
<div class="card-body d-flex">
<span class="no-data-notice flex-fill" wicket:id="noRecommendationLabel"></span>
</div>
</div>

Expand All @@ -54,7 +54,7 @@
</div>
</form>

<form class="card" wicket:id="recommendationForm">
<form class="card flex-content" wicket:id="recommendationForm">
<div class="card-header small">
<wicket:message key="recommendation"/>
</div>
Expand Down Expand Up @@ -111,7 +111,7 @@
</div>
</form>

<form class="card flex-content"
<form class="card flex-content" style="min-height: 10em;"
wicket:id="learningHistoryForm">
<div class="card-header small">
<wicket:message key="history"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,10 +863,7 @@ private void loadSuggestionInActiveLearningSidebar(AjaxRequestTarget aTarget,

private Form<?> createLearningHistory()
{
Form<?> learningHistoryForm = new Form<Void>(CID_LEARNING_HISTORY_FORM)
{
private static final long serialVersionUID = -961690443085882064L;
};
var learningHistoryForm = new Form<Void>(CID_LEARNING_HISTORY_FORM);
learningHistoryForm.add(LambdaBehavior.onConfigure(
component -> component.setVisible(alStateModel.getObject().isSessionActive())));
learningHistoryForm.setOutputMarkupPlaceholderTag(true);
Expand All @@ -878,8 +875,7 @@ private Form<?> createLearningHistory()

private ListView<LearningRecord> createLearningHistoryListView()
{
ListView<LearningRecord> learningHistory = new ListView<LearningRecord>(
CID_HISTORY_LISTVIEW)
var learningHistory = new ListView<LearningRecord>(CID_HISTORY_LISTVIEW)
{
private static final long serialVersionUID = 5594228545985423567L;

Expand Down Expand Up @@ -1385,7 +1381,7 @@ private void refreshAvailableSuggestions()
public void onDocumentOpenedEvent(DocumentOpenedEvent aEvent)
{
// If active learning is not active, update the sidebar in case the session auto-terminated
ActiveLearningUserState alState = alStateModel.getObject();
var alState = alStateModel.getObject();
if (!alState.isSessionActive()) {
aEvent.getRequestTarget().ifPresent(target -> target.add(alMainContainer));
return;
Expand Down
26 changes: 21 additions & 5 deletions inception/inception-agreement/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-app</artifactId>
<version>31.0-SNAPSHOT</version>
<version>32.0-SNAPSHOT</version>
</parent>
<artifactId>inception-agreement</artifactId>
<name>INCEpTION - Core - Agreement</name>
Expand Down Expand Up @@ -52,6 +52,10 @@
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-support</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-annotation-storage</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-model</artifactId>
Expand All @@ -60,6 +64,10 @@
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-security</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-scheduling</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-project-api</artifactId>
Expand All @@ -76,6 +84,10 @@
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-support-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-annotation-storage-api</artifactId>
</dependency>

<dependency>
<groupId>org.dkpro.statistics</groupId>
Expand All @@ -86,6 +98,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>

<!-- Spring dependencies -->
<dependency>
Expand All @@ -110,10 +126,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 All @@ -126,6 +138,10 @@
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>wicket-jquery-ui-core</artifactId>
</dependency>
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-annotationeventdispatcher</artifactId>
</dependency>
<dependency>
<groupId>org.danekja</groupId>
<artifactId>jdk-serializable-functional</artifactId>
Expand Down
Loading

0 comments on commit 7b03898

Please sign in to comment.