Skip to content

Commit 79136ba

Browse files
committed
Do not default on local name or URL when no label is found
1 parent fc8208e commit 79136ba

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ public String getLabel() {
6565
if ( label == null ) {
6666
label = res.getLabel( null );
6767
}
68-
if ( label == null ) {
69-
label = res.getLocalName();
70-
}
71-
if ( label == null ) {
72-
label = res.getURI();
73-
}
7468
return label;
7569
}
7670

@@ -113,6 +107,12 @@ public int hashCode() {
113107
@Override
114108
public String toString() {
115109
String s = getLabel();
110+
if ( s == null ) {
111+
s = res.getLocalName();
112+
}
113+
if ( s == null ) {
114+
s = res.getURI();
115+
}
116116
if ( s == null ) {
117117
s = res.toString();
118118
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ public interface OntologyResource extends Comparable<OntologyResource> {
2828
/**
2929
* A label, if known, otherwise null.
3030
*/
31+
@Nullable
3132
String getLabel();
3233

3334
/**
3435
* A URI if known, otherwise null.
3536
*/
37+
@Nullable
3638
String getUri();
3739

3840
/**

0 commit comments

Comments
 (0)