Esempio n. 1
0
  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);
  }
Esempio n. 2
0
  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);
  }
Esempio n. 3
0
 public void close() throws RepositoryException {
   System.out.println("Closing...");
   con.close();
   System.out.println("Done.");
 }