{{{ #!html

rdf2java

The logo has been designed by Dominik Heim

Sven Schwarz    Michael Sintek

}}} == Introduction == rdf2java is a small tool written in Java. It allows easy handling of RDF data. Instead of using an RDF api for creating and searching for RDF triples, i.e., (subject, predicate, object), you just work with Java objects representing RDF subjects / objects. So, in a nutshell, instead of {{{ Property authorProperty = ... Resource myBook = ... myResource.addProperty(authorProperty, "Kobayashi"); }}} you write {{{ Book myBook = ... myBook.setAuthor("Kobayashi"); }}} which not only is more readable but also a lot more comfortable (think of auto-completion in modern programming environments!). Typically, you first create an RDFS (RDF Schema) file, containing declarations for classes and properties. RDF data (e.g. in an RDF file) refers to this RDFS file, just like an XML file can refer to a DTD or to an XML Schema file. The RDF Schema specifies what kind of RDF subjects (i.e. instances of these classes) are allowed and how they are linked to each other (-> properties). So, you have RDFS specifications and RDF data (instances) matching this RDF Schema. == Implementation Details == First, create the .java files containing the code implementing the RDFS instance Java wrapper classes. Each of these wrapper classes is a subclass of !JenaResourceWrapper which extends a Jena Resource in turn. You have to use de.dfki.km.jena2java.RDFS2Class for that. An !ObjectTracker instance keeps a map of RDFS class URIs and the corresponding Java classes. The !ObjectTracker is the place to ask for wrapper objects. The !ObjectTracker takes an URI and returns the most specialized subclass of !JenaResourceWrapper that fits to the RDF:type of the URI supplied. Then, you can use that object's methods to manipulate the underlying RDF. No caching is done - the wrapper object's methods directly work on the Jena RDF model. You have to register all wrapper classes with the !ObjectTracker before using it. This is what the Constants file generated by rdfs2class is for. That's it :-). In case you wonder, if you use a wrapper object's getter method that returns not a literal but an instance, the corresponding wrapper object will get created automatically if not already existing. This is why every wrapper object is linked to an !ObjectTracker - only the !ObjectTracker can create new wrapper objects. == Limitations == * missing support for anonymous resources, RDF sequences, RDFS meta classes, RDFS multiple inheritance == Status == The new Jena-based version of rdf2java is rather new and more or less in prototype stadium. We use it for our projects and with little manual work it processes even quite large RDFS ontologies though. == Development == * Subversion repository URL: https://rdf2java.opendfki.de/repos/rdf2java * Repository web frontend: https://rdf2java.opendfki.de/cgi-bin/trac.cgi/browser/ * Subclipse (Eclipse SVN plugin): http://subclipse.tigris.org/ Contacting the developers is currently done via [mailto:Sven.Schwarz@dfki.de,Malte.Kiesel@dfki.de?subject=[rdf2java]%20 email]. == Credits == The original tool was written by Michael Sintek. Sven Schwarz developed his tool further to suit our increasing needs in the FRODO project. Malte Kiesel extended rdf2java to suit the needs of the !SmartWeb project. == Additional Stuff == In addition to really needed stuff like, e.g., the !KnowledgeBase class, other useful tools emerged naturally. * [wiki:RDFDiff RDFDiff] - compare two RDF files and listing new/missing triples * [wiki:RDFNice RDFNice] - order RDF triples in case a hierarchy can be found * [wiki:RDFDump RDFDump] - dump RDF as triples EOT.