Skip to content

Commit a14b330

Browse files
author
TortugaAttack
committed
Merged with v1.2.6 and up to Jena3.1
2 parents 87901c8 + 52833d5 commit a14b330

File tree

54 files changed

+2493
-1246
lines changed

Some content is hidden

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

54 files changed

+2493
-1246
lines changed

pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<junit.version>4.11</junit.version>
2525
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2626
<spring.version>3.2.17.RELEASE</spring.version>
27-
<jena.version>2.13.0</jena.version>
27+
<jena.version>3.1.0</jena.version>
2828
<jsonld-java-jena.version>0.4.1</jsonld-java-jena.version>
2929
</properties>
3030

@@ -53,11 +53,6 @@
5353

5454
<dependencies>
5555
<!-- NIF transfer lib -->
56-
<dependency>
57-
<groupId>org.aksw</groupId>
58-
<artifactId>gerbil.nif.transfer</artifactId>
59-
<version>1.2.3</version>
60-
</dependency>
6156
<!-- Jena for using JSON-LD -->
6257
<dependency>
6358
<groupId>org.apache.jena</groupId>
@@ -316,6 +311,11 @@
316311
<artifactId>lucene-analyzers-common</artifactId>
317312
<version>6.2.0</version>
318313
</dependency>
314+
<dependency>
315+
<groupId>org.aksw</groupId>
316+
<artifactId>gerbil.nif.transfer</artifactId>
317+
<version>1.2.5-jena3.1-SNAPSHOT</version>
318+
</dependency>
319319
</dependencies>
320320

321321
<build>

repository/org/apache/jena/jena-arq/2.12.1/jena-arq-2.12.1.pom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
<groups>
202202
<group>
203203
<title>SPARQL Query and Update</title>
204-
<packages>com.hp.hpl.jena.query:com.hp.hpl.jena.update</packages>
204+
<packages>org.apache.jena.query:org.apache.jena.update</packages>
205205
</group>
206206
<group>
207207
<title>RIOT</title>

repository/org/apache/jena/jena-core/2.12.1/jena-core-2.12.1.pom

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,23 @@
145145
<windowtitle>Apache Jena</windowtitle>
146146
<doctitle>Apache Jena Core ${project.version}</doctitle>
147147
<bottom>Licenced under the Apache License, Version 2.0</bottom>
148-
<excludePackageNames>com.hp.hpl.jena.shared.*:*.impl:com.hp.hpl.jena.assembler.assemblers:*.exceptions:*.regexptrees:com.hp.hpl.jena.mem:com.hp.hpl.jena.mem.*:com.hp.hpl.jena.n3:com.hp.hpl.jena.n3.*:com.hp.hpl.jena.rdf.arp.*:com.hp.hpl.jena.util.*:jena.cmdline:jena.util</excludePackageNames>
148+
<excludePackageNames>org.apache.jena.shared.*:*.impl:org.apache.jena.assembler.assemblers:*.exceptions:*.regexptrees:org.apache.jena.mem:org.apache.jena.mem.*:org.apache.jena.n3:org.apache.jena.n3.*:org.apache.jena.rdf.arp.*:org.apache.jena.util.*:jena.cmdline:jena.util</excludePackageNames>
149149
<groups>
150150
<group>
151151
<title>API - Application Programming Interface</title>
152-
<packages>com.hp.hpl.jena.db:com.hp.hpl.jena.rdf.model:com.hp.hpl.jena.rdf.listeners:com.hp.hpl.jena.rdf.arp:com.hp.hpl.jena.rdf.arp.lang:com.hp.hpl.jena.datatypes:com.hp.hpl.jena.datatypes.xsd:com.hp.hpl.jena.rdql:com.hp.hpl.jena.shared:com.hp.hpl.jena.vocabulary:com.hp.hpl.jena.xmloutput:com.hp.hpl.jena.ontology:com.hp.hpl.jena.ontology.daml:com.hp.hpl.jena.reasoner:com.hp.hpl.jena.reasoner.rulesys:com.hp.hpl.jena.reasoner.rulesys.builtins:com.hp.hpl.jena.reasoner.transitiveReasoner:com.hp.hpl.jena.reasoner.dig</packages>
152+
<packages>org.apache.jena.db:org.apache.jena.rdf.model:org.apache.jena.rdf.listeners:org.apache.jena.rdf.arp:org.apache.jena.rdf.arp.lang:org.apache.jena.datatypes:org.apache.jena.datatypes.xsd:org.apache.jena.rdql:org.apache.jena.shared:org.apache.jena.vocabulary:org.apache.jena.xmloutput:org.apache.jena.ontology:org.apache.jena.ontology.daml:org.apache.jena.reasoner:org.apache.jena.reasoner.rulesys:org.apache.jena.reasoner.rulesys.builtins:org.apache.jena.reasoner.transitiveReasoner:org.apache.jena.reasoner.dig</packages>
153153
</group>
154154
<group>
155155
<title>SPI - System Programming Interface</title>
156-
<packages>com.hp.hpl.jena.enhanced:com.hp.hpl.jena.graph:com.hp.hpl.jena.graph.compose:com.hp.hpl.jena.graph.query:com.hp.hpl.jena.util:com.hp.hpl.jena.util.iterator</packages>
156+
<packages>org.apache.jena.enhanced:org.apache.jena.graph:org.apache.jena.graph.compose:org.apache.jena.graph.query:org.apache.jena.util:org.apache.jena.util.iterator</packages>
157157
</group>
158158
<group>
159159
<title>Command line tools</title>
160160
<packages>jena</packages>
161161
</group>
162162
<group>
163163
<title>Other Packages</title>
164-
<packages>com.hp.hpl.jena.assembler</packages>
164+
<packages>org.apache.jena.assembler</packages>
165165
</group>
166166
</groups>
167167
</configuration>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* This file is part of General Entity Annotator Benchmark.
3+
*
4+
* General Entity Annotator Benchmark is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* General Entity Annotator Benchmark is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with General Entity Annotator Benchmark. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
package org.aksw.gerbil.annotator;
18+
19+
import java.util.List;
20+
21+
import org.aksw.gerbil.exceptions.GerbilException;
22+
import org.aksw.gerbil.transfer.nif.Document;
23+
import org.aksw.gerbil.transfer.nif.Marking;
24+
25+
public interface OKE2018Task4Annotator extends REAnnotator, A2KBAnnotator {
26+
27+
public List<Marking> performOKE2018Task4(Document document) throws GerbilException;
28+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* This file is part of General Entity Annotator Benchmark.
3+
*
4+
* General Entity Annotator Benchmark is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* General Entity Annotator Benchmark is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with General Entity Annotator Benchmark. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
package org.aksw.gerbil.annotator;
18+
19+
import java.util.List;
20+
21+
import org.aksw.gerbil.exceptions.GerbilException;
22+
import org.aksw.gerbil.transfer.nif.Document;
23+
import org.aksw.gerbil.transfer.nif.Relation;
24+
import org.aksw.gerbil.transfer.nif.Span;
25+
26+
public interface REAnnotator extends Annotator {
27+
28+
public List<Relation> performRETask(Document document) throws GerbilException;
29+
}

src/main/java/org/aksw/gerbil/annotator/decorator/ErrorCountingAnnotatorDecorator.java

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
import org.aksw.gerbil.annotator.D2KBAnnotator;
2626
import org.aksw.gerbil.annotator.EntityRecognizer;
2727
import org.aksw.gerbil.annotator.EntityTyper;
28+
import org.aksw.gerbil.annotator.OKE2018Task4Annotator;
2829
import org.aksw.gerbil.annotator.OKETask1Annotator;
2930
import org.aksw.gerbil.annotator.OKETask2Annotator;
31+
import org.aksw.gerbil.annotator.REAnnotator;
3032
import org.aksw.gerbil.annotator.RT2KBAnnotator;
3133
import org.aksw.gerbil.datatypes.ErrorTypes;
3234
import org.aksw.gerbil.datatypes.ExperimentType;
@@ -38,6 +40,7 @@
3840
import org.aksw.gerbil.transfer.nif.Marking;
3941
import org.aksw.gerbil.transfer.nif.Meaning;
4042
import org.aksw.gerbil.transfer.nif.MeaningSpan;
43+
import org.aksw.gerbil.transfer.nif.Relation;
4144
import org.aksw.gerbil.transfer.nif.Span;
4245
import org.aksw.gerbil.transfer.nif.TypedSpan;
4346
import org.aksw.gerbil.transfer.nif.data.TypedNamedEntity;
@@ -85,6 +88,10 @@ public static ErrorCountingAnnotatorDecorator createDecorator(ExperimentType typ
8588
return new ErrorCountingOKETask2Annotator((OKETask2Annotator) annotator, maxErrors);
8689
case RT2KB:
8790
return new ErrorCountingRT2KBAnnotator((RT2KBAnnotator) annotator, maxErrors);
91+
case RE:
92+
return new ErrorCountingREAnnotator((REAnnotator) annotator, maxErrors);
93+
case OKE2018Task4:
94+
return new ErrorCountingOKE2018Task4Annotator((OKE2018Task4Annotator) annotator, maxErrors);
8895
case Rc2KB:
8996
break;
9097
case Sa2KB:
@@ -141,6 +148,59 @@ public List<Span> performRecognition(Document document) throws GerbilException {
141148
}
142149
}
143150

151+
private static class ErrorCountingOKE2018Task4Annotator extends ErrorCountingAnnotatorDecorator implements OKE2018Task4Annotator {
152+
153+
protected ErrorCountingOKE2018Task4Annotator(Annotator decoratedAnnotator, int maxErrors) {
154+
super(decoratedAnnotator, maxErrors);
155+
}
156+
157+
@Override
158+
public List<Relation> performRETask(Document document) throws GerbilException {
159+
return ErrorCountingAnnotatorDecorator.performRE(this, document);
160+
}
161+
162+
@Override
163+
public List<Span> performRecognition(Document document) throws GerbilException {
164+
return ErrorCountingAnnotatorDecorator.performRecognition(this, document);
165+
166+
}
167+
168+
@Override
169+
public List<Marking> performOKE2018Task4(Document document) throws GerbilException {
170+
return ErrorCountingAnnotatorDecorator.performOKE2018Task4(this, document);
171+
172+
}
173+
174+
@Override
175+
public List<MeaningSpan> performA2KBTask(Document document) throws GerbilException {
176+
return ErrorCountingAnnotatorDecorator.performExtraction(this, document);
177+
}
178+
179+
@Override
180+
public List<MeaningSpan> performD2KBTask(Document document) throws GerbilException {
181+
return ErrorCountingAnnotatorDecorator.performD2KBTask(this, document);
182+
}
183+
184+
@Override
185+
public List<Meaning> performC2KB(Document document) throws GerbilException {
186+
return ErrorCountingAnnotatorDecorator.performC2KB(this, document);
187+
}
188+
189+
}
190+
191+
private static class ErrorCountingREAnnotator extends ErrorCountingAnnotatorDecorator implements REAnnotator {
192+
193+
protected ErrorCountingREAnnotator(Annotator decoratedAnnotator, int maxErrors) {
194+
super(decoratedAnnotator, maxErrors);
195+
}
196+
197+
@Override
198+
public List<Relation> performRETask(Document document) throws GerbilException {
199+
return ErrorCountingAnnotatorDecorator.performRE(this, document);
200+
}
201+
202+
}
203+
144204
private static class ErrorCountingA2KBAnnotator extends ErrorCountingD2KBAnnotator implements A2KBAnnotator {
145205

146206
public ErrorCountingA2KBAnnotator(A2KBAnnotator decoratedAnnotator, int maxErrors) {
@@ -247,7 +307,53 @@ protected static void logResult(List<? extends Marking> result, String annotator
247307
LOGGER.debug(builder.toString());
248308
}
249309

250-
protected static List<Meaning> performC2KB(ErrorCountingAnnotatorDecorator errorCounter, Document document)
310+
public static List<Relation> performRE(ErrorCountingAnnotatorDecorator errorCounter,
311+
Document document) throws GerbilException {
312+
List<Relation> result = null;
313+
try {
314+
result = ((REAnnotator) errorCounter.getDecoratedAnnotator()).performRETask(document);
315+
} catch (Exception e) {
316+
if (errorCounter.getErrorCount() == 0) {
317+
// Log only the first exception completely
318+
LOGGER.error("Got an Exception from the annotator (" + errorCounter.getName() + ")", e);
319+
} else {
320+
// Log only the Exception message without the stack trace
321+
LOGGER.error("Got an Exception from the annotator (" + errorCounter.getName() + "): "
322+
+ e.getLocalizedMessage());
323+
}
324+
errorCounter.increaseErrorCount();
325+
return new ArrayList<Relation>(0);
326+
}
327+
if (printDebugMsg && LOGGER.isDebugEnabled()) {
328+
logResult(result, errorCounter.getName(), "Relation");
329+
}
330+
return result;
331+
}
332+
333+
public static List<Marking> performOKE2018Task4(ErrorCountingAnnotatorDecorator errorCounter,
334+
Document document) throws GerbilException {
335+
List<Marking> result = null;
336+
try {
337+
result = ((OKE2018Task4Annotator) errorCounter.getDecoratedAnnotator()).performOKE2018Task4(document);
338+
} catch (Exception e) {
339+
if (errorCounter.getErrorCount() == 0) {
340+
// Log only the first exception completely
341+
LOGGER.error("Got an Exception from the annotator (" + errorCounter.getName() + ")", e);
342+
} else {
343+
// Log only the Exception message without the stack trace
344+
LOGGER.error("Got an Exception from the annotator (" + errorCounter.getName() + "): "
345+
+ e.getLocalizedMessage());
346+
}
347+
errorCounter.increaseErrorCount();
348+
return new ArrayList<Marking>(0);
349+
}
350+
if (printDebugMsg && LOGGER.isDebugEnabled()) {
351+
logResult(result, errorCounter.getName(), "Meaning");
352+
}
353+
return result;
354+
}
355+
356+
protected static List<Meaning> performC2KB(ErrorCountingAnnotatorDecorator errorCounter, Document document)
251357
throws GerbilException {
252358
List<Meaning> result = null;
253359
try {

0 commit comments

Comments
 (0)