RDFReactor
From semanticweb.org
| RDFReactor | |
|---|---|
| rdfreactor.semweb4j.org = this page | |
| Status: | stable |
| Last release: | 4.6.2 (2008-00-09) |
| License: | BSD licenses |
| Affiliation: | FZI |
| Web resources | |
RDFReactor views the RDF data model through object-oriented Java proxies. It makes using RDF easy for Java developers. Technically, it translates an ontology into corresponding Java classes.
- 1. Think in objects, not statements - Read and write RDF data using familiar Java objects, e.g. use
person.setName("Max Mustermann")
instead of
addTriple( personURI, nameURI, "Max Mustermann" )
- 2. Dynamic state - all state information is at all times only in the RDF model in the triple store of your choice
- 3. Java interfaces are generated automatically from an RDF Schema. Code generation via Velocity templates.
Contents |
[edit] About
License: Since 13.02.07: RDFReactor is released under the new BSD license. Alternative licensing is possible, just ask us.
Download releases from the release directory
Short changelog: (please see changelog of modules for detailed changes)
- 4.6.2
- Fixed two minor bugs (getAllInstance_as is now getAllInstances, removeAllPROP() is now available more often)
- 4.6.1
- Reduced memory consumption of generator (was 1.5 GB, now is 250M for certain ontologies)
Dependends on Java 5.0, RDF2Go, Jena or Sesame, Velocity
[edit] Modules
[edit] rdfreactor.runtime
This module is needed at runtime to make the generated classes work.
- Maven reports including links to JavaDocs, changelog, source code as HTML, JUnit test results, developer team, dependencies, list of open TODO tags in the code, ...
- Releases (consider downloding the distribution instead)
- Anonymous Subversion (use https:// for developer access)
[edit] rdfreactor.generator
This modules is only needed to generate classes. At runtime, it is not needed.
- Maven reports including links to JavaDocs, changelog, source code as HTML, JUnit test results, developer team, dependencies, list of open TODO tags in the code, ...
- Releases (consider downloding the distribution instead)
- Anonymous Subversion (use https:// for developer access)
Note that the memory consumption for this module can be quite high, e.g. up to 250M for some larger ontologies.
[edit] Documentation
- Frequently Asked Questions
- A paper on RDFReactor presented at the Jena User Conference 2006.
- Currently a (slow running) effort is underway to unite several RDF-Java-bridges, see Tripresso for more information.
- List of open issues - check here if you have a problem or add a new one.
[edit] Introduction to use RDFReactor
The easiest way is to generate Java classes from an RDFS ontology by simply calling a very short Java program from within eclipse. Here you see such a mini-application. It will load an RDF schema from ./data/schema.n3, and generate .java files in src/gen. The generated classes will all have the package declaration org.ontoware.myproject and the ontology will be interpreted as RDFS semantics. Automatically, however, OWL cardinality constraints will be used, if present. The true,true at the end of the method call means that build-ins are skipped. If you set this to false, you re-generate classes for e.g. rdf:Resource, which is redundant. The second true triggers whether rdf:type statements are automatically written to the model. If you create a new Person p with p = new Person( model, someURI ) then automatically the statement (someURI, rdf:type, :Person) will be added to the model.
package org.ontoware.rdfreactor.example;
import org.ontoware.rdf2go.Reasoning; import org.ontoware.rdfreactor.generator.CodeGenerator;
public class GenerateSomething throws Exception {
public static void main(String[] args) {
// "./data/myschema.n3" -
// "src/gen" -
//
CodeGenerator.generate("./data/myschema.n3", "src/gen",
"org.ontoware.myproject", Reasoning.rdfs, true, true);
}
}
[edit] Developer Workflow
Create API
- Write or find an RDF Schema
- Generate API
CodeGenerator.generate("./data/schema.n3", "./src", "org.ontoware.rdfreactor.example","rdfs", true, true);
Use API - Set up RDFReactor
// create an RDF2Go wrapper, e.g. around a Jena data model, which holds all data at runtime
- see RDF2Go
Model m = ...
Use RDFReactor
Person p1 = new Person(m, "http://www.example.com/ns/2005/#person1"); Person p2 = new Person(m, "http://www.example.com/ns/2005/#person2"); Person p3 = new Person(m, "http://www.example.com/ns/2005/#person3"); p1.setName("Joe"); p1.addKnows(p2); p1.addKnows(p3); p2.setName("Jim"); p3.setName("Jon"); Person[] p1friends = p1.getAllKnows(); for (int i = 0; i < p1friends.length; i ) { System.out.println(p1.getName() " knows " p1friends[i].getName() ); }
[edit] Contact
Currently there is no mailinglist.
Acknowledgements
- Initial idea and proof-of-concept-implementation: Andreas Eberhart
- Working prototype: Daniel Oberle and Max Völkel
- The little details that make it work: Werner Thiemann, Benjamin Heitmann, ...
- European Projects supporting this research: Knowledge Web and NEPOMUK

