Wednesday, December 20, 2006

TBC: Name Completion with Ctrl+Space

Learned another TopBraid Composer trick: when filling out form fields, you can type Ctrl+Space bar to do name completion, very handy. Of course dragging and dropping classes into the slot areas works as well.

Probably lots more tips waiting for me if I read the manual one day...

Friday, December 15, 2006

HowTo: Remember Your Power Chord

Not a semantic tech topic, but a note to self on how to be a better computer user and save much pain and anguish. A coworker rescued me last night when I had left my laptop's power chord in the office when returning to my hotel. I've done this a number of times, the worst case undoubtedly in 2003 when I discovered at the airport that I had left my power cable behind and had no time to retrieve it before making a 3+ week international journey. A great friend who had a key to my house dashed off, found the chord (amongst many similar chords), sped off to the airport and saved the day. I thought that would be enough to teach me never to forget my chord again... it wasn't.

But now, I think I've hit upon a nearly fool proof way to always remember it:
Pack the chord first.
Pack the chord before you pack up the laptop.
The risk is then that you might get distracted before packing the laptop itself. The obviously too lite computer bag is sure to remind you, so risk mitigated.

Wednesday, December 13, 2006

Class Labels & Window Wrangling

Learned some new tricks with TopBraid Composer and Eclipse.

When you create a new class or subclass in TBC, at the bottom of the wizard window there will be rdfs:label under the "Property" column and an empty cell in the "Initial Value" column. Check the rdfs:label checkbox and in the "Initial Value" column put {name}. This sets the default value for future class creations as well. {name} will automagically copy the class name into the rdfs:label field after you click "Ok".

Somehow I managed to make my "Classes" window a tab of my "Navigator" window, and also managed to make my "Basket" window pane a tab within the pane to its left. Restoring the tab into a separate window pane is not intuitive. The way to do it is to hold down your left mouse button and drag the window to the edge of eclipse (left-right, or top-bottom) until a black arrow head appears. When this arrow head appears, you can release the mouse button and the window is returned as either a vertical split or horizontal split depending on where you dragged the window to. This also works in other places where you see tabs, such as for source files. Move a source tab in the same way and vertically split the pane, then seeing both windows side by side.

Friday, December 08, 2006

A Trisket, A Trasket, A Little Semantic Basket

Spent some time writing my first eclipse plug-in following the steps on the TopBraid Composer (TBC) Plug-in Development Guide, fun stuff! Plus I learned my new favorite eclipse command Ctrl+Shift+M which will automatically add the import for an unresolved class (keep your mouse over the class when hitting the sequence).

So I used the CreateInstanceAction skeleton and added my own JenaFu to find the resources I wanted from the loaded model, then printed the resources to System.out. It soon dawned on my that the snazier thing to do would be to send the resources to the "Basket" instead. Some inquiries to the TBC folks uncovered that the needed BasketView class was not exported from the jar in TBC 1.3, but they did export it in the 1.4 release that came out today. Thanks guys!

The tweaks needed:

import org.topbraidcomposer.ui.views.basket.BasketView;
:
IWorkbench wb = org.eclipse.ui.PlatformUI.getWorkbench();
IWorkbenchWindow wbw = wb.getActiveWorkbenchWindow();
IWorkbenchPage wbp = wbw.getActivePage();
:
try {
BasketView basket = (BasketView)wbp.showView("org.topbraidcomposer.ui.views.basket");
:
while (iter.hasNext) {
basket.add( (Resource)iter.next() );
}
:
}
catch(PartInitException ex) {
:
}

Some gotchas:

1) wb.getActiveWorkbenchWindow(); will return null if it is not invoked within a "UI Thread". So if these basket sending lines are in the "AbstractChange" class, or in another class that's called by the AbstractChange class, then you're in a UI Thread and it bombs.

2) code put after the TB.getSession().getChangeEngine().execute(change); will be executed before the line. Really.

3) you don't actually need the AbstractChange class and the corresponding TB...execute(change); line unless you've modified the loaded model.

4) if you do modify the model and want to send items to the basket, then invoke the TB...execute(change); line with an extra argument as per:

Runnable andThen = new Runnable() {
public void run() {
sendFoundStatementsToBasket();
}
};
TB.getSession().getChangeEngine().execute(change, andThen);

or with an anonymous runnable as the 2nd arg.

Sunday, November 26, 2006

del.icio.us dreams

It struck me today that I could use the "notes" field for annotation. For example, if I tag restaurants or parks that I want to visit, I can write my reviews of them later. A reminder to myself for whether or not I would want to return. Or I could also tag such sites with "good", "bad", but this is not expressive enough.

The notes field likely has some length limitation that wouldn't allow for much annotation, perhaps it can store a URL back to blog page that would have a more in-depth annotation.

What I'd really like from del.icio.us would be a way to relate tags with my own properties. While dreaming, why not go all the way and extend the tag editor to a full OWL class editor?

If you're going to dream, dream big. Time to look for the del.icio.us feedback form...

Monday, November 13, 2006

Early SPARQL Impressions

I postponed blogging this, then had to relearn this morning how I did it -shame!

Spent my first significant amount of time with SPARQL in the middle of last week and had to struggle with it a bit before getting the hang of it. I seem to get more (initially) out of struggling than reading through documentation -but will do that later for the advanced syntax.

TopBraid Composer has a decent SPARQL interface, very handy and has enough smarts that it is aware of local prefixes, they need not be specified via PREFIX. I wish it had a little more sanity checking though, it doesn't complain if you SELECT a variable that is never defined in the WHERE, it silently returns an empty list of results. Some of my typos got through in that way leading me to think I had malformed WHERE syntax.

I've got to find out what "." really means, right now I view it as a pipe where the result set from the first part of a condition are fed into the next. That is each successive predicate operates only on the set found by the preceding predicate. No space is needed after the "." and the end of the predicate string, and the dot after the final predicate is optional.

This took me a number of tries, How to find the rdfs:labels of instances of some subclass:

SELECT ?label
WHERE {
?sub rdfs:subClassOf foo:Bar .
?inst rdf:type ?sub .
?inst rdfs:label ?label
}

Which I read as bottom-to-top as "find all labels, of all instances, of all subclasses of foo:Bar". Or top-to-bottom as "find all subclasses of foo:Bar, then find all instances of the subclasses, then all the labels of the instances". Maybe there is a cdecl for SPARLQ.

The Jena SPARQL page has a tutorial along with a list to other tutorials.

Monday, November 06, 2006

First Post

The birth of the semantic web had Tim Burners Lee been a less than benevolent overlord and had an Emporer Palpatine / Darth Sidious split persona:


TBL: Syntactic Web.

Syntactic Web: Yes Master?

TBL: rrrrRRRiiiiIIIIIIiiiiissse.....