Skip to content

Instantly share code, notes, and snippets.

View kendall's full-sized avatar

Kendall Clark kendall

View GitHub Profile
Book aBook = aManager.find(Book.class, URI.create("urn:x-domain:oreilly.com:product:9780596514129.IP"));
// prints: Switching to the Mac: The Missing Manual, Leopard Edition
System.err.println(aBook.getTitle());
// prints: O'Reilly Media / Pogue Press
System.err.println(aBook.getPublisher());
EntityManager aManager = Persistence.createEntityManagerFactory("oreilly")
.createEntityManager();
Empire.init(new OpenRdfEmpireModule());
@RdfProperty("dc:title")
private String title;
@RdfProperty("dc:publisher")
private String publisher;
@RdfProperty("dc:issued")
private Date issued;
@RdfProperty("frbr:embodiment")
@OneToMany(fetch = FetchType.LAZY,
cascade = {CascadeType.PERSIST, CascadeType.MERGE})
private Collection<Manifestation> mEmbodiments = new HashSet<Manifestation>();
private String title;
private String publisher;
private Date issued;
// ... annotations ...
public class Book implements SupportsRdfId
@Namespaces({"frbr", "http://vocab.org/frbr/core#"})
@Entity
@RdfsClass("frbr:Expression")
public class Book
@Entity
public class Book
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...