Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.

Commit c890f14

Browse files
committed
Merge branch 'hotfix/1.8.4' into release
2 parents b832a4e + 37fd4e7 commit c890f14

File tree

11 files changed

+39
-93
lines changed

11 files changed

+39
-93
lines changed

biomedicus-core/pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<artifactId>biomedicus</artifactId>
2323
<groupId>edu.umn.biomedicus</groupId>
24-
<version>1.8.3</version>
24+
<version>1.8.4</version>
2525
</parent>
2626
<modelVersion>4.0.0</modelVersion>
2727

@@ -76,8 +76,7 @@
7676
<dependency>
7777
<groupId>edu.umn.biomedicus</groupId>
7878
<artifactId>biomedicus-measures</artifactId>
79-
<version>2.0.0</version>
79+
<version>2.0.1</version>
8080
</dependency>
8181
</dependencies>
82-
8382
</project>

biomedicus-distribution/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<artifactId>biomedicus</artifactId>
1313
<groupId>edu.umn.biomedicus</groupId>
14-
<version>1.8.3</version>
14+
<version>1.8.4</version>
1515
</parent>
1616
<packaging>pom</packaging>
1717
<modelVersion>4.0.0</modelVersion>

biomedicus-distribution/src/main/resources/desc/ae/writer/XmiWriter.xml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,24 @@
6060
</analysisEngineMetaData>
6161
<externalResourceDependencies>
6262
<externalResourceDependency>
63-
<key>typeSystemWriterResource</key>
63+
<key>typeSystemWriter</key>
6464
<description>Responsible for writing the type system out to the folder.</description>
65-
<interfaceName>edu.umn.biomedicus.uima.xmi.TypeSystemWriterResource</interfaceName>
6665
</externalResourceDependency>
6766
</externalResourceDependencies>
6867
<resourceManagerConfiguration>
6968
<externalResources>
7069
<externalResource>
71-
<name>TypeSystemWriterResourceImpl</name>
70+
<name>typeSystemWriter</name>
7271
<description>Writes the type system once.</description>
73-
<fileResourceSpecifier>
74-
<fileUrl>file:edu/umn/biomedicus/types/TypeSystem.xml</fileUrl>
75-
</fileResourceSpecifier>
76-
<implementationName>edu.umn.biomedicus.uima.xmi.TypeSystemWriterResourceImpl
77-
</implementationName>
72+
<customResourceSpecifier>
73+
<resourceClassName>edu.umn.biomedicus.uima.xmi.TypeSystemWriter</resourceClassName>
74+
</customResourceSpecifier>
7875
</externalResource>
7976
</externalResources>
8077
<externalResourceBindings>
8178
<externalResourceBinding>
82-
<key>typeSystemWriterResource</key>
83-
<resourceName>TypeSystemWriterResourceImpl</resourceName>
79+
<key>typeSystemWriter</key>
80+
<resourceName>typeSystemWriter</resourceName>
8481
</externalResourceBinding>
8582
</externalResourceBindings>
8683
</resourceManagerConfiguration>

biomedicus-rtf/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<artifactId>biomedicus</artifactId>
2323
<groupId>edu.umn.biomedicus</groupId>
24-
<version>1.8.3</version>
24+
<version>1.8.4</version>
2525
</parent>
2626
<modelVersion>4.0.0</modelVersion>
2727

@@ -31,7 +31,7 @@
3131
<dependency>
3232
<groupId>edu.umn.biomedicus</groupId>
3333
<artifactId>biomedicus-core</artifactId>
34-
<version>1.8.3</version>
34+
<version>1.8.4</version>
3535
</dependency>
3636
</dependencies>
3737

biomedicus-uima/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<artifactId>biomedicus</artifactId>
2323
<groupId>edu.umn.biomedicus</groupId>
24-
<version>1.8.3</version>
24+
<version>1.8.4</version>
2525
</parent>
2626
<modelVersion>4.0.0</modelVersion>
2727

biomedicus-uima/src/main/java/edu/umn/biomedicus/uima/types/BiomedicusTsLabelsPlugin.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,13 +757,13 @@ public static class NumberLabelAdapter extends AbstractLabelAdapter<Number> {
757757
private final Feature typeFeature;
758758

759759
NumberLabelAdapter(CAS cas) {
760-
super(cas, cas.getTypeSystem().getType("edu.umn.biomedicus.uima.type1_8.Number"));
760+
super(cas, cas.getTypeSystem().getType("edu.umn.biomedicus.uima.type2_0.Number"));
761761
numFeature = cas.getTypeSystem()
762-
.getFeatureByFullName("edu.umn.biomedicus.uima.type1_8.Number:numerator");
762+
.getFeatureByFullName("edu.umn.biomedicus.uima.type2_0.Number:numerator");
763763
denomFeature = cas.getTypeSystem()
764-
.getFeatureByFullName("edu.umn.biomedicus.uima.type1_8.Number:denominator");
764+
.getFeatureByFullName("edu.umn.biomedicus.uima.type2_0.Number:denominator");
765765
typeFeature = cas.getTypeSystem()
766-
.getFeatureByFullName("edu.umn.biomedicus.uima.type1_8.Number:type");
766+
.getFeatureByFullName("edu.umn.biomedicus.uima.type2_0.Number:numberType");
767767

768768
}
769769

biomedicus-uima/src/main/java/edu/umn/biomedicus/uima/xmi/TypeSystemWriterResourceImpl.java renamed to biomedicus-uima/src/main/java/edu/umn/biomedicus/uima/xmi/TypeSystemWriter.java

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616

1717
package edu.umn.biomedicus.uima.xmi;
1818

19+
import edu.umn.biomedicus.exc.BiomedicusException;
20+
import java.io.BufferedWriter;
1921
import java.io.IOException;
2022
import java.nio.file.Files;
2123
import java.nio.file.Path;
2224
import java.util.concurrent.Semaphore;
23-
import org.apache.uima.cas.TypeSystem;
24-
import org.apache.uima.resource.DataResource;
2525
import org.apache.uima.resource.ResourceInitializationException;
26-
import org.apache.uima.resource.SharedResourceObject;
26+
import org.apache.uima.resource.Resource_ImplBase;
2727
import org.apache.uima.resource.metadata.TypeSystemDescription;
28-
import org.apache.uima.util.TypeSystemUtil;
2928
import org.xml.sax.SAXException;
3029

3130
/**
@@ -34,8 +33,7 @@
3433
* @author Ben Knoll
3534
* @since 1.3.0
3635
*/
37-
public class TypeSystemWriterResourceImpl implements TypeSystemWriterResource,
38-
SharedResourceObject {
36+
public class TypeSystemWriter extends Resource_ImplBase {
3937

4038
/**
4139
* Semaphore which prevents the type system from being written more than once.
@@ -46,19 +44,14 @@ public class TypeSystemWriterResourceImpl implements TypeSystemWriterResource,
4644
* {@inheritDoc} <p>Writes the type system to the path if it hasn't already been written. Uses the
4745
* semaphore with 1 permit {@code writeOnce}.</p>
4846
*/
49-
@Override
50-
public void writeToPath(Path path, TypeSystem typeSystem) throws IOException, SAXException {
47+
public void writeToPath(Path path) throws BiomedicusException {
5148
if (writeOnce.tryAcquire()) {
52-
Path folder = path.getParent();
53-
Files.createDirectories(folder);
54-
TypeSystemDescription typeSystemDescription = TypeSystemUtil
55-
.typeSystem2TypeSystemDescription(typeSystem);
56-
typeSystemDescription.toXML(Files.newOutputStream(path));
49+
try (BufferedWriter bufferedWriter = Files.newBufferedWriter(path)) {
50+
TypeSystemDescription description = getCasManager().getCasDefinition().getTypeSystemDescription();
51+
description.toXML(bufferedWriter);
52+
} catch (IOException | ResourceInitializationException | SAXException e) {
53+
throw new BiomedicusException(e);
54+
}
5755
}
5856
}
59-
60-
@Override
61-
public void load(DataResource aData) throws ResourceInitializationException {
62-
63-
}
6457
}

biomedicus-uima/src/main/java/edu/umn/biomedicus/uima/xmi/TypeSystemWriterResource.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

biomedicus-uima/src/main/java/edu/umn/biomedicus/uima/xmi/XmiWriter.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package edu.umn.biomedicus.uima.xmi;
1818

19+
import edu.umn.biomedicus.exc.BiomedicusException;
1920
import java.io.FileOutputStream;
2021
import java.io.IOException;
2122
import java.io.OutputStream;
@@ -29,7 +30,6 @@
2930
import org.apache.uima.cas.CAS;
3031
import org.apache.uima.cas.Feature;
3132
import org.apache.uima.cas.Type;
32-
import org.apache.uima.cas.TypeSystem;
3333
import org.apache.uima.cas.impl.XmiCasSerializer;
3434
import org.apache.uima.resource.ResourceAccessException;
3535
import org.apache.uima.resource.ResourceInitializationException;
@@ -45,7 +45,7 @@ public class XmiWriter extends CasAnnotator_ImplBase {
4545
private static final Logger LOGGER = LoggerFactory.getLogger(XmiWriter.class);
4646

4747
@Nullable
48-
private TypeSystemWriterResource typeSystemWriter;
48+
private TypeSystemWriter typeSystemWriter;
4949

5050
@Nullable
5151
private Path outputDir;
@@ -69,8 +69,7 @@ public void initialize(UimaContext context) throws ResourceInitializationExcepti
6969
}
7070

7171
try {
72-
typeSystemWriter = (TypeSystemWriterResource) context
73-
.getResourceObject("typeSystemWriterResource");
72+
typeSystemWriter = (TypeSystemWriter) context.getResourceObject("typeSystemWriter");
7473
} catch (ResourceAccessException e) {
7574
throw new ResourceInitializationException(e);
7675
}
@@ -80,15 +79,13 @@ public void initialize(UimaContext context) throws ResourceInitializationExcepti
8079
public void process(CAS cas) throws AnalysisEngineProcessException {
8180
assert typeSystemWriter != null;
8281
assert outputDir != null;
83-
84-
TypeSystem typeSystem = cas.getTypeSystem();
8582
try {
86-
typeSystemWriter.writeToPath(outputDir.resolve("TypeSystem.xml"), typeSystem);
87-
} catch (IOException | SAXException e) {
83+
typeSystemWriter.writeToPath(outputDir.resolve("TypeSystem.xml"));
84+
} catch (BiomedicusException e) {
8885
throw new AnalysisEngineProcessException(e);
8986
}
9087

91-
Type type = typeSystem.getType("edu.umn.biomedicus.uima.type1_5.DocumentId");
88+
Type type = cas.getTypeSystem().getType("edu.umn.biomedicus.uima.type1_5.DocumentId");
9289
Feature documentId = type.getFeatureByBaseName("documentId");
9390
String fileName = cas.getView("metadata")
9491
.getIndexRepository()
@@ -104,8 +101,8 @@ public void process(CAS cas) throws AnalysisEngineProcessException {
104101
try (OutputStream out = new FileOutputStream(path.toFile())) {
105102
XmiCasSerializer.serialize(cas, out);
106103
} catch (IOException | SAXException e) {
104+
LOGGER.error("Failed on document: {}");
107105
throw new AnalysisEngineProcessException(e);
108106
}
109-
110107
}
111108
}

biomedicus-uima/src/main/resources/edu/umn/biomedicus/types/TypeSystem.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@
321321
</typeDescription>
322322

323323
<typeDescription>
324-
<name>edu.umn.biomedicus.uima.type1_8.Number</name>
324+
<name>edu.umn.biomedicus.uima.type2_0.Number</name>
325325
<supertypeName>uima.tcas.Annotation</supertypeName>
326326
<features>
327327
<featureDescription>
@@ -339,7 +339,7 @@
339339
<rangeTypeName>uima.cas.String</rangeTypeName>
340340
</featureDescription>
341341
<featureDescription>
342-
<name>type</name>
342+
<name>numberType</name>
343343
<description>
344344
The type of number
345345
</description>

0 commit comments

Comments
 (0)