examples.indexes
public class: IndexingExample [javadoc |
source]
java.lang.Object
examples.ExampleBase
examples.indexes.IndexingExample
An example application showing how to use the indexing APIs of TM4J.
This application parses a topic map and prints out the topic, association
and occurrence types found in the map and the number of instances of each.
This application should be invoked as follows:
java examples.indexes.IndexingExample [tm_file_name]
Where tm_file_name is the file name of the topic map to be parsed. The
topic map file must be in XTM syntax. If this parameter is not defined, tm_file_name
defaults to topicmaps/kings_and_queens.xtm which should be a valid
topic map file name if this application is run from the examples subdirectory of
the TM4J installation.
| Constructor: |
public IndexingExample(String tmSource) {
// Load the topic map first
m_topicMap = readTopicMap(tmSource);
// Get the IndexManager which provides access to the indexes:
m_ixMgr = m_topicMap.getIndexManager();
}
Constructor which initialises the application by parsing the
topic map file specified by tmSource and getting
the IndexManager for that topic map. Parameters:
tmSource - the file name of the topic map to be parsed.
|
| Method from examples.indexes.IndexingExample Summary: |
|---|
|
main, run |
| Method from examples.indexes.IndexingExample Detail: |
public static void main(String[] args) {
String tmSource = "topicmaps/kings_and_queens.xtm";
if (args.length > 0)
{
tmSource = args[0];
}
try
{
IndexingExample theApp = new IndexingExample(tmSource);
theApp.run();
}
catch(Exception ex)
{
System.out.println("Error running test: " + ex.toString());
ex.printStackTrace();
}
}
|
public void run() throws Exception {
// Dump info:
dumpTopicTypes();
dumpAssociationTypes();
dumpOccurrenceTypes();
}
|