The Sun BabelFish Blog Don't panic ! 2010-02-04T17:44:16+00:00 Apache Roller RDFa parser for Sesame bblfish 2009-09-09T10:39:42+00:00 2009-09-10T18:45:28+00:00 > How to setup Tomcat as a foaf+ssl server bblfish 2009-07-23T09:25:23+00:00 2009-07-24T10:01:29+00:00 <p><a href="">foaf+ssl</a> is a standards based protocol enabling one click identification/authentication to web sites, without requiring the user to enter either a username or a password. It can be used as a global distributed access control mechanism. It works with current browsers. It is RESTful, thereby working with <a href="">Linked Data</a> and especially linked foaf files, enabling thereby distributed social networks.</p> <p>I will show here what is needed to get foaf+ssl working for Tomcat 6x. The general principles are documented on the <a href="">Tomcat ssl howto page</a>, which should be used for detailed reference. Here I will document the precise setup needed for foaf+ssl. If you want to play with this protocol quickly without bothering with this procedure I recommend using the <a href="">foaf+ssl Identity Provider service</a> which you can point to on your web pages, and which will then redirect your users to the service of your choosing with the URLEncoded WebId of your visitor. </p> <p>foaf+ssl works by having the server request a client certificate on an https connection. The server therefore needs an https end point which can be specified in Tomcat by adding the following connector to the <code>conf/server.xml</code> file: <code> <pre> <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="50" scheme="https" secure="true" sslProtocol="TLS"/> </pre> </code> Note: the default https port is 443, but it requires root privileges. </p> <p>.(I found one for €15 at <a href="">trustico</a>.) Usually the CA's will have very detailed instructions for installing the cert for a wide range of servers. In the case of Tomcat you will end up with the following addition property values: </p> <code> <pre> <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="50" scheme="https" secure="true" <span class="xml_highlight"> </pre> </code> <p> And of course this requires placing the server cert file at the keystoreFile path.</p> <p> There are usually two ways for the server to respond to the client not sending a (valid) certificate. Either it can simply fail, or it can allow the server app to decide what to do. Automatic failure is not a good option, especially for a login service, as the user will then be confronted with a blank page. Much better is to allow the server to redirect the user to another page explaining how to get a certificate and giving him the option of authentication using OpenId or simply the well known username/password pattern. To enable Tomcat to respond this way you need to add the <code>Bruno Harbulot</a> put together the <a href="">JSSLUtils library available on Google Code</a>. As mentioned in the <a href="">JSSLUtils Tomcat documentation page</a> this will require you to place two jars in the Tomcat <code>lib</code> directory: jsslutils-0.5.1.jar and jsslutils-extra-apachetomcat6-0.5.2.jar (the version numbers may differ as the library evolves). You will also need to specify the SSLImplementation in the conf file as follows: </p> <code> <pre> <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="50" scheme="https" secure="true" keystoreFile="conf/yourServerCert.kdb" keystoreType="JKS" keystorePass="changeme" <span class="xml_highlight"> </pre> </code> <p> <a href="">that the browser can send any certificate (TLS 1.1)</a>. With the JSSLutils library available to Tomcat, this is specified in the <code>conf/server.xml</code> file with the <code>acceptAnyCert=true</code> attribute.</p> <code> <pre> <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="50" scheme="https" secure="true" keystoreFile="conf/yourServerCert.kdb" keystoreType="JKS" keystorePass="changeme" SSLImplementation="org.jsslutils.extra.apachetomcat6.JSSLutilsImplementation" <span class="xml_highlight"> </pre> </code> </p> <p>At this point you have set up your Apache Server correctly. A user that arrives at your SSL endpoint and that has a couple of certificates will be asked to choose between them. Your client code can the extract the certificate with the following code:</p> <code> <pre> X509Certificate[] certificates = (X509Certificate[]) request .getAttribute("javax.servlet.request.X509Certificate"); </pre> </code> <p>You can use these certificates then to extract the <a href="">WebId</a>, and verify the SSL certificates. I will write more about how to do this in my next blog post. </p> Adding twitter to my blog using Scala bblfish 2009-04-29T04:25:36+00:00 2009-04-29T18:39:29+00:00 <p>Having <a href="">added javascript widgets to my blog</a> a few months ago, I found that this slowed the page downloads a lot. Here is a way to speed this up again, by pre-processing the work with a Scala script, and using iFrames to include the result.</p> <p>Here are the short steps to do this: <ol><li>I wrote a <a href="">Scala Program</a> (<a href="">see source</a>) to take the twitter Atom feed, and generate xhtml from it. </li> <li>I wrote a shell script to run the compiled scala jar <pre> #!/bin/bash export CP=$HOME/java/scala/lib/scala-library.jar:$HOME/java/scala/lib/learning.jar /usr/bin/java -cp $CP learning.BlogIFrame $\* </pre> </li> <li>Then I just started a cron job on my unix server to process the script every half an hour <pre> $ crontab -l 5,36 \* \* \* \* $HOME/bin/twitter.sh $HOME/htdocs/tmp/blogs.sun.com/tweets.html </pre> </li> <li>Finally I added the iFrame to my blog here pointing to the produced html <code> <IFRAME src="" height="300" frameborder="0"></IFRAME> </code> </li> </ol> <p>As a result there is a lot less load on the twitter server - it only has to serve one atom feed every half an hour instead of 1000 or so a day - and my html blog page does not stall if the twitter site itself is overloaded. </p> <p>Also I learnt a lot about Scala by doing this little exercise.</p> I ♡ NetBeans 6.7 ! bblfish 2009-02-13T08:12:04+00:00 2009-02-26T02:27:23+00:00 <a href=""><img src="" align="right" alt="picture of NetBeans 7 Daily build 200902061401"/></a> <p>As I was developing <a href="">my recently released foaf+ssl server</a> to demonstrate how to create distributed secure yet open social networks, I stumbled across a <a href="">daily build</a> of NetBeans 7 (<a href="">build 200902061401</a>), that is stable, beautiful and that has really helped me get my work done. NetBeans 7 is really going to rock!</p> <p>Update: What I called NetBeans 7 <a href="">is now called NetBeans 6.7</a>.</p> <p>Here is a list of some of the functionality that I realy appreciated. <h3>Maven Integration</h3> <p>Haleluia for <a href="">Maven</a> Integration! I got going on my project by setting up a little <a href="">Wicket</a> project which I easily adapted to include the <a href="">Sesame</a> semantic web libraries and more (<a href="\*checkout\*/sommer/FoafServer/pom.xml?content-type=text%2Fplain&rev=450">view pom</a>). </p> <p>The nicest part of this is that it then becomes extreemly easy to link the source and the javadoc together. Two commands which should be integrated as menu options have finally made it possible for me to work with NetBeans. </p> <pre><code> # get the javadoc $ mvn dependency:resolve -Dclassifier=javadoc # get sources $ mvn dependency:sources </code></pre> <p> This simple thing just used to be a nightmare to do, especially as the number of jars one's project depended on increased. The Sesame group have split a lot of their jars up nicely, so that one could use subset of them, but the way NetBeans was set up it bacame a real huge amazing astounding pain to link those to the source. And what is an open source IDE worth if it can't help you browse the source code and see its documentation easily? </p> <p>Now I don't think Maven is in any way the final word in project deployement. My criticims in short is that it is not RESTful in a few ways, not least of which is that it fails to use URLs to name things and it makes the cache the central element. It is as if they had turned web architecture upside down web, where people would name things by trying to identify the caches in which they were located rather than their Universal Locator. My guess is that as a result things are a lot less flexible than they could be. As Roy Fielding pointed out recently <a href="">REST APIs must be hypertext driven</a>. Software is located in a global information space, so there is no good reason in my opinion to not follow this precept.</p> <p>Clearly though this is a huge huge improovement!</p> <h3>A better file explorer</h3> <p>I have sworn a few times at the previous versions of the NB file manager! Even more so when I had to use it to tie the javadoc to the source code - at that point it became a scream. Finally we have a command line File Explorer with tab completion. This is so beautiful I have to take a picture of it: <img src="" alt="file explorer"/> <p>We use the keyboard all the time, and one can get many things done much faster that way. Navigating the File System with a keyboard is just much nicer. So why oh why is it still impossible to use up and down arrow keys in the classic view when some files are greyed out? ( Writing this I noticed there seems to be no way to get back from the classic view to the new command line view - please make it possible to get back! ) </p> <h3>GlassFish 3 Integration</h3> <p>Well it is a real pleasure to work with a web server that loads a war in half a second. I use hardly any of the J2EE features so it's a good thing those don't get loaded.</p> <p>I tried the HTTP Server Monitor and that could be useful if it were more informative. In RESTful development it is really important to know the response codes 303, etc... so that one can follow the conversations between the client and the server. Currently that piece is trying to tie things up too much into baby steps: just as with the File Explorer there should be an easy UI into a feature and an advanced mode. I'd like to see the full pure unadulterated content going over the wire, highligted perhaps to make it easy to find things. (It turns out this has been filed as <a href="">feature request 36706</a>)</p> <p>GlassFish integration really helped me get my develop and deploy <a href="">my foaf+ssl service</a>.</p> <h3>User Interface</h3> <p>As you can see from the main picture the NetBeans UI seems to be going through a big transformation. Gone are some of the huge fat aqua buttons. The pieces are layed out in similar ways as in NB6.5, but this is a lot more elegant. A welcome change.</p> <p>There is a very useful search bar at the top right of NB 7 now, which prooved to be very helpful at finding documentation, maven repositories, and many other things. It prooved to be very helpful a couple of times in my project.</p> <p>One simple thing I would like would be to have a menu on each of the windows to open a file in its default OS viewer. So when I edit HTML which is a pleasure to do in NB, I would like to be able to quickly view that code in Firefox, Safari or Opera. Other XML files may have their default viewers, and so I think this is quite generalisable. In any case it should be easy to copy the file path of an open window, as one often has to do external processing of it. For files that are located on the internet, it would be great to be able to get their URL. This would help when chatting to people about source code one is working on for example.</p> <h3>Other</h3> <ul> <li>There are IntelliJ key bindings now. I really needed this a year or so ago, as I was switching between the IDEs. I have forgotten them now so it's less of a problem for me, but it will be very important for people switching between the IDEs.</li> <li>I think this was part of NB6, but being able to browse the local history of source code is a really great feature. (I noticed that this does not diff html or xml for the moment)</li> <li><a href="">Geertjan's</a> <a href="">Wicket integration Module</a> partly works on this daily build. You may require starting of with NB7 milestone 1 to get going as it seemed still to be fully functional there.</li> <li>I find this daily build needs restarting every day, as it seems to slow down after a while, perhaps using up a lot of memory.</li> </ul> <h3>Where is this going</h3> <p>Well those are the features that really stood out for me. And I am very happy to work with NB now.</p> <p>I still think that the next big step, for NB 8 perhaps, should be the <a href="">webification of the IDE</a>. I think there is a huge amount to gain by applying <a href="">Web Architecture principles</a> to an IDE, and then the <b>Net</b> in NetBeans would fully reveal it's meaning.</p> <p> ruby script to set skype and adium mood message with twitter on osx bblfish 2008-12-12T05:18:00+00:00 2008-12-12T13:31:44+00:00 <p>Twitter is a great way to learn many little web2.0ish things. I wanted to set the status message on my Skype and Adium clients using my last twitter message. So I found <a href="">a howto document</a> by <a href="">Michael Tyson</a> which I adapted a bit to add Skype support and to only post twits that were not replies to someone else - I decide there was just too much loss of context for that to make sense. </p> <code><pre> #!the unix crontab as explained in Michael's article</a>, and all is good.</p> <p>What can one learn with this little exercise? Quite a lot: <ul> <li>Ruby - this is my first Ruby hack <li>Atom - twitter uses an atom xml feed to publish its posts <li>unix crontab <li>AppleScript to send messages to all these silly OSX apps <li>vi to edit all of this, but that's not obligatory, you can use less viral ones <li>the value of reusing data accross applications </ul> So that's a good way to spend a little time when one has had a little bit too much to drink the night before. Hmm, is this what one calls <a href="">procrastination (video)</a>? </p> </p> foaf+ssl: a first implementation bblfish 2008-11-20T10:04:23+00:00 2009-02-15T15:09:28+00:00 <p>The first very simple implementations for the <a href="">foaf+ssl</a> protocol are now out: the first step in adding simple distributed security to the <a href="">global open distributed decentralized social network</a> that is emerging. </p> <p><i>Update Feb 2009: I put up a service <a href="">to create a foaf+ssl service in a few clicks</a>. Try that out if you are short on time first.</i></p> <p> The foaf+ssl protocol has been discussed in detail in a previous blog: "<a href="">FOAF & SSL: creating a global decentralised authentication protocol</a>", which goes over the theory of what we have implemented here. For those of you who have more time I also recommend my JavaOne 2008 presentation <a href="">Building Secure, Open and Distributed Social Network Applications</a>, which explains the need for a protocol such as this, gives some background understanding of the semantic web, and covers the working of this protocol in detail, all in a nice to listen to slideshow with audio. </p> <p>In this article we are going to be rather more practical, and less theoretical, but still too technical for the likes of many. I could spend a lot of time building a nice user interface to help make this blog a point and click experience. But we are not looking for point and click users now, but people who feel at home looking at some code, working with abstract security concepts, who can be critical and find solutions to problems too, and are willing to learn some new things. So I have simplified things as much as needs be for people who fall into that category (and made it easy enough for technical managers to follow too, I hope ). </p> <p>To try this out yourself you need just download the source code in the <a href="">So(m)mer repository</a>. This can be done simply with the following command line: </p> <pre><code> $ <font color="blue">svn checkout sommer --username guest</font> </code></pre> (leave the password blank) <p>This is downloading a lot more code than is needed by the way. But I don't have time to spend on isolating all the dependencies, bandwidth is cheap, and the rest of the code in there is pretty interesting too, I am sure you will agree. Depending on your connection speed, this will take some time to download, so we can do something else in the meantime, such as have a quick look at the uml diagram of the foaf+ssl protocol: </p> <a href=""><img src="" alt="foaf+ssl uml sequence diagram" align="center"/></a> </p> <p>Let us make clear who is playing what role. You are Romeo. You want your client - a simple web browser such as Firefox or Safari will do - to identify yourself to Juliette's Web server. Juliette as it happens is a semantic web expert and she trusts that if you are able to read through this blog, understand it, create your X509 certificate and set up your foaf file so that it publishes your public key information correctly then you are human, intelligent, avant-garde, and you have enough money to own a web server which is all to your advantage. As a result her semantically enabled server will give you the secret information you were looking for. </p> <p>Juliette knows of course that at a later time things won't be that simple anymore, when distributed social networks will be big enough that the proportion of fools will be large enough for their predators to take an interest in this technology, and the tools for putting up a certificate will come packaged with everyone's operating system, embedded in every tool, etc... At that point things will have moved on and Juliette will have <b>added</b> more criteria to give access to her secret file. Not only will your certificate have to match the information in your foaf file as it does now, but given that she knows your URL and what you have published there of your social graph, she will be able to use that and your position in the social graph of her friends to enabling her server to decide how to treat you.</p> <h3>Creating a certificate and a foaf file</h3> <p>So the first thing to do is for you to create yourself a certificate and a foaf file. This is quite easy. You just need to do the following in a shell.</p> <pre><code> $ <font color="blue">cd sommer/misc/FoafServer/</font> $ <font color="blue">java -version</font> java version "1.5.0_16" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284) Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing) $ <font color="blue">ant jar</font> </code></pre> <p>Currently one needs at least Java 5 to run this.</p> <p>Before you create your certificate, you need to know what your <a href="">foaf URL</a> is going to be. If you allready have a foaf file, then that is easy, and the following will get you going: </p> <pre><code> $ <font color="blue">java -cp dist/FoafServer.jar net.java.dev.sommer.foafserver.utils.GenerateKey -shortfoaf</font> Enter full URL of the person to identify (no relative urls allowed): for example: <font color="blue"></font> Enter password for new keystore :<font color="blue">enterAnewPasswordForNewStore</font> publish the triples expressed by this n3 # you can use use cwm to merge it into an rdf file # or a web service such as to convert it to rdf/xml # Generated by sommer.dev.java.net @prefix cert: <> . @prefix rsa: <> . @prefix foaf: <> . <> a foaf:Person; is cert:identity of [ a rsa:RSAPublicKey; rsa:public_exponent "65537"\^cert:decimal ; rsa:modulus """b6bd6ce1a5ef51aaa69752c6af2e71948ab6da 9e5a5f086dba7548d8b80150d392117d90138948062eec6ecb5745a45491eea03a46b0a1c2e6324d 54144f42cdaa05ca39939eb973086cfedc8e31641cf7f29abc58310dcb8e56d9e6dae2233a317167 74d1eb32ced152084cfb860fb8cb5298a3c0270145c5d878f07f6417af"""\^cert:hex ; ] . the public and private keys are in the stored in cert.p12 you can list the contents by running the command $ openssl pkcs12 -clcerts -nokeys -in cert.p12 | openssl x509 -noout -text </code></pre> <p>If you do then run the openssl command you will find that the public key components should match the rdf above. <pre><code> $ <font color="blue"> openssl pkcs12 -clcerts -nokeys -in cert.p12 | openssl x509 -noout -text</font> Enter Import Password: MAC verified OK Certificate: Data: Version: 3 (0x2) Serial Number: 1 (0x1) Signature Algorithm: sha1WithRSAEncryption Issuer: CN= Validity Not Before: Nov 19 10:58:50 2008 GMT Not After : Nov 10 10:58:50 2009 GMT Subject: CN= Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (1024 bit)<font color="green">)</font> X509v3 extensions: X509v3 Basic Constraints: critical CA:TRUE X509v3 Key Usage: critical Digital Signature, Non Repudiation, Key Encipherment, Key Agreement, Certificate Sign Netscape Cert Type: SSL Client, S/MIME X509v3 Subject Key Identifier: 85:CD:66:A3:F7:23:DA:42:4B:F6:44:A1:90:A8:FE:27:9E:55:64:FE X509v3 Authority Key Identifier: keyid:85:CD:66:A3:F7:23:DA:42:4B:F6:44:A1:90:A8:FE:27:9E:55:64:FE X509v3 Subject Alternative Name: <font color="green"> URI:</font> Signature Algorithm: sha1WithRSAEncryption a6:e0:3f:7c:cb:78:9b:f1:75:7f:62:ca:20:9e:a3:bb:87:61: 29:59:3f:b9:bb:70:c5:06:bd:9a:62:fc:98:32:b7:f4:8b:53: ca:69:fc:5e:01:6a:4c:d8:85:5c:b3:a1:84:ec:1c:d2:6f:a8: 0f:dd:c0:ff:9f:88:d2:84:8f:77:48:2e:f0:91:fb:2c:2a:22: 96:07:be:ce:b2:98:87:ee:40:bd:16:32:fa:11:55:fb:0f:96: fb:c4:f8:be:66:3f:98:fa:62:61:0b:2f:b5:02:98:97:53:35: b5:46:32:c4:38:01:4c:97:66:aa:79:40:1a:67:45:bd:a0:e1: 97:72 </code></pre> <p>Notice also that the X509v3 Subject Alternative Name, is your foaf URL. The Issuer Distinguished name (starting with CN= here) could be anything.<br/> This by the way, is the certificate that you will be adding to your browser in the next section. </p> <p>If you don't have a foaf file, then the simplest way to do this is to: <ol> <li>decide where you are going to place the file on your web server <li>decide what the name of it is <li>Put a fake file there named <code>cert.rdf</code> <li>get that file with a browser by typing in the full url there <li>your foaf url with then be <code></code> </ol> <p>Then you can use the following command to create your foaf file:</p> <pre><code> $ <font color="blue">java -cp dist/FoafServer.jar net.java.dev.sommer.foafserver.utils.GenerateKey</font> </code></pre> <p>That is the same as the first one but without the <code>-shortfoaf</code> argument. You will be asked for some information to fill up your foaf file, so as to make it a little more realistic -- you might as well get something useful out of this. You can then use either <a href="">cwm</a> or <a href="">a web service</a> to convert that N3 into rdf/xml, which you can then publish at the correct location. Now entering your url into a web browser should get your foaf file.</p> <h3 id="para_adding_cert+to_browser">Adding the certificate to the browser</h3> <p>The previous procedure will have created a certificate <b>cert.p12</b>, which you now need to import into your browser. The software that creates the certificate could I guess place it in your browser too, but that would require some of work to make it cross platform. Something to do for sure, but not now. On OSX adding certs programmatically to the Keychain application is quite easy. </p> <p>So to add the certificate to your browsers store, open up Firefox's preferences and go to the Advanced->Encryption tab as shown here </p> <img align="center" alt="Firefox 3.03 Advanced Preferences dialog" src=""/> <p> <p>Click on "View Certificates" button, and you will get the Certificate Manager window pictured here. </p> <img align="center" alt="Firefox 3.03 Certificate manager" src=""/> </p> <p>Click the import button, and import the certificate we created in the previous section. That's it.</p> <h3>Starting Juliette's server</h3> <p>In a few days time <a href="">Ian Jacobi</a> will have a python based server working with the <a href="">new updated certificate ontology</a>. I will point to that as soon as he has it working. In the mean time you can run Juliette's test server locally like this: </p> <pre><code> $ <font color="blue">ant run</font> </code></pre> <p>This will start her server on your computer on localhost on port 8843 where it will be listening on a secure socket. </p> <h3>Connecting your client to Juliette's server</h3> <p>So now you can just <a href="">go to</a> in your favorite browser. This is Juliette's protected resource by the way, so we have moved straight to step 2 in the above UML diagram.<p> <p>Now because this is a server running locally, and it has a secure port open that emits a certificate that is not signed by a well established security authority things get more complicated than they usually need be. So the following steps appea only because of this and so, to make it clear that this is just a result of this experiment, I have placed the following paragraph in a blue background. You will only need to do this the first time you connect in this experminent, so be weary of the blues.</p> <div style="background-color: #CCFFFF"> <p>Firefox gave me the following warning the first time I tried it.</p> <img align="center" alt="Firefox 3.03 certificate error dialog" src=""/> <p> This is problematic because it just warns that the server's certificate is not trusted, but does not allow you to specify that you trust it (after all, perhaps you just mailed you the public key in the certificate and you could use that information to decide that you trust the server). </p> <p>On trying again, shift reloading perhaps, I am not sure, I finally got Firefox to present me with the following secure connection failed page: </p> <img align="center" alt="Firefox 3.03 secure connection failed page" src=""/> <p> Safari had done the right things first off. Since we trust localhost:8843 (having just started it and even inspected some of the code ) we just need to click the "Or you can add an exception ..." link, which brings up the dialog below: </p> <img align="center" alt="Firefox 3.03 secure add exception page" src=""/> <p> They are trying to frighten users here of course. And so they should. Ahh if only we had a localhost signed certificate by a trusted CA, I would not have to write this whole part of the blog! </p>So of course you go there and click "Add Exception...", and this brings up the following dialog. </p> <img align="center" alt="Firefox 3.03 get Certificate dialog" src=""/> <p> So click "Get Certificate" and get the server certificate. When done you can see the certificate </p> <img align="center" alt="Firefox 3.03 get Certificate dialog" src=""/> <p>And confirm the security Exception. </p> </div> <p>Again all of this need not happen. But since it also makes clear what is going on, it can be helpful to show it. </p> <h3>Choose your certificate</h3> <p>Having accepted the server's certificate, it will now ask you for yours. As a result of this Firefox opens up the following dialog. </p> <img align="center" alt="Firefox 3.03 Server requesting Client Certificate" src=""/> <p>Since you only have one client certificate this is an easy choice. If you had a number of them, you could choose which persona to present to the site. When you click Ok, the certificate will be sent back to the server. This is the end of stage 2 in the UML diagram above. At that point Juliette's server ( on localhost ) will go and get your foaf file (step 3), and compare the information about your public key to the one in the certificate you just presented (step 4) by making the following query on your foaf file, <a href="">as shown in the CheckClient class</a>: <code><pre> TupleQuery query = rep.prepareTupleQuery(QueryLanguage.SPARQL, "PREFIX cert: <>" + "PREFIX rsa: <>" + "SELECT ?mod ?exp " + "WHERE {" + " ?sig cert:identity ?person ." + " ?sig a rsa:RSAPublicKey;" + " rsa:modulus [ cert:hex ?mod ] ;" + " rsa:public_exponent [ cert:decimal ?exp ] ." + "}"); query.setBinding("person", vf.createURI(uri.toString())); TupleQueryResult answer = query.evaluate(); </pre> </code> If the information in the certificate and the foaf file correspond, then the server will send you Juliette's secret information. In a Tabulator enabled browser this comes out like this: </p> <img align="center" alt="Firefox 3.03 displaying Juliette's secret info" src=""/> <p>The source code for all that is not far, and you will see that the algorithms used are very simple. This proves that the minimal piece, which is equivalent to what OpenID does, works. Next we will need to build up the server so that it can make decisions based on a web of trust. But by then you will have your foaf file, and filled up your social network a little for this to work. </p> <h3>Further Work</h3> <p>Discussions on this and on a number of other protocols in the same space is currently happening on <a href="">the foaf protocols</a> mailing list. You are welcome to join the <a href="">sommer project</a> to work on the code and debug it. As I mentioned <a href="">Ian Jacobi</a> has a public server running which he should be updating soon with the new certificate ontology that we have been using here.</p> <p>Clearly it would be really good to have a number of more advanced servers running this in order to experiment with access controls that add social proximity requirements.</p> <p>Things to look at: <ul><li>What other browsers does this work with? <li>Can anyone get this to work with <a href="">Aladdin USB e-Token keys</a> or similar tools? <li>Work on access controls that take social proximity into account <li>Does this remove the need for cookie identifiers on web sites? </ul> <p>I hope to be able to present this at the <a href="">W3C Workshop on the Future of Social Networking</a> in January 2009.</p> Serialising Java Objects to RDF with Jersey bblfish 2008-09-24T08:31:08+00:00 2008-11-20T09:48:27+00:00 <p><a href="">Jersey</a> is the reference implementation of <a href="">JSR311 (JAX-RS)</a>. </p> <p <a href="">So(m)mer</a>'s <code>@rdf</code> annotation one can remove remove the hurdle of having to create yet another format, and do this in a way that should be really easy to understand. </p> <p>I have been wanting to demonstrate how this could be done, since the JavaOne 2007 presentation on Jersey. Last week I finally got down to writing up some initial code with the help of <a href="">Paul Sandoz</a> whilst in Grenoble. It turned out to be really easy to do. Here is a description of where this is heading. </p> <h3>Howto</h3> <p>The code to do this <a href="">available from the so(m)mer subversion repository</a>, in the <code>misc/Jersey</code> directory. I will refer and link to the online code in my explanations here. </p> <h4>Annotate one's classes</h4> <p <a href="">Person class</a> can be written out like this: <code><pre> @rdf(foaf+"Person") public class Person extends Agent { static final String</a>"; >(); .... } </pre></code> <p) </p> <h4>Map the web resources to the model</h4> <p>Next one has to find a mapping for web resources to objects. This is done by subclassing the <a href="">RdfResource<T></a> template class, as we do three times in the <a href="">Main class</a>. Here is a sample: </p> <code><pre> @Path("/person/{id}") public static class PersonResource extends RdfResource<Employee> { public PersonResource(@PathParam("id") String id) { t = DB.getPersonWithId(id); } } </pre></code> <p>This just tells Jersey to publish any Employee object on the server at the local <code>/person/{id}</code> url. When a request for some resource say <code>/person/155492</code> is made, a PersonResource object will be created whose model object can be found by querying the DB for the person with id 155492. For this of course one has to somehow link the model objects ( <code>Person</code>, <code>Office</code>,... in our example ) to some database. This could be done by loading flat files, querying an ldap server, or an SQL server, or whatever... In our example we just created a <a href="">simple hard coded java class that acts as a DB</a>. <h4>Map the Model to the resource</h4> <p> An object can contain pointers to other objects. In order for <a href="">the serialiser</a> to know what the URL of objects are one has to map model objects to web resources. This is done simply with the static code in the same <a href="">Main class</a> [ looking for improovements here too ] <code><pre> static { RdfResource.register(Employee.class, PersonResource.class); RdfResource.register(Room.class, OfficeResource.class); RdfResource.register(Building.class, BuildingResource.class); } </pre></code> <p> Given an object the <a href="">serialiser (RdfMessageWriter)</a> can then look up the resource URL pattern, and so determine the object's URL. So to take an example, consider an instance of the <a href="">Room class</a>. From the above map, the serialiser can find that it is linked to the <code>OfficeResource</code> class from which it can find the <code>/building/{buildingName}/{roomId}</code> URI pattern. Using that it can then call the two getters on that Room object, namely <code>getBuildingName()</code> and <code>getRoomId()</code> to build the URL referring to that object. Knowing the URL of an object means that the serialiser can stop its serialisation at that point if the object is not the primary topic of the representation. So when serialising <code>/person/155492</code> the serialiser does not need to walk through the properties of <code>/building/SCA22/3181</code>. The client may already have that information and if not, the info is just a further GET request away. </p> <h4>Running it on the command line</h4> <p>If you have downloaded the whole repository you can just run <code><pre> $ ant run </pre> </code> from the command line. This will build the classes, recompile the @rdf annotated classes, and start the simple web server. You can then just <code>curl</code> for a few of the published resources like this: <code><pre>" . </pre></code> <p>The representation returned not a very elegant serialisation of the <a href="">Turtle</a> subset of <a href="">N3</a>. This makes the triple structure of RDF clear- subject relation object - and it uses relative URLs to refer to local resources. Other serialisers could be added, such as for rdf/xml. See the todo list at the end of this article. </p> <p>The represenation says simple that this resource <code><></code> has as primary topic the entity named by <code>#HS</code> in the document. That entity's name is "Henry Story" and knows a few people, one of which is refered to via a global URL <code></code>, and the other via a local URL <code>/person/528#JG</code>. </p> <p>We can find out more about the <code>/person/528#JG</code> thing by making the following request: </p> <code><pre>" . </pre></code> <p>... where we find out that the resource named by that URL is <a href="">James Gosling</a>. We find that James has an office named by a further URL, which we can discover more about with yet another request <pre><code>" . </code></pre> <p>Here we have a Location that has an Address. The address does not have a global name, so we give it a document local name, <code>_:2828781</code> and serialise it in the same representation, as shown above. </p> <p>Because every resource has a clear hyperlinked representation we don't need to serialise the whole virtual machine in one go. We just publish something close to the <a href="">Concise Bounded Description</a> of the graph of objects.</p> <h4>Browsing the results</h4> <p>Viewing the data through a command line interface is nice, but it's not as fun as when viewing it through a web interface. For that it is best currently to install the <a href="">Tabulator Firefox plugin</a>. Once you have that you can simply click on our first URL <a href=""></a>. This will show up something like this: </p> <img src="" align="center" alt="picture of tabualator on loading /person/155492"/> <p>If you then click on <b>JG</b> you will see something like this:</p> <img src="" align="center" alt="picture tabulator showing James Gosling"/> <p> This it turns out is a resource naming James Gosling. James knows a few people including a <b>BT</b>. The button next to BT is in blue, because that resource has not yet been loaded, whereas the resource for "Henry Story" has. Load BT by clicking on it, and you get </p> <img src="" align="center" alt="picture of tabulator showing Henry Story knowning Bernard Traversat"/> <p>This reveals the information about Bernard Traversat we placed in <a href="">our little Database class</a>. Click now on the <b>i</b> and we get </p> <img src="" align="center" alt="Tabulator with info about Tim Berners Lee"/> <p> Now we suddenly have a whole bunch of information about Tim Berners Lee, including his picture, some of the people he has listed as knowing, where he works, his home page, etc... This is information we did <b>not</b> put in our Database! It's on the web of data. </p> <p>One of the people Tim Berner's Lee knows is our very own <a href="">Tim Bray</a>. </p> <img src="" align="center" alt="tabulator showing info from dbpedia on Tim Bray"/> <p>And you can go on exploring this data for an eternity. All you did was put a little bit of data on a web server using Jersey, and you can participate in the global web of data. </p> <h3>Todo</h3> <p>There are of course a lot of things that can be done to improove this Jersey/so(m)mer mapper. Here are just a few I can think of now: <ul><li>Improove the N3 output. The code works with the examples but it does not deal well with all the literal types, nor does it yet deal with relations to collections. The output could also be more human readable by avoiding repetiations. <li>Refine the linking between model and resources. The use of getters sounds right, but it could be a bit fragile if methods are renamed.... <li>Build serialisers for rdf/xml and other RDF formats. <li>Deal with publication of non information resources, such as <a href="">http:// xmlns.com/foaf/0.1/Person</a> which names the class of Persons. When you GET it, it redirects you to an information resources: <code><pre>> </pre></code> This should also be made easy and foolproof for Java developers. <li>make it industrial strength... <li <a href="">RdfSerialiser</a> interface to make it easy to access the private fields. <li>One may want to add support for serialising @rdf annotated getters <li>Add some basic functionality for POSTing to collections or PUTing resources. This will require some thought. </ul> </p> <p> Bookmarks: <a target="_blank" href="" onclick="this.href='' + escape(window.location)" rel="nofollow">digg+</a>, <a target="_blank" href="" onclick="this.href='' + escape(window.location) + '&title=' + escape('Serialising Java Objects to RDF with Jersey')" rel="nofollow">reddit+</a>, <a target="_blank" href="" onclick="this.href='' + escape(window.location) + '&title=' + escape('Serialising Java Objects to RDF with Jersey')" rel="nofollow">del.icio.us+</a>, <a target="_blank" href="" onclick="this.href='' + escape(window.location) + '&title=' + escape('Serialising Java Objects to RDF with Jersey')" rel="nofollow">dzone+</a>, <a target="_blank" href="" onclick="this.href='' + escape(window.location)" rel="nofollow">facebook+</a> </p> Are OO languages Autistic? bblfish 2008-09-17T03:07:17+00:00 2008-09-19T05:47:44+00:00 <a href=""><img align="right" src="" alt="illustration of a simple play"></a> <p>One important criterion of <a href="">Autism</a> is the <a href="">failure to develop a proper theory of mind</a>. <blockquote cite="">. </blockquote> Children with autism will tend to answer that Sally will look for the ball in the box. </p> <p>Here are two further descriptions of autism from <a href="">today's version of the Wikipedia article</a>: <blockquote cite="">The main characteristics are of Autism are impairments in social interaction, impairments in communication, restricted interests and repetitive behavior.</blockquote> <blockquote cite="">Sample symptoms include lack of social or emotional reciprocity, stereotyped and repetitive use of language or idiosyncratic language, and persistent preoccupation with parts of objects.</blockquote> </p> <p <a href="">possible worlds</a>. Sally believes she is in a world where the ball is in the basket, whereas Ann believes she is in a world where the ball is in the box. Here the worlds are contradictory. They cannot both be true of the actual world. </p> <p>To be able to make this type of statement one has to be able to do at least the following things: <ul> <li>Speak of ways the world could be <li>Refer to objects across these worlds <li>Compare these worlds </ul> The ability to do this is present in none of the well known Object Oriented (OO) languages by default. One can add it, just as one can add garbage collection to C, but it requires a lot of discipline and care. It does not come naturally. Perhaps a bit like a person with <a href="">Asperger's syndrome</a> can learn to interact socially with others, but in a reflective awkward way. </p> <p>Let us illustrate this with a simple example. Let us see how one could naively program the puppet play in Java. Let us first create the objects we will need: <code><pre> Person sally = new Person("Sally"); Person ann = new Person("Ann"); Container basket = new Container("Basket"); Container box = new Container("Box"); Ball ball = new Ball("b1"); Container room = new Container("Room"); </pre> </code> So far so good. We have all the objects. We can easily imagine code like the following to add the ball into the basket, and the basket into the room. <code><pre> basket.add(ball); room.add(basket); </pre></code> Perhaps we have methods whereby the objects can ask what their container is. This would be useful for writing code to make sure that a thing could not be in two different places at once - in the basket and in the box, unless the basket was in the box. <code><pre> Container c = ball.getImmediateContainer(); Assert.true(c == basket); try { box.add(ball) Assert.fail(); } catch (InTwoPlacesException e) { } </pre></code> All that is going to be tedious coding, full of complicated issues of their own, but it's the usual stuff. Now what about the beliefs of Sally and Ann? How do we specify those? Perhaps we can think of <code>sally</code> and <code>ann</code> as being small databases of objects they are conscious of. Then one could just add them like this: <code><pre> sally.consciousOf(basket,box,ball); ann.consciousOf(basket,box,ball); </pre></code> But the problem should be obvious now. If we move the ball from the basket to the box, the state of the objects in <code>sally</code> and <code>ann</code>'s database will be exactly the same! After all they are the same objects! <code><pre> basket.remove(ball); box.add(ball); Ball sb = sally.get(Ball.class,"b1"); Assert.true(box.contains(sb)); //that is because Ball ab = ann.get(Ball.class,"b1"); Assert.true(ab==sb); </pre></code> <code>ann</code>'s belief database, and how easy it would be to by mistake allow it to be added to <code>sally</code>'s belief store. </p> <p>These are not minor problems. These are problems that have dogged logicians for the last century or more. To solve it properly then one should look for languages that were inspired by the work of such logicians. The most serious such project is now knows as <a href="">the Semantic Web</a>. </p> <img src=""> <p>Using <a href="">N3 notation</a> we can write the state of affairs described by our puppet show, and illustrated by the above graph, out like this: <code><pre> @prefix : <> . :Ann :believes { :ball :in :box . } . :Sally :believes { :ball in :basket } . </pre></code> <p>N3 comes with a special notation for grouping statements by placing them inside of { }. We could then easily ask who believes the ball is in the basket using <a href="">SPARQL</a> <code><pre> PREFIX : <> SELECT ?who WHERE { GRAPH ?g1 { :ball :in :basket } ?who :believes ?g1 . } </pre></code> <p>The answer would bind ?who to :Sally, but not to :Ann. </p> <p>RDF therefore gives us the basic tools to escape from the autism of simpler languages: <ul> <li>One can easily refer to the same objects across contexts, as URIs are the basic building block of RDF <li>The basic unit of meaning are sets of relations - graphs - and these are <a href="">formally described</a>. </ul> The above allows query for objects across contexts and so to compare, merge and work with contexts. </p> <p>. </p> <p>Of course tools can be written in OO languages to work with RDF. Very good ones have been written in Java, such as <a href="">Sesame</a>, making it possible to query repositories for beliefs across contexts (see <a href="">this example</a>). <a href="">theory of mind</a>, and so most things to do with communication. For that one will have to use the work done in the semantic web space and familiarize oneself with the languages and tools developed for working with them. </p> <p>Finally the semantic web also has its OO style with <a href="">the Web Ontology Language (OWL)</a>.. </p> <p><b><a href="">vote on reddit and follow the discussion</a></b><br> <b><a href="">vote on dzone</a></b></p> exploring a web 2.0 app bblfish 2008-09-02T09:13:50+00:00 2008-09-02T17:05:32+00:00 <p>I was trying today to understand what communication was going in the <a href="">social site</a> project today, which contains an implementation of <a href="">the Open Social protocol</a>.: <ul> <li>Usually I use the command line <code>tcpflow</code> that just captures all the communication on the wire. The problem is that this does not decrypt the ssl connections, and social site has a lot of requests going over https. <li>There was a Firefox plugin called <a href="">Slogger</a> that would keep all the communication going back and forth and store it to the hard disk. But it is no longer maintained, and no longer seems to be working for Firefox 3.0.1 . (I even tried the workaround suggested on the plugin page) <li><a href="">Firebug</a>: <img align="center" alt="Firebug HTTP console" src=""/></br> (one can immediately see some oddities here: the last visible request asks for xml content types, but the response is json). <li><a href="">Francois Le Droff</a> pointed me to <a href="">Charles Web Debugging Proxy</a> . </ul> </p> <p> Getting this type of information is really important when debugging an application. Hopefully <a href="">bug 430155</a> will be fixed soon, allowing Firebug to do the right thing. I wonder if <a href="">Google's Chrome</a> comes with this functionality built in?</p> A Simple Sommer Project bblfish 2008-08-09T23:28:49+00:00 2008-08-12T04:12:06+00:00 <p>Are you dreaming of the coasts of Java? Need some real sunshine? Have you had enough of hibernation? Here is a simple project to help you wake up and open up some new horizons :-)</p> <p>A couple of weeks ago, <a href="">Stephanie Stroka</a> asked me how to make use of the <a href="">so(m)mer</a> library. So(m)mer is designed to plays a similar role for the semantic web that <a href="">Hibernate</a> plays for relational databases. So when relational databases feel too constraining, and you need an open database that spans the world, the semantic web is for you. And if you are a Java programmer, then so(m)mer is a good open source project you can participate in. <br/>Anyway, I had not had time to write out a HOWTO, so I directed Stephanie over instant messenger on how to get going. It turns out this was a little more complicated that I had imagined, for someone completely new to the project. So Stephanie wrote out a really simple, indeed the simplest possible project, <a href="">documented it</a>, and added it to the so(m)mer repository. </p> <p>As a result there is now a really simple example to follow to get out of hibernation mode, and into the blooming summer. <a href="">Just follow the instructions</a>. </p> NetBeans and Semantic Wikis bblfish 2008-06-25T07:39:12+00:00 2008-06-26T16:58:06+00:00 <p>The <a href="">Kiwi</a> team <a href="">is meeting at the Prague Sun offices for the next few days</a> to discuss the roadmap of this cutest of all semantic wikis. I completely empathize with <a href="">Jana Herwig</a>, <a href="">when she writes</a>: </p> <blockquote> An IT project is like herding cats, they say - in our case, we’ll be herding kiwis, and if we can enjoy it only half as much as these guys, I’ll be fine:-) </blockquote> <p> And illustrates it with this video: </p> <object width="425" height="344"> <param name="movie" value=""></param> <param name="wmode" value="transparent"></param> <embed src="" type="application/x-shockwave-flash" wmode="transparent" width="425" height="344"></embed><br/> <b>VIDEO CLIP</b> -- <i>this should only display if shockwave does not work. Why does it not do the right thing in Firefox 3? If no video appears try it <a href="">directly on youtube</a></i>. </object> <p>I like to think of us developers as being the cats, and the kiwis as the things we want to herd. Tasty :-) That would indeed also explain why I am still in France - herding cats ain't easy.</p> <p> Why am I still in France and not tasting free beer in Prague? Well, <a href="">last month's conferences</a> in California has given me a conference overdose, from which I am still recovering. Also I have been speaking so much about the <a href="">Address Book</a>, that I really need to sit down, roll up my sleeves, and just work on it. I did try to write something on topic yesterday, <a href="">relating the semantic web and NetBeans</a> - since Prague is the center of NetBeans development. I hope that excuses me somewhat. </p> <p>A list of on the spot updates to this meeting can be found on <a href="">kiwi planet</a>. </p> Webifying Integrated Development Environments bblfish 2008-06-24T03:45:18+00:00 2008-07-16T06:44:22+00:00 <p>IDEs should be browsers of code on a Read Write Web. A whole revolution in how to build code editors is I believe hidden in those words. So let's imagine it. Fiction anticipates reality. </p> <p>Imagine your favorite IDE, a future version of NetBeans perhaps or IntelliJ, which would make downloading a new project as easy as <a href="">dragging and dropping a project url onto your IDE</a>.. ( <a href="">Subversion</a> is in fact designed like this, so this is not so far fetched at all.) And let's imagine that NetBeans thinks about each software component primarily via this URL. <br/> Since every piece of code and every library has a URL, the IDE would be able to use <a href= "">RESTful architectural principles</a> of the web. A few key advantages of this are <ul> <li><b>Caching</b>: <a href="">web architecture</a>. <li><b>Universal names</b>: since every resource has a URL, any resource can relate in one way or another to any other resource wherever it is located. This is what enables hypertext and what is enabling <a href="">hyperdata</a>. </ul> </br> Back to the IDE. So now that all code, all libraries, can be served up RESTfully in a Resource Oriented Architecture what does this mean to the IDE? Well a lot. Each may seem small, but together they pack a huge punch: <ul> <li><b>No need to download libraries twice</b>: if you have been working on open source projects at all frequently you must have noticed how often the same libraries are found in each of the projects you have downloaded. Apache logging is a good example. <li><b>No need to download source code</b>: it's on the web! You don't therefore need a local cache of code you have never looked at. Download what you need when you need it (<a href="">and then cache it!</a>): the Just in Time principle. <li><b>Describe things globally</b>: Since you have universal identifiers you can now describe how source code relates to documentation, to people working on the code, or anything else in a global way, that will be valid for all. Just describe the resources. There's a <a href="">framework around just for that</a>, that is very easy to use with <a href="">the right introduction</a>. </ul> <p> The above advantages may seem rather insignificant. After all, real developers are tough. They use vi. (And I do). So why should they change? Well notice that they also use <a href="">Adobe Air</a> or <a href="">Microsoft Silverlight</a>. So productivity considerations do in fact play a very important factor in the software ecosystem. <br/> Don't normal developers just work on a few pieces of code? Well speaking for myself here, I have 62 different projects in my <code>/Users/hjs/Programming</code> directory, and in each of these I often have a handful of project branches. As more and more code is open source, and owned and tested by different organizations, the number of projects available on the web will continue to explode, and due to the <a href="">laziness principle</a>: <ol> <li? <li>Then I have to browse a web page, which may not be written in my language, and find the repository of the source code <li>Then I have to find the command line to download the source code, or the command in the IDE and also somehow guess which version number produced the jar I am using. <li>Once downloaded, and this can take some time, I may have to find the build procedure. There are a few out there. Luckily ant and maven are catching on. But some of these files can be very complicated to understand. <li. <li. <li>Once that project downloaded one may discover that it depends on yet another project, and so we have to go back to step 1. </ol> </br> So doing the above is currently causing me huge headaches even for very simple projects. As a result I do it a lot less often than I could, missing valuable opportunities as a result. Each time I download a project in order to access the sources to walk through my code and find a bug, or to test out a new component I have to do all that download rigmarole described above. If you have a deadline, this can be a killer. </p> <img src=""/> <p>So why do we have to tie together all the components on our local file system? This is because the IDE's are not referring to the resources with global identifiers. The owner of the junit project should say somewhere, in his <a href="">doap file perhaps</a> that: <pre> @prefix java: <> . #made this up @prefix code: <> . <> a java:Jar; code:builtFrom <> . #what would be needed here needs to be worked out more carefully. The point is that we don't #at any point refer to any local file. </pre> <p>. </p> <p>From here many other things follow. A couple of years ago <a href="">I showed how this could be used link source code to bugs</a>, to create a distributed bug database. Recently I showed how one could use this to <a href="">improve build scripts</a>.. <p> <p>If you want to make a big impact in the IDE space, that will be the way to go.</p> </p> Three Semantic Web talks at JavaOne 2008 bblfish 2008-05-07T10:50:21+00:00 2008-09-08T09:03:05+00:00 <p>Following <a href="">on the success last year</a>, <a href="">JavaOne 2008</a> has lined up <b>three</b> talks on the Semantic Web, a 200% increase. The program should be an excellent way for Java enthusiasts to get a feel for how the Semantic Web is getting used in real application making money for real start ups, how to develop such apps in Java, how to build open social networks that bridge the social networking data silos, and with the help of <a href="">Dean Allemang</a> cover some theoretical grounds from a practical perspective .</p> <p>Here is the timetable of the sessions at JavaOne. Highlighted in green are the three semantic web sessions. Highlighted in gray are 4 of the 5 sessions on Google's Open Social API, which reveals the importance social networks are taking in development. I don't think though that that API solves the real problem of current social networks: <a href="">The Data silo problem</a>. Only Semantic Web technologies can do that. </p> <p>Update Sept 2008: Two of the talks are now available online: <ul><li>TS-5555 as "<a href="">Semantic Web for the Working Ontologist</a>" <li>BOF-5911 as "<a href="">Building Secure, Open and Distributed Social Network Applications</a>" </p> </ul> <+00:00 2008-11-20T09:55:20+00:00 > <h4>Update</h4> <p> An improved version of the presentation I gave is now available online with audio as <a href="">Building Secure, Open and Distributed Social Network Applications</h3> </p> Opening Sesame with Networked Graphs bblfish 2008-03-05T08:40:41+00:00 2008-04-24T08:47:05+00:00  bblfish 2008-02-28T13:20:58+00:00 2008-02-29T11:11:15+00:00 > replacing ant with rdf bblfish 2008-02-06T02:39:38+00:00 2008-02-06T14:34:10+00:00  bblfish 2008-02-01T09:44:36+00:00 2008-04-24T08:47:37+00:00 > Scoble gets thrown off Facebook bblfish 2008-01-03T08:09:57+00:00 2008-04-24T08:52:17+00:00 <a href=""><img align="right" alt="picture of current version of Beatnik" src=""></a> <p> Scoble, who became very famous for getting blogging started at Microsoft, <a href="">got ejected from FaceBook</a>. <p>This is what <a href="">Beatnik</a>, a friend of a friend browser, which I described in <a href="">this email to the social network portability group</a>, will make it easy for anyone to do. <p> <p>Everyone is welcome to help on this open source project: artists, documenters, Swing experts, testers, RESTafarians, ... </p> Hyperdata in Sao Paulo bblfish 2007-12-19T06:24:02+00:00 2008-09-08T09:09:39+00:00 <a href=""><img align="right" title="audience at GlobalCode talk" src=""></a><p> In the past week I gave a couple of presentations of <a href="">Hyperdata</a> illustrating the concept with demos of <a href="">the Tabulator</a> and <a href="">Beatnik</a>, the Hyper Address Book I am just working on. <p>The first talk I gave at the University of Sao Paulo, which was called at the last minute by <a href="">Professor Imre Simon</a>, who had led the <a href="">Yochai Benkler talk the week before</a>. It was a nice turnout of over 20 people, and I spoke at a more theoretical level of the semantic web, how it related to Metcalf's law, as explained in more detailed in a <a href="">recently published paper by Prof. James Hendler</a>, and how an application like Beatnik could give a powerful social meaning to all of this. I also looked at some of the <a href="">interesting problems related to trust and belief revision</a> that come up in a simple application like Beatnik, which touched a chord with <a href="">Renata Wassermann</a> who has written extensively on that field of the Semantic Web.<br> Many thanks to Prof Simon, for allowing me to speak. For a view from the audience see <a href="">Rafael Ferreira's blog</a> (in English) and <a href="">Professor Ewout's blog</a> (in Portuguese).</p> <p>Yesterday I gave a more Java oriented technical talk at <a href="">GlobalCode</a>, an evening learning center in Sao Paulo, with <a href="">a J2EE project on dev.java.net</a>. I touched on how one may be able <a href="">to use OpenId and foaf</a> to create a secure yet open social network. <br>About 25 people attended which must be a really good turnout for a period so close to Christmas, when everyone is looking forward to the surf board present from Santa Claus, getting into their swimming trunks and paddling off to catch the next big wave. Well the really big wave that everyone in the know will be preparing for is the hyperdata wave. And to catch it one needs to practice one's skills. And a good way to do this is to help out with a simple application like <a href="">Beatnik</a>. <br> Thanks to Vinicius and Yara Senger for organising this. </p> <h4>Update</h4> <p>The talk I gave is now available online with audio as "<a href="">Building Secure, Open and Distributed Social Network Applications</a>". </p> Jazoon call for papers bblfish 2007-11-27T04:42:06+00:00 2007-12-01T18:13:39+00:00 <p>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 <a href="">out a request for papers</a>. My submission last year "<a href="">Web 3.0, this is the semantic web</a>" was very well attended. I also met some great folk such as <a href="">Dean Allemang</a> and <a href="">Harold Carr</a>. 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 <a href="">Roy Fielding</a> who gave a keynote presentation.</p> <p>Anyway, the <a href="">call for papers</a> is up till the end of December. So hurry up to add your contribution.</p> <p>I will put forward a talk on a <a href="">Semantic Address Book</a>: <ul> <li>a talk to introduce the semantic web and reasoning - even if this touches only slightly on Java <li>a talk explaining how a real <a href="">hyperdata</a> application was written in Java <li>a panel on the current state and the future of semantic web tools on the Java platform. </ul> </p> <p>I suppose I should also put something forward for JavaPolis... Anyone know what the deadlines are there?</p> Vote for Java6 on Leopard! bblfish 2007-11-02T15:12:13+00:00 2007-12-19T15:09:07+00:00 <!--a<img align="right" src=""></a--> <p>As <a href="">mentioned previously</a> a lot of Java developers on OSX <a href="">are upset</a> 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 <a href="">Java Tutorial examples</a>. 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 <a href="">using it since 2004</a>. <p> The first solution of course is to have our voice heard. One way to do this <a href="">is to file a bug with Apple</a>. Please do this! The only problem I have with it is that as opposed to the <a href="">Java bug database</a> 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 <a href="">people to make their voice heard in support of the Burmese people</a> and got <a href="">some real results</a>, let us do the same to help Apple make the right decision.<br> Anybody who would like to support this issue in the blogosphere, should help post a blog with the string <pre>13949712720901ForOSX</pre> <p> The first part of the string is the decimal notation for 0xCAFEBABE [1], the magic cookie for JavaClass files (thanks <a href="">David for the number</a> and the pointer to <a href="">Fredericiana's</a> photo). Then post similar instructions on your blog or point people here. Let's see how far this gets us! [2] </p> <p>We should then be able to use any search engine, Google is a good choice, <a href="">to search for this string</a> [3], and hopefully motivate the managers at Apple to invest more time on Java and be more open about their plans with the community. </p> <p>Your vote may also be an energizer to those groups that are starting <a href="">to port the OpenJDK to OSX</a> (<a href="">via the mac java community</a>). </p> <h3>Notes</h3> <ol><li> 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". :-) <li>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. <a href="">Language is a Virus</a>, but it is most virulent when it is understandable and hyperlinked, of course. <li>A search on <a href="">Google Web</a> returns more results - more than <a href="">AllTheWeb</a> or <a href="">AltaVista</a> - but <a href="">Google Blog Search</a> 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 <a href="">keeping count</a>. <li><a href="">Karussell</a> is keeping a list of related articles. </ol> </p> <h3>Update</h3> <p> <b>Tuesday Nov 13</b>: Landon Fuller has been able to get a <a href="">very nice hello world</a> GUI app running on OSX using the FreeBSD jdk1.6 port. It runs under X Windows only. Excellent work! </p> <p><b>Nov 20th, 2007</b>: Dave Dirbin publishes <a href="">the first beta release of the open source java 6</a>. This campaign has gathered 105 blog votes if we count the results from Google Blog Search, placing it easily among the <a href="">top 10 bug reports</a> 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. </p> <p> <b>Wednesday Dec 19</b>: Apple has put a developer preview of Java 6 up on <a href="">Apple Developer Connection</a>. 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. </p> JavaOne call for Papers Open bblfish 2007-10-29T02:47:58+00:00 2007-10-29T09:47:58+00:00 The <a href="">2008 Java One call for papers</a> 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! <p> This is an opportunity to talk to over 15 thousand developers and leaders in the Java community. At the last JavaOne I presented a <a href="">Semantic Web Birds Of a Feather</a> 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 <a href="">Jena</a>, <a href="">Sesame</a> or <a href="">Mulgara</a>, to just name some of the 256 java projects listed by <a href="">AI3's sweet Tools</a>. With 100% pure Java companies such as <a href="">Radar Networks unveiling this year</a>, 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.</p> <p>Anyway. There is not much time!</p> Echo2: building Web 2.0 in Java bblfish 2007-10-27T11:37:16+00:00 2007-10-29T13:46:54+00:00 <a href=""><img align="right" src=""></a> During some heated discussion on the <a href="">Apple Java Dev mailing list</a> as to why there still is not Java 6 available in Leopard, with some serious calls to port <a href="">OpenJDK</a> to OSX, <a href="">Will Gilbert pointed to</a> the <a href="">Echo2 demo</a> by Nextapp, which is written with a Java™ library. Here is what Will had to say: <blockquote> 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: <p> <a href=""></a> <p> 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. <p> 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 <a href="">Karora.org</a>. They took the Echo2 source, added a nice bug reporting system (JIRA), scheduled releases, and Maven repository support. <p> 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. <p> From terminal run the following. Maven will install what it need and then create the application <p> <pre> % </pre> </blockquote> <p>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: <ul> <li>The user interface is snappier <li>Spotlight finally works (It used to take forever to find things, and the user interface was terrible). <li>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 <a href="">NeoOffice</a> document. (NeoOffice is a free and excellent Office suite with the User Interface written in Java btw) <li. <li><a href="">Netbeans 6 beta 2</a> 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. <li>Matt Neuburg <a href="">post some well illustrated criticisms on the new features in Leopard</a>, which I agree with. The last point about the help windows being impossible get out of the foreground is, it is true, quite bizarre. <li>Some minor and not so minor bugs in <a href="">The lame Leopard blog</a> </ul> <p>But the final and best review is as usual <a href="">John Siracusa's Ars Technica review</a>. No marketing hype. Real facts, and good criticism.</p> Java for iPhone by Feb 2008? bblfish 2007-10-17T10:05:28+00:00 2007-10-17T23:15:18+00:00 <p>I just received this email as a response to a bug I had filed at Apple concerning Java's non presence on the iPhone.<br> (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?) <blockquote> <b>Subject:</b> Re: Bug ID 4918928: java on iphone<p> Dear Henry, <p> 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. <p> ------------------- <a href=""></a> [no permalink it seems] . . <p> 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> Steve <p> P.S.: The SDK will also allow developers to create applications for iPod touch. </blockquote> Java Picture Editor bblfish 2007-10-15T02:55:09+00:00 2007-10-15T18:38:15+00:00 <a href=""><img align="right" src=""></a> <p>Over the past year I have found myself again and again using the free <a href="">Java Image Editor</a> from <a href="">JH Labs</a>, a company that seems to be doing a lot of interesting work in the java graphics area. </p> <p>ImageEditor, starts much quicker than the Gimp, does not require X11, and has a modern look, as you can see from <a href="">the snapshot I made</a>, which integrates beautifully in OSX. It comes with <a href="">a lot of filters</a>, which are <a href="">available in source code</a> under an Apache licence</a>. ( I have not really used them, to tell the truth)<br> Today I have been using it for the very simple task of editing a <a href="">foaf icon</a>. I had tried for hours to get X11 going after it got clobbered by an installation I made using <a href="">fink</a>, 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.</p> <p>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. <p>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.</p> Doap Bean available bblfish 2007-10-05T08:33:48+00:00 2007-10-05T17:29:27+00:00 <a href=""><img align="right" src=""></a> <p>I have just made the NetBeans Doap Bean available on the <a href="">plugin portal</a>. Just download onto your desktop and install in <a href="">a version of NetBeans 6</a> (check <code>Tools < Plugins</code> in the menu)</p> <p>This is the module I demonstrated at <a href="">James Gosling's 'fun things' presentation</a> 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 <a href=""></a> project. Then drag the blue button next to the URL </p> <a href=""><img src=""></a> <p> <a href="">this</a>: </p> <a href=""><img alt="window describing the so(m)mer project" src=""></a> <p> Clicking on the other tabs will show you the original RDF/XML or an easier to read <a href="">Turtle</a> representation of the data. It is really important to show these tabs so that you can distinguish good from bad <a href="">doap</a>. Of course one can also go to the <a href="">W3C Validator</a> for an independent opinion. <br> <code>Versioning &gr; Subversion > Checkout...</code> ) <p> If you want to try dropping other projects onto the button go to <a href="">DoapSpace</a>, they have put together a large collection of doap files for all the projects on SourceForge, Freshmeat and PyPi. </p> <p>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: <ul> <li>Having it produce Doap for a project automatically <li>Tying it into NetBeans's Project panel <li>describing the relationships a project and others it depends on <li>Linking bug reports to information gleaned from the doap:bugdatabase relation <li>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 <li>find a way to view source on a jar, by relating jars to source code repositories... (more difficult this one) <li>and a lot more...</ul> <p <a href="">Semantic Radar</a> plugin, and go to the <a href="">So(m)mer</a> 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</p> <img alt="semantic radar icon in Firefox" src=""/> <p>I should probably add this icon to the Doap button come to think of it... <br :-)</p> Turtle support for NetBeans 6 bblfish 2007-10-03T12:52:05+00:00 2007-10-09T10:50:18+00:00 <a href=""><img align="right" src=""></a> <p>Yesterday I added NTriples support for NetBeans. Today it was the turn of <a href="">Turtle</a>, a notation for RDF that takes human writers into account, and that is carefully being looked after by <a href="">Dave Beckett</a>, who now works at Yahoo!, on some project which seems to be leading to <a href="">employment opportunities</a> . 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. </p> <p> Turtle makes things more readable because it allows one to <ul> <li>declare namespaces, so as not to have to constantly write out the URLs in full <li>declare a base url <li>use relative urls <li>some punctuation shorthands: <ul><li>use "," when you have sentences that have the same subject and predicate but different objects <li>use ";" when you have sentences that have the same subject but different predicates and objects </ul> <li><code>[]</code> 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. <li><code>( a b c ) </code> shorthand for lists </ul> Here for example is a section of my foaf file in Turtle: <pre> @prefix foaf: <>. @prefix : <> . :me a foaf:Person; foaf:depiction <>; foaf:openid <> ; foaf:gender "male"; foaf:birthday "07-29"; foaf:title "Mr"; foaf:family_name "Story"; foaf:givenname "Henry"; foaf:name "Henry J. Story"; foaf:homepage <>; foaf:schoolHomepage <>, <>, <>; foaf:mbox <mailto:henry.story@bblfish.net>, <mailto:henry.story@gmail.com>, <mailto:henry.story@sun.com>; foaf:nick "bblfish". </pre> 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. </p> <p>There are again two main sections to the <a href="">NetBeans Schliemann file</a> (<a href="">view the current version</a>) <code> <pre> 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:boolean:("true"|"false") TOKEN:exists:("[" | "]") TOKEN:list:( "(" | ")" ) TOKEN:prefix:("@base" | "@prefix") TOKEN:prefixName:(["A"-"Z" "a"-"z"]["A"-"Z" "_" "a"-"z"]\* ) TOKEN:shortrels:("a" | "=") TOKEN:nameSep:(":") TOKEN:lang:("@" ["A"-"Z" "a"-"z"]["A"-"Z" "a"-"z"]) #wrong but simpler </pre> </code> <p>I have not yet filled in all the unicode special cases as I wanted to first make sure the main pieces would be working. <p> Then there is the grammar that goes with it. </p> <code> <pre> S = ( Statement )\*; Statement = ( Directive "." ) | ( Triples "." ) ; Directive = PrefixID | Base ;<exists,"]"> | <exists,"["> PredicateObjectList <exists,"]"> | Collection ; Double = <integer> <exponent> | <decimal> <exponent> ; Collection = <list,"("> [ ItemList ] <list,")"> ; ItemList = Object ( Object )\*; </pre> </code> <p>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: <code> <pre> SKIP:space SKIP:comment </pre> </code> More problematic was that I could not get the optional ending of sentences with ";" to work. In Turtle one can have sentences like <code> <pre> :me foaf:knows [ a foaf:Person; foaf:name "Tim Boudreau"; foaf:weblog <> ] . </pre> </code> 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: <code> <pre> Triples = Subject PredicateObjectList ; PredicateObjectList = Verb ObjectList More [";"] ; More = ( ";" Verb ObjectList) \*; </pre> </code> <p> 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.... </p> <p>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: <code> <pre> HYPERLINK:uriref: net.java.dev.sommer.editors.Turtle.hyperlink </pre> </code> <p>And then wrote out a clearly more complicated <a href="">Turtle.java</a> class. This is more complicated because Turtle allows relative urls, and defines the <code>base</code> 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. </p> working on NTriples support in Netbeans 6 bblfish 2007-10-02T11:41:59+00:00 2007-10-09T10:37:41+00:00 <a href=""><img align="right" src=""></a> <p>In the last couple of days I have been learning about the very powerful <a href="">Schlieman project</a>. The result of the project is that one can now very simply create language support for <a href="">NetBeans</a>, 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... </p> <p>I did not take more than a day for me to get the basics for <a href="">NTriples</a> support done. NTriples is the simplest serialization of RDF. It is extremely explicit, one line per statement. <pre> <SubjectURL> <PredicateURL> <ObjectURL> . </pre> This is RDF at its purest. It is not very humanly writable, but it is easiest to understand. If you download <a href="">cwm</a> you can transform any rdf/xml into this format. For example you can transform my foaf file into NTriples like this: <pre> hjs@bblfish:0$ cwm --rdf --ntriples | head <> <> <> . <> <> <> . <> <> <> . <> <> <> . </pre> <p> 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... </p> <p>All of the source code is available under a BSD licence on the <a href="">so(m)mer</a> project. Download it with subversion from <a href=""></a>. The project is in the <code>misc/Editor</code> 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.</p> <p>The main tokenizer and grammar code itself is in the <a href="">Ntriples.nbs</a> file. As you can see it is split into token definitions <code><pre> 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"]+) TOKEN:brackets:(".") TOKEN:type:("\^\^") </pre></code> and a simple grammar <code><pre> 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>)\*; </pre></code> <p>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. <p> 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 <a href="">Schliemann NBS Language Description Wiki page</a>. </p> One can then add color information (and one could easily do a lot better than this) <code><pre> COLOR:bnode: { foreground_color: "blue"; } COLOR:qliteral: { foreground_color: "green"; } COLOR:absoluteUri: { foreground_color: "blue"; } COLOR:type: { foreground_color: "red"; } </pre></code> Then finally I added hyperlink functionality by adding the line <code><pre> HYPERLINK:absoluteURI: net.java.dev.sommer.editor.ntriples.HyperLink.hyperlink </pre></code> I then wrote the very simple <a href="">HyperLink.java</a> class with the <code>hyperlink(Context context)</code> method. This was easy to do by following <a href="">Geertjan's excellent hints</a>. <code><pre> 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); } } }; } } </pre> </code> <p>You will find <a href="">Gertjan's blog</a> 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 <code>Tools>Plugins</code> menu and get the <code>Generic Languages Framework Studio</code> plugin. Once it is installed you will find in the <code>Windows > Others</code> menu an AST and Tokens submenu, which when clicked will open two very helpful views on the left of your editor you can see <a href="">in the main image</a>. This apparently only currently works on the <a href="">latest developer release of NetBeans</a>, but should be distributes standard with Netbeans beta 2 . </p> <p>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...</p> M2N: building Swing apps with N3 bblfish 2007-09-18T14:13:56+00:00 2007-09-18T21:29:35+00:00 <a href=""><img align="right" src=""></a><p>At <a href="">the Triple-I conference</a> in Graz, I came across one very interesting demo by the <a href="">M2N Intelligence Management</a> company, where they showed a Development environment powered by <a href="">N3</a>, the powerful, easy to read notation for the Semantic Web. Using a Visual Editor that mapped UML diagrams to N3, instead of <a href="">the usual limited and difficult to understand OMG MOF</a> 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 <a href="">on their solutions page</a>. <p> <p>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. <a href="">Sebastian Schaffert</a> -... </p> <p>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. </p>