<?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>B:\datenbrei &#187; CIL</title>
	<atom:link href="http://b4mad.net/datenbrei/skos/technology/cil/feed/" rel="self" type="application/rss+xml" />
	<link>http://b4mad.net/datenbrei</link>
	<description>Collaborating Individuals - All Knowledge on one Floppy</description>
	<lastBuildDate>Sat, 24 Jan 2009 12:03:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Hacking Jena and Mono/C#</title>
		<link>http://b4mad.net/datenbrei/archives/2006/01/19/hacking-jena-and-monoc/</link>
		<comments>http://b4mad.net/datenbrei/archives/2006/01/19/hacking-jena-and-monoc/#comments</comments>
		<pubDate>Thu, 19 Jan 2006 20:03:22 +0000</pubDate>
		<dc:creator>[GNU]</dc:creator>
				<category><![CDATA[CIL]]></category>
		<category><![CDATA[Mono/C#]]></category>
		<category><![CDATA[semantic web]]></category>

		<guid isPermaLink="false">http://B4mad.Net/datenbrei/?p=266</guid>
		<description><![CDATA[After a short discussion with AndyS on #jena I reengaged on writing a C# application (using Mono) that uses Jena. Compiling all the ARQ-1.2 .jars to CIL using ikvmc was an easy job: ikvmc commons-logging.jar log4j-1.2.12.jar -out:log4j.dll -target:library ikvmc stax-api-1.0.jar wstx-asl-2.8.jar xercesImpl.jar xml-apis.jar \ resolver.jar -out:xml.dll -target:library ikvmc antlr-2.7.5.jar arq.jar concurrent.jar icu4j_3_4.jar \ jakarta-oro-2.0.8.jar jena.jar [...]]]></description>
			<content:encoded><![CDATA[<p>After a short discussion with AndyS on #jena I reengaged on writing a C# application (using <a href="http://www.go-mono.com/">Mono</a>) that uses <a href="http://jena.sourceforge.net/">Jena</a>. Compiling all the <a href="http://jena.sourceforge.net/ARQ/FAQ.html">ARQ</a>-1.2 <code>.jar</code>s to <a href="http://http://en.wikipedia.org/wiki/Common_Intermediate_Language">CIL</a> using <code>ikvmc</code> was an easy job:</p>
<pre><code>
ikvmc commons-logging.jar log4j-1.2.12.jar  -out:log4j.dll -target:library
ikvmc stax-api-1.0.jar wstx-asl-2.8.jar xercesImpl.jar xml-apis.jar \
 resolver.jar -out:xml.dll -target:library
ikvmc antlr-2.7.5.jar arq.jar concurrent.jar icu4j_3_4.jar \
jakarta-oro-2.0.8.jar jena.jar -reference:xml.dll -reference:log4j.dll \
 -out:arq.dll -target:library
</code></pre>
<p>A short test if the Jena classes are working was derived from an example of the Jena documentatio and worked out just fine&#8230; replacing <code>import</code> with <code>using</code> and omitting the trailing <code>.*</code> gave quick working results.</p>
<p>The hard part starts if it comes to <a href="http://jena.sourceforge.net/DB/mysql-howto.html">persistent Jena Models</a>. I am using MySQL, so I <code>ikvmc</code>ed the Java MySQL 3.2alpha driver and used the following code segment as learned from the docs:</p>
<pre><code>
  System.Activator.CreateInstance(&quot;mysql32alpha&quot;,
     &quot;com.mysql.jdbc.Driver&quot;);

  IDBConnection idbcon = new  DBConnection(&quot;jdbc:mysql://db-server-2/jena23&quot;,
     &quot;jdbc&quot;, &quot;password&quot;, &quot;MySQL&quot;);
</code></pre>
<p><code>mysql32alpha</code> is the name of the assembly where the class <code>com.mysql.jdbc.Driver</code> is to be found. Compiling the code went well, running it resulted in <code>Exception: Failure to instantiate DB Driver:MySQL java.lang.NullPointerException</code>. So, I droppt the ikvm developers a line&#8230; awaiting an answer. Hang on for updates</p>
<p><strong>UPDATE 1</strong>: With the devine intervention of &#8220;reinstall and configure your tool chain&#8221; I did that, currently running:</p>
<pre><code>
goern@node-236:~/src/mono/ARQ-1.2$ ikvm -version
CLR version: 1.1.4322.2032 (32 bit)
System: 1.0.5000.0
IKVM.Runtime: 0.22.0.0
IKVM.GNU.Classpath: 0.22.0.0
ikvm: 0.22.0.0
mscorlib: 1.0.5000.0
GNU Classpath version: 0.19
goern@node-236:~/src/mono/ARQ-1.2$ mono --version
Mono JIT compiler version 1.1.13.1, (C) 2002-2005 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV      : normal
</code></pre>
<p>Redoing the build process I got the ARQ and MySql <code>.dll</code>s and my binary, compiled just fine and runs fine. JDBC Connection is opned up, Jena Model gets opened and all the content dumped to Console. Having all the good tools in place two point araise:</p>
<p>1. Determining the Language you use is hard! C# just looks like Java to me at the moment:</p>
<pre><code>
using System;
using com.hp.hpl.jena.rdf.model;
using com.hp.hpl.jena.db;

public class hodge {
   public static void Main() {
           IDBConnection idbcon = null;
           ModelMaker maker = null;
           Model model = null;

           System.Activator.CreateInstance(&quot;mysql32alpha&quot;,
            &quot;com.mysql.jdbc.Driver&quot;);

           idbcon = new  DBConnection(&quot;jdbc:mysql://server/jena23&quot;,
            &quot;user&quot;, &quot;pass&quot;, &quot;MySQL&quot;);
           if (idbcon == null)
                   Console.WriteLine(&quot;no IDBConnection&quot;);

           try {
                   maker = ModelFactory.createModelRDBMaker(idbcon);
                   model = maker.openModel(&quot;pim&quot;);
           } catch (Exception e) {
                   Console.WriteLine(&quot;Exception: &quot; + e.Message);
           }

           Console.WriteLine(model); // model.write(System.out);
   }
}
</code></pre>
<p>2. C# and Mono world seems to be open for Jena.</p>
<p>PS: I have attached a <a href="http://b4mad.net/2006/01/20/jena-sharp.tar.gz">distribution</a> that contains a nant build file for the tasks above and the source code, just configure at top of <code>build.build</code>.</p>
<p>PPS: I have not tested this under some MS Windows.</p>
]]></content:encoded>
			<wfw:commentRss>http://b4mad.net/datenbrei/archives/2006/01/19/hacking-jena-and-monoc/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
