I had to refactor both programs a bit and merge the data models. I used a Java Swing JTable with a TableModel interface for the data table and the jFreeChart PieDataset interface for the pie chart. I created a new class that implemented both interfaces and populated that class with the results of the SPARQL query. Then I put the chart panel and table panel into a root panel and used the common model. It is a bit slow, but otherwise it works great.
Up to this point, I had a hard-coded SPARQL query. Unlike SQL that can take parameters, the current version of SPARQL doesn't have parameters, so I added an Apache Commons Lang StrSubstitutor to edit the query template. First I passed the account category on the command line, and finally I made it into a JComboBox pull-down menu so you can change the category while the application is running. Again, other than being a bit slow, it works great. Here's a screenshot:

There are a lot more features that this application can do. It is still just something to explore what is possible. One obvious thing is to format the numbers in the table with 2 fixed decimal places and commas.
As I was comparing the various ways the ORCSD budget is categorized, I was reminded how hard it is to get a good picture of the budget breakdown. The categories are not used consistently. That is what lead me to find the NH handbook account categories. I need another RDF file to map the ORCSD accounts to the NH categories. This needs to be hand coded, or at least hand tweaked, so it may take a while to get all 1,000 plus accounts categorized properly.
Unfortunately, I still don't have a place to publish my RDF files. Since a Java program is a bit more than I asked for, I think a good place for it would be on SourceForge. I'll create a new open source project for it and put it there. This will allow others to use it and add to it as well. And, it won't burden the district website any more than I've asked for already.
No comments:
Post a Comment