Skip to content

Commit e357b03

Browse files
committed
Deprecate getTerm() in OntologyTerm in favour of getLabel()
1 parent 3fb042d commit e357b03

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

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

0 commit comments

Comments
 (0)