Empire: RDF & SPARQL Meet
Java & JPA
2010 Semantic Technology
Director of Software Development
Clark & Parsia, LLC.
http://clarkparsia.com -- http://www.twitter.com/candp
RDF & SPARQL
You know what these are...
Java Persistence API (JPA)
Standard ORM API for Java developers
Provides a way to map Java beans to relational
Part of Java SE and EE editions
Implementations: Hibernate and Toplink.
Implements JPA for RDF databases
Uses SPARQL rather than JPQL
We're considering adding JPQL support
Apache 2.0 License -- released in Feb 2010.
Empire bridges the gap between traditional web apps &
the semantic web
JPA helps abstract away (most) of the RDF details
Helps lower learning curve for new developers
API, database, & query language independence
Application code is written w/r/t to JPA API
Developers only need to learn the domain API
Sesame/Jena/Other bindings are injected at
runtime -- invisible to the developer
Helps open up the Semantic Web toolkit
Can integrate semweb apps, like Pelorus, with
Conversely, can integrate traditional Java web
frameworks with the Semantic Web
Why do this...
Graph aGraph = new GraphImpl();
URI aBook = aGraph.getValueFactory().createURI("urn:oreilly.com:product:9780596514129.IP");
aGraph.getValueFactory().createLiteral("O'Reilly Media / Pogue Press"));
aGraph.getValueFactory().createLiteral("Switching to the Mac: The Missing Manual, Leopard Edition"));
// ... setting the additional properties here ...
When you can do this.
Book aBook = new Book();
aBook.setTitle("Switching to the Mac: The Missing Manual, Leopard Edition");
aBook.setPublisher("O'Reilly Media / Pogue Press");
// And so on...
This code is...
Easier to understand and maintain
Lowers the learning curve by simplifying the codebase
No more triples and graphs littering your code
Utilities can generate your domain from your ontology
Lets you concentrate on the more important things
Need to switch from Sesame Memory Store to
TDB? Change one line of code and you're done.
We standardize on the standards, RDF & SPARQL
(and JPA), not a particular API like Sesame or Jena.
Plays nicely with others...
Can work alongside normal JPA implementations
Provides a straightforward migration to a more
semantic-web based infrastructure
Obligatory Technical Fu
Provides support for Jena, Sesame & 4Store
This includes TDB, SDB, Sesame Native, etc.
Support planned for Mulgara, Bigdata, Virtuoso and
Dialect implementations for both SPARQL and SeRQL.
No complicated configuration and mappings
Mappings use standard JPA annotations
Configuration are basic Java properties files.
Google Guice used to manage plugin architecture
Javassist for bytecode enhancement
In case you're still awake...
Really? JPA? All of it?
Not quite... We don't support things that are obviously
relational, such as @Table or @Column.
We also don't support parts such as
@SqlSetResultMapping or JPQL, but we're planning
on doing that Real Soon Now
And we're still a little fuzzy on transactions and locking
Most RDF stores don't neatly support these, or do
We provide a naive approach, but that too will
For more information...
A detailed overview:
The mailing list: