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
- (concept "reference")
- (set MIFTYPE)
- (list MIFTYPE)
- (oneof PRIMITIVETYPE v1 v2 ...)
- (interval NUMERICTYPE loV hiV)
PRIMITIVETYPE definitions:
NUMERICTYPE definitions:
- See Also:
- MIFFactory
-
MIFConcept(String)
- Constructs a new MIFConcept with the specified name and no attributes.
-
MIFConcept(String, MIFConcept, String[], MIFType[])
- Constructs a new MIFConcept with the specified name, parent and
attributes.
-
MIFConcept(URL)
- Constructs a new MIFConcept with the specified name (URL) and
no attributes.
-
equals(MIFConcept)
-
-
getAttributes()
- Returns an enumeration of all attribute names.
-
getDescendants()
- Returns an enumeration of all descendants to this concept.
-
getType(String)
- Returns the type for the specified attribute.
-
getURL()
- Returns the concept name as a URL referring to the concept definition.
-
getURLRef()
- Returns the concept name as a URL referring to the concept definition.
-
isOrAncestor(MIFConcept)
- Returns true if the specified concept is the same or an ancestor to
this concept.
-
main(String[])
-
-
readConcept(URL, InputStream)
- Reads and parses a MIF concept definition from the specified stream.
-
toString()
- Returns a string representation of this concept.
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.
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.
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.
getURL
public URL getURL()
- Returns the concept name as a URL referring to the concept definition.
- Returns:
- the concept name as a URL
getURLRef
public String getURLRef()
- Returns the concept name as a URL referring to the concept definition.
- Returns:
- the concept name as a String
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.
equals
public boolean equals(MIFConcept c)
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.
getAttributes
public Enumeration getAttributes()
- Returns an enumeration of all attribute names.
- Returns:
- an enumeration of all attribute names as Strings.
getDescendants
public Enumeration getDescendants()
- Returns an enumeration of all descendants to this concept.
- Returns:
- an enumeration of all descendants to this concept.
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
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
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index