Friday, March 31, 2006, 08:16 PM
- Python
Some friends using Windows only asked me about RDFRoom (Yes! Really!), and I was about to tell them than unless they spent a while installing python, pygame, rdflib, it wasn't gonna happen, but I thought I'll google first. Dada! Enter py2exe! After I spent a bit of time installing python, pygame, rdflib on my vmware image, wrote a 6 line setup.py and ran py2exe (Then fiddled with packaging the right rdflib packages, damn plugin-architecture), I had a RDFRoom.exe which would run without installing any other packages. Amazing. Download RDFRoom.zip for windows NOW! :D
[ add comment ] ( 2 views ) | permalink |




( 3 / 4226 )Thursday, March 30, 2006, 11:53 PM
- RDF, Python
Too late to be verbose now, but after being encouraged by Danny last week, I've spent long evening hacking together this crappy demo. The webpage has all the info you need (including downloads), and the screenshot here should tickle your senses enough to click that link. If you like RDF that is. And you like old-fashioned computer games. And if you're bored. 
Some notes:
- Look at some RDF DATA, schemas dont work well just now.
- Yes i know the fire effect is badly aligned.
- You need data with rdfs:seeAlso links to get doors.
That's it for now, I refuse to waste any more time on this useless nonsense!
(Oh, and I submitted this to the ESWC Semantic Web Scripting Challenge :-)
[ 1 comment ] ( 705 views ) | permalink |




( 3 / 4994 )Tuesday, March 21, 2006, 08:34 PM
- Java
(I try again, with considerably less love than last time)
Opening files in their "natural" application was something I knew had to be done sooner or later for aperture/gnowsis/nepomuk, but I put it off for as long as possible because I had a horrible feeling that to get it to work on all platforms it would be long and messy and maybe involve nasty C code.
Imagine my surprise when in a few hours today I got it working for files, directories and web links, and this on both windows, macosx and linux (kde/gnome). All without leaving the world of Java. The code is so short I will paste it here (beautifully formatted by code2html!)
private void windowsopen(URI uri) throws IOException {
Runtime.getRuntime().exec(
new String [] { "rundll32", "url.dll,FileProtocolHandler",uri.toString() });
}
private void linuxopen(URI uri) throws IOException {
// TODO: I don't know how reliable this is.
// It's set correctly for kde/gnome on my machine
if (System.getenv("DESKTOP_SESSION").toLowerCase().contains("kde")) {
//kde:
Runtime.getRuntime().exec(new String [] { "kfmclient","exec",uri.toString()} );
} else {
//Default to gnome as it complains less if it's not running.
Runtime.getRuntime().exec(new String [] { "gnome-open",uri.toString()} );
}
}
private void macopen(URI url) throws IOException {
try {
Class macopener = Class.forName("com.apple.eio.FileManager");
Method m = macopener.getMethod("openURL",new Class[] {String.class});
m.invoke(null,new Object[] {url.toString()});
} catch (Exception e) {
throw new IOException("Could not open URI: "+url+" - "+e);
}
}
This is for opening http links, but the file code is almost identical, KDE and Windows doesn't like file:// URIs so I convert them to filenames first, and launching things in Windows is done by executing "cmd /c blah" instead (Thanks Michael Sintek!).
Still damn easy. It's not very well tested yet - but it works on my three instances of each OS! If anyone feels like testing it the code is in the aperture cvs repos, FileOpener.java and HttpOpener.java (although it's only just committed so it'll take a while for the sourceforge cvs mirrors to catch up)
[ 2 comments ] ( 44 views ) | permalink |




( 3 / 2065 )Tuesday, March 21, 2006, 07:47 PM
- Everything Else
It wasn't horribly long, but it was full of love! The session timed out or something, and when I hit the preview button I got 403 and when I went back the text was all gone. Bastards. That will teach me to draft the entries in something that isn't firefox... Oh well. I might rewrite it later.
[ 2 comments ] ( 30 views ) | permalink |




( 3 / 4145 )Monday, March 13, 2006, 09:11 PM
- RDF, PhD
Recently I decided that for the planning part of Smeagol it would make sense if all the avaiable actions were specified in RDF. This seemed sensible since I was re-factoring the action/planning part of Smeagol anyway - it was all pretty much coded in one coffee fuelled weekend just before some paper deadline and was now completely incomprehensible to anyone. Moving to RDF also seemed right and elegant because I enjoy moving "things" into a more explicit and structured format; like my very first thoughts on the internal structuring of Smeagol moved from being hard-coded to being dynamically planned, or how someone (Malte?) pointed out that Semantic Wikis and the [ur=http://en.wikipedia.org/wiki/Infobox]Infoboxes[/url] of wikipedia are steps on a road where soon all content will be represented in structured form.
Anyway, I digress. An action in Smeagol now looks like this:
(I steal freely from N3 Rules and cwm in general).
@prefix : <http://www.csd.abdn.ac.uk/~ggrimnes/dev/smeagol/ontology#>.
@prefix ac: <http://www.csd.abdn.ac.uk/~ggrimnes/dev/smeagol/actions#>.
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
ac:read a :Action ;
rdfs:label "read" ;
:in ( ?u ) ;
:out () ;
:preconditions { ?u :source ?source . ?u :triples ?t1 } ;
:effects { ?u :triples ?t2 . ?t2 math:greaterThan ?t1} .
This represents an action "read something about this URI (?u)" - it needs a source of information about this uri to be known beforehand, and if executed it will result in Smeagol knowing more triples about ?u that we did before. Hardly rocket science, but I like the idea of using :triples as a magic property, which is evaluated rather than looked up in the graph. The idea is of course old, cause cwm and n3 rules/queries do exactly the same with builtin functions. Oh well - this time I got the idea from the handling of full-text lucene queries in sparql as done in Gnowsis.
So this evening I finished the planning module of Smeagol, and while I was developing it I used a list of only 2 actions for testing. And when it appeared to work I uncommented the other actions in the n3 file, and whoho! It just worked! And 4 different plans were generated! ... and then I thought of the subject line and sniggered to myself.
[ add comment ] | permalink |




( 3 / 2037 )Back Next



