All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sics.agentbase.mif.MIFConcept

java.lang.Object
   |
   +----sics.agentbase.mif.MIFConcept

public class MIFConcept
extends Object
implements Serializable
The MIFConcept class implements the representation of MIF concept definitions. The MIFConcept objects uses MIFFactory to store and find concepts.

To enable the MIFConcept objects to find their parents and children, the MIFConcept objects build up an inheritance tree by keeping references to their parents and descendants.

MIF concept definitions:
(def REFERENCE ISA (aname MIFTYPE) ...)

REFERENCE definition:
"url"

ISA definition:
"isa"

MIFTYPE definitions:

PRIMITIVETYPE definitions:

NUMERICTYPE definitions:

See Also:
MIFFactory

Constructor Index

 o MIFConcept(String)
Constructs a new MIFConcept with the specified name and no attributes.
 o MIFConcept(String, MIFConcept, String[], MIFType[])
Constructs a new MIFConcept with the specified name, parent and attributes.
 o MIFConcept(URL)
Constructs a new MIFConcept with the specified name (URL) and no attributes.

Method Index

 o equals(MIFConcept)
 o getAttributes()
Returns an enumeration of all attribute names.
 o getDescendants()
Returns an enumeration of all descendants to this concept.
 o getType(String)
Returns the type for the specified attribute.
 o getURL()
Returns the concept name as a URL referring to the concept definition.
 o getURLRef()
Returns the concept name as a URL referring to the concept definition.
 o isOrAncestor(MIFConcept)
Returns true if the specified concept is the same or an ancestor to this concept.
 o main(String[])
 o readConcept(URL, InputStream)
Reads and parses a MIF concept definition from the specified stream.
 o toString()
Returns a string representation of this concept.

Constructors

 o MIFConcept
 public MIFConcept(String ref) throws MalformedURLException
Constructs a new MIFConcept with the specified name and no attributes.

Parameters:
ref - a concept name as a string.
Throws: MalformedURLException
if a malformed URL is specified.
 o MIFConcept
 public MIFConcept(URL url)
Constructs a new MIFConcept with the specified name (URL) and no attributes.

Parameters:
url - a concept name as a URL.
 o MIFConcept
 public MIFConcept(String ref,
                   MIFConcept isa,
                   String fieldNames[],
                   MIFType fieldTypes[]) throws MalformedURLException
Constructs a new MIFConcept with the specified name, parent and attributes.

Parameters:
ref - the concept name.
isa - a reference to the parent concept or null if the concept has no parents.
fieldNames - an array with the attribute names as Strings.
fieldTypes - an array with the attribute types as MIF types.
Throws: MalformedURLException
if a malformed URL is specified.

Methods

 o getURL
 public URL getURL()
Returns the concept name as a URL referring to the concept definition.

Returns:
the concept name as a URL
 o getURLRef
 public String getURLRef()
Returns the concept name as a URL referring to the concept definition.

Returns:
the concept name as a String
 o isOrAncestor
 public boolean isOrAncestor(MIFConcept concept)
Returns true if the specified concept is the same or an ancestor to this concept.

Parameters:
concept - the concept to compare.
Returns:
true if the specified concept is the same or an ancestor to this concept and false otherwise.
 o equals
 public boolean equals(MIFConcept c)
 o getType
 public MIFType getType(String attributeName)
Returns the type for the specified attribute.

Parameters:
attributeName - the name of the attribute
Returns:
the type of the specified attribute or null if the attribute does not exist.
 o getAttributes
 public Enumeration getAttributes()
Returns an enumeration of all attribute names.

Returns:
an enumeration of all attribute names as Strings.
 o getDescendants
 public Enumeration getDescendants()
Returns an enumeration of all descendants to this concept.

Returns:
an enumeration of all descendants to this concept.
 o readConcept
 public static MIFConcept readConcept(URL url,
                                      InputStream in) throws IOException
Reads and parses a MIF concept definition from the specified stream.

All concepts in the concept definition will be read, parsed and registered at MIFFactory but only the specified concept will be returned.

Parameters:
url - the concept name for the concept to read.
in - the input stream to read the concept from.
Returns:
the read concept or null if it could not be found.
Throws: IOException
if an I/O or parse error occurs.
See Also:
MIFFactory
 o toString
 public String toString()
Returns a string representation of this concept. All references are made global.

Returns:
a string representation of this concept.
Overrides:
toString in class Object
 o main
 public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index