Categories
People

On personas

Recovered from the Wayback Machine.

I have never been much of a game player. I liked some sports and participant games such as Tag and marbles, played volleyball and baseball and soccer, and I’m rather fond of Mahjong. But I never was one for cards, or board games, or anything of that nature. Monopoly leaves me cold.

When I started college, a big thing on campus at that time was role-playing games, such as Dungeons and Dragons. These were a novelty to me and I remember attending a day long D & D festival, marveling at the people that took it all so very seriously.

My indifference to games extends to computer and online role-playing games such as Quake or, well I can’t even think of the names of popular games. I was at one time heavily interested in three-dimensional computer graphics – I applied for but didn’t get a job at Lucas’ Industrial Light and Magic; however this interest was because of the technology and the beauty of the creations, not because I was a gamer.

I playacted when I was younger, and acted a bit in high school. But I quit high school and grew up. (Or was it, I grew up when I quit high school?) As I got a older I would sometimes put on a Social Mask, part of the same costume that included flowers and halter top one year, gold chains and disco dress another. Over time, though, I found that people would sometimes like the Mask more than me, and I came to realize the Mask was not my friend.

At Central University, when I returned to college as an old woman of 29, I wore the persona of Young Female College Student, and faced my 30th birthday behind anorexic walls and determined denial. As part of my ‘fitting in’, not the least of which was trying to share my young lover’s interests, I tried the role-playing games a couple of times but they had no appeal for me. I liked the pretty dice, but eventually became bored with the game and pretty young man.

Now, the only mask I wear is one of mud.

I must seem prosaic and lacking in imagination because I don’t care for role-playing. However, I can walk along Katy Trail and imagine the Little People calling to me as Owl from the bushes; I can see a story unfold before me, overlayed on reality and forming a double image in my mind until spilled forth on paper or keyboard; I can dive into a book and wrap the words around me, losing myself; I’ll look at a photograph or a painting or a piece of sculpture and I can sense menace, or joy, or sorrow, or even silliness from abstract curves and empty seats. If this isn’t imagination, I’ll take whatever it is and be content.

Some might point out that Burningbird is a role, a persona I take on as a weblogger. Yet the words I write as Burningbird are no different than the words I would write as Shelley, or Bb, or Shell or any name I’m called.

Does role-playing give us insight, and allow us greater freedom of expression? I can see how this would be, and perhaps I’m voluntarily stifling my creativity by not trying out different roles, especially when communicating. Other people’s reaction to the roles and the words spoken while in role must be enlightening – but then, how do I know they’re not also adopting roles when they respond?

Perhaps the roles are really bits of ourselves we slice off to stand in stark contrast to the blended whole, like the photographer who filters out the reds in a photo that will eventually be published in black & white. I do sometimes let my Evil Twin out to play, but I have a little secret for you – she’s me.

Are novelists like WG Sebald and poets like Sylvia Plath taking on roles when they write? Or are they using empathy rather than masks?

I think that role-playing for some of us happens internally rather than externally. I am talking with you and you don’t see the Joker or the Whore or the Mother or the Sadist but they’re here, inside me. And someday their response to you will find life, in a phrase or a sentence I write for a story. But by then, you’ll be inside me, too.

manitou.jpg

Categories
Connecting

How communication fails

I need to finish my “Semiotics of I” essay with its discussion of URIs, representations, and self (“I am linked, therefore I am”). However, the weather saps my energy as we enter our fifth day of hot weather alerts. Rather than profound writing on web esoterics, I’ll be happy if I can actually manage to get my clothes to the laundry room this morning.

Speaking of semantics, interesting thread over at the Pie/Echo/Atom syntax email list. The thread started innocently enough with Simon Willison:

 

Tim just mentioned a mandatory order for the <issued>, <modified> and <created> elements, hence my question. Will the final Atom specification include text along the lines of “client implementations MUST reject Atom feeds if they are invalid”.

The thread then spiraled wildly into discussions of well-formed XML versus badly formed HTML, sensible suggestions interspersed with the geek equivalents of “Yo dog’s a bitch and so’s your mama”.

However, a couple of comments arose on the thread that are worth yanking out of geekland and talking about openly. The first has to do with validity of data, not just validity of syntax. The second has to do with error notification.

One suggestion being circulated is that when an aggregator tries to consume an invalid Pie/Echo/Atom syndication feed, an email or some other notice is sent to the producer of said feed, telling them to fix their broken feed. This sounds feasible until you start looking at what happens in the real world.

For many webloggers, the feeds we produce are ones we’ve added to our tools following one person or another’s instructions. Most people provide the feed primarily because they’ve been asked to and have only a small understanding of what the template tags and the XML means. Many of us have tweaked our feeds, such as my removal of the content encoded element because I don’t publish my content in its entirety. Any one of these actions can introduce errors.

Now, consider the scenario: your feed is accessed by let’s say 100 aggregators, because you have 100 people subscribe to your feed. Each aggregator accesses the feed once per hour. Do the math: exactly how many email messages are going to be generated in one single day based on one simple easy to do mistake? I wasn’t aware that spam is an effective tool for helping people correct their mistake.

Simon Willison recognized this as a problem:

There’s also the problem of what could amount to a distributed DoS on anyone with a lot of traffic who accidentally invalidates their feed. Can you imagine if someone with a thousand subscribers dropped an unescaped ampersand in to their Atom feed? Within the hour they would have 1,000 error reports to wade through (assuming all aggregators followed the report-error part of the standard).

However, Simon then proposed acceptance of another idea:

A better practical solution is probably to follow Bill Kearney’s example in having a big directory of Atom feeds which publically flags any that are broken, gently embaressing the owner in to fixing the feed.

What did Bill Kearney say? The following:

Ignorance we can help with decent documentation and friendly validators.
Laziness we can combat with a rigorous validator and, frankly, fear of exposure.
Should folks find themselves desparate to remain ignorant and lazy, well,
they’re more than welcome to use a spec that better suits them. It’s been my
experience, however, that by educating people and setting good examples they dotend to come around..

This is probably the first time I’ve ever heard ‘embarrassment’ and ‘fear of exposure’ used as effective solutions to a technical problem.

Tim Bray wrote an essay on this, but he’s confused the types of error handling, as others in the list have done, and that leads me to my next and more serious concern: validating the data rather than validating the syntax. Asserting that the syntax is valid and well-formed XML is one thing; but start validating the data delimited with the syntax, and that’s where the problems are going to arise.

Sam mentions that the Pie/Echo/Atom validator has now been extended to check for dates:

Recently, the validator was improved to check for dates like February
30th. Within days, a feed was caught with this problem.

Well, that’s cool – but what does this have to do with the syntax? What if I want to generate a feed that has February 30th, as a joke or because I’m feeling contrary. No harm to the Pie/Echo/Atom syntax, is there? Not even the RDF Validator – and we all know that RDF is complex and just full of meaning – checks the data contained within the syntax requirements.

Scott Johnson suggests we go even further because of a misuse of the language tag. He writes:

Something like 50+% of asian weblogs are set to english when they display kanji.

There are linguistic algorithms that could be put into the validator as well as a user level prompt that asks them “Is this text in english” and if they answer No, it could deny the validation.

So when is technically correct but lying invalid?

Lying? After reading this I immediately went to my RSS 2.0 syndication template and changed the language to mn – Mongolian. Why? Because I’m both arbitrary and contrary. In other words, I’m a typical technology user.

Head’s up Alpha Geeks, you forgot one rule, one important lesson: know your customers. Don’t assume that the recipient of the ‘bad feed’ email is going to be a commercial feed provider, or someone who even gives a shit whether the feed is accurate or not – they’re only providing it because they were asked. Additionally, don’t assume that your rules over the syntax of the feed bleed over into imposing rules on the data of the feed, outside of those that are essential for the syntax. The more rules you add to Pie/Echo/Atom, the more rules are going to be broken.

(By the way – PEAW? You all are using a word that looks suspiciously like “pugh” for a name now?)

Categories
Political

Gonna learn? Learn from the best

There’s lots of discussion about the nasty doings among the technologists, but let’s face it – we’re rank amateurs compared to the political parties in this country.

While the media is dazzled by the carnival atmosphere surrounding the recall in California, in Texas a group of Democrats are fighting a far more difficult battle to prevent the Republican party from creating King George, the First.

I just received the following from moveon.org:

Below is the letter from State Senator Rodney Ellis.
___________________
August 18, 2003

Dear friends,

I am writing to you from a hotel room in Albuquerque, New Mexico, where I and 10 of my colleagues in the Texas Senate have been forced to reside for the past 20 days. If we return to our homes, families, friends, and constituents, the Governor of Texas will have us arrested.

I know, it sounds more like a banana republic than the dignified democracy on which we have long prided ourselves. We are effectively exiled from the state due to our unalterable opposition to a Republican effort – pushed by Tom Delay and Karl Rove, and led by Texas Governor Rick Perry – that would rewrite the map of Texas Congressional districts in order to elect at least 5 more Republicans to Congress.

You may not have heard much about the current breakdown in Texas politics. The Republican power play in California has obscured the Republican power play in Texas that has forced my colleagues and me to leave the state.

Recognizing that public pressure is the only thing that can break the current stalemate, our friends at MoveOn have offered to support our efforts by sharing this email with you. In it, you will find:

* Background information on how the situation in Texas developed;
* Analysis of what’s at stake for Democrats and the democratic process; and
* How you can help by contacting Texas politicians, signing our petition, contributing funds, and forwarding this email!

The Republican redistricting effort shatters the tradition of performing redistricting only once a decade immediately after the Census – making redistricting a perpetual partisan process. It elevates partisan politics above minority voting rights, in contravention of the federal Voting Rights Act. It intends to decimate the Democratic party in Texas, and lock in a Republican majority in the U.S. House of Representatives. And Republican efforts to force a vote on this issue by changing the rules of legislative procedure threaten to undermine the rule of law in Texas.

We do not take lightly our decision to leave the state. It was the only means left to us under the rules of procedure in Texas to block this injustice. We are fighting for our principles and beliefs, and we can win this fight with your support.

Sincerely,

Rodney Ellis
Texas State Senator (Houston)

Background

During the 2001 session of the Texas Legislature, the legislature was unable to pass a Congressional redistricting plan as it is required to do following the decennial Census. A three judge federal panel was forced to draw the plan. Neither Governor Rick Perry or then Attorney General John Cornyn, both Republicans, objected to the plan, which was reviewed and approved by the U.S. Supreme Court.

The 2002 Congressional elections, the first held under the new redistricting plan, resulted in a Congressional delegation from Texas consisting of 17 Democrats and 15 Republicans. However, five of the 17 Democrats prevailed only because they were able to win the support of Republican and independent voters. All statewide Republican candidates carried these five districts. Most experts agree that the current plan has 20 strong or leaning Republican districts and 12 Democratic districts.

Meanwhile, the 2001 redistricting of Texas legislative seats (which was enacted by the Republican-controlled Legislative Redistricting Board, after the legislature again gridlocked in its efforts) resulted in wide Republican majorities in both the Texas House and Texas Senate. Now Tom Delay has made it his priority to force the Republican-controlled Legislature to enact a new redistricting plan to increase the number of Republican-leaning Congressional districts. Republicans believe they can manipulate the districts to elect as many as 22 Republicans out of the 32 member Texas Congressional delegation. They achieve this by packing minority voters into as few districts as possible and breaking apart rural districts so that the impact of independent voters will be reduced and suburban Republican voters will dominate.

During the regular session of the Texas Legislature, Democratic members of the Texas House of Representatives exercised an unprecedented parliamentary move to prevent the House from passing Tom Delay’s redistricting plan. While Democrats are in the minority of the House of Representatives, the state constitution requires that at least 2/3 of the House be present for the House to pass a bill. Because it was clear that the Republicans would entertain no debate and brook no compromise in their effort to rewrite the rules by which members of Congress are elected, the Democrats were forced to break the quorum to prevent the bill from passing. Because the Republican Speaker of the House and Governor called on state law enforcement officials to physically compel the Democrats to return, the lawmakers removed themselves to a Holiday Inn in Ardmore, Oklahoma – outside the reach of state troops(1). In there effort to apprehend the Democrats, Tom Delay officially sought the help of the Department of Homeland Security, the Department of Transportation and the Department of Justice.

The House Democrats (nicknamed the “Killer D’s”, based on an earlier episode in Texas history in which a group of Democratic state senators called the “Killer Bees” broke the quorum in the Senate over a similarly political stalemate) succeeded in stopping Delay’s redistricting plan during the regular session, returning to Texas after the legislative deadline had expired for the House to pass legislation. However, because the Texas Legislature meets in regular session only every two years, the state constitution gives the Governor the power to call a 30-day special legislative session at any time between regular sessions. Despite statewide protests from Texas citizens who oppose Tom Delay’s redistricting plan, the Governor has called two special sessions(2) already this summer to attempt to force the legislature to enact a new plan.

The first called session expired in a deadlock, as 12 of 31 Texas Senators(3) opposed the plan. Under Senate rules and tradition, a 2/3 vote is required to consider any bill on the floor of the Senate, giving 11 Senators the power to block a vote(4). The Republican Governor and Lieutenant Governor then determined they would do away with the 2/3 rule, and called another special session, forcing 11 Democratic Senators to break the quorum and leave the state.(5) These Senators have spent the past 22 days in Albuquerque, New Mexico.

The Governor has indicated he will continue calling special sessions until the Republican redistricting plan is enacted, despite the fact that the Republican-controlled Texas Supreme Court recently rejected the Governor’s writ of mandamus filing to compel the Senators to return to the Senate. Meanwhile, eleven Democratic state senators are exiled from their state, unable to be with their families, friends, and constituents, for fear of being arrested as part of a partisan power play by Republicans. In the most recent indignity, Republican Senators voted to fine the absent Democrats up to $5,000 per day, and to revoke parking and other privileges for their staffs as long as the Senators are away.

What’s at stake

At stake, on the surface, is whether Tom Delay will succeed in exploiting Republican control of the Texas Legislature to add to the Republican majority in the United States Congress. But deeper issues are also at stake.

* If the Republicans succeed in redrawing the Texas Congressional lines to guarantee the election of five to seven more Republicans, it will ensure that Republicans hold the majority in the U.S. House of Representatives for the entire decade and will likely result in Tom Delay becoming Speaker of the House.(6)
* The Republican advantage would be gained by removing many African American and Hispanic voters from their current Congressional districts and “packing” them into a few districts that already have Democratic majorities. The voting power of these minority voters would be dramatically diluted by the Republican plan, in contravention of the federal Voting Rights Act. If the Republicans succeed, over 1.4 million African American and Hispanic voters will be harmed. It would be the largest disenfranchisement of minority voters since the Voting Rights Act was passed.
* Redistricting exists for the purpose of reapportioning voters among political districts to account for population shifts. The purpose of this reapportionment is to ensure a roughly equal number of voters in each district, to preserve the principle of “one man, one vote.”(7) For this reason, redistricting has always been conducted immediately following the U.S. Census’ decennial population reports. Tom Delay now proposes a new redistricting plan two years after the Census report simply because Republicans gained control over the Texas Legislature in 2002 and now have the power to enact a much more Republican-friendly plan than the one drawn by the federal courts two years ago. This is an unprecedented approach to redistricting, one that subordinates its original purpose of ensuring the principle of “one man, one vote” to the purpose of perpetual partisan politics. Redistricting, in this model, would never be a settled matter, and districts would constantly be in flux depending on the balance of political power in the Legislature.
* The Texas Legislature has traditionally been defined by a spirit of bipartisanship and cooperation. This issue has polarized the legislature in a way that threatens to destroy that tradition. The Republicans have effectively exiled their Democratic counterparts in a power play that makes our state look more like a banana republic than a dignified democracy. The arbitrary decision to discard the 2/3 rule in the Senate sets a precedent that undermines that body’s tradition of consensus and cooperation. The deployment of state law enforcement officials to apprehend boycotting legislators erodes the separation of powers between the executive and legislative branches of government, and diminishes legislators’ ability to represent their constituents as they see fit. The unilateral Republican effort to penalize Democratic Senators and their staffs

What is needed

The Democratic Senators currently in Albuquerque have two critical needs. The first is to generate increased public awareness of the situation. By all reason, every day the Senators are out of the state this story should get bigger. Instead, news media have gradually lost interest in the story. The California recall has dominated the attention of the national media, and the Texas media has largely lost interest in the story – out of sight, out of mind. Without public attention to this story, the Republicans have all the leverage – if it does not cost them politically, it costs them nothing(8) to continue calling special sessions until the Texas 11 are forced to come home.

The second critical need is funding. The cost of hotels, meeting rooms, staff support, and public relations efforts is mounting. In addition, the Senators must defend themselves legally against Republican efforts to compel their return, while also filing legal claims against the Republican power play. The Senators are actively raising money for the Texas Senate Democratic Caucus Fund to offset these costs and prepare themselves for a stay of indefinite duration in Albuquerque.

Notes

1. A recent Department of Justice investigation chronicled Republican state officials’ illegal attempts to use federal resources – including anti-terrorism resources from the Department of Homeland Security – to compel the Democratic lawmakers’ return. See http://www.washingtonpost.com/wp-dyn/articles/A51520-2003Aug12.html for a news report on the Justice Department investigation, or http://www.usdoj.gov/oig/special/03-08a/final.pdf for a copy of the complete Justice Department report.
2. At a cost to taxpayers of over $1.5 million per session.
3. House Republicans passed a redistricting bill in the special session despite an outpouring of public opposition in hearings across the state. All 12 Democratic state senators opposed the plan, along with Republican state senator (and former Lieutenant Governor) Bill Ratliff.
4. The “2/3 rule” requires the Senate to reach broader consensus on difficult issues than a simple majority vote. It is a combination of official Senate rules and tradition. The rules of the Senate require a 2/3 vote to suspend the “regular order of business” to consider a bill that is not the first bill on the Senate calendar. By tradition, the Senate has always placed a “blocker bill” at the top of the Senate calendar, so that every bill requires a suspension of the regular order of business to be considered. The process requires compromise and consensus to achieve a 2/3 majority on each bill. One Texas insider has said that the 2/3 rule is “what separates us from animals.”
5. In fact, the Governor and Lt. Governor attempted to “surprise” the Senators by calling the second special one day early and “trap” them in the Senate Chamber. The Senators were able to escape the Capitol with literally minutes to spare.
6. Republican party activist Grover Norquist, head of the Washington D.C.-based Americans for Tax Reform, was quoted as follows in the August 17 Fort Worth Star Telegram: “Republicans will hold the House for the next decade through 2012 if Texas redistricts. It depresses the hell out of the Democrats and makes it doubly impossible to take the House and probably depresses their fund raising. Anything that helps strengthen the Republican leadership helps DeLay become speaker someday if he wants it.”
7. Established in the landmark case Baker v. Carr, 369 U.S. 186 (1962)
8. Notwithstanding the millions of dollars it is costing taxpayers.

Read more at Google News.

I have no interest in hearing politicians or would-be politicians speak. People’s political voting records speak for themselves, and are easily accessible online, which is why I’ll never support Gephardt or Lieberman for Democratic presidential candidate. Rather than travel north, we need to travel south – take the fight to Bush and his fellow ‘publicans.

When I see a growing movement in this country to literally decimate the multi-party system, to turn government over to big business, and the worst of big business – oil, aluminum, Ashcroft – then I realize that this country’s in the midst of a war, and it has nothing to do with Iraq. Or perhaps, ultimately, everything to do with Iraq.

If the Republicans have nothing to fear, then why are they redistricting now against established practices. If the Republicans have nothing to fear, why are they trying to force dully elected leaders out of office to sneak aging inexperienced actors in. If the Republicans have nothing to fear, then why don’t they try fighting fairly for once.

Read. Act. Now.

Categories
RDF Writing

Practical RDF-Generating giggles around the world

Practical RDF has now been immortalized in a comic strip.

Achewood

Hey! I love black licorice!

Categories
RDF

Jena Week: Migrating the first example

Recovered from the Wayback Machine.

(Note: all examples are compiled and run on a Windows 2000 box, MySql 4.x, Java 1.4.1_01)

I downloaded and unzipped the Jena2 from the SourceForge project and first thing I noticed is that there is a lot of material with this download. With the classes for the ontology support as well as RDF, this is a large Java framework, providing support for all aspects of RDF and OWL, including an inferential engine, the ‘reasoner’.

The second thing I noticed is that the documentation for Jena2 is sketchy at best, with the tutorial still set for Jena 1.4, some migration guides, and the ubiquitous Javadocs. But hey! We all know that Java is self-documenting with Javadocs, so we don’t need to stinkin’ tutorials and user manuals. Besides, tutorials are for babies.

Seriously, the generated Java documentation, installation and migration guides, and the essential Jena Mini I/O are enough if you’ve worked with Jena previously. If not, hopefully the essays this week, migrating the Jena applications in the book to Jena2 will provide a good start in your efforts.

(If all goes well, next week we’ll work with the ontology classes and all of the other new Jena2 goodes. )

Once installed, I added all of the Jena jar files to my classpath, per the README document in the root directory. I then tested the installation using the test.bat file, but I could have used Ant, or used test.sh within a Unix environment. Once tested, second step was to start porting the first example Java application, reproduced here as a guide:

import com.hp.hpl.mesa.rdf.jena.mem.ModelMem; import com.hp.hpl.mesa.rdf.jena.model.*; import com.hp.hpl.mesa.rdf.jena.common.PropertyImpl; import java.io.PrintWriter;

public class pracRDFFirst extends Object {

public static void main (String args[]) { String sURI = “http://burningbird.net/articles/monsters1.htm”; String sPostcon = “http://www.burningbird.net/bbd/elements/1.0/”; String sRelated = “related”; try { // create an empty graph Model model = new ModelMem();

// create the resource Resource postcon = model.createResource(sURI);

// create the predicate (property) Property related = model.createProperty(sPostcon, sRelated);

// add the properties with associated values (objects) postcon.addProperty(related, “http://burningbird.net/articles/monster3.htm”); postcon.addProperty(related, “http://burningbird.net/articles/monster2.htm”);

// Print RDF/XML of model to system output model.write(new PrintWriter(System.out));

} catch (Exception e) { System.out.println(“Failed: ” + e); } } }

This example is pretty simple: create an in-memory model, a new resource, and add two properties to that resource, both with the predicate “related”. Absolute URIs are used, and once the model is built, it’s printed out to the system. General exceptions are captured and the error message is printed. No other error checking and management is done.

The first step in migrating this example is to change the existing class structure to the new refactored one:

    * com.hp.hpl.mesa.rdf.jena.model -> com.hp.hpl.jena.rdf.model
    * com.hp.hpl.mesa.rdf.jena.vocabulary -> com.hp.hpl.jena.vocabulary

This is a bit tricky at first because not only is ‘mesa’ removed, the jena.rdf reference is reversed. Another change is the fact that there no longer is a specific ModelMem class or a specific PropertyImpl implementation class. This simplifies the number of Java classes that are included:

import com.hp.hpl.jena.rdf.model.*;
import java.io.FileOutputStream;
import java.io.PrintWriter;

The actual code of the application doesn’t change drastically. We’re using a class factor rather than new, but creating the resource and adding the properties doesn’t change:


import com.hp.hpl.jena.rdf.model.*;
import java.io.FileOutputStream;
import java.io.PrintWriter;

public class pracRDFFirst extends Object {
public static void main (String args[]) { String sURI = “http://burningbird.net/articles/monsters1.htm”; String sPostcon = “http://burningbird.net/postcon/elements/1.0/”; String sRelated = “related”; try { // create an empty graph Model model = ModelFactory.createDefaultModel();
// create the resource Resource postcon = model.createResource(sURI);
// create the predicate (property) Property related = model.createProperty(sPostcon, sRelated);
// add the properties with associated values (objects) postcon.addProperty(related, “http://burningbird.net/articles/monster3.htm”); postcon.addProperty(related, “http://burningbird.net/articles/monster2.htm”);

Once the model is built, to print it out with Jena, I used to use Jena’s Writer. In Jena2, this is replaced with InputStream and OutputStreams, a change significant enough for the Jena team to put out wht they call a “Rush Guide – Jena 1 Migration (Must Read)”.

According to the guide:

The Jena1 developer will note that all but one of these methods are new in Jena2. Jena1 mistakenly required the use of java.io.Reader and java.io.Writer. While these classes work well on a single machine, the way they address character encoding problems differs significantly from the solution offered by XML. A typical use of the Jena1 input interface such as mdl.read(new FileReader(fName)); is incorrect, and will give the wrong results if the file contains non-ASCII data. Also, in Jena1, mdl.write(new FileWriter(fName)); wrote incorrect XML for non-ASCII data (now fixed). However, these two bugs in Jena1 canceled each other out, as long as the system doing the reading had the same default character encoding as the one doing the writing, which is why it did not bite in a typical development environment. There is the substantial migration task when porting Jena1 code to Jena2 code of reviewing all the I/O calls and changing them to use InputStream’s and OutputStream’s.

Now, this is my kind of technical description, …which is why it did not bite in a typical development environment…. According to the guide, the old methods are still supported, and can still be useful and I found this so when I compiled the application without making the I/O change. However, Jena now traps for the bugs mentioned in the description and issues errors – errors that are almost guaranteed to occur.

You can still use Reader and Writer, but do so when you’re working with StringBuffer in memory, or when you specifically control the string encoding. Otherwise – go with the new OutputStream/InputStream objects. Only problem is, according to the Rush I/O guide example, to access the new OutputStream class, RDFWriter, use getRDFWriter. This was a typographical error, and to get RDFWriter, use getWriter on the model object, passing in an optional string with the serialization language. The default serialization language, RDF/XML, works so we don’t need to pass in the string.

The change to the code to use RDFWriter in the updated application is (outputting to System.out):

          
// Print RDF/XML of model to system output
          RDFWriter writer = model.getWriter();
          writer.write(model, System.out, null);

Easy enough to change. The complete new tiny application that creates an RDF model with one resource and a repeating property, printed out to system is:

import com.hp.hpl.jena.rdf.model.*;
import java.io.FileOutputStream;
import java.io.PrintWriter;

 

public class pracRDFFirst extends Object {

public static void main (String args[]) { String sURI = “http://burningbird.net/articles/monsters1.htm”; String sPostcon = “http://burningbird.net/postcon/elements/1.0/”; String sRelated = “related”; try { // create an empty graph Model model = ModelFactory.createDefaultModel();

// create the resource Resource postcon = model.createResource(sURI);

// create the predicate (property) Property related = model.createProperty(sPostcon, sRelated);

// add the properties with associated values (objects) postcon.addProperty(related, “http://burningbird.net/articles/monster3.htm”); postcon.addProperty(related, “http://burningbird.net/articles/monster2.htm”);

// Print RDF/XML of model to system output RDFWriter writer = model.getWriter(); writer.write(model, System.out, null);

} catch (Exception e) { System.out.println(“Failed: ” + e); } } }

Compiling the application and running it gives us the following serialized RDF/XML:

<rdf:RDF
    xmlns:j.0="http://burningbird.net/postcon/elements/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
  <rdf:Description rdf:about="http://burningbird.net/articles/monsters1.htm">
    <j.0:related>http://burningbird.net/articles/monster3.htm</j.0:related>
    <j.0:related>http://burningbird.net/articles/monster2.htm</j.0:related>
  </rdf:Description>
</rdf:RDF>

That’s it, an application that compiles and runs within Jena2, and a remarkably pain free migration. Of course, this was a small application. Next essay in this series, we’ll start looking at slightly more complicated applications. I’m sure the headache factor of the migration will increase as the complications in the applications increase. Isn’t there a law saying this is so?