Re: TreeBing goes RDF

Hi Joe,

On mer, 2005-06-29 at 15:38 -0400, Joe Betz wrote:
> Hi Eric,
> 
> A while ago a wrote a Java 5 tool that allows Java Beans to exported to 
> RDF in a Jena Model, which ofcourse can then be serialized.  For example,
> 
> public class Person {
>  
>         String name;
>         ...
>  
>         public String getName() {
>                 return name;
>         }
>  
>         public void setName(String name) {
>                 this.name = name;
>         }
> ....
> }
> 
> can be annotated like so:
> 
> @RdfSerializable
> public class Person {
>  
>         static final String prefix = 
> "http://test.ibm.com/tantrum/person/";
>         static final String namePredicate = 
> "http://test.ibm.com/tantrum/name";
>         ...
> 
>         String name;
>         Person significantOther;
>         List<String> nicknames = new ArrayList<String>();
>         int age;
>  
>         @ResourceField(prefix=prefix)
>         @PredicateField(uri=namePredicate)
>         public String getName() {
>                 return name;
>         }
>  
>         public void setName(String name) {
>                 this.name = name;
>         }
> ....
> }
> 
> Then it can be serialized:
> 
> Model model = ModelFactory.createDefaultModel();
> Person monica = new Person();
> monica.setName("Monica");
> RdfSerializer.serialize(clinton, model);
> model.write(System.err);
> 
> The output is:
> 
> <rdf:RDF
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>     xmlns:j.0="http://test.ibm.com/tantrum/" >
>   <rdf:Description rdf:about="http://test.ibm.com/tantrum/person/Monica">
>     <j.0:name 
> rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Monica</j.0:name>
>   </rdf:Description>
> </rdf:RDF>

This seems to be yet another slightly different approach to RDF
binding...

> I wrote this tool a while ago and it's just a basic proof-of-concept.  It 
> does support some list types and can follow object references (and avoid 
> cycles) but hasn't been tested much.  I would be happy to put it up as 
> opensource on the Jastor sourceforge page if you think it would be useful 
> to you.

For the limited features I have in mind right now (as explained in my
blog), that shouldn't be necessary as the coding seems to be very
straightforward. OTH, this can be a useful example for many
applications.

> Just a couple comments on why we chose to promote Jastor instead of this: 
> Jastor keep a connection with a RDF model so multiple applications 
> changing this data can interact and listen on events through the RDF 
> graph,  Jastor puts a focus on an explicit ontological structure instead 
> of one that implicitly defined by the structure of Java classes.

Yes, that makes sense too. I guess that all that depends where you're
starting from. If you start designing an ontology a Jastor like approach
saves you the time to write your Java classes from scratch but if you
start with a set of existing classes and design your RDF model from
these classes, an approach like TreeBind or the one you're proposing
here make sense.

Thanks,

Eric

-- 
Weblog:
                 http://eric.van-der-vlist.com/blog?t=category&a=English
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------

Received on Thursday, 30 June 2005 06:42:22 UTC