|
||||||||||
| 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(String name)
Creates a new instance of SimpleComparableOntology with the given, immutable, non-nullable name. |
| Method Summary | |
|---|---|
int |
compareTo(Object o)
Ontologies are compared only by name. |
boolean |
containsTerm(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 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. |
Term |
createTerm(String name,
String description)
Create a new term in this ontology. |
Term |
createTerm(String name,
String description,
Object[] synonyms)
Create a new term in this ontology. |
Triple |
createTriple(Term subject,
Term object,
Term predicate,
String name,
String description)
Creates a new Triple. If you call this method with plain Terms instead of ComparableTerms, it will import them into the local ontology first. |
Variable |
createVariable(String name,
String description)
Create a new term in this ontology that is used as a variable. NOT IMPLEMENTED |
void |
deleteTerm(Term t)
Remove a term from an ontology, together with all triples which refer to it. If you call this method with a plain Term instead of a ComparableTerm, it may not match any of the terms in the ontology as they are all stored as ComparableTerms. |
boolean |
equals(Object obj)
Ontologies are equal if their names are equal. |
String |
getDescription()
Return a human-readable description of this ontology, or the empty string if none is available |
String |
getName()
Return the name of this ontology |
OntologyOps |
getOps()
Return the associated OntologyOps. |
ComparableTerm |
getOrCreateTerm(String name)
Looks for a term with the given name and returns it. If the term has to be created, it is added with the description "auto-generated by biojavax". |
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(String s)
Fetch the term with the specified name. |
Set |
getTerms()
Return all the terms in this ontology This will always return a set of ComparableTerm objects. |
Set |
getTermSet()
Returns the set of terms in this ontology. Warning this method gives access to the original Collection not a copy. |
Set |
getTriples(Term subject,
Term object,
Term predicate)
Return all triples from this ontology which match the supplied pattern. 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. |
Set |
getTripleSet()
Returns the set of triples in this ontology. Warning this method gives access to the original Collection not a copy. |
int |
hashCode()
|
Term |
importTerm(Term t,
String localName)
Create a view of a term from another ontology. This particular implementation merely copies the term into this ontology, and returns a pointer to the copied term. |
void |
setDescription(String description)
Sets a human-readable description of this ontology. |
void |
setTermSet(Set terms)
Clears out all the terms and populates the ontology with the contents of the set passed. Warning this method gives access to the original Collection not a copy. |
void |
setTripleSet(Set triples)
Clears out all the triples and populates the ontology with the contents of the set passed. Warning this method gives access to the original Collection not a copy. |
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(String name)
name - the name of the ontology.protected SimpleComparableOntology()
| Method Detail |
|---|
public int compareTo(Object o)
compareTo in interface Comparablepublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectpublic boolean containsTerm(String name)
name
containsTerm in interface Ontology
public Term getTerm(String s)
throws NoSuchElementException
getTerm in interface Ontologyname
NoSuchElementException - if no term exists with that namepublic ComparableTerm getOrCreateTerm(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(String name,
String description,
Object[] synonyms)
throws AlreadyExistsException,
ChangeVetoException,
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
IllegalArgumentException - if either name or
description is null, or violates
some other constraint of this implementation.
ChangeVetoException
public Term importTerm(Term t,
String localName)
throws ChangeVetoException,
IllegalArgumentException
importTerm in interface Ontologyt - the Term to importlocalName - the local name to import it under, optionally null
ChangeVetoException
IllegalArgumentExceptionComparableTerm
public Triple createTriple(Term subject,
Term object,
Term predicate,
String name,
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 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(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 Set getTripleSet()
getTripleSet in interface ComparableOntologypublic Set getTerms()
getTerms in interface OntologyComparableTerm
public void setTermSet(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 Set getTermSet()
getTermSet in interface ComparableOntologyComparableTerm
public boolean containsTriple(Term subject,
Term object,
Term predicate)
containsTriple in interface OntologyComparableTerm,
ComparableTriple
public Term createTerm(String name,
String description)
throws AlreadyExistsException,
ChangeVetoException,
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
IllegalArgumentException - if either name or
description is null, or violates
some other constraint of this implementation.
ChangeVetoException
public Variable createVariable(String name,
String description)
throws AlreadyExistsException,
ChangeVetoException,
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
IllegalArgumentException - if either name or
description is null, or violates
some other constraint of this implementation.
ChangeVetoExceptionpublic String getDescription()
getDescription in interface OntologygetDescription in interface ComparableOntology
public void setDescription(String description)
throws ChangeVetoException
setDescription in interface ComparableOntologydescription - the description.
ChangeVetoException - in case of problems.public String getName()
getName in interface Ontologypublic OntologyOps getOps()
getOps in interface Ontology
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||