|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.biojava.utils.AbstractChangeable
org.biojavax.ontology.SimpleComparableOntology
public class SimpleComparableOntology
Represents an ontology that can be compared to other ontologies.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.biojava.ontology.Ontology |
|---|
Ontology.Impl |
| Field Summary |
|---|
| Fields inherited from interface org.biojavax.ontology.ComparableOntology |
|---|
DESCRIPTION, TERM, TRIPLE |
| Constructor Summary | |
|---|---|
protected |
SimpleComparableOntology()
|
|
SimpleComparableOntology(java.lang.String name)
Creates a new instance of SimpleComparableOntology with the given, immutable, non-nullable name. |
| Method Summary | |
|---|---|
int |
compareTo(java.lang.Object o)
Ontologies are compared only by name. |
boolean |
containsTerm(java.lang.String name)
Determines if this ontology currently contains a term named name |
boolean |
containsTriple(Term subject,
Term object,
Term predicate)
See if a triple exists in this ontology |
Term |
createTerm(java.lang.String name)
Create a new term in this ontology. |
Term |
createTerm(java.lang.String name,
java.lang.String description)
Create a new term in this ontology. |
Term |
createTerm(java.lang.String name,
java.lang.String description,
java.lang.Object[] synonyms)
Create a new term in this ontology. |
Triple |
createTriple(Term subject,
Term object,
Term predicate,
java.lang.String name,
java.lang.String description)
Creates a new Triple. |
Variable |
createVariable(java.lang.String name,
java.lang.String description)
Create a new term in this ontology that is used as a variable. |
void |
deleteTerm(Term t)
Remove a term from an ontology, together with all triples which refer to it. |
boolean |
equals(java.lang.Object obj)
Ontologies are equal if their names are equal. |
java.lang.String |
getDescription()
Return a human-readable description of this ontology. |
java.lang.Integer |
getId()
Gets the Hibernate ID. |
java.lang.String |
getName()
Return the name of this ontology |
OntologyOps |
getOps()
Return the associated OntologyOps. |
ComparableTerm |
getOrCreateTerm(java.lang.String name)
Looks for a term with the given name and returns it. |
ComparableTriple |
getOrCreateTriple(Term subject,
Term object,
Term predicate)
Looks for a triple with the given subject object and predicate and returns it. |
ComparableTerm |
getOrImportTerm(Term term)
Looks for a term with the same name as the given term and returns it. |
Term |
getTerm(java.lang.String s)
Fetch the term with the specified name. |
java.util.Set |
getTerms()
Return all the terms in this ontology |
java.util.Set |
getTermSet()
Returns the set of terms in this ontology. |
java.util.Set |
getTriples(Term subject,
Term object,
Term predicate)
Return all triples from this ontology which match the supplied pattern. |
java.util.Set |
getTripleSet()
Returns the set of triples in this ontology. |
int |
hashCode()
|
Term |
importTerm(Term t,
java.lang.String localName)
Create a view of a term from another ontology. |
void |
setDescription(java.lang.String description)
Sets a human-readable description of this ontology. |
void |
setId(java.lang.Integer id)
Sets the Hibernate ID. |
void |
setName(java.lang.String name)
Set the name for this ontology |
void |
setTermSet(java.util.Set terms)
Clears out all the terms and populates the ontology with the contents of the set passed. |
void |
setTripleSet(java.util.Set triples)
Clears out all the triples and populates the ontology with the contents of the set passed. |
java.lang.String |
toString()
Form: "name" |
| Methods inherited from class org.biojava.utils.AbstractChangeable |
|---|
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.biojava.utils.Changeable |
|---|
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener |
| Constructor Detail |
|---|
public SimpleComparableOntology(java.lang.String name)
name - the name of the ontology.protected SimpleComparableOntology()
| Method Detail |
|---|
public int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparablepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean containsTerm(java.lang.String name)
name
containsTerm in interface Ontology
public Term getTerm(java.lang.String s)
throws java.util.NoSuchElementException
getTerm in interface Ontologys - the name of the term
name
java.util.NoSuchElementException - if no term exists with that namepublic ComparableTerm getOrCreateTerm(java.lang.String name)
getOrCreateTerm in interface ComparableOntologyname - the name of the term to look for.
public ComparableTriple getOrCreateTriple(Term subject,
Term object,
Term predicate)
getOrCreateTriple in interface ComparableOntologysubject - the subject of the triple eg appleobject - the object of the triple eg fruitpredicate - the relationship of the triple eg is_a
public ComparableTerm getOrImportTerm(Term term)
getOrImportTerm in interface ComparableOntologyterm - the term to look for.
public Term createTerm(java.lang.String name,
java.lang.String description,
java.lang.Object[] synonyms)
throws AlreadyExistsException,
ChangeVetoException,
java.lang.IllegalArgumentException
createTerm in interface Ontologyname - The name of the term (must be unique)description - A human-readable description (may be empty)synonyms - Some synonyms for this term.
AlreadyExistsException - if a term of this name already exists
ChangeVetoException
java.lang.IllegalArgumentException - if either name or
description is null, or violates
some other constraint of this implementation.
public Term importTerm(Term t,
java.lang.String localName)
throws ChangeVetoException,
java.lang.IllegalArgumentException
importTerm in interface Ontologyt - the Term to importlocalName - the local name to import it under, optionally null
ChangeVetoException
java.lang.IllegalArgumentExceptionComparableTerm
public Triple createTriple(Term subject,
Term object,
Term predicate,
java.lang.String name,
java.lang.String description)
throws AlreadyExistsException,
ChangeVetoException
createTriple in interface Ontologysubject - the subject Termobject - the object Termpredicate - the predicate Termname - the name of the triple, or nulldescription - the description of the triple, or null
AlreadyExistsException - if a triple already exists with the same
subject, object and predicate, regardless of the name and description
ChangeVetoExceptionComparableTerm
public void deleteTerm(Term t)
throws ChangeVetoException
deleteTerm in interface OntologyChangeVetoExceptionComparableTerm
public java.util.Set getTriples(Term subject,
Term object,
Term predicate)
null,
they are treated as wildcards.
If you call this method with plain Terms instead of ComparableTerms, it may
not match any of the triples in the ontology as they are all stored as
ComparableTerms. So, use ComparableTerm objects! The set returned is a set
of ComparableTriple objects.
getTriples in interface Ontologysubject - The subject to search for, or nullobject - The object to search for, or nullpredicate - The relationship to search for, or null.
ComparableTerm,
ComparableTriple
public void setTripleSet(java.util.Set triples)
throws ChangeVetoException
setTripleSet in interface ComparableOntologytriples - the set of ComparableTriple objects this ontology should have.
ChangeVetoException - if any of them are unacceptable.ComparableTriplepublic java.util.Set getTripleSet()
getTripleSet in interface ComparableOntologypublic java.util.Set getTerms()
getTerms in interface OntologyComparableTerm
public void setTermSet(java.util.Set terms)
throws ChangeVetoException
setTermSet in interface ComparableOntologyterms - a set of Term objects this ontology should have.
ChangeVetoException - if any of them are unacceptable.ComparableTermpublic java.util.Set getTermSet()
getTermSet in interface ComparableOntologyComparableTerm
public boolean containsTriple(Term subject,
Term object,
Term predicate)
containsTriple in interface OntologyComparableTerm,
ComparableTriple
public Term createTerm(java.lang.String name)
throws AlreadyExistsException,
ChangeVetoException,
java.lang.IllegalArgumentException
createTerm in interface Ontologyname - The name of the term (must be unique))
AlreadyExistsException - if a term of this name already exists
ChangeVetoException
java.lang.IllegalArgumentException - if either name or
description is null, or violates
some other constraint of this implementation.
public Term createTerm(java.lang.String name,
java.lang.String description)
throws AlreadyExistsException,
ChangeVetoException,
java.lang.IllegalArgumentException
createTerm in interface Ontologyname - The name of the term (must be unique)description - A human-readable description (may be empty)
AlreadyExistsException - if a term of this name already exists
ChangeVetoException
java.lang.IllegalArgumentException - if either name or
description is null, or violates
some other constraint of this implementation.
public Variable createVariable(java.lang.String name,
java.lang.String description)
throws AlreadyExistsException,
ChangeVetoException,
java.lang.IllegalArgumentException
createVariable in interface Ontologyname - The name of the term (must be unique)description - A human-readable description (may be empty)
AlreadyExistsException - if a term of this name already exists
ChangeVetoException
java.lang.IllegalArgumentException - if either name or
description is null, or violates
some other constraint of this implementation.public java.lang.String getDescription()
getDescription in interface OntologygetDescription in interface ComparableOntology
public void setDescription(java.lang.String description)
throws ChangeVetoException
setDescription in interface OntologysetDescription in interface ComparableOntologydescription - the description.
ChangeVetoException - in case of problems.public java.lang.String getName()
getName in interface Ontologypublic void setName(java.lang.String name)
Ontology
setName in interface Ontologyname - - the namepublic OntologyOps getOps()
getOps in interface Ontologypublic java.lang.Integer getId()
public void setId(java.lang.Integer id)
id - the Hibernate ID, if using Hibernate.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||