2. Viewing the loaded grammer via the Query menu & constructing a sentence. The disabled speaker icon () appearing in the leaf menu item "[AND THEN]" represents an unloaded/unretrieved grammar of a related agent. By selecting this menuitem the agent will be retrieved and its grammar loaded dynamically.
3. Notice that the speaker icon has changed (while we waited... we didn't erase and renavigate the menus). This indicates that the new grammar was successfully loaded. If there had been a problem a menuitem entitled "Error Loading Grammar" would have appeared. Once the grammar from the referenced agent has been loaded we can continue cnstructing a sentence.
Notice that the first grammar belongs to a "Location" type agent which can locate airports, U.S. bases, and NATO bases. The grammar loaded because of our sentence construction, essentially ending at the "Miami" segment terminator, belongs to an Airport agent (and perhaps specifically a military-oriented Miami Airport Agent). Also, notice that the first sentence constructed could be a complete valid sentence -- its execution would return some reference to airport(s) closest to Miami. In addition, the Miami Airport Agent's grammar could also be used independent of the previous grammar if we had actually a link to that agent in the first place. However, if constraint passing was supported, there would be no constraints passed to the airport agent if it was accessed directly. Note, too, this kind of grammar independence may not always exist. It should be possible to name this sentence & reduce it, or a fragment of it, to a single menu item -- useful if it is frequently constructed.
When used in combination, each grammar is a sub-grammar and enables the construction of a sentence segment or fragment.
These AgentGram agents are located on my ISP's server.
Here's an example of this new menuing idea:
MenuFields allow dynamic querying based upon user-entered values which the grammar might not recognize or support. Or it's possible that too many values could exist (such as how much to withdrawal from your bank account). In the example above, the user was allowed to enter an alternate US Base location. Once entered, the appropriate grammar is acquired and loaded from the corresponding agent in realtime. (While a speaker icon should be displayed here as well in the MenuField menuitem, this capability is still being worked on.)
BTW, to my knowledge, no one has created a MenuField before (perhaps not too surprising). In fact, it is either very difficult or impossible to do without modifying the original Sun java source code. I've submitted a bug report which the responding engineer admitted was an interesting point: one CAN add fields to menu items, but only if they do not have submenus themselves. This occurred because they have redefined the inherited add method (from menuitem) to be used strictly to add submenus.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE grammar PUBLIC "-//OBJS//DTD AgentGram//EN" "file://J:/nli10/AgentGramDemo/gram.dtd">
<grammar name="Military AgentGrammar1">
<item name="Find the">
<item name="Airport">
<item name="in the U.S">
<item name="nearest to">
<item name="Washington D.C">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Air.xml"></item>
</item>
<item name="San Francisco">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Air.xml"></item>
</item>
<item name="Miami">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Air.xml"></item>
</item>
<item name="Seattle">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Air.xml"></item>
</item>
</item>
</item>
<item name="in Europe">
<item name="nearest to">
<item name="Paris">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Air.xml"></item>
</item>
<item name="London">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Air.xml"></item>
</item>
<item name="Vienna">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Air.xml"></item>
</item>
<item name="Rome">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Air.xml"></item>
</item>
</item>
</item>
</item>
<item name="U.S. Bases">
<item name="where the base is">
<item name="nearest to">
<item name="Washington D.C">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Base.xml"></item>
</item>
<item name="San Francisco">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Base.xml"></item>
</item>
<item name="Miami">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Base.xml"></item>
</item>
<item name="Seattle">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Base.xml"></item>
</item>
</item>
<item name="larger than">
<item name="5,000 troops">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Base.xml"></item>
</item>
<item name="10,000 troops">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Base.xml"></item>
</item>
</item>
<item name="smaller than">
<item name="5,000 troops">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-Base.xml"></item>
</item>
</item>
</item>
</item>
<item name="NATO Bases">
<item name="[AND THEN]" url="file:///nli10/AgentGramDemo/MilGram-NATO.xml"></item>
</item>
</item>
</grammar>
?