use of de.tudarmstadt.ukp.clarin.webanno.automation.service.export.model.ExportedTrainingDocument in project webanno by webanno.
the class AutomationTrainingDocumentExporter method exportTrainingDocuments.
private void exportTrainingDocuments(Project aProject, ExportedProject aExProject) {
List<ExportedTrainingDocument> trainDocuments = new ArrayList<>();
List<TrainingDocument> trainingDocuments = automationService.listTrainingDocuments(aProject);
for (TrainingDocument trainingDocument : trainingDocuments) {
ExportedTrainingDocument exDocument = new ExportedTrainingDocument();
exDocument.setFormat(trainingDocument.getFormat());
exDocument.setName(trainingDocument.getName());
exDocument.setState(trainingDocument.getState());
exDocument.setTimestamp(trainingDocument.getTimestamp());
exDocument.setSentenceAccessed(trainingDocument.getSentenceAccessed());
// actual AnnotationFeature in the project
if (trainingDocument.getFeature() != null) {
exDocument.setFeature(new ExportedAnnotationFeatureReference(trainingDocument.getFeature()));
}
trainDocuments.add(exDocument);
}
aExProject.setProperty(TRAINING_DOCUMENTS, trainDocuments);
}
use of de.tudarmstadt.ukp.clarin.webanno.automation.service.export.model.ExportedTrainingDocument in project webanno by webanno.
the class AutomationTrainingDocumentExporter method importTrainingDocuments.
private void importTrainingDocuments(ExportedProject aExProject, Project aProject) throws IOException {
ExportedTrainingDocument[] trainingDocuments = aExProject.getArrayProperty(TRAINING_DOCUMENTS, ExportedTrainingDocument.class);
for (ExportedTrainingDocument importedTrainingDocument : trainingDocuments) {
TrainingDocument trainingDocument = new TrainingDocument();
trainingDocument.setFormat(importedTrainingDocument.getFormat());
trainingDocument.setName(importedTrainingDocument.getName());
trainingDocument.setState(importedTrainingDocument.getState());
trainingDocument.setProject(aProject);
trainingDocument.setTimestamp(importedTrainingDocument.getTimestamp());
trainingDocument.setSentenceAccessed(importedTrainingDocument.getSentenceAccessed());
if (importedTrainingDocument.getFeature() != null) {
AnnotationLayer trainingLayer = annotationService.findLayer(aProject, importedTrainingDocument.getFeature().getLayer());
AnnotationFeature trainingFeature = annotationService.getFeature(importedTrainingDocument.getFeature().getName(), trainingLayer);
trainingDocument.setFeature(trainingFeature);
}
automationService.createTrainingDocument(trainingDocument);
}
}
Aggregations