Tuesday Nov 27, 2007

Jazoon call for papers

Jazoon is a Java conference taking place in Zürich, Switzerland in the summer, June 23 - 26 2008 to be precise. The Jazoon conference committee has sent out a request for papers. My submission last year "Web 3.0, this is the semantic web" was very well attended. I also met some great folk such as Dean Allemang and Harold Carr. It is a smaller conference so you get more time to meet people than at JavaOne, but they also get some famous people to come along, such as Roy Fielding who gave a keynote presentation.

Anyway, the call for papers is up till the end of December. So hurry up to add your contribution.

I will put forward a talk on a Semantic Address Book that I submitted for this year's JavaOne. The good news there is that there have been at least three talks on the Semantic Web put forward for J1 this year that I directly know about, and indirectly I believe there are a lot more. I really hope that at least three of them will get accepted, which would make for a nice SemWeb track. Hey, there were two talks on the subject at Jazoon! There should be at least the following talks in my opinion at J1:

  • a talk to introduce the semantic web and reasoning - even if this touches only slightly on Java
  • a talk explaining how a real hyperdata application was written in Java
  • a panel on the current state and the future of semantic web tools on the Java platform.

I suppose I should also put something forward for JavaPolis... Anyone know what the deadlines are there?

Friday Nov 02, 2007

Vote for Java6 on Leopard!

As mentioned previously a lot of Java developers on OSX are upset at Apple's silence as to its intentions with respect to the release of Java 6. There used to be a developer preview available, which was pulled recently with no indication as to when a replacement would be available. People like me who upgraded in the hope of having the latest and greatest - which we have been very patiently waiting for over a year for - are very disappointed. It creates all kinds of annoyances, like not being able to run Java Tutorial examples. Some who are working on Java 6 projects cannot use their computer easily, without resorting to installation of a separate OS in a virtual machine, to do their job. We all like OSX: its a beautiful easy to use Unix that usually really helps us get our work done. I have been very happily using it since 2004.

The first solution of course is to have our voice heard. One way to do this is to file a bug with Apple. Please do this! The only problem I have with it is that as opposed to the Java bug database which is completely open, the Apple bug database is completely closed. So there's no real way of verifying how many people have posted a report. We must therefore complement that action with an equal Open action. Following the noble example given to us by Nova Spivack, when he asked for people to make their voice heard in support of the Burmese people and got some real results, let us do the same to help Apple make the right decision.
Anybody who would like to support this issue in the blogosphere, should help post a blog with the string


The first part of the string is the decimal notation for 0xCAFEBABE [1], the magic cookie for JavaClass files (thanks David for the number and the pointer to Fredericiana's photo). Then post similar instructions on your blog or point people here. Let's see how far this gets us! [2]

We should then be able to use any search engine, Google is a good choice, to search for this string [3], and hopefully motivate the managers at Apple to invest more time on Java and be more open about their plans with the community.

Your vote may also be an energizer to those groups that are starting to port the OpenJDK to OSX (via the mac java community).


  1. Oops I just noticed a mistake here. 13949712720901 in dec = 0xCAFEBABE405 in Hex. Even better. So that's CAFEBABE + the HTTP 405 Response, which means "Method not available". :-)
  2. If you know a foreign language then please translate the instructions and explanations so that more people can understand what is going on. Always post a link to some instructions. Language is a Virus, but it is most virulent when it is understandable and hyperlinked, of course.
  3. A search on Google Web returns more results - more than AllTheWeb or AltaVista - but Google Blog Search contains less duplicates. The real number of votes is somewhere between those two numbers, as some people are voting on their open source web sites, which are not always feed enabled. Simon is keeping count.
  4. Karussell is keeping a list of related articles.


Tuesday Nov 13: Landon Fuller has been able to get a very nice hello world GUI app running on OSX using the FreeBSD jdk1.6 port. It runs under X Windows only. Excellent work!

Nov 20th, 2007: Dave Dirbin publishes the first beta release of the open source java 6. This campaign has gathered 105 blog votes if we count the results from Google Blog Search, placing it easily among the top 10 bug reports at the Java Bug database. The Google web search returns 256 results, which will contain the blog search, many duplicate pages pointing to blogs + some extra votes people may have placed on the web. I guess that those extra votes may pop this bug report up to the top 5 position.

Wednesday Dec 19: Apple has put a developer preview of Java 6 up on Apple Developer Connection. It is nice to see things progress on that side. As a result of this conflict, Java development on OSX has become a lot richer, with an open source JDK starting to compete with the closed one from Apple. This can only be good for both, and for developer and customer confidence in the platform.

Monday Oct 29, 2007

JavaOne call for Papers Open

The 2008 Java One call for papers is now open, and the time period for submitting papers is on the way too short side. The call opened last Friday, and closes on November 16th!

This is an opportunity to talk to over 15 thousand developers and leaders in the Java community. At the last JavaOne I presented a Semantic Web Birds Of a Feather that was very well attended. It would be really great if there were some papers presented by some of the larger Java semantic web open source infrastructure projects such as Jena, Sesame or Mulgara, to just name some of the 256 java projects listed by AI3's sweet Tools. With 100% pure Java companies such as Radar Networks unveiling this year, the business interest should have seriously increased by the time we get to the conference, and so with it developer interest. Perhaps a sprinking of very cool client side applications to make the point of hyper data would also be a good idea.

Anyway. There is not much time!

Saturday Oct 27, 2007

Echo2: building Web 2.0 in Java

During some heated discussion on the Apple Java Dev mailing list as to why there still is not Java 6 available in Leopard, with some serious calls to port OpenJDK to OSX, Will Gilbert pointed to the Echo2 demo by Nextapp, which is written with a Java™ library. Here is what Will had to say:
I eventually found little known framework which blew my socks off with performance and seduced me with the source code I would be writing. It was Echo2 from NextApp.com. Fully open source and free. There is nice demo at:


Use the accordion pane to select the "Technology" panel, the click on the "Java Development" button you can see the source code, then run the app which is defined by the source. You will see an immediate similarity to AWT with a flavor of Swing.

I don't know if you have already committed to a development platform, if not, check out Echo2. More specifically take a look at the Echo2 fork which was done by some guys in Australia called Cooee at Karora.org. They took the Echo2 source, added a nice bug reporting system (JIRA), scheduled releases, and Maven repository support.

I you have Leopard, you now have Maven installed. You can run a archetype which I've been developing to create a runnable demo application. This archetype is underdevelopment and is likely to change.

From terminal run the following. Maven will install what it need and then create the application

% mvn archetype:create \\
-DarchetypeGroupId=org.karora.cooee.sandbox.informagen \\
-DarchetypeArtifactId=webapp \\
-DarchetypeVersion=1.0.0 \\
-DremoteRepositories=http://informagen.com/maven2 \\
-DgroupId=com.foo.bar \\
% cd xxxxx
% more readme.txt

Anyway, that is a really nice discovery that got my mind off my disappointment with the unavailability of even a preview of Java 6 on Leopard. This is an OSX release that otherwise has many very nice features. Here are some of my initial impressions:

  • The user interface is snappier
  • Spotlight finally works (It used to take forever to find things, and the user interface was terrible).
  • The Finder is very much improved. The nice big graphics previews helped me find a few videos I did not know I had. With the click of a space you can see the first page of a NeoOffice document. (NeoOffice is a free and excellent Office suite with the User Interface written in Java btw)
  • Spaces, the multi windowing environment, is dead beautiful, but broken. You can drag one web browser window from one virtual desktop to another with one simple gesture, but then when you want to switch between a number of web browser in different windows using alt-tab you usually end up in the original window. Using Expose keys does not help that much either. So you have to have all windows from one application on the same virtual window. You also don't get much choice for selecting your short cut keys, which means that you may have trouble with it interfering with other applications.
  • Netbeans 6 beta 2 works very well on Leopard. There have been some improvements to the graphics library in their new Java release which has broken IntelliJ and Eclipse though. NetBeans 6 by the way is getting to be really really good.
  • Matt Neuburg post some well illustrated criticisms on the new features in Leopard, which I agree with. The last point about the help windows being impossible get out of the foreground is, it is true, quite bizarre.
  • Some minor and not so minor bugs in The lame Leopard blog

But the final and best review is as usual John Siracusa's Ars Technica review. No marketing hype. Real facts, and good criticism.

Wednesday Oct 17, 2007

Java for iPhone by Feb 2008?

I just received this email as a response to a bug I had filed at Apple concerning Java's non presence on the iPhone.
(Hmm... Reading the message closely it does not say "Java" though, it just mentions an SDK... I wonder what kind of Software Development Kit they mean?)

Subject: Re: Bug ID 4918928: java on iphone

Dear Henry,

This is a follow-up to Bug ID# 4918928 . Apple has just announced via Apple HotNews an iPhone SDK will be made available to developers in February 2008.

------------------- http://www.apple.com/hotnews/ [no permalink it seems]

Third Party Applications on the iPhone Let me just say it: We want native third party applications on the iPhone, and we plan to have an SDK in developers’ hands in February. We are excited about creating a vibrant third party developer community around the iPhone and enabling hundreds of new applications for our users. With our revolutionary multi-touch interface, powerful hardware and advanced software architecture, we believe we have created the best mobile platform ever for developers.

It will take until February to release an SDK because we’re trying to do two diametrically opposed things at once—provide an advanced and open platform to developers while at the same time protect iPhone users from viruses, malware, privacy attacks, etc. This is no easy task. Some claim that viruses and malware are not a problem on mobile phones—this is simply not true. There have been serious viruses on other mobile phones already, including some that silently spread from phone to phone over the cell network. As our phones become more powerful, these malicious programs will become more dangerous. And since the iPhone is the most advanced phone ever, it will be a highly visible target.

Some companies are already taking action. Nokia, for example, is not allowing any applications to be loaded onto some of their newest phones unless they have a digital signature that can be traced back to a known developer. While this makes such a phone less than “totally open,” we believe it is a step in the right direction. We are working on an advanced system which will offer developers broad access to natively program the iPhone’s amazing software platform while at the same time protecting users from malicious programs.

We think a few months of patience now will be rewarded by many years of great third party applications running on safe and reliable iPhones.


P.S.: The SDK will also allow developers to create applications for iPod touch.

Monday Oct 15, 2007

Java Picture Editor

Over the past year I have found myself again and again using the free Java Image Editor from JH Labs, a company that seems to be doing a lot of interesting work in the java graphics area.

ImageEditor, starts much quicker than the Gimp, does not require X11, and has a modern look, as you can see from the snapshot I made, which integrates beautifully in OSX. It comes with a lot of filters, which are available in source code under an Apache licence. ( I have not really used them, to tell the truth)
Today I have been using it for the very simple task of editing a foaf icon. I had tried for hours to get X11 going after it got clobbered by an installation I made using fink, the open source distribution platform for OSX. What I now have keeps crashing after a few minutes of use. This is where Image Editor came to the rescue.

ImageEditor has quite a few limitations, other than it not being fully open source. I don't think it has more than one step undo for example. And some of the menus are a little obscure.

But what I really like about it is that it shows that you can build applications in Java that look as good as native OSX apps.

Friday Oct 05, 2007

Doap Bean available

I have just made the NetBeans Doap Bean available on the plugin portal. Just download onto your desktop and install in a version of NetBeans 6 (check Tools < Plugins in the menu)

This is the module I demonstrated at James Gosling's 'fun things' presentation on NetBeans day in San Francisco. I have updated the code to make it easy to understand for people who would wish to emulate and enhance it. It is easy to do that. Install the plugin, and go to the https://sommer.dev.java.net/ project. Then drag the blue button next to the URL

from your browser (I have checked that it works with Safari and Firefox on OSX) onto the DOAP button on the toolbar. This will fetch the information from the web page and pop up a window with a human readable representation of the RDF. This window should look like this:

window describing the so(m)mer project

Clicking on the other tabs will show you the original RDF/XML or an easier to read Turtle representation of the data. It is really important to show these tabs so that you can distinguish good from bad doap. Of course one can also go to the W3C Validator for an independent opinion.
In any case if the source code is available via a CVS or Subversion repository, you should be able to download it with just the click on the "download" button. (Make sure that NetBeans knows where your svn command line tool is though, by going to the menu Versioning &gr; Subversion > Checkout... )

If you want to try dropping other projects onto the button go to DoapSpace, they have put together a large collection of doap files for all the projects on SourceForge, Freshmeat and PyPi.

As I mention this is really only version 0.1 of the doap integration of Netbeans. Clearly one could do a lot more, such as:

  • Having it produce Doap for a project automatically
  • Tying it into NetBeans's Project panel
  • describing the relationships a project and others it depends on
  • Linking bug reports to information gleaned from the doap:bugdatabase relation
  • Perhaps see if one can set things up so that one can immediately find the javadoc online for a doap project one has information of
  • find a way to view source on a jar, by relating jars to source code repositories... (more difficult this one)
  • and a lot more...

Now you may wonder: How is one going to know that there is a doap link on some project's source page? Searching for the doap link seems a lot of work, right? Well to get an idea of how things will integrate you can install the Firefox Semantic Radar plugin, and go to the So(m)mer project again. You will then see displayed at the bottom of your browser an icon of square smiley faces, as shown on the following screenshot

semantic radar icon in Firefox

I should probably add this icon to the Doap button come to think of it...
The Doap button is in the So(m)mer repository, which is all published under the very generous BSD licence, so you are welcome to help out and add your own features... I may be having to work on a few other things next, so I won't be getting in your way :-)

Wednesday Oct 03, 2007

Turtle support for NetBeans 6

Yesterday I added NTriples support for NetBeans. Today it was the turn of Turtle, a notation for RDF that takes human writers into account, and that is carefully being looked after by Dave Beckett, who now works at Yahoo!, on some project which seems to be leading to employment opportunities . Of course making things simple for humans, makes things more complicated for the computer. But not so complex, that I did not get most of it done in one day.

Turtle makes things more readable because it allows one to

  • declare namespaces, so as not to have to constantly write out the URLs in full
  • declare a base url
  • use relative urls
  • some punctuation shorthands:
    • use "," when you have sentences that have the same subject and predicate but different objects
    • use ";" when you have sentences that have the same subject but different predicates and objects
  • [] for anonymous nodes (nodes you can't be bothered to give a URL to). You can place predicate object statements into the brackets, meaning that their subject is the anonymous node.
  • ( a b c ) shorthand for lists
Here for example is a section of my foaf file in Turtle:
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix : <http://bblfish.net/people/henry/card#> .

:me    a foaf:Person;
       foaf:depiction <http://farm1.static.flickr.com/164/373663745_1801c2dddf.jpg?v=0>;
       foaf:openid <http://openid.sun.com/bblfish> ;
       foaf:gender "male";
       foaf:birthday "07-29";
       foaf:title "Mr";
       foaf:family_name "Story";
       foaf:givenname "Henry";
       foaf:name "Henry J. Story";
       foaf:homepage <http://bblfish.net/>;
       foaf:schoolHomepage <http://www.bbk.ac.uk/phil/>,
       foaf:mbox <mailto:henry.story@bblfish.net>,
       foaf:nick "bblfish".
This is clearly much easier to read and to write that NTriples, but it hides somewhat the fact that everything is named by a URL.

There are again two main sections to the NetBeans Schliemann file (view the current version)

TOKEN:space:( [" " "\\t" "\\n" "\\r"]+ ) #unicodify
TOKEN:comment:("#" [\^ "\\n" "\\r"]\* ["\\n" "\\r"]+ )
TOKEN:bnode:( "_:" ["A"-"Z" "a"-"z" "0"-"9"]+ ) 
TOKEN:uriref:( "<" [\^ "<" ">" " " "\\t"]\* ">" ) #unicodify
TOKEN:string:( "\\"" [\^ "\\"" "\\n" "\\r"]\* "\\"" )
TOKEN:qname:(["A"-"Z" "a"-"z" "0"-"9"]\* ":" ["A"-"Z" "a"-"z" "0"-"9" "_"]+)
TOKEN:longString:("\\"\\"\\"" .\* "\\"\\"\\"" )
TOKEN:punct:(";" | "," | "." | "\^\^" )
TOKEN:integer:([ "+" "-"]? ["0"-"9"]+)
TOKEN:decimal:(["+" "-"]? ((["0"-"9"]+ "." ["0"-"9"]\*) | ( "." ["0"-"9"]+) )) # I leave out the decimals that can't be distinguished from integers 
TOKEN:exponent:(["e" "E"]["+" "-"]?["0"-"9"]+)
TOKEN:exists:("[" | "]")
TOKEN:list:( "(" | ")" )
TOKEN:prefix:("@base" | "@prefix")
TOKEN:prefixName:(["A"-"Z" "a"-"z"]["A"-"Z" "_" "a"-"z"]\* )
TOKEN:shortrels:("a" | "=")
TOKEN:lang:("@" ["A"-"Z" "a"-"z"]["A"-"Z" "a"-"z"]) #wrong but simpler

I have not yet filled in all the unicode special cases as I wanted to first make sure the main pieces would be working.

Then there is the grammar that goes with it.

S = ( Statement )\*;
Statement = ( Directive "."  ) | ( Triples  "."  ) ;
Directive = PrefixID | Base ;
PrefixID = "@prefix"  [ <prefixName> ] ":"  <uriref> ;
Base = "@base"  <uriref> ;
Triples = Subject  PredicateObjectList ;
#PredicateObjectList = ( Verb  ObjectList [";"] )+ ; #we have to force the ";" even though this is not necessary
PredicateObjectList = Verb  ObjectList More ; #Here it gets confused about whether the last ";" belongs here or below
More = (  ";"  Verb  ObjectList) \*; 
ObjectList = Object (  ","  Object )\* ;
Verb = Predicate | "a" | "=";
Subject = Resource | Blank ;
Predicate = Resource ;
Object = Resource | Blank | Literal ;
Literal = ( QuotedString [ <lang> ] ) | DatatypeString | <integer> | Double | <decimal> | <boolean> ;
DatatypeString = QuotedString "\^\^" Resource ;
QuotedString = <string> | <longString> ;
Resource = <uriref> | <qname>;
Blank = <bnode> | <exists,"["><exists,"]"> | <exists,"["> PredicateObjectList <exists,"]"> | Collection ;
Double = <integer> <exponent> | <decimal> <exponent> ;
Collection = <list,"("> [ ItemList ]  <list,")"> ;
ItemList = Object (  Object )\*;

The Grammar is a little different from Dave's official Turtle spec. For one I added the "=" sign as a tease. More importantly I ignore all blank spaces and all comments. It tried not to, but the parser in NBS only looks ahead by one token I think, so the white spaces was confusing it a lot. Removing them does not seem to be problematic, but only time will tell. I did this with the two lines:

More problematic was that I could not get the optional ending of sentences with ";" to work. In Turtle one can have sentences like
:me foaf:knows      [ a foaf:Person;
                   foaf:name "Tim Boudreau";
                   foaf:weblog <http://weblogs.java.net/blog/timboudreau/>
                                ] .
Notice how the last line does not need a semicolon as it is followed by a "]" which clearly closes the sentence too. But it is nice to be able to add the semicolon anyway, as it is one less thing for the programmer to worry about. But I could not get it to work. Following the Turtle spec I tried:
Triples = Subject  PredicateObjectList ;
PredicateObjectList =  Verb  ObjectList More [";"] ; 
More = (  ";"  Verb  ObjectList) \*;

But this confuses the parser, who does not know if the final ";" is the one at the end of the PredicateObjectList line, or at the beginning of the More line... So for the moment I decide not to allow extra semicolons....

Again since everything is built on URIs (and so also URLs) in RDF, it is nice to add functionality so that one can click on links. Just as in yesterday's demo, I added a line to the nbs file:

HYPERLINK:uriref: net.java.dev.sommer.editors.Turtle.hyperlink

And then wrote out a clearly more complicated Turtle.java class. This is more complicated because Turtle allows relative urls, and defines the base e in different parts of the document. Hacking the AST libraries I put something together that works well enough for me to be satisfied at having done a great days work, and having spent a great time here in Prague.

Tuesday Oct 02, 2007

working on NTriples support in Netbeans 6

In the last couple of days I have been learning about the very powerful Schlieman project. The result of the project is that one can now very simply create language support for NetBeans, and is what has allowed the very quick recent growth of a huge number of languages such as Groovy, Ruby, Prolog, Erlang, and many many others...

I did not take more than a day for me to get the basics for NTriples support done. NTriples is the simplest serialization of RDF. It is extremely explicit, one line per statement.

<SubjectURL> <PredicateURL> <ObjectURL> .
This is RDF at its purest. It is not very humanly writable, but it is easiest to understand. If you download cwm you can transform any rdf/xml into this format. For example you can transform my foaf file into NTriples like this:
hjs@bblfish:0$ cwm --rdf http://bblfish.net/people/henry/card --ntriples | head
<http://bblfish.net/people/henry/card> <http://www.iana.org/assignments/relation/alternate> <http://bblfish.net/people/henry/card.n3> .
<http://bblfish.net/people/henry/card> <http://www.iana.org/assignments/relation/alternate> <http://bblfish.net/people/henry/card.rdf> . 
<http://bblfish.net/people/henry/card> <http://xmlns.com/foaf/0.1/maker> <http://bblfish.net/people/henry/card#me> .
<http://bblfish.net/people/henry/card> <http://xmlns.com/foaf/0.1/primaryTopic> <http://bblfish.net/people/henry/card#me> .

So I now have basic syntax highlighting and clickability: i.e. you can control-hover of a URL, then click, and it will fetch a representation of that resource and open it in a browser. There is a lot more that can be done: if the representation were RDF it would be nice if it could be translated into NTriples and opened inside of NetBeans itself...

All of the source code is available under a BSD licence on the so(m)mer project. Download it with subversion from https://sommer.dev.java.net/svn/sommer/trunk. The project is in the misc/Editor directory. Once opened, just right click on the project and choose "Install/Reload in the development IDE". For debugging it is better to do this in the Target Platform IDE. Then you can open any ntriples extension file and get a little syntax highlighting.

The main tokenizer and grammar code itself is in the Ntriples.nbs file. As you can see it is split into token definitions

TOKEN:space:( [" " "\\t"]+ )
TOKEN:comment:( [" " "\\t"]\* "#" [\^ "\\n" "\\r"]\* ["\\n" "\\r"]+ )
TOKEN:bnode:( "_:" ["A"-"Z" "a"-"z" "0"-"9"]+ ) 
TOKEN:absoluteURI:( "<" [\^ "<" ">" " " "\\t"]+ ">" )
TOKEN:qliteral:( "\\"" [\^ "\\"" "\\n" "\\r"]\* "\\"" )
TOKEN:eol:(["\\n" "\\r"]+)
and a simple grammar
S = (Triple | BlankLine )\*;
BlankLine = Space <eol>;
Triple =   Space Subject <space> Predicate <space> Object Space "." Space <eol>;
Subject = UriRef | <bnode>;
Predicate = UriRef;
Object = UriRef | <bnode> | Literal ;
Literal =   <qliteral> [ <type,"\^\^"> UriRef ];
UriRef =  <absoluteURI>;
Space = (<space>)\*;

As you can see, this is an incredibly simple grammar for the most powerful of all languages. You can express anything in NTriples, clearly and distinctly, or even fuzzily if you wish to. Of course it is not very practical for human editing as it is. But for machine consumption it is excellent, and it compresses very very well as you can imagine. :-) Making it more human friendly will be the topic of my next blogs.

The Token processing comes first, so one has to be careful there not to create ambiguity for the parser. The reference for Schlieman is currently the Schliemann NBS Language Description Wiki page.

One can then add color information (and one could easily do a lot better than this)
COLOR:bnode: {
    foreground_color: "blue";

COLOR:qliteral: {
    foreground_color: "green";

COLOR:absoluteUri: {
    foreground_color: "blue";

COLOR:type: {
    foreground_color: "red";
Then finally I added hyperlink functionality by adding the line
HYPERLINK:absoluteURI: net.java.dev.sommer.editor.ntriples.HyperLink.hyperlink
I then wrote the very simple HyperLink.java class with the hyperlink(Context context) method. This was easy to do by following Geertjan's excellent hints.
public class HyperLink {

    public static Runnable hyperlink(Context context) {
        SyntaxContext scontext = (org.netbeans.api.languages.SyntaxContext) context;
        ASTPath path = scontext.getASTPath();
        ASTToken t = (ASTToken) path.getLeaf();
        String url = t.getIdentifier();
        if (url.startsWith("<"))
            url = url.substring(1);
        if (url.endsWith(">"))
            url = url.substring(0,url.length()-1);
        final String cleanUrl = url;
        return new Runnable() {

            public void run() {
                try {
                    org.openide.awt.HtmlBrowser.URLDisplayer.getDefault().showURL(new java.net.URL(cleanUrl));
                } catch (MalformedURLException ex) {
                    Logger.getLogger(HyperLink.class.getName()).log(Level.SEVERE, null, ex);

You will find Gertjan's blog to be a great source of information on how to get going with Schlieman and NetBeans programming in general. One very useful thing to help with writing a grammar and a parser is a debugging tool of course. To get this you need to open the Tools>Plugins menu and get the Generic Languages Framework Studio plugin. Once it is installed you will find in the Windows > Others menu an AST and Tokens submenu, which when clicked will open two very helpful views on the left of your editor you can see in the main image. This apparently only currently works on the latest developer release of NetBeans, but should be distributes standard with Netbeans beta 2 .

I will next try to add support from Turtle and N3, then it would be nice to add a more intelligent way of displaying linked to RDF files. I can think of quite a lot of different features here...

Tuesday Sep 18, 2007

M2N: building Swing apps with N3

At the Triple-I conference in Graz, I came across one very interesting demo by the M2N Intelligence Management company, where they showed a Development environment powered by N3, the powerful, easy to read notation for the Semantic Web. Using a Visual Editor that mapped UML diagrams to N3, instead of the usual limited and difficult to understand OMG MOF family of standards, we could see how one could build a complete User Interface application, including logic in a visual way. The same could be done manually in vi by editing the N3 directly, for those proficient enough. I think they describe parts of this very generally on their solutions page.

It is a pity that M2N does not open source this library, as that would allow one to get a better idea as to the advantages of doing things this way. Sebastian Schaffert - who works at a research company in Salzburg, and was looking at their demo with me - was quite enthusiastic about the idea. There was a lot one could do with such a tool, he thought, such as being able to SPARQL query one's user interface, test it for constraints, etc...

It would be nice to have some feedback from people who had used this on the pros and the cons of their implementation, or of the general idea.

Monday Sep 10, 2007

The Church of NetBeans

If there is anyone else who is close to being as homeless as me at Sun, it is certainly Tim Boudreau, who is now on a World Tour in a truck he bought for $1000. As he is the ultimate NetBeans evangelist, he painted up his car with the NetBeans logo, and will evangelise to whomever wants to hear the word :-) Read up on his story on his blog.

Tim is also a creative guitar player and song composer so don't hesitate to ask him to play you a song.
This reminds me of Timbuk 3's song "Reverend Jack and his Roamin Cadillac Church" (iTunes).

Come hell or high water
A soul's got to find some release
Some find it in power
And some in heavenly peace
Some look to the preacher
As he speaks from his holy perch
Me, I back Rev. Jack & his Roamin Cadillac Church
So if you're stuck at the station
On the road to the Glory on High
If you need some inspiration
He's got more than your money can buy
If you're lookin for salvation
Well my friend it's the end of your search
Here comes Rev. Jack & his Roamin Cadillac Church
Ain't no use watchin the road, son
When you ride in his automobile
Cause we're all back seat drivers,
& there's nobody at the wheel
Now for the well-to-do doctor
There's a home & a summer retreat
And for the jet-settin banker
There's a place in the social elite
But for the poor & the hungry
All the lost souls left in the lurch
There's just Rev. Jack & his Roamin Cadillac Church

Thursday Jul 12, 2007

java on the iPhone

According to Ed Burnette' misleadingly entitled post "Apple sneaks Java support onto the iPhone", a java virtual machine named Jazelle runs natively on the CPU that the iPhone is made from, and this feature is enabled on the processor. Apparently it is very small and very efficient, blatantly contradicting Steve Jobs' comments:

Jobs: “Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain.”
Java is available on every cell phone except his pretty much, on nearly every computer shipped, on robots, and credit cards... Presumably because nobody uses it. And now we find he would not even have to build it into the iPhone, as it is already written for that cpu - well perhaps Apple would have to do some work on the graphics libraries.
Perhaps it's not surprising that he would think this, given that he is surrounded by ObjectiveC programmers. On the other hand I have heard an interesting argument that this may be a way to entice various providers to start creating video streams in h.264 format...
Myself, I won't see the point of having such a phone if I can't have a good version of Java on it that is usable. I can wait.

Monday Jul 02, 2007

refactoring xml

Refactoring is defined as "Improving a computer program by reorganising its internal structure without altering its external behaviour". This is incredibly useful in OO programming, and is what has led to the growth of IDEs such as Netbeans, IntelliJ and Eclipse, and is behind very powerful software development movements such as Agile and Xtreeme programming. It is what helps every OO programmer get over the insidious writers block. Don't worry too much about the model or field names now, it will be easy to refactor those later!

If maintaining behavior is what defines refactoring of OO programs - change the code, but maintain the behavior - what would the equivalent be for XML? If XML is considered a syntax for declarative languages, then refactoring XML would be changing the XML whilst maintaining its meaning. So this brings us right to the question of meaning. Meaning in a procedural language is easy to define. It is closely related to behavior, and behavior is what programming languages do their best to specify very precisely. Java pushes that very far, creating very complex and detailed tests for every aspect of the language. Nothing can be called Java if it does not pass the JCP, if it does not act the way specified.
So again what is meaning of an XML document? XML does not define behavior. It does not even define an abstract semantics, how the symbols refer to the world. XML is purely specified at the syntactic level: how can one combine strings to form valid XML documents, or valid subsets of XML documents. If there is no general mapping of XML to one thing, then there is nothing that can be maintained to retain its meaning. There is nothing in general that can be said to be preserved by transformation one XML document into another.
So it is not really possible to define the meaning of an XML document in the abstract. One has to look at subsets of it, such at the Atom syndication format. These subset are given more or less formal semantics. The atom syndication format is given an english readable one for example. Other XML formats in the wild may have none at all, other than what an english reader will be able to deduce by looking at it. Now it is not always necessary to formally describe the semantics of a language for it to gain one. Natural languages for example do not have formal semantics, they evolved one. The problem with artificial languages that don't have a formal semantics is that in order to reconstruct it one has to look at how they are used, and so one has to make very subtle distinction between appropriate and inappropriate uses. This inevitably ends up being time consuming and controversial. Nothing that is going to make it easy to build automatic refactoring tools.

This is where Frameworks such as RDF come in very handy. The semantics of RDF, are very well defined using model theory. This defines clearly what every element of an RDF document means, what it refers to. To refactor RDF is then simply any change that preserves the meaning of the document. If two RDF names refer to the same resource, then one can replace one name with the other, the meaning will remain the same, or at least the facts described by the one will be the same as the one described by the other, which may be exactly what the person doing the refactoring wishes to preserve.

In conclusion: to refactor a document is to change it at the syntactic level whilst preserving its meaning. One cannot refactor XML in general, and in particular instances it will be much easier to build refactoring tools for documents with clear semantics. XML documents that have clear RDF interpretations will be very very easy to refactor mechanically. So if you are ever asking yourself what XML format you want to use: think how useful it is to be able to refactor your Java programs. And consider that by using a format with clear semantics you will be able to make use of similar tools for your data.

Thursday Jun 28, 2007

Jazoon: Web 3.0

Well over 100 people attended my Web 3.0 talk at the Jazoon conference in Zurich today, which covered the same topics as my JavaOne BOF (slides here). You can count them here in the picture which I took at the end of the talk.

The Jazoon conference is 1/17th of the size of JavaOne, so the attendance numbers were tremendous. As a comparison I had 250 people attended the JavaOne BOF. Had the same percentage of the JavaOne conference attended my talk, I would have had an audience of 110\*17=1770!

I had just about time to cover the slides in the 40 minutes allocated to me, so it was really great to have a follow on question and answer session which at least a third of the people remained for. Dean Allemang (blog) shared the space with me on the Q&A, and was able to bring his vast experience to bear. The attendees were thus able to get a quick overview of TopBraid Composer which Dean presented quickly in response to a question on tooling. Questions on security popped up, which allowed me to speak a little more about RDF graphs and quads, essential pieces of the Semantic Web story.

Friday Jun 01, 2007

Semantic Wonderland

Among the most impressive demos at JavaOne was the open sourced Project Wonderland[1] which James Gosling presented during his Toy show. It is a virtual world that grew out of project Looking Glass, the 2.5D Java Desktop that was unveiled a couple of years ago. The desktop has now been integrated into a full 3D world (or should it be 4D? space+time) where one can move around, meet people, work together on projects, etc...

It was not too difficult to get it to work on OSX (even though Apple is lagging with a 8 months old beta release of Java 6, grrrr!), by following the instructions on the main page, and reading the Java.net thread "Building Wonderland on MacOS" [2].

Once I got it started I noticed this billboard entitled "Knowledge Driven Hyperlinks: A Semantic Web Application". Really intriguing!

Apparently one gets the best out of wonderland by running it on Linux, as one can then interact with real X applications. The one that was most tested with OSX is Ubuntu Edgy, under BootCamp. A new version of Parallels has just come out though, that has OpenGL and DirectX graphics acceleration for Windows, so it may soon be possible to run Wonderland in Parallels using Ubuntu, and so get all the features, before making the leap to a full Linux OS again.

I am going to try one of these options out. This is going to be real fun! :-)


Saturday May 26, 2007

Answers to "Duck Typing Done Right"

I woke up this morning with a large number of comments to my previous post "Duck Typing Done right" . It would be confusing to answer them all together in the comments section there, so I aggregated my responses here.

I realize the material covered here is very new to many people. Luckily it is very easy to understand. For a quick introduction see my short Video introduction to the Semantic Web.

Also I should mention that the RDF is a declarative framework. So its relationship to method Duck Typing is not a direct one. But nevertheless there is a lot to learn by understanding the simplicity of the RDF framework.

On the reference of Strings

Kevin asks why the URI "http://a.com/Duck" is less ambigous than a string "Duck". In one respect Kevin is completely correct. In RDF they are both equally precise. But what they refer to is quite different from what one expects. The string "Duck" refers to the string "Duck". A URI on the other hand refers to the resource identified by it; URIs stand for Universal Resource Identifiers after all. The URI "http://a.com/Duck", as defined above, refers to the set of Ducks. How do you know? Well you should be able to GET <http://a.com/Duck> and receive a human or machine representation for it, selectable via content negotiation. This won't work in the simple examples I gave in my previous post, as they were just quick examples I hacked together by way of illustration. But try GETing <http://xmlns.com/foaf/0.1/knows> for a real working example. See my longer post on this issue GET my meaning?

Think about the web. Everyday you type in URLs into a web browser and you get the page you want. When you type "http://google.com/" you don't sometimes get <http://altavista.com>. The web works as well as it does, because URLs identify things uniquely. Everyone can mint their own if they own some section of the namespace, and PUT the meaning for that resource at that resource's location.

On Ambiguity and Vagueness

Phil Daws is correct to point out that URIs don't remove all fuzziness or vagueness. We can have fuzzy or vague concepts, and that is a good thing. foaf:knows (<http://xmlns.com/foaf/0.1/knows> ) whilst unambigous is quite a fuzzily defined relation. If you click on it's URL this is what you will get:

We take a broad view of 'knows', but do require some form of reciprocated interaction (ie. stalkers need not apply). Since social attitudes and conventions on this topic vary greatly between communities, counties and cultures, it is not appropriate for FOAF to be overly-specific here.

If someone foaf:knows a person, it would be usual for the relation to be reciprocated. However this doesn't mean that there is any obligation for either party to publish FOAF describing this relationship. A foaf:knows relationship does not imply friendship, endorsement, or that a face-to-face meeting has taken place: phone, fax, email, and smoke signals are all perfectly acceptable ways of communicating with people you know.

You probably know hundreds of people, yet might only list a few in your public FOAF file. That's OK. Or you might list them all. It is perfectly fine to have a FOAF file and not list anyone else in it at all. This illustrates the Semantic Web principle of partial description: RDF documents rarely describe the entire picture. There is always more to be said, more information living elsewhere in the Web (or in our heads...).

Since foaf:knows is vague by design, it may be suprising that it has uses. Typically these involve combining other RDF properties. For example, an application might look at properties of each foaf:weblog that was foaf:made by someone you "foaf:knows". Or check the newsfeed of the online photo archive for each of these people, to show you recent photos taken by people you know.

For more information on this see my post "Fuzzy thinking in Berkeley"


Paddy worries that this requires a Universal Class Hierarchy. No worries there. The Semantic Web is designed to work in a distributed way. People can grow their vocabularies, just like we all have grown the web by each publishing our own files on it. The Semantic Web is about linked data. The semantic web does not require UFOs (Unified Foundational Ontologies) to get going, and it may never need them at all, though I suspect that having one could be very helpful. See my longer post UFO's seen growing on the Web.

Relations are first class objects

Paddy and Jon Olson were mislead by my uses of classes to think that RDF ties relations/properties to classes. They don't. Relations in RDF are first class citizens, as you may see in the Dublin Core metadata initiative, which defines a set of very simple and very general relations to describe resources on the web, such as dc:author, dc:created etc... I think we need a :sparql relation that would relate anything to an authoritative SPARQL endpoint, for example. There clearly is no need to constrain the domain of such a relation in any way.

Scalability and efficiency

Jon Olson agrees with me that duck typing is good enough for some very large and good software projects. One of my favorite semantic web tools for example is cwm, which is written in python. When I say Duck Typing does not scale as implemented in those languages, I mean really big scale, like you know, the web. URIs is what has allowed the web to scale to the whole planet, and what will allow it to scale into structured data way beyond what we may even be comfortable imagining right now. This is not over engineered at all as Eric Biesterfeld fears. In fact it works because it gets the key elements right. And they are very simple as I demonstrated in my recent JavaOne BOF. The key concepts are:
  • URIs refer to resources,
  • resources return representations,
  • to describe something on the web one needs to
    • refer to the thing one wishes to describe, and that requires a URI,
    • second specify the property relation one wishes to attribute to it (and that also requires a URI)
    • and finally specify the value of that property.
That's it.


An anonymous writer mentions the "ugliness" of the syntax. This is not a problem. The semantic web is about semantic (see the illustration on this post) It defines the relationship of a string to what it names. It does not require a specific syntax. If you don't like the xml/rdf syntax, which most people think is overly complicated, then use the N3 syntax, or come up with something better.

On Other Languages

As mentioned above there need not be one syntax for RDF. Of course it helps in communication if we agree on something, and currently, for better of for worse that is rdf/xml.

But that does not mean that other procedural languages cannot play well with it. They can since the syntax is not what is important, but the semantics, and those are very well defined.

There are a number of very useful bindings in pretty much every language. From Franz lisp to the redland library for c, python, perl, ruby, to Prolog bindings, and many Java bindings such as Sesame and Jena. Way too much to list here. For a very comprehensive overview see Mike Bergman's full survey of Semantic tools.


I have received a huge amount of hits from reddit. Way over 500. If it is still on the top page when you read this, take the time to vote for it :-)

Friday May 25, 2007

Duck Typing done right

Dynamic Languages such as Python, Ruby and Groovy, make a big deal of their flexibility. You can add new methods to classes, extend them, etc... at run time, and do all kinds of funky stuff. You can even treat an object as of a certain type by looking at it's methods. This is called Duck Typing: "If it quacks like a duck and swims like a Duck then it's a duck", goes the well known saying. The main criticism of Duck Typing has been that what is gained in flexibility is lost in precision: it may be good for small projects, but it does not scale. I want to show here both that the criticism is correct, and how to overcome it.

Let us look at Duck Typing a little more closely. If something is a bird that quacks like a duck and swims like a duck, then why not indeed treat it like a duck? Well one reason that occurs immediately, is that in nature there are always weird exceptions. It may be difficult to see the survival advantage of looking like a duck, as opposed to say looking like a lion, but one should never be surprised at the surprising nature of nature.
Anyway, that's not the type of problem people working with duck typing ever have. How come? Well it's simple: they usually limit the interactions of their objects to a certain context, where the objects being dealt with are such that if any one of them quacks like a duck, then it is a duck. And so here we in essence have the reason for the criticism: In order for duck typing to work, one has to limit the context, one has to limit the objects manipulated by the program, in such a way that the duck typing falls out right. Enlarge the context, and at some point you will find objects that don't fit the presuppositions of your code. So: for simple semantic reasons, those programs won't scale. The more the code is mixed and meshed with other code, the more likely it is that an exception will turn up. The context in which the duck typing works is a hidden assumption, usually held in the head of the small group of developers working on the code.

A slightly different way of coming to the same conclusion, is to realize that these programming languages don't really do an analysis of the sound of quacking ducks. Nor do they look at objects and try to classify the way these are swimming. What they do is look at the name of the methods attached on an object, and then do a simple string comparison. If an object has the swim method, they will assume that swim stands for the same type of thing that ducks do. Now of course it is well established that natural language is ambiguous and hence very context dependent. The methods names gain their meaning from their association to english words, which are ambiguous. There may for example be a method named swim, where those letters stand for the acronym "See What I Mean". That method may return a link to some page on the web that describes the subject of the method in more detail, and have no relation to water activities. Calling that method in expectation of a sound will lead to some unexpected results
But once more, this is not a problem duck typing programs usually have. Programmers developing in those languages will be careful to limit the execution of the program to only deal with objects where swim stand for the things ducks do. But it does not take much for that presupposition to fail. Extend the context somewhat by loading some foreign code, and at some point these presuppositions will break down and nasty difficult to locate bugs will surface. Once again, the criticism of duck typing not being scalable is perfectly valid.

So what is the solution? Well it requires one very simple step: one has to use identifiers that are context free. If you can use identifiers for swimming that are universal, then they will alway mean the same thing, and so the problem of ambiguity will never surface. Universal identifiers? Oh yes, we have those: they are called URIs.
Here is an example. Let us

  • name the class of ducks
    <http://a.com/Duck> a owl:Class;
             rdfs:subClassOf <http://a.com/Bird>;
             rdfs:comment "The class of ducks, those living things that waddle around in ponds" .
  • name the relation <http://a.com/swimming> which relates a thing to the time it is swimming
     <http://a.com/swimming> a owl:DatatypeProperty;
                             rdfs:domain <http://a.com/Animal> ;
                             rdfs:range xsd:dateTime .
  • name the relation <http://a.com/quacking> which relates a thing to the time it is quacking (like a duck)
     <http://a.com/quacking> a owl:DatatypeProperty;
                             rdfs:domain <http://a.com/Duck> ;
                             rdfs:range xsd:dateTime .
  • state that an duck is an animal
     <http://a.com/Duck> rdfs:subClassOf <http://a.com/Animal> .
Now if you ever see the relation
:d1  <http://a.com/quacking> "2007-05-25T16:43:02"\^\^xsd:dateTime .

then you know that :d1 is a duck ( or that the relation is false, but that is another matter ), and this will be true whatever the context you find the relation in. You know this because the url http://a.com/quacking always refers to the same relation, and that relation was defined as linking ducks to times.
Furthermore notice how you may conclude many more things from the above statement. Perhaps you have an ontology of animals written in OWL, that states that Ducks are one of those animals that always has two parents. Given that, you would be able to conclude that :d1 has two parents, even if you don't know which they are. Animals are physical beings, you may discover by clicking on the http://a.com/Animal URL, and in particular one of those physical things that always has a location. It would therefore be quite correct to query for the location of :d1...
You can get to know a lot of things with just one simple statement. In fact with the semantic web, what that single statement tells you gets richer and richer the more you know. The wider the context of your knowledge the more you know when someone tells you something, since you can use inferencing to deduce all the things you have not been told. The more things you know, the easier it is to make inferences (see Metcalf's law).

In conclusion, duck typing is done right on the semantic web. You don't have to know everything about something to work with what you have, and the more you know the more you can do with the information given to you. You can have duck typing and scale.

Friday May 11, 2007

Semantic Web Birds of a Feather at JavaOne 2007

Nova Spivack, Lew Tucker, and Tim Boudreau joined me today in a panel discussion on the Semantic Web at Java One. Given that it was at 8pm and that we were competing with a huge party downstairs with free drinks, with robots fighting each other, with live bands, and numerous other private pub parties, the turnout of over 250 participants was quite extraordinary [1]. There was a huge amount of material to cover, and we managed to save 13 minutes at the end for questions. The line of questioners was very long and I think most were answered to the satisfaction of the questioners. It was really great having Nova and Lew over. They brought a lot of experience to the discussion, which I hope gave everyone a feel for the richness of what is going on in this area.

Since many people asked for the presentation it is available here.

[1] It was quite difficult to tell from the stage how many people were in the room, but a good one third of the 1200 room was full . 580 people had registered for the talk.

Tuesday May 08, 2007

Dropping some Doap into NetBeans

Yesterday evening I gave a short 10 minute presentation on the Semantic Web in front of a crowd of 1000 NetBeans developers during James Gosling's closing presentation at NetBeans Day in San Francisco.

In interaction with Tim Boudreau we managed to give a super condensed introduction to the Semantic Web, something that is only possible because its foundations are so crystal clear - which was the underlying theme of the talk. It's just URIs and REST and relations to build clickable data. (see the pdf of the presentation)

All of this lead to a really simple demonstration of an integration with NetBeans that Tim Boudreau was key in helping me put together. Tim wrote the skeleton of a simple NetBeans plugin (stored in the contrib/doap section of the NetBeans CVS repository), and I used Sesame 2 beta 3 to extract the data from the so(m)mer doap file that got dropped onto NetBeans. As a result NetBeans asked us were we wanted to download the project, and after selecting a directory on my file system, it proceeded to check out the code. On completion it asked us if we wanted to install the modules in our NetBeans project. Now that is simple. Drag a DOAP url onto NetBeans: project checked out!

This Thursday we will be giving a much more detailed overview of the Semantic Web in the BOF-6746 - Web 3.0: This is the Semantic Web, taking place at 8pm at Moscone on Thursday. Hope to see you there!

Wednesday Mar 21, 2007

Sun Tech Days, Paris

The second of the Sun Tech Days conference in Paris was more directly focused on Java. Under the Grande Arche de la Defense, Bruno Hourdel prided himself (photo) of the even better turnout for this even than the previous week's London one. Europe is an eternal competition between nations. Good for them. I think of myself as English, French and Austrian, even a little American, though my passport is British. So I don't take offense either way.

After Eric Mahe's opening welcome (photo), James Gosling came on stage to give an overview of the directions of the Java Platform. More on this in the next blog. This was followed by some really quick demos of which:

  • A revisited Pet Store example(photo) with an AJAX and dynamic html make over. I am starting to get the feeling that these things are getting stable enough that it may be worth learning, without having to spend one's life on it.
  • Romain Guy gave a quick overview of his extreeme Java Makeover (photo), which he showed a year ago. I wonder if it is open source yet? Romain is now an intern at Google. Hope he comes back to Sun soon.
  • A presentation of the small Java DB (photo)
  • And the lovely Pet Flower Store presentation by Doris Chen (photo)

I was busy taking pictures of the session so I did not quite capture every one's name. Please help me fill that out. Thanks.

I was not so good at attending the afternoon sessions. Instead I spend some time meeting people, such as the Solaris group, catching up on some questions I had. I'll be working harder on filling in my gaps at JavaOne. But now I really need to prepare my BOF. Sorry I won't be able to attend today's meetings.




« July 2016