Interface Ontology

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Ontology.Impl
      A basic in-memory implementation of an ontology
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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.
      java.lang.String getDescription()
      Return a human-readable description of this ontology, or the empty string if none is available
      java.lang.String getName()
      Return the name of this ontology
      OntologyOps getOps()
      Return the associated OntologyOps.
      Term getTerm​(java.lang.String name)
      Fetch the term with the specified name.
      java.util.Set<Term> getTerms()
      Return all the terms in this ontology
      java.util.Set<Triple> getTriples​(Term subject, Term object, Term predicate)
      Return all triples from this ontology which match the supplied pattern.
      Term importTerm​(Term t, java.lang.String localName)
      Create a view of a term from another ontology.
      void setDescription​(java.lang.String description)
      set the description of this ontology
      void setName​(java.lang.String name)
      Set the name for this ontology
    • Method Detail

      • getName

        java.lang.String getName()
        Return the name of this ontology
        Returns:
        the name of the ontology
      • setName

        void setName​(java.lang.String name)
        Set the name for this ontology
        Parameters:
        name - - the name
      • getDescription

        java.lang.String getDescription()
        Return a human-readable description of this ontology, or the empty string if none is available
        Returns:
        the description of the term
      • setDescription

        void setDescription​(java.lang.String description)
        set the description of this ontology
        Parameters:
        description -
      • getTerms

        java.util.Set<TermgetTerms()
        Return all the terms in this ontology
        Returns:
        a Set of all Terms of the ontology.
      • getTerm

        Term getTerm​(java.lang.String name)
              throws java.util.NoSuchElementException
        Fetch the term with the specified name.
        Parameters:
        name - the name of the term
        Returns:
        The term named name
        Throws:
        java.util.NoSuchElementException - if no term exists with that name
      • getTriples

        java.util.Set<TriplegetTriples​(Term subject,
                                         Term object,
                                         Term predicate)
        Return all triples from this ontology which match the supplied pattern. If any of the parameters of this method are null, they are treated as wildcards.
        Parameters:
        subject - The subject to search for, or null
        object - The object to search for, or null
        predicate - The relationship to search for, or null.
        Returns:
        a Set of triples
      • getOps

        OntologyOps getOps()
        Return 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.
        Returns:
        the OntologyOps instance associated with this instance.
      • createTerm

        Term createTerm​(java.lang.String name)
                 throws AlreadyExistsException,
                        ChangeVetoException,
                        java.lang.IllegalArgumentException
        Create a new term in this ontology.
        Parameters:
        name - The name of the term (must be unique))
        Returns:
        The newly created term.
        Throws:
        java.lang.IllegalArgumentException - if either name or description is null, or violates some other constraint of this implementation.
        AlreadyExistsException - if a term of this name already exists
        ChangeVetoException
      • createTerm

        Term createTerm​(java.lang.String name,
                        java.lang.String description)
                 throws AlreadyExistsException,
                        ChangeVetoException,
                        java.lang.IllegalArgumentException
        Create a new term in this ontology.
        Parameters:
        name - The name of the term (must be unique)
        description - A human-readable description (may be empty)
        Returns:
        The newly created term.
        Throws:
        java.lang.IllegalArgumentException - if either name or description is null, or violates some other constraint of this implementation.
        AlreadyExistsException - if a term of this name already exists
        ChangeVetoException
      • createTerm

        Term createTerm​(java.lang.String name,
                        java.lang.String description,
                        java.lang.Object[] synonyms)
                 throws AlreadyExistsException,
                        ChangeVetoException,
                        java.lang.IllegalArgumentException
        Create a new term in this ontology.
        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:
        java.lang.IllegalArgumentException - if either name or description is null, or violates some other constraint of this implementation.
        AlreadyExistsException - if a term of this name already exists
        ChangeVetoException
      • createVariable

        Variable createVariable​(java.lang.String name,
                                java.lang.String description)
                         throws AlreadyExistsException,
                                ChangeVetoException,
                                java.lang.IllegalArgumentException
        Create a new term in this ontology that is used as a variable.
        Parameters:
        name - The name of the term (must be unique)
        description - A human-readable description (may be empty)
        Returns:
        The newly created term.
        Throws:
        java.lang.IllegalArgumentException - if either name or description is null, or violates some other constraint of this implementation.
        AlreadyExistsException - if a term of this name already exists
        ChangeVetoException
      • importTerm

        Term importTerm​(Term t,
                        java.lang.String localName)
                 throws ChangeVetoException,
                        java.lang.IllegalArgumentException
        Create 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.
        Parameters:
        t - the Term to import
        localName - the local name to import it under, optionally null
        Returns:
        a Term
        Throws:
        ChangeVetoException
        java.lang.IllegalArgumentException
      • createTriple

        Triple createTriple​(Term subject,
                            Term object,
                            Term predicate,
                            java.lang.String name,
                            java.lang.String description)
                     throws AlreadyExistsException,
                            ChangeVetoException
        Creates a new Triple.
        Parameters:
        subject - the subject Term
        object - the object Term
        predicate - the predicate Term
        name - the name of the triple, or null
        description - 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 description
        ChangeVetoException
        java.lang.NullPointerException - if subject, object or predicate are null
        java.lang.IllegalArgumentException - if subject, object or predicate are not all from the same ontology
      • containsTriple

        boolean containsTriple​(Term subject,
                               Term object,
                               Term predicate)
        See if a triple exists in this ontology
        Parameters:
        subject -
        object -
        predicate -
        Returns:
        true if contained
      • containsTerm

        boolean containsTerm​(java.lang.String name)
        Determines if this ontology currently contains a term named name
        Parameters:
        name -
        Returns:
        true is contained