public void addFromFile() throws RDFParseException, RepositoryException, IOException { // /add data to repo File file = new File("src/test/resources/example/onto2plus.owl"); System.out.println("Add from file."); con.add(file, baseURI, RDFFormat.RDFXML); }
public void addFromURI() throws RepositoryException { ValueFactory f = repo.getValueFactory(); // create some resources and literals to make statements out of org.openrdf.model.URI alice = f.createURI(baseURI + "Alice"); org.openrdf.model.URI bob = f.createURI(baseURI + "Bob"); org.openrdf.model.URI age = f.createURI(baseURI + "age"); org.openrdf.model.URI person = f.createURI(baseURI + "Person"); Literal bobsAge = f.createLiteral(5); Literal alicesAge = f.createLiteral(14); // alice is a person con.add(alice, RDF.TYPE, person); // alice's name is "Alice" // con.add(alice, age, alicesAge); // bob is a person con.add(bob, RDF.TYPE, person); // bob's name is "Bob" // con.add(bob, age, bobsAge); }