jade.content.onto

Class Ontology

    • Constructor Summary

      Constructors 
      Constructor and Description
      Ontology(java.lang.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.
      Ontology(java.lang.String name, Ontology base)
      Construct an Ontology object with a given name that extends a given ontology.
      Ontology(java.lang.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.
      Ontology(java.lang.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.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void add(ObjectSchema schema)
      Adds a schema to this ontology
      void add(ObjectSchema schema, java.lang.Class javaClass)
      Adds a schema to the ontology and associates it to the class javaClass
      static void checkIsTerm(java.lang.Object obj)
      Check whether a given object is a valid term.
      ConceptSlotFunction createConceptSlotFunction(java.lang.String slotName, Concept c)
      Create a ConceptSlotFunction for a given slot of a given Concept.
      void dump()
      Dump ontology to default output stream
      void dump(java.io.PrintStream ps)
      Dump ontology to specified PrintStream
      static AbsObject externalizeSlotValue(java.lang.Object obj, Introspector introspector, Ontology referenceOnto) 
      AbsObject fromObject(java.lang.Object obj)
      Converts a Java object into a proper abstract descriptor.
      java.util.List getActionNames()
      Retrieve the names of all agent actions defined in this ontology (including extended ontologies).
      java.lang.Class getClassForElement(java.lang.String name)
      Retrieves the concrete class associated with element name in this ontology.
      java.util.List getConceptNames()
      Retrieve the names of all concepts defined in this ontology (including extended ontologies).
      Introspector getIntrospector() 
      java.lang.String getName()
      Retrieves the name of this ontology.
      java.util.List getOwnActionNames()
      Retrieve the names of the agent actions defined in this ontology only (excluding extended ontologies).
      java.util.List getOwnConceptNames()
      Retrieve the names of the concepts defined in this ontology only (excluding extended ontologies).
      java.util.List getOwnPredicateNames()
      Retrieve the names of the predicates defined in this ontology only (excluding extended ontologies).
      java.util.List getPredicateNames()
      Retrieve the names of all predicatess defined in this ontology (including extended ontologies).
      static java.util.List<ObjectSchema> getReferencedSchemas(ObjectSchema rootSchema) 
      ObjectSchema getSchema(java.lang.Class clazz)
      Retrieves the schema associated to a given class in this ontology.
      ObjectSchema getSchema(java.lang.String name)
      Retrieves the schema of element name in this ontology.
      static java.lang.Object internalizeSlotValue(AbsObject abs, Introspector introspector, Ontology referenceOnto) 
      static boolean isBaseOntology(Ontology[] oo, java.lang.String name) 
      java.lang.Object toObject(AbsObject abs)
      Converts an abstract descriptor to a Java object of the proper class.
      java.lang.String toString() 
      protected void useConceptSlotsAsFunctions()
      Instruct this ontology to support usage of concept slots as functions.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Ontology

        public Ontology(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.lang.String getName()
        Retrieves the name of this ontology.
        Returns:
        the name of this ontology.
      • add

        public void add(ObjectSchema schema,
               java.lang.Class javaClass)
                 throws OntologyException
        Adds a schema to the ontology and associates it to the class javaClass
        Parameters:
        schema - the schema.
        javaClass - the concrete class.
        Throws:
        OntologyException
      • getSchema

        public ObjectSchema getSchema(java.lang.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(java.lang.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 java.lang.Class getClassForElement(java.lang.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
      • checkIsTerm

        public static void checkIsTerm(java.lang.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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getOwnConceptNames

        public java.util.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 java.util.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 java.util.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 java.util.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 java.util.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 java.util.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)
      • createConceptSlotFunction

        public ConceptSlotFunction createConceptSlotFunction(java.lang.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)
      • isBaseOntology

        public static boolean isBaseOntology(Ontology[] oo,
                             java.lang.String name)
      • dump

        public void dump()
        Dump ontology to default output stream
      • dump

        public void dump(java.io.PrintStream ps)
        Dump ontology to specified PrintStream

These are the official JADE API. For these API backward compatibility is guaranteed accross JADE versions