Skip to content

Instantly share code, notes, and snippets.

View kendall's full-sized avatar

Kendall Clark kendall

View GitHub Profile
#
# To query for all individuals that have an age between 18 and 37 (exclusive)
# in Pellet 2.0, you have to write (ignoring PREFIXes for now):
#
SELECT ?x
WHERE
{ ?x a [ a owl:Restriction ;
owl:onProperty :age ;
owl:someValuesFrom [
Graph aGraph = new GraphImpl();
URI aBook = aGraph.getValueFactory().createURI("urn:x-domain: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 ...
Graph aGraph = new GraphImpl();
URI aBook = aGraph.getValueFactory().createURI("urn:x-domain: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"));
<rdf:Description rdf:about="urn:x-domain:oreilly.com:product:9780596514129.IP">
<foaf1:primarySubjectOf rdf:resource="http://oreilly.com/catalog/9780596514129"/>
<dc1:title xml:lang="en">Switching to the Mac: The Missing Manual, Leopard Edition</dc1:title>
<dc1:title>Switching to the Mac: The Missing Manual, Leopard Edition</dc1:title>
<dc1:creator rdf:resource="urn:x-domain:oreilly.com:agent:pdb:350"/>
<dc1:publisher xml:lang="en">O'Reilly Media / Pogue Press</dc1:publisher>
<dc1:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-02-26</dc1:issued>
<frbr1:embodiment rdf:resource="urn:x-domain:oreilly.com:product:9780596514129.BOOK"/>
<frbr1:embodiment rdf:resource="urn:x-domain:oreilly.com:product:9780596802899.EBOOK"/>
<frbr1:embodiment rdf:resource="urn:x-domain:oreilly.com:product:9780596514129.SAF"/>
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...
@Entity
public class Book
@Namespaces({"frbr", "http://vocab.org/frbr/core#"})
@Entity
@RdfsClass("frbr:Expression")
public class Book
// ... annotations ...
public class Book implements SupportsRdfId
private String title;
private String publisher;
private Date issued;
@OneToMany(fetch = FetchType.LAZY,
cascade = {CascadeType.PERSIST, CascadeType.MERGE})
private Collection<Manifestation> mEmbodiments = new HashSet<Manifestation>();