<metaname="copyright"content="Copyright (c) IBM Corporation and others 2000, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
createReference(myObjectType1, myObjectType2, myRelationType); // myObjectType1 instances can be associated with myObjectType2 instances by myRelationType
createReference(myObjectContainerType, myObjectType1); // myObjectContainerType instances can contain myObjectType1 instances
createReference(myObjectContainerType, myObjectType2); // myObjectContainerType instances can contain myObjectType2 instances
...
}
</pre>
</font>
<p>
The DataStore does not enforce that instance element trees are structured in the manner that the schema describes so the
establishing of relationships between object types, as done in this example, is unnecessary as a miner knows its own
model, since it defined it. But by convention, it is a good thing to describe a model with those relationships explicitly stated
because other miners or client tools may want to leverage or extend the model for their own purposes.
</p>
<h2>Handling Commands</h2>
<p>
The <code>handleCommand</code> method is called by the <ahref="Communications.html#servercommandhandler">Server Command Handler</a>
if the descriptor for a command instance is associated with a particular miner. When this is called, it is up to the miner implementation
to interpret and execute the command.
</p>
<p>
A <ahref="DataElements.html#commands">Command instance</a> is a tree of <ahref="DataElements.html">DataElements</a> representing the
command, the subject of the command, additional arguments to the command and the status of the command. The way this is normally interpretted
by a miner to mean <i>perform the specified command on the subject using the specified arguments. Change the status to be "done" when the
operation is complete.</i>.
</p>
<p>
The base miner class provides APIs to assist a miner implementation in extracting information from
a command tree. The method <code>getCommandName(DataElement)</code> is used to extract the
name of the command, <code>getCommandStatus(DataElement)</code> returns the status element of
the command, and <code>getCommandArgument(DataElement, int)</code> returns an argument at the
specified index. The first argument is always the subject. The code below illustrates
the typical structure of a <code>handleCommand</code> implementation.
</p>
<fontcolor='#4444CC'>
<pre>
public DataElement handleCommand(DataElement theElement)
{
String name = getCommandName(theElement);
DataElement status = getCommandStatus(theElement);