Skip to content

Commit

Permalink
Merge pull request #4577 from inception-project/feature/4576-Allow-se…
Browse files Browse the repository at this point in the history
…tting-a-document-level-annotation-when-bulk-processing

#4576 - Allow setting a document-level annotation when bulk processing
  • Loading branch information
reckart authored Mar 2, 2024
2 parents 522bec4 + b1f887a commit b9c65a6
Show file tree
Hide file tree
Showing 23 changed files with 582 additions and 118 deletions.
5 changes: 5 additions & 0 deletions inception/inception-app-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-plugin-manager</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-processing</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-project-initializers</artifactId>
Expand Down Expand Up @@ -942,6 +946,7 @@
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-websocket</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-layer-docmetadata</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-feature-lookup</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-processing</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-project-initializers</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-project-initializers-basic</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-project-initializers-doclabeling</usedDependency>
Expand Down
5 changes: 5 additions & 0 deletions inception/inception-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@
<artifactId>inception-preferences</artifactId>
<version>32.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-processing</artifactId>
<version>32.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-guidelines</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.wicket.Component;
import org.apache.wicket.MetaDataKey;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
Expand Down Expand Up @@ -63,7 +62,6 @@
import de.tudarmstadt.ukp.inception.schema.api.adapter.TypeAdapter;
import de.tudarmstadt.ukp.inception.schema.api.feature.FeatureEditor;
import de.tudarmstadt.ukp.inception.schema.api.feature.FeatureEditorValueChangedEvent;
import de.tudarmstadt.ukp.inception.schema.api.feature.FeatureSupport;
import de.tudarmstadt.ukp.inception.schema.api.feature.FeatureSupportRegistry;
import de.tudarmstadt.ukp.inception.support.uima.ICasUtil;
import de.tudarmstadt.ukp.inception.support.wicket.DescriptionTooltipBehavior;
Expand Down Expand Up @@ -142,8 +140,8 @@ protected void populateItem(ListItem<FeatureState> item)
final FeatureEditor editor;

// Look up a suitable editor and instantiate it
FeatureSupport<?> featureSupport = featureSupportRegistry
.findExtension(featureState.feature).orElseThrow();
var featureSupport = featureSupportRegistry.findExtension(featureState.feature)
.orElseThrow();
editor = featureSupport.createEditor(CID_EDITOR,
DocumentMetadataAnnotationDetailPanel.this, actionHandler,
annotationPage.getModel(), item.getModel());
Expand All @@ -158,15 +156,15 @@ protected void populateItem(ListItem<FeatureState> item)
}

// Add tooltip on label
StringBuilder tooltipTitle = new StringBuilder();
var tooltipTitle = new StringBuilder();
tooltipTitle.append(featureState.feature.getUiName());
if (featureState.feature.getTagset() != null) {
tooltipTitle.append(" (");
tooltipTitle.append(featureState.feature.getTagset().getName());
tooltipTitle.append(')');
}

Component labelComponent = editor.getLabelComponent();
var labelComponent = editor.getLabelComponent();
labelComponent.add(new AttributeAppender("style", "cursor: help", ";"));
labelComponent.add(new DescriptionTooltipBehavior(tooltipTitle.toString(),
featureState.feature.getDescription()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService;
import de.tudarmstadt.ukp.inception.support.uima.SegmentationUtils;
import de.tudarmstadt.ukp.inception.ui.core.docanno.layer.DocumentMetadataLayerSupport;
import de.tudarmstadt.ukp.inception.ui.core.docanno.recommendation.MetadataSuggestionSupport;

@ExtendWith(MockitoExtension.class)
class MetadataSuggestionExtractionTest
Expand Down
2 changes: 2 additions & 0 deletions inception/inception-processing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.apt_generated/
/.apt_generated_tests/
1 change: 1 addition & 0 deletions inception/inception-processing/marker-wicket-module
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Marker file which activates the profile "wicket-module" from the parent POM.
165 changes: 165 additions & 0 deletions inception/inception-processing/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<!--
Licensed to the Technische Universität Darmstadt under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The Technische Universität Darmstadt
licenses this file to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-app</artifactId>
<version>32.0-SNAPSHOT</version>
</parent>
<artifactId>inception-processing</artifactId>
<name>INCEpTION - Processing</name>
<dependencies>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-model</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-ui-core</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-ui-scheduling</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-recommendation</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-layer-docmetadata</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-api-render</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-schema-api</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-support</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-security</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-recommendation-api</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-model-vdoc</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-project-api</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-annotation-storage-api</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-documents-api</artifactId>
</dependency>

<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-spring</artifactId>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-request</artifactId>
</dependency>
<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-core</artifactId>
</dependency>
<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-extensions</artifactId>
</dependency>
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-annotation</artifactId>
</dependency>
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-input-events</artifactId>
</dependency>
<dependency>
<groupId>org.danekja</groupId>
<artifactId>jdk-serializable-functional</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>

<dependency>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-core</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<!--
Licensed to the Technische Universität Darmstadt under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The Technische Universität Darmstadt
licenses this file to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html xmlns:wicket="http://wicket.apache.org">
<head>
<wicket:head>
<style type="text/css">
.page-content {
flex-direction: column !important;
overflow: hidden;
}
</style>
</wicket:head>
</head>
<body>
<wicket:extend>
<div class="d-flex flex-row flex-grow-1 overflow-hidden">
<div class="d-flex flex-grow-1 flex-column scrolling">
<div wicket:id="processingPanel" class="d-flex flex-column flex-grow-1 overflow-hidden"/>
</div>

<div class="d-flex flex-sidebar flex-column border-start scrolling" style="min-width: 30rem;">
<div class="d-flex flex-grow-1 flex-column" wicket:id="runningProcesses"/>
</div>
</div>
</wicket:extend>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.tudarmstadt.ukp.inception.recommendation.processor;
package de.tudarmstadt.ukp.inception.processing;

import static de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel.MANAGER;
import static de.tudarmstadt.ukp.clarin.webanno.ui.core.page.ProjectPageBase.NS_PROJECT;
Expand All @@ -27,6 +27,8 @@

import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.page.ProjectPageBase;
import de.tudarmstadt.ukp.inception.processing.recommender.BulkRecommenderPanel;
import de.tudarmstadt.ukp.inception.ui.scheduling.TaskMonitorPanel;

@MountPath(NS_PROJECT + "/${" + PAGE_PARAM_PROJECT + "}/process")
public class BulkProcessingPage
Expand All @@ -44,6 +46,9 @@ public BulkProcessingPage(PageParameters aParameters)

requireProjectRole(user, MANAGER);

add(new BulkProcessingPanel("processingPanel", getProjectModel()));
queue(new BulkRecommenderPanel("processingPanel", getProjectModel()));

queue(new TaskMonitorPanel("runningProcesses").setPopupMode(false)
.setShowFinishedTasks(true));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.tudarmstadt.ukp.inception.recommendation.processor;
package de.tudarmstadt.ukp.inception.processing;

import static de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel.MANAGER;
import static java.lang.String.format;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Licensed to the Technische Universität Darmstadt under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The Technische Universität Darmstadt
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.tudarmstadt.ukp.inception.processing.config;

import javax.servlet.ServletContext;

import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
import de.tudarmstadt.ukp.inception.processing.BulkProcessingPageMenuItem;
import de.tudarmstadt.ukp.inception.project.api.ProjectService;

@ConditionalOnProperty(prefix = "bulk-processing", name = "enabled", havingValue = "true", matchIfMissing = false)
@Configuration
public class ProcessingAutoConfiguration
{
@ConditionalOnWebApplication
@Bean
@ConditionalOnExpression("${websocket.enabled:true} and ${recommender.enabled:true}")
public BulkProcessingPageMenuItem bulkProcessingPageMenuItem(UserDao aUserRepo,
ProjectService aProjectService, ServletContext aServletContext)
{
return new BulkProcessingPageMenuItem(aUserRepo, aProjectService, aServletContext);
}
}
Loading

0 comments on commit b9c65a6

Please sign in to comment.