Skip to content

Commit 5f9adad

Browse files
committed
Merge branch 'hotfix-1.1.14'
2 parents 914413d + e357b03 commit 5f9adad

7 files changed

Lines changed: 23 additions & 18 deletions

File tree

pom.xml

Lines changed: 1 addition & 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.13</version>
8+
<version>1.1.14</version>
99
<inceptionYear>2003</inceptionYear>
1010
<description>
1111
<![CDATA[Data structures, math and statistics tools, and utilities that are often needed across projects.]]>

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@ public static Collection<OntClass> getParents( OntModel model, Collection<OntCla
1818
if ( ontClasses.isEmpty() ) {
1919
return Collections.emptySet();
2020
}
21-
Collection<OntClass> result = new HashSet<>();
2221
Iterator<OntClass> it = ontClasses.iterator();
2322
ExtendedIterator<OntClass> iterator = it.next()
2423
.inModel( model )
2524
.as( OntClass.class )
26-
.listSuperClasses( direct )
27-
.filterDrop( new PredicateFilter<>( o -> o.equals( model.getProfile().THING() ) ) );
25+
.listSuperClasses( direct );
2826
while ( it.hasNext() ) {
29-
iterator = iterator.andThen( it.next().inModel( model ).as( OntClass.class ).listSuperClasses( true ) );
27+
iterator = iterator.andThen( it.next().inModel( model ).as( OntClass.class ).listSuperClasses( direct ) );
3028
}
3129

30+
Collection<OntClass> result = new HashSet<>();
3231
while ( iterator.hasNext() ) {
3332
OntClass c = iterator.next();
3433

@@ -49,6 +48,10 @@ public static Collection<OntClass> getParents( OntModel model, Collection<OntCla
4948
if ( c.getURI() == null )
5049
continue;
5150

51+
// owl:Thing
52+
if ( c.equals( model.getProfile().THING() ) )
53+
continue;
54+
5255
result.add( c );
5356
}
5457

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,8 @@ public Collection<OntologyRestriction> getRestrictions() {
194194
*/
195195
@Override
196196
public String getTerm() {
197-
String res;
198-
String label = getLabel();
199-
String localName = getLocalName();
200-
if ( label != null ) {
201-
res = label;
202-
} else if ( localName != null ) {
203-
res = localName;
204-
} else if ( this.getUri() != null ) {
205-
res = this.getUri();
206-
} else {
197+
String res = getLabel();
198+
if ( res == null ) {
207199
res = ontResource.toString();
208200
}
209201
return res;

src/ubic/basecode/ontology/model/OntologyResource.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@
2525
*/
2626
public interface OntologyResource extends Serializable, Comparable<OntologyResource> {
2727

28+
/**
29+
* A label, if known, otherwise null.
30+
*/
2831
String getLabel();
2932

33+
/**
34+
* A URI if known, otherwise null.
35+
*/
3036
String getUri();
3137

3238
/**

src/ubic/basecode/ontology/model/OntologyTerm.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ default Collection<OntologyTerm> getParents( boolean direct, boolean includeAddi
8080

8181
Collection<OntologyRestriction> getRestrictions();
8282

83+
/**
84+
* @deprecated use {@link #getLabel()} instead.
85+
*/
86+
@Deprecated
8387
String getTerm();
8488

8589
boolean isRoot();

src/ubic/basecode/ontology/model/OntologyTermSimple.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ public Collection<OntologyIndividual> getIndividuals( boolean direct ) {
7474

7575
@Override
7676
public String getLabel() {
77-
return this.getTerm();
77+
return term;
7878
}
7979

8080
@Override
8181
public String getLocalName() {
82-
return this.getTerm();
82+
return term;
8383
}
8484

8585
@Override

test/ubic/basecode/ontology/OntologyTermTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public void testGetParentsFromMultipleTerms() {
191191
OntologyTerm brain = uberon.getTerm( "http://purl.obolibrary.org/obo/UBERON_0000955" );
192192
OntologyTerm liver = uberon.getTerm( "http://purl.obolibrary.org/obo/UBERON_0002107" );
193193
Collection<OntologyTerm> children = uberon.getParents( Arrays.asList( brain, liver ), false, true );
194-
assertEquals( 22, children.size() );
194+
assertEquals( 30, children.size() );
195195
assertFalse( children.contains( uberon.getTerm( OWL2.Nothing.getURI() ) ) );
196196
}
197197

0 commit comments

Comments
 (0)