Resource Description Framework (RDF) aims to capture all the data in the world. That's a big goal. It is a very complicated goal, too. So, RDF needs to be very flexible. To be flexible it uses the most basic building blocks: simple statements with only 3 parts. They are like simple sentences with a subject, verb and object. The subject is a piece of data so it is named with a Uniform Resource Identifier (URI). The verb is called a predicate in Artificial Intelligence-speak. It is also called a property in Object-Oriented-speak. The object of the statement is either another piece of data, another URI, or a literal name, number, date, etc. That's it. They are called triples, and the semantic web has billions of them.
Last time we looked at budget data. In particular, we focused on the spreadsheet of budget line items that had 5 or 6 columns: account number and description, last year expended budget, current year budget, next year proposed budget, difference and comments. So, for each line, there are at least 6 parts. But, 6 is greater than 3, so we need to be creative.
To start, we can ignore the difference column. Any application can easily calculate the difference between the current budget and proposed budget. Even more, applications will probably want to find other kinds of differences: proposed budget to 5-year trend of actual expenditures; proposed budget to other districts' proposed budgets; between sums of accounts. So, we can ignore the difference column.
The account number and description are actually 2 different items concatenated together. The "and" in the name tells you that. The account number is the real key to each line item. Given any account number, you can look up the description. For almost all accounts the description for a given account number stays the same. So, for a yearly proposed budget, the description can be ignored, too.
Applications will need an RDF file that labels each account number with the description so thay can stitch them back together. Let's take a slight detour to describe that file. Each account is identified by the URL for the RDF file and a hash tag for the account number. Say, something like this:
http://www.orcsd.org/data/2011/accounts-20110115.rdf#10-101-1100-51020-00-11-00000
where all the stuff between "http://" and "#" is the URL for the file and the rest between "10-" and "-00000" is the account number as a long tag name. Each account will share the URL part, so we'll use a handy prefix as a shorthand for it. Read "accounts:" to be a simple substitution for "http://www.orcsd.org/data/2011/accounts-20110115.rdf#". Then, the above hash URI can be written as accounts:10-101-1100-51020-00-11-00000, which is a little bit better. With any luck, from year to year, most of the accounts will stay the same, so these account numbers can be easily compared, and the URIs can be stable. This RDF file is where we would have the descriptions of the accounts as triples like this:
Subject: accounts:10-101-1100-51020-00-11-00000
Predicate: skos:prefLabel
Object: "PROF TEACH-MW"
The 3 columns of budget numbers are parallel. We want to be able to combine them and compare them. So, if we can figure out how to express 1 column of numbers in RDF, we can extend that to handle the others. For example, the current year budget is just the proposed budget from last year. Since it is the most important column, let's focus on the proposed budget column.
In the proposed budget, each account number is assigned an amount of money. This is a triple: account number, "proposed", and amount. We can use the hash URI for the account number. We can use a literal number for the amount. But, what do we use for the verb, that is the predicate. This is what I was looking for in Choose Your Words Carefully. I didn't really find it.
Applying the anti-procrastination principle that it is better to publish something that can later be changed than wait until it is all worked out to even start, I ask what is an easy first step? Next time I'll start to try to answer this question.
No comments:
Post a Comment