<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lost Boy &#187; Java</title>
	<atom:link href="http://www.ldodds.com/blog/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ldodds.com/blog</link>
	<description>A journal of no fixed aims or direction, by Leigh Dodds</description>
	<lastBuildDate>Sat, 22 Jan 2011 20:23:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using Jena in an Application Server</title>
		<link>http://www.ldodds.com/blog/2005/09/using-jena-in-an-application-server/</link>
		<comments>http://www.ldodds.com/blog/2005/09/using-jena-in-an-application-server/#comments</comments>
		<pubDate>Thu, 29 Sep 2005 00:47:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.ldodds.com/lostboy/?p=237</guid>
		<description><![CDATA[I&#8217;ve been lurking on the jena-dev mailing list for a while now, and I&#8217;m constantly impressed with the level of patience displayed by the jena team at handling repeated questions and queries. This is despite the comprehensive documentation which covers all aspects of the toolkit.
Often these queries stray outside the realm of RDF and Jena [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been lurking on the <a href="http://groups.yahoo.com/group/jena-dev/">jena-dev</a> mailing list for a while now, and I&#8217;m constantly impressed with the level of patience displayed by the jena team at handling repeated questions and queries. This is despite the <a href="http://jena.sourceforge.net/documentation.html">comprehensive documentation</a> which covers all aspects of the toolkit.<br />
Often these queries stray outside the realm of RDF and Jena into basic questions such as &#8220;how do I write a JSP or a web application&#8221;. Makes me wonder if there&#8217;s been a sudden increase in the number of undergraduate semantic web projects. Anyway one question I&#8217;ve seen quite often recently is &#8220;How do I use Jena within an Application Server?&#8221;<br />
Here are some notes and pointers that may help answer that particular question. I don&#8217;t have time for a complete tutorial, but hopefully the following pointers may be sufficient to get your oriented.</p>
<h4>The Database</h4>
<p>I&#8217;ll assume that you&#8217;re going to be working with data held in a relational database. In Jena terminology this is known as a &#8220;persistent model&#8221;.<br />
The Jena team have created a <a href="http://jena.sourceforge.net/DB/howto.html">HOWTO on using persistent models</a>. See that page for detailed database configuration options and pointers to database specific documentation.<br />
You don&#8217;t have to worry about creating the relational database structure into which your RDF data will be stored. Jena will do that for you automatically once you create your first persistent model. This makes it very simple to get up and running.<br />
The <a href="http://jena.sourceforge.net/DB/howto.html">persistent model HOWTO</a> contains example code that shows how to create and configure a persistent model.<br />
However within an application server the code you&#8217;ll write is going to be slightly different: you&#8217;re going to need a connection pool.</p>
<h4>Connection Pooling</h4>
<p>All Java application servers allow you to configure a database connection pool, the specifics vary from server to server so you&#8217;ll need to consult your server documentation to find out how to do that. Here&#8217;s <a href="http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html#JDBC Data Sources">the Tomcat 5.5 JDBC data source documentation</a>. You should be able to find similar documentation for JBoss, Weblogic, et al.<br />
Once correctly configured a connection pool will allow you to do a JNDI lookup to obtain a <a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html">DataSource</a> from which you can create a <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Connection.html">Connection</a>.<br />
Creating a Jena Model is then simply a matter of instantiating a <a href="http://jena.sourceforge.net/javadoc/com/hp/hpl/jena/db/DBConnection.html">DBConnection</a>. Here&#8217;s a code snippet which illustrates this:
<pre><code>
// Obtain our JNDI context
Context initialContect = new InitialContext();
Context env = (Context) initialContext.lookup("java:comp/env");
// Look up our data source
DataSource dataSource = (DataSource)env.lookup("jdbc/MyDataSource");
// Allocate and use a connection from the pool
Connection connection = dataSource.getConnection();
//Create a Jena IDBConnection
IDBConnection jenaConnection = new DBConnection(connection, "MySQL");
//use open for an existing model, or createModel to create a new one
Model model = ModelRDB.open(jenaConnection);
//do some useful work, then tidy up</code></pre>
<h4>Business Logic</h4>
<p>So far we&#8217;ve looked at creating connections and opening a Model to get access to the persistent data. For example you may <a href="http://jena.sourceforge.net/tutorial/RDF_API/index.html#ch-Navigating%20a%20Model">navigate through the model</a> using <a href="http://jena.sourceforge.net/javadoc/index.html">the Jena API</a> or query it using <a href="http://jena.sourceforge.net/ARQ/documentation.html">ARQ</a> the SPARQL query engine built upon Jena. More information on how to do that can be found in Phil McCarthy&#8217;s &#8220;<a href="http://www-128.ibm.com/developerworks/xml/library/j-sparql/">Search RDF data with SPARQL</a>&#8221; tutorial.<br />
The context within which this code lives will depend on the overall architecture of your application.<br />
If you&#8217;re just writing a simple Java web application that uses servlets and/or JSPs then you&#8217;ll want to structure your code so that the logic is in a servlet or utility code accessed from a JSP, ideally a <a href="http://java.sun.com/products/jsp/taglibraries/index.jsp">tag library</a>. This avoids mixing up your user interface code with your application logic. To ensure that your connection pool is available to your web application you&#8217;ll need to configure a resource reference in its <code>web.xml</code><br />
However if you&#8217;re writing a full J2EE application that uses EJBs, then you&#8217;ll want to do all of your Jena manipulation from with a bean. As J2EE Container Managed Persistence is designed for relational databases and not triple stores, you&#8217;ll have to use Bean Managed Persistence. In other words write the database manipulation code yourself.<br />
Personally I&#8217;d suggest going with <a href="http://java.about.com/library/weekly/aa_ejbintro2_1.htm">a Session bean</a> that delegates to a <a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html">Data Access Object</a> to do the real work. Your Jena specific code will then be relegated to a small manageable layer in your application. In this scenario you&#8217;ll need to configure the bean&#8217;s deployment descriptor to ensure that it has a resource to your connection pool.<br />
Hopefully that&#8217;s some useful pointers that&#8217;ll help get you started.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ldodds.com/blog/2005/09/using-jena-in-an-application-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jaikoz</title>
		<link>http://www.ldodds.com/blog/2005/06/jaikoz/</link>
		<comments>http://www.ldodds.com/blog/2005/06/jaikoz/#comments</comments>
		<pubDate>Tue, 07 Jun 2005 15:43:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://www.ldodds.com/lostboy/?p=209</guid>
		<description><![CDATA[The developers of Jaikoz, a Java MP3 tag editor mailed be yesterday to say that their latest release is now live on their site. I&#8217;m mentioning this because Jaikoz bundles my MusicBrainz API for doing metadata lookups using MusicBrainz.
Jaikoz is payware although there&#8217;s a free trial available. I should note that I&#8217;m not getting any [...]]]></description>
			<content:encoded><![CDATA[<p>The developers of <a href="http://www.jthink.net/jaikoz/jsp/startup.jsp">Jaikoz</a>, a Java MP3 tag editor mailed be yesterday to say that their latest release is now live on their site. I&#8217;m mentioning this because Jaikoz bundles <a href="http://www.ldodds.com/projects/musicbrainz/">my MusicBrainz API</a> for doing metadata lookups using <a href="http://www.musicbrainz.org">MusicBrainz</a>.<br />
Jaikoz is payware although there&#8217;s a free trial available. I should note that I&#8217;m not getting any kickbacks from this: the API is CreativeCommons licenced so they&#8217;re free to do what they want with it. They did check in with me first though, which was very friendly. I did suggest that they may want to consider donating money to MusicBrainz if they get enough sales.<br />
I&#8217;m just pleased that they found it useful enough to include it in their application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ldodds.com/blog/2005/06/jaikoz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MusicBrainz Java API beta-2</title>
		<link>http://www.ldodds.com/blog/2005/02/musicbrainz-java-api-beta-2/</link>
		<comments>http://www.ldodds.com/blog/2005/02/musicbrainz-java-api-beta-2/#comments</comments>
		<pubDate>Tue, 01 Feb 2005 18:20:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Semantic Web]]></category>

		<guid isPermaLink="false">http://www.ldodds.com/lostboy/?p=183</guid>
		<description><![CDATA[I&#8217;ve just uploaded beta-2 of my Java API to MusicBrainz RDF web service.
The API is Creative Commons licensed and is built around the Jena 2 Semantic Web toolkit.
The API provides raw access to the RDF returned from the service, but also a simple JavaBean layer for developers wanting a simpler interface to the data. You [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just uploaded beta-2 of my <a href="http://www.ldodds.com/projects/musicbrainz/">Java API to MusicBrainz RDF web service</a>.<br />
The API is <a href="http://creativecommons.org/licenses/by-sa/1.0/">Creative Commons licensed</a> and is built around the <a href="http://jena.sourceforge.net">Jena 2</a> Semantic Web toolkit.<br />
The API provides raw access to the RDF returned from the service, but also a simple JavaBean layer for developers wanting a simpler interface to the data. You can read the <a href="http://www.ldodds.com/projects/musicbrainz/api">Javadoc</a> and view the <a href="http://www.ldodds.com/projects/musicbrainz/CHANGES.txt">changes</a> since the last beta; these mainly consist of some bug fixes and support for a few new properties (including Amazon ASINs).<br />
The API doesn&#8217;t aim to mimic everything in the C/C++ API, e.g. track id calculation or submission, it&#8217;s merely a read-only version suitable for embedding in Java applications.<br />
I&#8217;ve included a trivial demo in this release: a simple command-line application that reads in a list of album names, looks them up in the service and aggregates the basic metadata into a new RDF document which is dumped to the console.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ldodds.com/blog/2005/02/musicbrainz-java-api-beta-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slug: A Simple Semantic Web Crawler</title>
		<link>http://www.ldodds.com/blog/2004/12/slug-a-simple-semantic-web-crawler/</link>
		<comments>http://www.ldodds.com/blog/2004/12/slug-a-simple-semantic-web-crawler/#comments</comments>
		<pubDate>Fri, 10 Dec 2004 03:38:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Semantic Web]]></category>

		<guid isPermaLink="false">http://www.ldodds.com/lostboy/?p=167</guid>
		<description><![CDATA[Back in March I was tinkering with writing a Scutter. I&#8217;d never written a web crawler before, so was itching to give it a go as a side project.  I decided to call it Slug because I was pretty sure it&#8217;d end up being a slow and probably icky; crafting a decent web crawler [...]]]></description>
			<content:encoded><![CDATA[<p>Back in March I was tinkering with writing a <a href="http://rdfweb.org/topic/Scutter">Scutter</a>. I&#8217;d never written a web crawler before, so was itching to give it a go as a side project.  I decided to call it Slug because I was pretty sure it&#8217;d end up being a slow and probably icky; crafting a decent web crawler is an art in itself.</p>
<p>I got as far as putting together a basic framework that did the essential stuff: reading a scutter plan, fetching the documents using multi-threaded workers, etc. But I ended up getting sucked into a work project that ate up all my time so didn&#8217;t get much further with it.</p>
<p>Anyway, because the world is obviously sorely in need of another half-finished Scutter implementation, I&#8217;ve spent a few hours this evening tidying up some of the code so that it&#8217;s suitable for sharing.</p>
<p><span id="more-167"></span></p>
<p>If you&#8217;re just in interested in the code, then lets get the links out of the way first:</p>
<ul>
<li><a href="http://www.ldodds.coms/projects/slug/slug-alpha-1-src.zip">Slug Alpha 1 Source Distribution</a></li>
<li><a href="http://www.ldodds.com/projects/slug/javadoc/">Slug API Javadoc</a></li>
</ul>
<p>The code is published under a <a href="http://creativecommons.org/licenses/by-sa/2.0/">Creative Commons Attribution-ShareALike licence</a>.</p>
<p>To run the code using the supplied batch file (sorry, don&#8217;t have access to a *nix box at the moment to add a shell script) do the following from the directory into which you unpack the zip:</p>
<pre>
<code>
slug -mem memory.rdf -workers 10 -plan sample-plan.rdf
</code>
</pre>
<p>This will kick off a scutter with 10 worker threads, as well as telling it where to find its memory and new scutter plan.</p>
<p>As Slug is basically a prototype it doesn&#8217;t do anything clever with what it finds. It simply GETs every URL from its RDF scutter plan, writes a copy of the <i>original</i> RDF file to filesystem, which it then parses with Jena to find any seeAlso&#8217;s. The new URLs it finds as a result are then added to its ongoing list of tasks. And so on ad infinitum: it&#8217;ll just keep on sliming its way across the semantic web until you kill it. You can merrily Ctrl-C the process as there&#8217;s a shutdown hook registered that&#8217;ll ensure the process tidies up after itself.</p>
<p>The reason it doesn&#8217;t add the triples directly to a triple store is because I wanted to be able to collect a chunk of RDF files locally for processing in different ways, e.g. to test out smushing algorithms, look for common authoring mistakes, etc. By default these files are stored in a <code>slug-cache</code> directory under your user home &#8212; but you can override that with the <code>-cache</code> parameter.</p>
<p>The one novel thing it does do (at least as far as I&#8217;m aware) is to use the <a href="http://rdfweb.org/topic/ScutterVocab">ScutterVocab</a> to record what it did when. This is what gets stored in the memory. Here&#8217;s an extract from the example included in the distribution:
<pre><code>
&lt;scutter:Representation>
&lt;scutter:source rdf:resource="http://heddley.com/edd/foaf.rdf"/>
&lt;scutter:origin rdf:resource="http://ldodds.com/ldodds-knows.rdf"/>
&lt;scutter:origin rdf:resource="http://rdfweb.org/people/danbri/rdfweb/webwho.xrdf"/>
&lt;scutter:origin rdf:resource="http://www.simonstl.com/foaf.rdf"/>
&lt;scutter:fetch>
&lt;scutter:Fetch>
&lt;dc:date>2004-12-09T21:57:03+0000&lt;/dc:date>
&lt;scutter:status>200&lt;/scutter:status>
&lt;scutter:contentType>application/rdf+xml&lt;/scutter:contentType>
&lt;scutter:lastModified>Mon, 05 Jul 2004 13:52:28 GMT&lt;/scutter:lastModified>
&lt;scutter:etag>"adc416-2741-40e95d1c"&lt;/scutter:etag>
&lt;scutter:rawTripleCount>164&lt;/scutter:rawTripleCount>
&lt;/scutter:Fetch>
&lt;/scutter:fetch>
&lt;scutter:localCopy>...\ldodds\slug-cache\heddley.com\edd\foaf.rdf&lt;/scutter:localCopy>
&lt;scutter:origin rdf:resource="http://www.ldodds.com/ldodds-knows.rdf"/>
&lt;scutter:origin rdf:resource="http://eikeon.com/foaf.rdf"/>
&lt;scutter:fetch rdf:nodeID="A164"/>
&lt;scutter:latestFetch rdf:nodeID="A164"/>
&lt;scutter:origin rdf:resource="http://www.grorg.org/dean/foaf.rdf"/>
&lt;scutter:origin rdf:resource="http://www.wachob.com/foaf.rdf"/>
&lt;scutter:origin rdf:resource="http://weblog.greenpeace.org/foaf.rdf"/>
&lt;scutter:origin rdf:resource="http://chimpen.com/foaf.rdf"/>
...
&lt;/scutter:Representation>
</code></pre>
</p>
<p>The <code>source</code> property indicates the source URL of the <code>Representation</code>, and the <code>origin</code> properties indicating references to it from elsewhere. </p>
<p>The Scutter stores the results of its its GET in a <code>Fetch</code> resource that includes details such as date of fetch, HTTP response codes, Last-Modified and ETag headers (Slug supports Conditional-GET behaviour), and the number of triples in the file. If Slug encountered an error then a <code>Reason</code> is recorded too &#8212; it&#8217;ll also avoid refetching that URL again. See the <a href="http://purl.org/net/scutter/">ScutterVocab</a> page for more details.</p>
<p>Thats pretty much it. No fancy crawling strategires, no loop detection, no cleaver handling of HTML responses to look for referenced metadata, and no LiveJournal avoidance tactics. If you want to do something more clever with it though, then the framework is reasonably extensible:</p>
<p>For example if you want to put the triples directly into a triple store, then just add a new <a href="http://www.ldodds.com/projects/slug/api/com/ldodds/slug/framework/Consumer.html">Consumer</a> implementation. The <a href="http://www.ldodds.com/projects/slug/api/com/ldodds/slug/framework/DelegatingConsumerImpl.html">DelegatingConsumerImpl</a> I&#8217;m already using can create a simple pipeline for handling results of a GET.</p>
<p>Or if you want to add on a user interface then there are hooks for that too, look at the <a href="http://www.ldodds.com/projects/slug/api/com/ldodds/slug/framework/Controller.html">Controller</a> and <a href="http://www.ldodds.com/projects/slug/api/com/ldodds/slug/framework/Monitor.html">Monitor</a> interfaces. There are methods there for monitoring how many threads are active, and dynamically adjusting the number of workers.</p>
<p>But if you&#8217;re just interested in analysing links between resources on the semantic web, getting estimates of numbers of triples, or analysing the RDF that&#8217;s out there to look for common authoring mistakes, etc then just collecting data in Slug&#8217;s memory and offline cache may be sufficient for your needs.</p>
<p>Anyway, if you do find this useful, or want help getting it up and running and/or integrated into your own applications then please feel free to get in touch.</p>
<p>At the moment I&#8217;m noodling with an alternate version which uses asynchronous messaging using JMS as the basic Scutter kernel. Matt Biddulph&#8217;s <a href="http://idealliance.org/papers/dx_xmle04/papers/03-06-03/03-06-03.html">Crawling the Semantic Web</a> paper mentions using asynchronous messaging to provider co-ordination between a Scutter and application interested in RDF data, so I may hack a crack at something in that vein.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ldodds.com/blog/2004/12/slug-a-simple-semantic-web-crawler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>foaf-beans 0.1</title>
		<link>http://www.ldodds.com/blog/2004/09/foaf-beans-0-1/</link>
		<comments>http://www.ldodds.com/blog/2004/09/foaf-beans-0-1/#comments</comments>
		<pubDate>Tue, 07 Sep 2004 02:52:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Semantic Web]]></category>

		<guid isPermaLink="false">http://www.ldodds.com/lostboy/?p=164</guid>
		<description><![CDATA[I&#8217;m pleased to announce the first iteration of a Java API for FOAF based around the Jena semantic web toolkit.
The API, which I&#8217;ve dubbed &#8220;foaf-beans&#8221;, is an attempt to provide a number of convenience classes that will allow Java developers to quickly get to grips with reading and writing FOAF data. With this in mind [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to announce the first iteration of a Java API for FOAF based around the <a href="http://jena.sourceforge.net">Jena</a> semantic web toolkit.<br />
The API, which I&#8217;ve dubbed &#8220;foaf-beans&#8221;, is an attempt to provide a number of convenience classes that will allow Java developers to quickly get to grips with reading and writing FOAF data. With this in mind the API provides a thin layer of abstraction which hides much of the RDF processing, instead presenting the user with simple factory classes that create <code>FOAFGraph</code> and <code>FOAFWriter</code> objects for reading and writing respectively. These objects generate and process simple Java Beans that should play nicely with other Java APIs and toolkits (particularly JSP, JSTL, etc).</p>
<p><span id="more-164"></span><br />
In this first version of the API, the <code>FOAFGraph</code> interface supports:</p>
<ul>
<li>Loading FOAF data from disk or the network</li>
<li>Determining the primaryTopic of a FOAF document, either using an explicit property of a <code>foaf:PersonalProfileDocument</code>,<br />
or some guesswork</li>
<li>Listing all people mentioned in a document</li>
<li>Finding people with a specific property (identified by URI) or property and value</li>
<li>Working with general RDF graphs as well as foaf:PersonalProfileDocuments</li>
<li>Reading basic <code>foaf:Person</code> properties and <code>foaf:knows</code> relationships</li>
</ul>
<p>The <code>FOAFWriter</code> interface supports:</p>
<ul>
<li>Writing basic <code>foaf:Person</code> metadata, including <code>foaf:knows</code> relationships</li>
<li>Writing to files, or POSTing to a URI (this is shamefully untested, but &#8220;release early&#8221; and all that&#8230;)</li>
<li>Writing <code>foaf:PersonalProfileDocument</code> documents including <code>admin:generatorAgent</code> and other<br />
useful metadata</li>
</ul>
<p>Developers familiar with Jena can directly make use of a number of utility classes that provide this functionality, so hopefully there&#8217;s something for everyone.<br />
The next release of the API will incorporate at least the following:</p>
<ul>
<li>Smushing &#8212; a major failing, but this is version 0.1</li>
<li>Dealing more sensibly with multiple properties of the same person (e.g. several &#8216;blogs, emails, etc)</li>
<li>Better documentation and examples</li>
</ul>
<p>It&#8217;s also worth noting that the API doesn&#8217;t do any inferencing or schema processing. If you dip into the Jena specific classes then you can substitute a model containing schema information, however I want to expose this more explicitly through the API. The basic classes and interfaces also have some basic hooks that will allow me to wire in other RDF toolkits as and when I get time to play with them (<a href="http://www.redland.opensource.ac.uk/">Redland</a> is top of my list).<br />
The majority of the code has been reasonably well tested but I don&#8217;t expect it to be bug free, so tread carefully. In fact in time honoured tradition I expect there&#8217;s at least one school boy error in there somewhere which&#8217;ll have me scrabbling to post 0.1.1 sometime tomorrow. The code has mainly evolved from work I originally did on the <a href="http://www.ldodds.com/blog/archives/000087.html">Java version of the FOAF-a-Matic</a>, and there are a number of JUnit test cases included which should illustrate how the API works.<br />
I&#8217;m happy to take suggestions, patches, bug reports, whatever. It&#8217;s all Public Domain (although attribution would be nice) so do with it what you will.<br />
<a href="http://www.ldodds.com/foaf/foaf-beans/foaf-beans-0.1-src.zip">Download foaf-beans-0.1-src.zip</a> (7.5MB, includes Jena)<br />
<a href="http://www.ldodds.com/foaf/foaf-beans/foaf-beans-0.1-nolibs-src.zip">Download foaf-beans-0.1-nolibs-src.zip</a> (~200kb, no Jena)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ldodds.com/blog/2004/09/foaf-beans-0-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bayesian Agents</title>
		<link>http://www.ldodds.com/blog/2004/09/bayesian-agents/</link>
		<comments>http://www.ldodds.com/blog/2004/09/bayesian-agents/#comments</comments>
		<pubDate>Thu, 02 Sep 2004 17:36:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Semantic Web]]></category>

		<guid isPermaLink="false">http://www.ldodds.com/lostboy/?p=159</guid>
		<description><![CDATA[Classifier4J is a Java text classification library that includes a text summariser and a Bayesian classifier. It was my interest in the latter that lead me to play with the API recently, as I wanted to demonstrate to some colleagues the ease with which one can use Bayesian classification to create a content filter/recommender. Well, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://classifier4j.sourceforge.net/">Classifier4J</a> is a Java text classification library that includes a text summariser and a Bayesian classifier. It was my interest in the latter that lead me to play with the API recently, as I wanted to demonstrate to some colleagues the ease with which one can use Bayesian classification to create a content filter/recommender. Well, it&#8217;s easy if all the hard work is done for you in a library!</p>
<p>The Classifier4J API is very easy to use, and you can plug a Bayesian classifier into an application with very few lines of code.</p>
<p>One of the things that intrigued me about the API design was that it separates out the Classifier from the storage of the words and their probabilities. The API comes with a simple in-memory implementation and a <a href="http://classifier4j.sourceforge.net/apidocs/net/sf/classifier4J/bayesian/JDBCWordsDataSource.html">JDBC Words Data Source</a> which stores the data in a database table.</p>
<p>It occured to me that it&#8217;d be an interesting experiment to create an implementation of <a href="http://classifier4j.sourceforge.net/apidocs/net/sf/classifier4J/bayesian/ICategorisedWordsDataSource.html">the data source interface</a> that stored the data as RDF.</p>
<p>Why RDF? Because then we&#8217;d have the share and aggregate the results of training classifiers.</p>
<p>For example I could export and share a classifier trained to spot spam, semantic web topics, or any number of other categories. The classifiers could be imported into both desktop applications (e.g. Thunderbird) as well as web applications. For example I might train a classifier to spot articles that I&#8217;m interested in, and then upload that configuration into a content management system and have it mine that data for material I may be interested in &#8212; hence &#8220;bayesian agents&#8221;</p>
<p>By tieing my exported bayesian probabilities to my FOAF file an aggregator may merge my data with others known to share similar interests. Trust is another aspect that may reflect whether my data is shared.</p>
<p>Anyone have any comments on this? Is anyone doing anything similar already? (They must be&#8230;)</p>
<p>I&#8217;ll try and hack something up when I get a few minutes.</p>
<p>For the RDF I was thinking of something like the following:</p>
<p><span id="more-159"></span></p>
<pre>
<code>
&lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
&lt;rdfs:Class rdf:ID="WordProbability"/>
&lt;rdf:Property rdf:ID="classifier">
&lt;rdfs:domain rdf:resource="#WordProbability"/>
&lt;rdfs:range rdf:resource="http://xmlns.com/foaf/0.1/Agent"/>
&lt;/rdf:Property>
&lt;rdf:Property rdf:ID="word">
&lt;rdfs:domain rdf:resource="#WordProbability"/>
&lt;rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/>
&lt;/rdf:Property>
&lt;!-- classifier4j uses strings for categories, but URIs seem better -->
&lt;rdf:Property rdf:ID="category">
&lt;rdfs:domain rdf:resource="#WordProbability"/>
&lt;rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
&lt;/rdf:Property>
&lt;!-- need to type these two... -->
&lt;rdf:Property rdf:ID="matchCount">
&lt;rdfs:domain rdf:resource="#WordProbability"/>
&lt;rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/>
&lt;/rdf:Property>
&lt;rdf:Property rdf:ID="nonMatchCount">
&lt;rdfs:domain rdf:resource="#WordProbability"/>
&lt;rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/>
&lt;/rdf:Property>
&lt;/rdf:RDF>
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ldodds.com/blog/2004/09/bayesian-agents/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to make RDF and JSP place nicely together?</title>
		<link>http://www.ldodds.com/blog/2004/03/how-to-make-rdf-and-jsp-place-nicely-together/</link>
		<comments>http://www.ldodds.com/blog/2004/03/how-to-make-rdf-and-jsp-place-nicely-together/#comments</comments>
		<pubDate>Mon, 29 Mar 2004 17:48:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.ldodds.com/lostboy/?p=132</guid>
		<description><![CDATA[Via Gavin (via the chumpologica): An application architecture that should yield superior productivity.
Interesting stuff. I&#8217;ve been pondering something similar myself, mainly because I have a slice of an application I&#8217;m working on that I want to replace with an RDF data model and storage. To achieve this successfully I need to make sure that the [...]]]></description>
			<content:encoded><![CDATA[<p>Via <a href="http://www.machinelake.com/archives/001064.html#001064">Gavin</a> (via the <a href="http://pants.heddley.com/logica/">chumpologica</a>): <a href="http://www.softwarecraftsmen.com/blog/archives/000031.html">An application architecture that should yield superior productivity</a>.<br />
Interesting stuff. I&#8217;ve been pondering something similar myself, mainly because I have a slice of an application I&#8217;m working on that I want to replace with an RDF data model and storage. To achieve this successfully I need to make sure that the data nicely dovetails with the JSP 2.0/JSTL templating environment we&#8217;ve built on top. However I don&#8217;t want to model everything as objects if I can help it, because by doing so I&#8217;m going to sacrifice some of the flexibility I gain from using RDF.<br />
Ideally I want to gut the current Data Access Objects and replace them with node that navigates the underlying RDF graph, perhaps using an RDF query language, and then return a subset of that graph in a form that suitable for traversing with JSTL. There&#8217;s not a great deal of business logic in that slice of the application so there&#8217;s little else to change.<br />
I had been wondering whether the technique used in <a href="http://rdftwig.sourceforge.net/">RDF Twig</a> could be generalized to creation of simple object hierarchies (Lists and Maps). <a href="http://rx4rdf.liminalzone.org/">Rx4RDF</a> might be another useful place to mine for ideas.<br />
Suggestions for other useful APIs to techniques to explore will be gratefully received.<br />
btw, if you find that you start extending your object model to allow arbitrary property annotation, and some of those properties are actually pointers to other objects in your graph, then that&#8217;s probably a sign that you may be better off using an RDF based model. And possibly Python too but I&#8217;ve not explored that angle yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ldodds.com/blog/2004/03/how-to-make-rdf-and-jsp-place-nicely-together/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SAXON</title>
		<link>http://www.ldodds.com/blog/2004/03/saxon/</link>
		<comments>http://www.ldodds.com/blog/2004/03/saxon/#comments</comments>
		<pubDate>Tue, 09 Mar 2004 15:15:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.ldodds.com/lostboy/?p=128</guid>
		<description><![CDATA[Via Cafe con Leche I notice that Saxon 7.9 has been released. The interesting thing is that Mike Kay has founded Saxonica Limited which will offer professional services and additional modules, including a schema-aware processor as a commercial offering.
I&#8217;ve used Saxon for a long time now. It&#8217;s my XSLT processor of choice. I&#8217;ve never bothered [...]]]></description>
			<content:encoded><![CDATA[<p>Via Cafe con Leche I notice that <a href="http://saxon.sourceforge.net/saxon7.9/index.html">Saxon 7.9</a> has been released. The interesting thing is that Mike Kay has founded <a href="http://www.saxonica.com/">Saxonica Limited</a> which will offer professional services and additional modules, including a schema-aware processor as a commercial offering.<br />
I&#8217;ve used Saxon for a long time now. It&#8217;s my XSLT processor of choice. I&#8217;ve never bothered with Xalan or other processors as Saxon has always Just Worked.<br />
Like any good tool Saxon is adjustable enough to help you solve any particular problem. Just recently I&#8217;ve benefited from both the <code>saxon:preview</code> which helped me deal with <a href="http://rdfweb.org/pipermail/rdfweb-dev/2004-January/012482.html">a large transform</a> and the very easy extension mechanism that allowed me to invoke some Java code during a transformation (generating a SHA1 sum for an email address).<br />
I think it&#8217;s good news that Mike is intending to continue offering the basic product for free and wish him well in the commerical venture.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ldodds.com/blog/2004/03/saxon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Web Start and Signing Jars</title>
		<link>http://www.ldodds.com/blog/2003/10/java-web-start-and-signing-jars/</link>
		<comments>http://www.ldodds.com/blog/2003/10/java-web-start-and-signing-jars/#comments</comments>
		<pubDate>Thu, 23 Oct 2003 17:40:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.ldodds.com/lostboy/?p=91</guid>
		<description><![CDATA[In response to a feature request from L. M. Orchard I&#8217;ve just spent a couple of hours packaging up the FOAF-a-Matic Mark 2 as a Java Web Start application.
Actually creating the requisite JNLP file was straight-forward; the specification is clear and the format simple. I very quickly had the application launching from a web page [...]]]></description>
			<content:encoded><![CDATA[<p>In response to a <a href="http://www.ldodds.com/blog/archives/000087.html">feature request</a> from <a href="http://www.decafbad.com/blog/">L. M. Orchard</a> I&#8217;ve just spent a couple of hours packaging up the FOAF-a-Matic Mark 2 as a <a href="http://java.sun.com/products/javawebstart/">Java Web Start</a> application.<br />
Actually creating the requisite JNLP file was straight-forward; the specification is clear and the format simple. I very quickly had the application launching from a web page link. What took a bit longer is working out how to sign the jar files so that I could request permission to access the file system, open local ports and remote connections. Actually with the current version of JNLP you have to create all permissions, there&#8217;s no granularity in what you can request or grant access to. Suprising really as you&#8217;d expect this to be relatively easy to implement giving that the underling security manager and permissions model is all in place.<br />
Anyway, the JNLP and jarsigner documentation just refer you to a certificate authority to get a certificate to sign your jar files. This is frustrating as I&#8217;m not about to fork out for a certificate when I&#8217;m giving the code away for free. A quick bit of googling dug up this excellent document from Richard Dallaway, &#8220;<a href="http://www.dallaway.com/acad/webstart/">Java Web Start and Code Signing</a>&#8220;. Dallaway had met exactly this problem and documented how to sign up for a free certificate from <a href="http://www.thawte.com/html/COMMUNITY/index.html">Thawte</a>.<br />
Completing the requisite application forms, and awaiting for email confirmations ate up the rest of the time required to get FM Mark 2 running under Web Start. Happily Ant already has tasks for signing jars so it was quite straight-forward to add a new target to my build file to create the Web Start distribution.<br />
The lesson to be learned here is to take the time to write up any non-trivial problems you resolve, because you&#8217;re going to save someone (and probaby many people) from floundering around. Doing so with bring good karma. Guaranteed<br />
The Web Start enabled FM Mark 2, plus a couple of bug fixes, will be beta-2.1 arriving at a browser near you shortly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ldodds.com/blog/2003/10/java-web-start-and-signing-jars/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Entity Management in XML applications</title>
		<link>http://www.ldodds.com/blog/2003/09/entity-management-in-xml-applications/</link>
		<comments>http://www.ldodds.com/blog/2003/09/entity-management-in-xml-applications/#comments</comments>
		<pubDate>Wed, 01 Oct 2003 00:37:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Markup]]></category>

		<guid isPermaLink="false">http://www.ldodds.com/lostboy/?p=88</guid>
		<description><![CDATA[I&#8217;m very pleased to say that my latest tutorial for IBM developerWorks is now up on their site:
Enity Management in XML applications
It covers the XML catalog specification and using the Apache XML Resolver classes to add catalog support to your XML applications. Why would you do that? Read the tutorial and find out&#8230;
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m very pleased to say that my latest tutorial for <a href="http://www.ibm.com/developerworks">IBM developerWorks</a> is now up on their site:<br />
<a href="http://www-106.ibm.com/developerworks/edu/x-dw-xentmng-i.html">Enity Management in XML applications</a><br />
It covers the XML catalog specification and using the Apache XML Resolver classes to add catalog support to your XML applications. Why would you do that? Read the tutorial and find out&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ldodds.com/blog/2003/09/entity-management-in-xml-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

