1212 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
1313 * specific language governing permissions and limitations under the License.
1414 */
15- package ubic .basecode .ontology .model ;
15+ package ubic .basecode .ontology .simple ;
16+
17+ import ubic .basecode .ontology .model .AnnotationProperty ;
18+ import ubic .basecode .ontology .model .OntologyIndividual ;
19+ import ubic .basecode .ontology .model .OntologyRestriction ;
20+ import ubic .basecode .ontology .model .OntologyTerm ;
1621
1722import javax .annotation .Nullable ;
18- import java .io .Serializable ;
1923import java .util .Collection ;
20- import java .util .Objects ;
2124
2225/**
2326 * A light-weight version of OntologyTerms. Only supports a subset of the functionality of OntologyTermImpl (namely, it
2427 * is missing the inference components)
2528 *
2629 * @author Paul
2730 */
28- @ SuppressWarnings ("unused" )
29- public class OntologyTermSimple implements OntologyTerm , Serializable {
30-
31- /**
32- *
33- */
34- private static final long serialVersionUID = -2589717267279872909L ;
31+ public class OntologyTermSimple extends AbstractOntologyResourceSimple implements OntologyTerm {
3532
36- private final String description ;
37- private final boolean obsolete ;
38- private final String term ;
33+ @ Nullable
3934 private final String uri ;
35+ @ Nullable
36+ private final String label ;
37+ @ Nullable
38+ private final String comment ;
39+ private final boolean obsolete ;
4040
41- public OntologyTermSimple ( String uri , String term ) {
42- this ( uri , term , "" , false );
41+ public OntologyTermSimple ( @ Nullable String uri , @ Nullable String label ) {
42+ this ( uri , label , "" , false );
4343 }
4444
45- public OntologyTermSimple ( String uri , String term , String description , boolean isObsolete ) {
45+ public OntologyTermSimple ( @ Nullable String uri , @ Nullable String label , @ Nullable String comment , boolean isObsolete ) {
46+ super ( uri , label );
4647 this .uri = uri ;
47- this .term = term ;
48- this .description = description ;
48+ this .label = label ;
49+ this .comment = comment ;
4950 this .obsolete = isObsolete ;
5051 }
5152
@@ -75,26 +76,17 @@ public Collection<OntologyTerm> getChildren( boolean direct, boolean includeAddi
7576 throw new UnsupportedOperationException ( "Use a OntologyTermImpl" );
7677 }
7778
79+ @ Nullable
7880 @ Override
7981 public String getComment () {
80- return this .description ;
82+ return this .comment ;
8183 }
8284
8385 @ Override
8486 public Collection <OntologyIndividual > getIndividuals ( boolean direct ) {
8587 throw new UnsupportedOperationException ( "Use a OntologyTermImpl" );
8688 }
8789
88- @ Override
89- public String getLabel () {
90- return term ;
91- }
92-
93- @ Override
94- public String getLocalName () {
95- return term ;
96- }
97-
9890 @ Override
9991 public Collection <OntologyTerm > getParents ( boolean direct , boolean includeAdditionalProperties , boolean keepObsoletes ) {
10092 throw new UnsupportedOperationException ( "Use a OntologyTermImpl" );
@@ -116,10 +108,12 @@ public boolean isTermObsolete() {
116108 }
117109
118110 @ Override
111+ @ Nullable
119112 public String getTerm () {
120- return this .term ;
113+ return this .label ;
121114 }
122115
116+ @ Nullable
123117 @ Override
124118 public String getUri () {
125119 return this .uri ;
@@ -129,24 +123,4 @@ public String getUri() {
129123 public boolean isObsolete () {
130124 return obsolete ;
131125 }
132-
133- @ Override
134- public boolean equals ( Object obj ) {
135- if ( this == obj ) return true ;
136- if ( obj == null ) return false ;
137- if ( getClass () != obj .getClass () ) return false ;
138- final OntologyResource other = ( OntologyResource ) obj ;
139- if ( getLabel () == null ) {
140- if ( other .getLabel () != null ) return false ;
141- } else if ( !getLabel ().equals ( other .getLabel () ) ) return false ;
142- if ( getUri () == null ) {
143- if ( other .getUri () != null ) return false ;
144- } else if ( !getUri ().equals ( other .getUri () ) ) return false ;
145- return true ;
146- }
147-
148- @ Override
149- public int hashCode () {
150- return Objects .hash ( getLabel (), getUri () );
151- }
152126}
0 commit comments