<?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>Cyberborean Chronicles &#187; API</title>
	<atom:link href="http://blog.cyberborean.org/tag/api/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.cyberborean.org</link>
	<description>by Alex Alishevskikh</description>
	<lastBuildDate>Wed, 18 Jan 2012 07:52:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>RDFBeans 2.0</title>
		<link>http://blog.cyberborean.org/2011/04/07/rdfbeans-2-0</link>
		<comments>http://blog.cyberborean.org/2011/04/07/rdfbeans-2-0#comments</comments>
		<pubDate>Thu, 07 Apr 2011 05:46:56 +0000</pubDate>
		<dc:creator>Alex Alishevskikh</dc:creator>
				<category><![CDATA[Howtos]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[RDF]]></category>
		<category><![CDATA[RDFBeans]]></category>
		<category><![CDATA[Semantic Web]]></category>

		<guid isPermaLink="false">http://blog.cyberborean.org/?p=695</guid>
		<description><![CDATA[The second edition of RDFBeans Java-to-RDF databinding framework is finally out. In 2.0 version the library underwent major refactoring to clean and enhance the API and provide new databinding techniques. RDFBeans is an open-source object-RDF databinding and persistence library for the Semantic Web development with Java language. It provides a framework for mapping an object-oriented [...]]]></description>
			<content:encoded><![CDATA[<p>The second edition of <a href="http://rdfbeans.sourceforge.net">RDFBeans</a> Java-to-RDF databinding framework is finally out. In 2.0 version the library underwent major refactoring to clean and enhance the API and provide new databinding techniques.</p>
<div class="excerpt fullwidth">
RDFBeans is an open-source object-RDF databinding and persistence library for the Semantic Web development with Java language. It provides a framework for mapping an object-oriented domain model to RDF resource descriptions. </p>
<p>For more information, see:</p>
<ul>
<li><a href="http://rdfbeans.sf.net">The project web-site</a></li>
<li><a href="http://rdfbeans.sourceforge.net/apidocs/index.html">Javadocs</a></li>
<li><a href="http://rdfbeans.sourceforge.net/download.html">How to get the sourcecode or configure Maven dependency</a></li>
</ul>
</div>
<p><span id="more-695"></span></p>
<h2>RDFBean interfaces and dynamic proxying</h2>
<p>Along with <a href="http://rdfbeans.sourceforge.net/usage.html#Working_with_RDFBean_classes">traditional JavaBean-like persisting technique</a> using RDFBean classes, the version 2.0 introduces new approach to object-RDF mapping: <a href="http://rdfbeans.sourceforge.net/usage.html#Working_with_RDFBean_interfaces">RDFBean interfaces</a>.</p>
<p>It works simply: you define an interface of your domain model object and annotate it just like an RDFBean class:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@RDFNamespaces<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;foaf = http://xmlns.com/foaf/0.1/&quot;</span><span style="color: #009900;">&#41;</span>
@RDFBean<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;foaf:Person&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> IPerson <span style="color: #009900;">&#123;</span>
&nbsp;
    @RDFSubject
    <span style="color: #003399;">String</span> getId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    @RDF<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;foaf:name&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #003399;">String</span> getName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">void</span> setName<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    @RDF<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;foaf:mbox&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #003399;">String</span> getEmail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">void</span> setEmail<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> email<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then you instantiate the <code>RDFBeanManager</code> (was <code>RDFBinding</code> in RDFBeans 1.x) upon an RDF2Go Model and create a <em>dynamic proxy object</em> with your interface:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">ModelFactory modelFactory <span style="color: #339933;">=</span> RDF2Go.<span style="color: #006633;">getModelFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Model model <span style="color: #339933;">=</span> modelFactory.<span style="color: #006633;">createModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
model.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>        
RDFBeanManager manager <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> RDFBeanManager<span style="color: #009900;">&#40;</span>model<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
IPerson person <span style="color: #339933;">=</span> manager.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://example.com/persons/jdoe&quot;</span>, IPerson.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>The methods of this proxy object are directed immediately to the underlying RDF triples, so that</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">person.<span style="color: #006633;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;John Doe&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
person.<span style="color: #006633;">setEmail</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;john@example.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>will cause adding the statements to the model:</p>
<pre>
&lt;http://example.com/persons/jdoe&gt; a &lt;http://xmlns.com/foaf/0.1/Person&gt; ;
	&lt;http://xmlns.com/foaf/0.1/name&gt; "John Doe" ;
	&lt;http://xmlns.com/foaf/0.1/mbox&gt; "john@example.com" ;
</pre>
<p>Similarly, the getter methods will return values retrieved directly from these statements.</p>
<h2>RDFBean annotations</h2>
<p>The <a href="http://rdfbeans.sourceforge.net/rdfbean.html">annotations scheme</a> has changed, so the old classes will be incompatible with RDFBeans 2.0. As you can see in the example above, <code>@RDF</code> annotation is now applied to the getter methods but not to the field declaration like in the previous versions.</p>
<p>You also can notice new annotation, <code>@RDFNamespaces</code>, which defines a list of URI prefixes to be used in other RDFBean annotations declared in a given class or interface. This includes class and property URIs, as well as RDFBean identifiers:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@RDFNamespaces<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> 
	<span style="color: #0000ff;">&quot;foaf = http://xmlns.com/foaf/0.1/&quot;</span>,
	<span style="color: #0000ff;">&quot;persons = http://example.com/persons/&quot;</span> 
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
@RDFBean<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;foaf:Person&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> IPerson <span style="color: #009900;">&#123;</span>
&nbsp;
	@RDFSubject<span style="color: #009900;">&#40;</span>prefix <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;persons:&quot;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #003399;">String</span> getId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
...</pre></div></div>

<p>Annotations are now inherited from superclasses and interfaces that makes the RDFBeans markup compatible with complex domain-specific object models. See how the <code>Thing</code>, <code>Agent</code> and <code>Person</code> classes of the <a href="http://rdfbeans.svn.sourceforge.net/viewvc/rdfbeans/tags/2.0/src/test/java/com/viceversatech/rdfbeans/test/foafexample/entities/">FOAF example</a> are organized to mimic the <code>owl:Thing → foaf:Agent → foaf:Person</code> subclassing in RDF-Schema.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cyberborean.org/2011/04/07/rdfbeans-2-0/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RDFBeans: Now on Sourceforge</title>
		<link>http://blog.cyberborean.org/2009/08/04/rdfbeans-now-on-sourceforge</link>
		<comments>http://blog.cyberborean.org/2009/08/04/rdfbeans-now-on-sourceforge#comments</comments>
		<pubDate>Tue, 04 Aug 2009 10:44:07 +0000</pubDate>
		<dc:creator>Alex Alishevskikh</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[RDF]]></category>
		<category><![CDATA[RDFBeans]]></category>
		<category><![CDATA[Semantic Web]]></category>

		<guid isPermaLink="false">http://blog.cyberborean.org/?p=471</guid>
		<description><![CDATA[RDFBeans framework (see &#8220;Simple RDF data binding&#8220;) is a Sourceforge project now: http://rdfbeans.sourceforge.net]]></description>
			<content:encoded><![CDATA[<p>RDFBeans framework (see &#8220;<a rel="bookmark" href="../2009/02/06/simple-rdf-data-binding">Simple RDF data binding</a>&#8220;) is a Sourceforge project now:</p>
<p class="hand"><a href="http://rdfbeans.sourceforge.net">http://rdfbeans.sourceforge.net</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cyberborean.org/2009/08/04/rdfbeans-now-on-sourceforge/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

