Package org.biojava.nbio.ontology
Class Ontology.Impl
java.lang.Object
org.biojava.nbio.ontology.Ontology.Impl
- All Implemented Interfaces:
 Serializable,Ontology
- Enclosing interface:
 - Ontology
 
A basic in-memory implementation of an ontology
- Since:
 - 1.3
 - Author:
 - Thomas Down, Matthew Pocock
 - See Also:
 
- 
Nested Class Summary
Nested classes/interfaces inherited from interface org.biojava.nbio.ontology.Ontology
Ontology.Impl - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsTerm(String name) Determines if this ontology currently contains a term namednamebooleancontainsTriple(Term subject, Term object, Term predicate) See if a triple exists in this ontologycreateTerm(String name) Create a new term in this ontology.createTerm(String name, String description) Create a new term in this ontology.createTerm(String name, String description, Object[] synonyms) Create a new term in this ontology.Creates a new Triple.createVariable(String name, String description) Create a new term in this ontology that is used as a variable.voiddeleteTerm(Term t) Remove a term from an ontology, together with all triples which refer to it.Return a human-readable description of this ontology, or the empty string if none is availablegetName()Return the name of this ontologygetOps()Return the associated OntologyOps.Fetch the term with the specified name.getTerms()Return all the terms in this ontologygetTriples(Term subject, Term object, Term predicate) Return all triples from this ontology which match the supplied pattern.importTerm(Term t, String name) Create a view of a term from another ontology.voidsetDescription(String description) set the description of this ontologyvoidSet the name for this ontologytoString() 
- 
Constructor Details
- 
Impl
 
 - 
 - 
Method Details
- 
getName
Description copied from interface:OntologyReturn the name of this ontology - 
getDescription
Description copied from interface:OntologyReturn a human-readable description of this ontology, or the empty string if none is available- Specified by:
 getDescriptionin interfaceOntology- Returns:
 - the description of the term
 
 - 
setDescription
Description copied from interface:Ontologyset the description of this ontology- Specified by:
 setDescriptionin interfaceOntology
 - 
getTerms
Description copied from interface:OntologyReturn all the terms in this ontology - 
getTerm
Description copied from interface:OntologyFetch the term with the specified name.- Specified by:
 getTermin interfaceOntology- Parameters:
 name- the name of the term- Returns:
 - The term named 
name - Throws:
 NoSuchElementException- if no term exists with that name
 - 
getTriples
Description copied from interface:OntologyReturn all triples from this ontology which match the supplied pattern. If any of the parameters of this method arenull, they are treated as wildcards.- Specified by:
 getTriplesin interfaceOntology- Parameters:
 subject- The subject to search for, ornullobject- The object to search for, ornullpredicate- The relationship to search for, ornull.- Returns:
 - a Set of triples
 
 - 
createTerm
Description copied from interface:OntologyCreate a new term in this ontology.- Specified by:
 createTermin interfaceOntology- Parameters:
 name- The name of the term (must be unique))- Returns:
 - The newly created term.
 - Throws:
 AlreadyExistsException- if a term of this name already existsIllegalArgumentException- if eithernameordescriptionisnull, or violates some other constraint of this implementation.
 - 
createTerm
public Term createTerm(String name, String description) throws AlreadyExistsException, IllegalArgumentException Description copied from interface:OntologyCreate a new term in this ontology.- Specified by:
 createTermin interfaceOntology- Parameters:
 name- The name of the term (must be unique)description- A human-readable description (may be empty)- Returns:
 - The newly created term.
 - Throws:
 AlreadyExistsException- if a term of this name already existsIllegalArgumentException- if eithernameordescriptionisnull, or violates some other constraint of this implementation.
 - 
createTerm
public Term createTerm(String name, String description, Object[] synonyms) throws AlreadyExistsException, IllegalArgumentException Description copied from interface:OntologyCreate a new term in this ontology.- Specified by:
 createTermin interfaceOntology- Parameters:
 name- The name of the term (must be unique)description- A human-readable description (may be empty)synonyms- Some synonyms for this term.- Returns:
 - The newly created term.
 - Throws:
 AlreadyExistsException- if a term of this name already existsIllegalArgumentException- if eithernameordescriptionisnull, or violates some other constraint of this implementation.
 - 
createVariable
public Variable createVariable(String name, String description) throws AlreadyExistsException, IllegalArgumentException Description copied from interface:OntologyCreate a new term in this ontology that is used as a variable.- Specified by:
 createVariablein interfaceOntology- Parameters:
 name- The name of the term (must be unique)description- A human-readable description (may be empty)- Returns:
 - The newly created term.
 - Throws:
 AlreadyExistsException- if a term of this name already existsIllegalArgumentException- if eithernameordescriptionisnull, or violates some other constraint of this implementation.
 - 
createOntologyTerm
- Throws:
 AlreadyExistsException
 - 
importTerm
Description copied from interface:OntologyCreate a view of a term from another ontology. If the requested term has already been imported under that name, this method returns the existing RemoteTerm object. If the term that is being imported is itself a RemoteTerm instance then first unwrap the term back to the orriginal term it represents and then produce a RemoteTerm from that. If the term being imported orriginated from this ontology, then return that term unaltered.- Specified by:
 importTermin interfaceOntology- Parameters:
 t- the Term to importname- the local name to import it under, optionally null- Returns:
 - a Term
 - Throws:
 IllegalArgumentException
 - 
deleteTerm
Description copied from interface:OntologyRemove a term from an ontology, together with all triples which refer to it.- Specified by:
 deleteTermin interfaceOntology
 - 
containsTerm
Description copied from interface:OntologyDetermines if this ontology currently contains a term namedname- Specified by:
 containsTermin interfaceOntology- Returns:
 - true is contained
 
 - 
containsTriple
Description copied from interface:OntologySee if a triple exists in this ontology- Specified by:
 containsTriplein interfaceOntology- Returns:
 - true if contained
 
 - 
createTriple
public Triple createTriple(Term subject, Term object, Term predicate, String name, String description) throws AlreadyExistsException, IllegalArgumentException, NullPointerException, IllegalArgumentException Description copied from interface:OntologyCreates a new Triple.- Specified by:
 createTriplein interfaceOntology- Parameters:
 subject- the subject Termobject- the object Termpredicate- the predicate Termname- the name of the triple, or nulldescription- the description of the triple, or null- Returns:
 - a new Triple over these three terms
 - Throws:
 AlreadyExistsException- if a triple already exists with the same subject, object and predicate, regardless of the name and descriptionIllegalArgumentException- if subject, object or predicate are not all from the same ontologyNullPointerException- if subject, object or predicate are null
 - 
getOps
Description copied from interface:OntologyReturn the associated OntologyOps. This method should be implemented by ontology implementors to allow OntoTools to get optimized access to some usefull ontology operations. It is not intended that users will ever invoke this. A sensible dumb implementation of this would return a per-ontology instance of DefaultOps. - 
toString
 - 
setName
Description copied from interface:OntologySet the name for this ontology 
 -