Skip navigation links
CASA Knowledge Science Group
Dept of Computer Science
Univeristy of Calgary
jade.content.onto

Class Ontology

    • Constructor Detail

      • Ontology

        public Ontology(String name,
                        Ontology base)
        Construct an Ontology object with a given name that extends a given ontology. The ReflectiveIntrospector is used by default to convert between Java objects and abstract descriptors.
        Parameters:
        name - The identifier of the ontology.
        base - The base ontology.
      • Ontology

        public Ontology(String name,
                        Introspector introspector)
        Construct an Ontology object with a given name that uses a given Introspector to convert between Java objects and abstract descriptors.
        Parameters:
        name - The identifier of the ontology.
        introspector - The introspector.
      • Ontology

        public Ontology(String name,
                        Ontology base,
                        Introspector introspector)
        Construct an Ontology object with a given name that extends a given ontology and that uses a given Introspector to convert between Java objects and abstract descriptors.
        Parameters:
        name - The identifier of the ontology.
        base - The base ontology.
        introspector - The introspector.
      • Ontology

        public Ontology(String name,
                        Ontology[] base,
                        Introspector introspector)
        Construct an Ontology object with a given name that extends a given set of ontologies and that uses a given Introspector to convert between Java objects and abstract descriptors.
        Parameters:
        name - The identifier of the ontology.
        base - The base ontology.
        introspector - The introspector.
    • Method Detail

      • getName

        public String getName()
        Retrieves the name of this ontology.
        Returns:
        the name of this ontology.
      • getSchema

        public ObjectSchema getSchema(String name)
                               throws OntologyException
        Retrieves the schema of element name in this ontology. The search is extended to the base ontologies if the schema is not found.
        Parameters:
        name - the name of the schema in the vocabulary.
        Returns:
        the schema or null if the schema is not found.
        Throws:
        OntologyException
      • getSchema

        public ObjectSchema getSchema(Class clazz)
                               throws OntologyException
        Retrieves the schema associated to a given class in this ontology. The search is extended to the base ontologies if the schema is not found.
        Parameters:
        clazz - the class whose associated schema must be retrieved.
        Returns:
        the schema associated to the given class or null if the schema is not found.
        Throws:
        OntologyException
      • getClassForElement

        public Class getClassForElement(String name)
                                 throws OntologyException
        Retrieves the concrete class associated with element name in this ontology. The search is extended to the base ontologies
        Parameters:
        name - the name of the schema.
        Returns:
        the Java class or null if no schema called name is found or if no class is associated to that schema.
        Throws:
        OntologyException - if name is null
      • getDefiningOntology

        private Ontology getDefiningOntology(String lcName)
        Retrieves the ontology actually containing the definition of a given schema. This can be the ontology itself or one of its super-ontologies.
        Parameters:
        lcName - The lower-case version of the name of the schema whose defining ontology must be retrieved
        Returns:
        The ontology actually containing the definition of schema lcName or null if such schema is not defined neither in this ontology nor in one of its super-ontologies
      • toObject

        protected Object toObject(AbsObject abs,
                                  String lcType,
                                  Ontology globalOnto)
                           throws UnknownSchemaException,
                                  UngroundedException,
                                  OntologyException
        Converts an abstract descriptor to a Java object of the proper class.
        Parameters:
        abs - the abstract descriptor.
        lcType - the type of the abstract descriptor to be translated aconverted into lower case. This is passed as parameters to avoid making the conversion to lower case for each base ontology.
        globalOnto - The ontology this ontology is part of (i.e. the ontology that extends this ontology).
        Returns:
        the object
        Throws:
        UnknownSchemaException - If no schema for the abs descriptor to be translated is defined in this ontology.
        UngroundedException - if the abstract descriptor contains a variable
        OntologyException - if some mismatch with the schema is found * ontology. In this case UnknownSchema
      • fromObject

        protected AbsObject fromObject(Object obj,
                                       Ontology globalOnto)
                                throws UnknownSchemaException,
                                       OntologyException
        Converts a Java object into a proper abstract descriptor.
        Parameters:
        obj - the object
        globalOnto - The ontology this ontology is part of (i.e. the ontology that extends this ontology).
        Returns:
        the abstract descriptor.
        Throws:
        UnknownSchemaException - If no schema for the object to be translated is defined in this ontology.
        OntologyException - if some mismatch with the schema is found
      • checkIsTerm

        public static void checkIsTerm(Object obj)
                                throws OntologyException
        Check whether a given object is a valid term. If it is an Aggregate (i.e. a List) it also check the elements.
        Throws:
        OntologyException - if the given object is not a valid term
      • getOwnConceptNames

        public List getOwnConceptNames()
        Retrieve the names of the concepts defined in this ontology only (excluding extended ontologies). It should be noticed that an agent-action is itself a concept and therefore the returned list also includes names of agent-actions defined in this ontology.
        NOT available in J2ME
        Returns:
        the names of the concepts defined in this ontology only (excluding extended ontologies)
      • getConceptNames

        public List getConceptNames()
        Retrieve the names of all concepts defined in this ontology (including extended ontologies). It should be noticed that an agent-action is itself a concept and therefore the returned list also includes names of agent-actions defined in this ontology.
        NOT available in J2ME
        Returns:
        the names of all concepts defined in this ontology (including extended ontologies)
      • getOwnActionNames

        public List getOwnActionNames()
        Retrieve the names of the agent actions defined in this ontology only (excluding extended ontologies).
        NOT available in J2ME
        Returns:
        the names of the agent actions defined in this ontology only (excluding extended ontologies)
      • getActionNames

        public List getActionNames()
        Retrieve the names of all agent actions defined in this ontology (including extended ontologies).
        NOT available in J2ME
        Returns:
        the names of all agent actions defined in this ontology (including extended ontologies)
      • getOwnPredicateNames

        public List getOwnPredicateNames()
        Retrieve the names of the predicates defined in this ontology only (excluding extended ontologies).
        NOT available in J2ME
        Returns:
        the names of the predicates defined in this ontology only (excluding extended ontologies)
      • getPredicateNames

        public List getPredicateNames()
        Retrieve the names of all predicatess defined in this ontology (including extended ontologies).
        NOT available in J2ME
        Returns:
        the names of all predicatess defined in this ontology (including extended ontologies)
      • getOwnElementNames

        private List getOwnElementNames(Class c)
      • getElementNames

        private Set getElementNames(Class c)
      • createConceptSlotFunction

        public ConceptSlotFunction createConceptSlotFunction(String slotName,
                                                             Concept c)
                                                      throws OntologyException
        Create a ConceptSlotFunction for a given slot of a given Concept. The ConceptSlotFunction class allows treating the slots of an ontological concept as functions. For instance, if an ontology defines a concept Person with a slot name and a slot age, it is possible to create expression such as
        (= (age (Person :name John)) 41)
        (> (age (Person :name John)) (age (Person :name Bill)))
        (iota ?x (= (age (Person :name John)) ?x))
        NOT available in MIDP
        Parameters:
        slotName - The name of the slot
        c - The concept a ConceptSlotFunction must be created for. This concept must have a slot called slotName
        Returns:
        A ConceptSlotFunction for the given slotName of the given Concept
        Throws:
        OntologyException
        Since:
        JADE 3.7
        See Also:
        ConceptSlotFunction, useConceptSlotsAsFunctions()
      • useConceptSlotsAsFunctions

        protected void useConceptSlotsAsFunctions()
        Instruct this ontology to support usage of concept slots as functions. This method must be invoked after all schemas have been completely defined and added to this ontology.
        Since:
        JADE 3.7
        See Also:
        ConceptSlotFunction, createConceptSlotFunction(String, Concept)
CASA Knowledge Science Group
Dept of Computer Science
Univeristy of Calgary