Categories
RDF

Jena Week: final examples

Recovered from the Wayback Machine.

I converted the rest of the Jena1 examples to Jena2 without any major reworking being necessary. At the end of this post is a zipped file of all of the Java source that you can download, use to start your own explorations.

In Example 7, reading in an RDF/XML file in is no different with Jena2 than it was with Jena1. The examples don’t change (other than class structure and creating the memory model using the factory object), except that iterating through statements using StmtIterator exhibits better Java behavior now. StmtIterator now returns an Object when you use next rather than a Statement, and you’ll need to cast it. Or you can use the new nextStatement function call:

// next statement in queue
Statement stmt = iter.nextStatement();

Examples 8 and 9 work against graphs/models persisted to a relational database. I used MySQL in Windows 2000 to test the examples, but you can also use Oracle or other supported database systems.

There have been some significant changes, for the better, with using a relational data model for persistence in Jena2. For instance, you don’t have to specify a storage type or preformat the storage as you did with Jena1; this is all automated in the new classes, by passing in the type of database when you create the model. Another change is that you don’t use the RDBModel.create method, which is deprecated – you can use a new class, ModelMaker, or you can call the static function, createModel.

In the following, the driver is loaded, a connection is established and a model created. Once created, a serialized RDF/XML graph is read.

// load driver class
Class.forName(“com.mysql.jdbc.Driver”).newInstance();

// establish connection – replace with your own conn info
Connection con = DriverManager.getConnection(sConn, sUser, sPass);
IDBConnection dbcon = new DBConnection(con, “MySQL”);

ModelRDB model = ModelRDB.createModel(dbcon, “one”);
model.read(sUri);

Check the documentation for Jena2, and in the DB directory, you’ll find a discussion on migrating Jena1 databases to Jena2, as well as a good description of these changes, and example code.

One interesting aspect of storing Jena within a relational database, especially as it relates to previous postings, is whether Jena2 maintains a reference to the actual source of the external data, and from what I can see, it does not.

Within Jena, you create a graph (termed a model in Jena) and can load many serialized sub-graphs (individual RDF/XML files) into it, or add statements directly using the API. I did so, loading in several FOAF files from people I know. I then looked through the data to see if the source of the sub-graph, the actual file, was maintained and couldn’t find anything.

Once the sub-graphs are merged into one graph, all blank nodes are resolved, and any traces of their separate natures are not maintained. This is proper behavior for RDF according to the RDF specifications, and this merging of sub-graphs is one of strengths of the RDF model.

Now, you can perform a little deductive work and find that a person’s properties have a specific blank node identifier, which is then the object of a “knows” predicate, which is then the property of another blank node identifier of another person with a given name – a bit of a fun challenge with RDQL – but there’s nothing I can see that identifies the source of the actual RDF/XML file, itself.

It could be among the information stored in the BLOB that makes up the graph’s name, but the only way to know this for sure is to examine the contents of BLOB itself, or to find a specific class that allows us to interrogate this data. However, that breaks into new territory not covered in the book examples, and best left for further essays.

Download file

Categories
Just Shelley

You know you should buy a lottery ticket when…

Recovered from the Wayback Machine.

You’re at the Department of Motor Vehicles, renewing your license plate tags, when outside a car whose brake wasn’t set correctly starts rolling towards your little golden girl, picking up speed as it rolled downhill only…

…only to hit a truck that had just pulled into the parking spot next to you, driven by a man who didn’t see the car coming.

Fate: 0 Golden Girl: 1

gg.jpg

Categories
Photography

Starry starry night

This week Mars is closer to our planet than at any other time in the last 60,000 years. In anticipation of a couple of night time field trips this week to see the ruby beauty, I spent the day yesterday with my telescope trying to figure out how to use the star/planet automatic tracking system. I can operate and maintain most types of computers, was first in my class in electronics in college, and can even program a VCR — you would think I could figure out how to program the telescope, wouldn’t you?

My mother gave me the telescope for Christmas two years ago. I’d been eying them for years, but just couldn’t bring myself to plunk down the money. I’d never told my mother I wanted a telescope — she just thought they’d make good presents, and sent one to me.

When I was in San Francisco, I used the telescope to look from my apartment out onto the harbor at the boats and the birds, and once seeing a shark attack a pelican, but I didn’t use it at night. I felt that people might misconstrue it’s use at night.

After I moved to Missouri, I’ve used it to look at and take photos of the moon, but this week is the first I’ve tried to use the automated features of the beasty, to faciliate my Mars viewing experience. Last night out on the back porch in 96+ F (in Celsius, “hot”) degree weather, I spent a happy hour training the telescope so that I can have it automatically find objects for me, and then track them once fixed. I viewed constellations and what might have been Uranus, lost in the heat haze and street light reflections. Unfortunately, light polution and a big tree blocked Mars, but tomorrow and Wednesday, I’ll move to more telescope friendly areas. To see Mars with my own eye, directly — what a wonder.

Thinking about people who love art but don’t necessarily love nature — I wonder if sometimes an artist isn’t more of a translator than anything else, interpreting the beauty of every day things for those who can’t see the beauty any other way. The artist is inspired to create art to inspire others who cannot be inspired by that which inspired the artist.

Who cannot be excited about seeing Mars directly, who cannot be moved by a night filled with stars or a full moon. Yet people will go into raptures about Vincent van Gogh’s masterpiece, Starry Night, and never spare a glance for a night sky unless its filled with neon and they have a martini in their hand.

Not van Gogh, though. I picture van Gogh, half mad, which is worse than being fully mad, pacing about at night because he can’t quiet the demons long enough to sleep. In one breathless, immortal moment, he lifts his head and looks out over the sleeping town below, and at the stars blazing in the heavens above on this crisp, cool night. In perfect clarity, he sees the glory of the stars, their truth, as they burned themselves into his soul and hence to his art, so that he may show those below him what they miss in their sleep and their sanity.

But I will refrain from falling into the trap of the inevitable by including the lyrics to Starry, Starry Night, though I do like the song. Besides, I know you’ve been humming it under your breath since you read the title.

moonshot.jpg

Categories
Diversity RDF

Accept

My roommate surprised me with a wonderful gift tonight, a movie I’ve been trying to find on DVD for a long time. The movie is “Mr. Baseball” with Tom Selleck. It wasn’t a popular movie, and I doubt you’ve heard of it. It’s also not especially ‘artsy’ but I still love it. *

I wish I could say that I identify with the lovely Aya Takanashi, but to no avail. Her gentle refined sense of acceptance sounds wonderfully peaceful, and is exceedingly elegant, but I never have been one to just roll with the punches. I’m not particularly elegant, either.

No I tend to identify more strongly with Jack, Mr. Baseball. Its not as if I chew tobacco, maintain a rigid inflexibility, have a hairy chest, and am rude to people in their own land, the defining symbols of the protagonist; it’s more a matter of having a strong sense of self, a streak of stubbornness and defensiveness, and not always to the good.

When I say, strong sense of self, this doesn’t mean that I’m not a team player, I can be. My problem, as it was Jack’s, is I tend to play in the wrong teams. And then I’m too stubborn to admit it.

I watched this movie tonight as I thought about some of the discussions I got into this week. Especially the discussions about RDF. This has not necessarily been a great week for my book on RDF/XML because it’s caught up in the very real wars between the XML ‘view source’ people, and those who support RDF and RDF/XML.

I spent two years working on the Practical RDF book, all the time maintaining one firm decision – it was not going to be a book for the Semantic Web adherents; it was going to be a book for just plain folks. For people like me. I lost some respect from the theoreticians with this approach. Not all, but some. I can name you about 20 long-time RDF adherants who could have done a better job covering the theory behind RDF and the Semantic Web.

My book also tends to fall between the cracks – too RDF/XML for some, not enough RDF for others. And the title doesn’t help: who ever heard of combining ‘Practical’ and ‘RDF’? The title itself generates laughter, sometimes with me, sometimes not.

However, I knew that if the Semantic Web is ever going to become real, it’s going to come about because of the same people who created today’s web, and this book is written for those people. Look in a mirror – that’s who created today’s web, and that’s where the Semantic Web of the future is coming from.

Lately, I’ve been spending considerable time with the Alpha Geeks, the P/E/A revolutionaries, and the XML view source people, and there’s just no return for me in this. Smart, dedicated, and too damn stubborn themselves, they’re good people and they make good team members. But they’re not my team. I’m not an Alpha Geek or a P/E/A revolutionary. I’m definitely not an XML view source person.

The technology is important to me, but it’s not a religion. If I support RDF/XML its because I want us to move on and do something with it. What’s more important to me is not that I win wars for RDF/XML; it’s that the technology is accessible and understandable to everyone, not just the Geeks.

I once thought that the disconnect between me and the Alpha Geeks was because they were primarily men, and I was a woman; sometimes the only woman. I realized today that I was wrong – in most cases gender has nothing to do with it. The disconnect is because we come from such different backgrounds, and our focus, interests, and talents are different.

Oh there’s a few pricks who get threatened by any woman smarter than a gerbil, You can recognize them – anytime a woman disagrees with them, they’re either being “hormonal” or “hysterical”. And as we’ve discussed, time and time again, men and women play together differently. But for most of the Alpha Geeks, gender really isn’t the issue. Passion, interest, and focus are, and in these we differ. The differences left me feeling like odd man out, making me defensive, but too damn stubborn to just get out, to realize I need to let go.

It was an epiphany for me, let me tell you. Kick in the pants time.

So, I’m making some changes, starting with closing down the Practical RDF weblog. I’m re-focusing on the …For Poets weblogs. They may not be for everyone, too poetic or wordy by far for many of my Alpha Geek friends and others, but I like them.

*And the noodle dinner scene cracks me up, every time.

Categories
Photography

Waiting for prosperity

Recovered from the Wayback Machine.

people waiting for the train silhouetted against Arch