Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Empire: JPA for RDF & SPARQL
1. Empire: RDF & SPARQL Meet
Java & JPA
2010 Semantic Technology
Conference
Michael Grove
Director of Software Development
Clark & Parsia, LLC.
mike@clarkparsia.com
http://clarkparsia.com -- http://www.twitter.com/candp
2. Background
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
data
Part of Java SE and EE editions
Implementations: Hibernate and Toplink.
Empire
Implements JPA for RDF databases
Uses SPARQL rather than JPQL
We're considering adding JPQL support
Apache 2.0 License -- released in Feb 2010.
3. Why?
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
traditional webapps
Conversely, can integrate traditional Java web
frameworks with the Semantic Web
4. Why do this...
Graph aGraph = new GraphImpl();
URI aBook = aGraph.getValueFactory().createURI("urn:oreilly.com:product:9780596514129.IP");
aGraph.add(aBook,
aGraph.getValueFactory().createURI("http://purl.org/dc/terms/publisher"),
aGraph.getValueFactory().createLiteral("O'Reilly Media / Pogue Press"));
aGraph.add(aBook,
aGraph.getValueFactory().createURI("http://purl.org/dc/terms/title"),
aGraph.getValueFactory().createLiteral("Switching to the Mac: The Missing Manual, Leopard Edition"));
// ... setting the additional properties here ...
aGraph.add(aBook,
RDF.TYPE,
aGraph.getValueFactory().createURI("http://vocab.org/frbr/core#Expression"));
5. 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");
aBook.setIssueDate("2008-02-26");
// And so on...
This code is...
More clear
More concise
Easier to understand and maintain
API independent
6. Advantages
Rapid prototypes
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
API independence
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
7. Obligatory Technical Fu
Provides support for Jena, Sesame & 4Store
This includes TDB, SDB, Sesame Native, etc.
Support planned for Mulgara, Bigdata, Virtuoso and
others.
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
8. 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
so inconsistently
We provide a naive approach, but that too will
improve
10. For more information...
A detailed overview:
http://semanticuniverse.com/articles-empire-
rdf-sparql-meet-jpa.html
The WIKI:
http://wiki.github.com/clarkparsia/Empire/
The mailing list:
http://groups.google.com/group/empire-rdf