Skip to content

Commit 1afc021

Browse files
committed
Few improvements and refactor for ontologies
Remove jena-arq and jena-larq dependencies by reimplementing the indexing of statements. Update jena to 2.13.0. Wrap search results in a OntologySearchResult class so that we don't have to add an optional score field in the OntologyResource interface. Add capabilities for excluding words from stemming.
1 parent 5a7f0b4 commit 1afc021

28 files changed

Lines changed: 564 additions & 863 deletions

pom.xml

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -144,45 +144,7 @@
144144
<dependency>
145145
<groupId>org.apache.jena</groupId>
146146
<artifactId>jena-core</artifactId>
147-
<version>2.7.4</version>
148-
<exclusions>
149-
<exclusion>
150-
<groupId>log4j</groupId>
151-
<artifactId>log4j</artifactId>
152-
</exclusion>
153-
<exclusion>
154-
<groupId>org.slf4j</groupId>
155-
<artifactId>slf4j-log4j12</artifactId>
156-
</exclusion>
157-
</exclusions>
158-
</dependency>
159-
<!-- Be careful with versions of lucene -->
160-
<!-- jena-text uses lucene 4.x.. Not ready for this. -->
161-
<!-- <dependency> <groupId>org.apache.jena</groupId> <artifactId>jena-text</artifactId> <version>1.0.0-SNAPSHOT</version>
162-
</dependency> -->
163-
<dependency>
164-
<groupId>org.apache.jena</groupId>
165-
<artifactId>jena-larq</artifactId>
166-
<version>1.0.0-incubating</version>
167-
<exclusions>
168-
<exclusion>
169-
<groupId>log4j</groupId>
170-
<artifactId>log4j</artifactId>
171-
</exclusion>
172-
<exclusion>
173-
<groupId>org.slf4j</groupId>
174-
<artifactId>slf4j-log4j12</artifactId>
175-
</exclusion>
176-
<exclusion>
177-
<artifactId>icu4j</artifactId>
178-
<groupId>com.ibm.icu</groupId>
179-
</exclusion>
180-
</exclusions>
181-
</dependency>
182-
<dependency>
183-
<groupId>org.apache.jena</groupId>
184-
<artifactId>jena-arq</artifactId>
185-
<version>2.9.4</version> <!-- latest release is 2.10.1, but not compatible with larq? -->
147+
<version>2.13.0</version>
186148
<exclusions>
187149
<exclusion>
188150
<groupId>log4j</groupId>
@@ -264,6 +226,11 @@
264226
<version>4.11.0</version>
265227
<scope>test</scope>
266228
</dependency>
229+
<dependency>
230+
<groupId>org.assertj</groupId>
231+
<artifactId>assertj-core</artifactId>
232+
<version>3.25.3</version>
233+
</dependency>
267234
<dependency>
268235
<groupId>org.apache.logging.log4j</groupId>
269236
<artifactId>log4j-core</artifactId>

src/ubic/basecode/ontology/jena/AbstractOntologyResource.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,22 @@
2525
import ubic.basecode.ontology.model.OntologyResource;
2626

2727
import javax.annotation.Nullable;
28-
import java.util.Comparator;
2928
import java.util.Objects;
3029

31-
import static java.util.Comparator.*;
32-
3330
/**
3431
* @author pavlidis
3532
*/
3633
abstract class AbstractOntologyResource implements OntologyResource {
3734

3835
protected static final Logger log = LoggerFactory.getLogger( AbstractOntologyResource.class );
3936

40-
private static final Comparator<OntologyResource> comparator = Comparator
41-
.comparing( OntologyResource::getScore, nullsLast( reverseOrder() ) )
42-
.thenComparing( OntologyResource::getUri, nullsLast( naturalOrder() ) );
43-
4437
private final OntResource res;
45-
@Nullable
46-
private final Double score;
4738

4839
private String _label;
4940
private boolean _isLabelNull = false;
5041

5142
protected AbstractOntologyResource( OntResource resource ) {
5243
this.res = resource;
53-
this.score = null;
54-
}
55-
56-
public AbstractOntologyResource( OntResource resource, double score ) {
57-
this.res = resource;
58-
this.score = score;
5944
}
6045

6146
@Override
@@ -97,17 +82,6 @@ public boolean isObsolete() {
9782
return res.hasLiteral( OWL2.deprecated, true );
9883
}
9984

100-
@Override
101-
@Nullable
102-
public Double getScore() {
103-
return score;
104-
}
105-
106-
@Override
107-
public int compareTo( OntologyResource other ) {
108-
return Objects.compare( this, other, comparator );
109-
}
110-
11185
@Override
11286
public boolean equals( Object obj ) {
11387
if ( this == obj ) return true;

0 commit comments

Comments
 (0)