Skip to content

Commit 0af40fa

Browse files
committed
Merge branch 'hotfix-1.1.15'
2 parents 5f9adad + 5ca005d commit 0af40fa

35 files changed

Lines changed: 714 additions & 479 deletions

pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<name>baseCode</name>
66
<groupId>baseCode</groupId>
77
<artifactId>baseCode</artifactId>
8-
<version>1.1.14</version>
8+
<version>1.1.15</version>
99
<inceptionYear>2003</inceptionYear>
1010
<description>
1111
<![CDATA[Data structures, math and statistics tools, and utilities that are often needed across projects.]]>
@@ -231,6 +231,13 @@
231231
<version>5.7.1</version>
232232
</dependency>
233233

234+
<!-- Development tools -->
235+
<dependency>
236+
<groupId>com.google.code.findbugs</groupId>
237+
<artifactId>jsr305</artifactId>
238+
<version>3.0.2</version>
239+
</dependency>
240+
234241
<!-- Testing utilities -->
235242
<dependency>
236243
<groupId>junit</groupId>

src/ontology.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ url.uberonOntology=http://purl.obolibrary.org/obo/uberon.owl
3030

3131
# as recommended at https://www.ebi.ac.uk/efo/ (this has changed several times)
3232
url.efOntology=https://www.ebi.ac.uk/efo/efo.owl
33-
url.obiOntology=http://svn.code.sf.net/p/obi/code/releases/2016-10-11/obi.owl
33+
url.obiOntology=http://purl.obolibrary.org/obo/obi.owl
3434

3535

3636
# no longer actively used.

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
import com.hp.hpl.jena.ontology.OntModel;
1818

19+
import javax.annotation.Nullable;
20+
import java.io.InputStream;
21+
1922
/**
2023
* This class has some stuff that's specific to in-memory ontologies. Unlike database backed ontologies we don't use a
2124
* pool keeping only one instance of model in memory.
@@ -25,7 +28,12 @@
2528
public abstract class AbstractOntologyMemoryBackedService extends AbstractOntologyService {
2629

2730
@Override
28-
protected synchronized OntModel loadModel() {
31+
protected OntModel loadModel() {
2932
return OntologyLoader.loadMemoryModel( this.getOntologyUrl(), this.getOntologyName() );
3033
}
34+
35+
@Override
36+
protected OntModel loadModelFromStream( InputStream is ) {
37+
return OntologyLoader.loadMemoryModel( is, this.getOntologyUrl() );
38+
}
3139
}

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@
1919
package ubic.basecode.ontology.jena;
2020

2121
import com.hp.hpl.jena.ontology.OntResource;
22-
import com.hp.hpl.jena.rdf.model.Resource;
2322
import com.hp.hpl.jena.vocabulary.OWL2;
2423
import org.slf4j.Logger;
2524
import org.slf4j.LoggerFactory;
2625
import ubic.basecode.ontology.model.OntologyResource;
2726

27+
import javax.annotation.Nullable;
2828
import java.util.Comparator;
2929
import java.util.Objects;
3030

31+
import static java.util.Comparator.*;
32+
3133
/**
3234
* @author pavlidis
3335
*/
@@ -37,10 +39,22 @@ public abstract class AbstractOntologyResource implements OntologyResource {
3739

3840
private static final long serialVersionUID = 1L;
3941

42+
private static final Comparator<OntologyResource> comparator = Comparator
43+
.comparing( OntologyResource::getScore, nullsLast( reverseOrder() ) )
44+
.thenComparing( OntologyResource::getUri, nullsLast( naturalOrder() ) );
45+
4046
private transient final OntResource res;
47+
@Nullable
48+
private final Double score;
4149

4250
protected AbstractOntologyResource( OntResource resource ) {
4351
this.res = resource;
52+
this.score = null;
53+
}
54+
55+
public AbstractOntologyResource( OntResource resource, double score ) {
56+
this.res = resource;
57+
this.score = score;
4458
}
4559

4660
@Override
@@ -67,9 +81,15 @@ public boolean isObsolete() {
6781
return res.hasLiteral( OWL2.deprecated, true );
6882
}
6983

84+
@Override
85+
@Nullable
86+
public Double getScore() {
87+
return score;
88+
}
89+
7090
@Override
7191
public int compareTo( OntologyResource other ) {
72-
return Objects.compare( getUri(), other.getUri(), Comparator.nullsLast( Comparator.naturalOrder() ) );
92+
return Objects.compare( this, other, comparator );
7393
}
7494

7595
@Override

0 commit comments

Comments
 (0)