The XMLB demo (it's XML for MLB, get it?!) uses the Niagara Internet Query System to implement a fantasy baseball league. XMLB demonstrates research on processing streams of data and on a new "merge" operator. In fantasy baseball, players create imaginary teams composed of real baseball players and these fantasy teams compete based on the real players' performance during a baseball season (see ESPN's version of fantasy baseball for more details).
XMLB takes as input streaming play-by-play data and roster information for a fantasy baseball league and produces an XML file containing statistics for each team in the fantasy league. This statistics file is queried to obtain a ranking of the fantasy teams based on a scoring formula. A trivial scoring formula might indicate that the team with the most runs wins. XMLB is implemented using version 1.0 of the Niagara Internet Query System - a query engine for processing web-resident XML data which uses XML-QL as its query language and is implemented in Java.
The basic functionality necessary for supporting a fantasy baseball league is combining the fantasy teams' rosters and the play-by-play data to produce team statistics, i.e. hits per team, strikeouts per team and so on and finally calculating the team scores from the statistics. In order to make the game fun to play, team scores and rankings must be provided throughout the season and not just at the end of the season.
Here you can see the architecture of the XMLB system. There are four major pieces of the system: the XMLB Generator, the Firehose, the Niagara Query Engine itself, and the client. |
The XMLB Generator generates a stream of play-by-play data based on data from a recent baseball season. Each element in this stream is a small XML document (see example) representing a game event. A game event is an at-bat and any associated actions (hits, runs, strikeouts, etc.). The generated play-by-play data is streamed to the firehose, a data streaming system developed at OGI, which in turn streams the data to the Niagara system.
Inside Niagara, the data from the firehose is used as input to the Team Statistics Query which restructures the play-by-play data and joins it with fantasy team roster data. The results of the Team Statistics Query are fed into an "Accumulate" operator which accumulates and maintains the fantasy teams' statistics in an "Accumulator" or Team Statistics File. The Accumulator (in this case the Team Statistics File) is stored in the system and appears to the rest of the Niagara system as an ordinary XML file which is available for query via the normal query facilities. To determine the team's rankings (who is winning) a Team Rankings Query is issued over the Team Statistics File to calculate the fantasy teams' scores based on a scoring formula.
The Team Rankings Query can be executed any number of times starting when the play-by-play data generation begins allowing the players to track the progress of their fantasy teams throughout the season. The Accumulate Operator is an implementation of the Merge technology developed at OGI. It is also important to state that the Team Statistics Query is so complex that it can not be expressed in the current Niagara query language, XML-QL, so it is represented as a physical query plan that is loaded into the system and executed using a system for executing physical query plans which are themselves specified in XML.
Additional information can be found in the slides from a recent presentation about
the XMLB system.
A Sample Game Event
<PLAY>
<GAMEID> KCA198905260 </GAMEID>
<HIT>
<BATTER> pettg001 </BATTER>
<PITCHER> bannf001
</PITCHER>
<BASES> 1
</BASES>
</HIT>
<BASE_RUNNERS>
<RUNNER_SECONDBASE>schur001</RUNNER_SECONDBASE>
<RUNNER_FIRSTBASE> pettg001
</RUNNER_FIRSTBASE>
</BASE_RUNNERS>
</PLAY>
A Sample
League Roster
<LEAGUE>
<TEAM>
<NAME> Team 1 </NAME>
<ROSTER>
<PLAYER>
<PNAME> "Tim Belcher" </PNAME>
<PLRID> belct001 </PLRID>
<POSITION> P </POSITION>
<STDATE> 04/01/89 </STDATE>
<ENDDATE> 10/03/89 </ENDDATE>
</PLAYER>
<PLAYER>
...