|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Triple
A triple in an ontology. This is two terms and a relationship between them, similar to RDF and other similar logic systems.
For documentation purposes, a Triple may provide a name. However, a Triple may also be named as "(subject, object, predicate)" if no specific name is provided.
ComparableTriple
Nested Class Summary | |
---|---|
static class |
Triple.Impl
Basic in-memory implementation of a Triple in an ontology This can be used to implement Ontology.createTriple |
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable |
---|
Annotatable.AnnotationForwarder |
Field Summary |
---|
Fields inherited from interface org.biojava.ontology.Term |
---|
ONTOLOGY |
Fields inherited from interface org.biojava.bio.Annotatable |
---|
ANNOTATION |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Check to see if an object is an equivalent Triple. |
Term |
getObject()
Return the object term of this triple. |
Term |
getPredicate()
Return a Term which defines the type of relationship between the subject and object terms. |
Term |
getSubject()
Return the subject term of this triple |
int |
hashCode()
The hashcode for a Triple. |
Methods inherited from interface org.biojava.ontology.Term |
---|
addSynonym, getDescription, getName, getOntology, getSynonyms, removeSynonym, setDescription |
Methods inherited from interface org.biojava.bio.Annotatable |
---|
getAnnotation |
Methods inherited from interface org.biojava.utils.Changeable |
---|
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener |
Method Detail |
---|
Term getSubject()
Term getObject()
Term getPredicate()
int hashCode()
This must be implemented as:
return getSubject().hashCode() + 31 * getObject().hashCode() + 31 * 31 * getPredicate().hashCode();If you do not implement hashcode in this way then you have no guarantee that your Triple objects will be found in an ontology and that they will not be duplicated.
hashCode
in class java.lang.Object
boolean equals(java.lang.Object obj)
Two triples are equivalent if they have the same subject, object and predicate fields.
if (! (o instanceof Triple)) { return false; } Triple to = (Triple) o; return to.getSubject() == getSubject() && to.getObject() == getObject() && to.getPredicate() == getPredicate();If you do not implement equals in this way then you have no guarantee that your Triple objects will be found in an ontology and that they will not be duplicated.
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |