Package org.openrdf.repository.sail

Examples of org.openrdf.repository.sail.SailRepository


    public void setUp() throws Exception {
        super.setUp();
        extractorGroup = ExtractorRegistryImpl.getInstance().getExtractorGroup();
        store = new MemoryStore();
        store.initialize();
        conn = new SailRepository(store).getConnection();
    }
View Full Code Here


    NotifyingSail sailStack = new MemoryStore();

    if (ontology == ONTOLOGY.RDFS)
      sailStack = new ForwardChainingRDFSInferencer(sailStack);

    repo = new SailRepository(sailStack);
    try {
      repo.initialize();
      con = repo.getConnection();
    } catch (final RepositoryException e) {
      e.printStackTrace();
View Full Code Here

  }

  @Override
  @Test
  public void testRemoveAll() throws Exception {
    Repository repo = new SailRepository(new MemoryStore());
    repo.initialize();
    RepositoryModelSet modelSet = new RepositoryModelSet(repo);
    modelSet.open();
    URI context1 = new URIImpl("uri:context1");
    URI context2 = new URIImpl("uri:context2");
    modelSet.addStatement(context1, new URIImpl("uri:r1"), new URIImpl(
View Full Code Here

    URI defaultContext = null;
    // create a Sail stack
    Sail sail = new MemoryStore();
    sail = new ForwardChainingRDFSInferencer(sail);
    // create a Repository
    Repository repository = new SailRepository(sail);
    repository.initialize();

    RepositoryConnection con = repository.getConnection();

    con.add(a, RDFS.SUBPROPERTYOF, b, defaultContext);
    con.add(b, RDFS.SUBPROPERTYOF, c, defaultContext);
    Assert.assertTrue(con.hasStatement(a, RDFS.SUBPROPERTYOF, c, true,
        defaultContext));
View Full Code Here

    // create a Sail stack
    Sail sail = new MemoryStore();
    sail = new ForwardChainingRDFSPlusInverseInferencer(sail);

    // create a Repository
    Repository repository = new SailRepository(sail);
    try {
      repository.initialize();
    } catch (RepositoryException e) {
      throw new RuntimeException(e);
    }

    URI a = new URIImpl("urn:test:a");
    URI b = new URIImpl("urn:test:b");
    URI c = new URIImpl("urn:test:c");
    URI d = new URIImpl("urn:test:d");
    URI nrlInverse = ForwardChainingRDFSPlusInverseInferencerConnection.NRL_InverseProperty;

    repository.getConnection().add(a, b, c, new Resource[0]);

    Assert.assertFalse(repository.getConnection().hasStatement(c, d, a,
        true, new Resource[0]));

    repository.getConnection().add(b, nrlInverse, d, new Resource[0]);

    Assert.assertTrue(repository.getConnection().hasStatement(c, d, a,
        true, new Resource[0]));

  }
View Full Code Here

    // create a Sail stack
    Sail sail = new MemoryStore();
    sail = new ForwardChainingRDFSPlusInverseInferencer(sail);

    // create a Repository
    Repository repository = new SailRepository(sail);
    try {
      repository.initialize();
    } catch (RepositoryException e) {
      throw new RuntimeException(e);
    }

    org.openrdf.model.URI a = new org.openrdf.model.impl.URIImpl(
        "urn:test:a");
    org.openrdf.model.URI b = new org.openrdf.model.impl.URIImpl(
        "urn:test:b");
    org.openrdf.model.URI c = new org.openrdf.model.impl.URIImpl(
        "urn:test:c");
    org.openrdf.model.URI d = new org.openrdf.model.impl.URIImpl(
        "urn:test:d");
    org.openrdf.model.URI nrlInverse = new org.openrdf.model.impl.URIImpl(
        "http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#inverseProperty");

    repository.getConnection().add(a, b, c, new Resource[0]);
    Assert.assertTrue("added [a] [b] [c]", repository.getConnection()
        .hasStatement(a, b, c, true, new Resource[0]));

    Assert.assertFalse("expect not [c] [d] [a]", repository.getConnection()
        .hasStatement(c, d, a, true, new Resource[0]));

    // add [b] hasInverse [d]
    repository.getConnection().add(b, nrlInverse, d, new Resource[0]);
    Assert.assertTrue("added [b] nrlInverse [d]", repository
        .getConnection().hasStatement(b, nrlInverse, d, true,
            new Resource[0]));

    Assert.assertTrue("expect [c] [d] [a]", repository.getConnection()
        .hasStatement(c, d, a, true, new Resource[0]));

  }
View Full Code Here

    // create a Sail stack
    Sail sail = new MemoryStore();
    sail = new ForwardChainingRDFSPlusInverseInferencer(sail);

    // create a Repository
    Repository repository = new SailRepository(sail);
    try {
      repository.initialize();
    } catch (RepositoryException e) {
      throw new RuntimeException(e);
    }
   
    URI p = new URIImpl("urn:rel:p");
    URI q = new URIImpl("urn:rel:q");
    URI nrlInverse = ForwardChainingRDFSPlusInverseInferencerConnection.NRL_InverseProperty;
    URI defaultContext = null; // new Resource[0]

    RepositoryConnection con = repository.getConnection();

    // add p-hasInverse-q
    con.add(p, nrlInverse, q, defaultContext);
    assertTrue("just added p-haInv-q, should stil be there",
        con.hasStatement(p, nrlInverse, q, true, defaultContext) );
View Full Code Here

    // create a Sail stack
    Sail sail = new MemoryStore();
    sail = new ForwardChainingRDFSPlusInverseInferencer(sail);

    // create a Repository
    Repository repository = new SailRepository(sail);
    try {
      repository.initialize();
    } catch (RepositoryException e) {
      throw new RuntimeException(e);
    }
   
    URI a1 = new URIImpl("urn:name:a1");
    URI b1 = new URIImpl("urn:name:b1");
    URI relA = new URIImpl("urn:rel:A");
    URI relAinv= new URIImpl("urn:rel:Ainv");
    URI nrlInverse = ForwardChainingRDFSPlusInverseInferencerConnection.NRL_InverseProperty;
    URI defaultContext = null; // new Resource[0]

    RepositoryConnection con = repository.getConnection();
    con.add(a1,relA,b1);
    assert con.hasStatement(a1,relA,b1, true, defaultContext);
    con.add(relA,nrlInverse,relAinv);
    assert con.hasStatement(b1, relAinv, a1, true, defaultContext);
  }
View Full Code Here

    if(reasoning) {
      sail = new ForwardChainingRDFSInferencer((MemoryStore)sail);
    }
   
    // create a Repository
    Repository repository = new SailRepository(sail);
    try {
      repository.initialize();
    } catch(RepositoryException e) {
      throw new ModelRuntimeException(e);
    }
   
    return repository;
View Full Code Here

     */
    @Before
    public void setUp() throws Exception {
        Sail store = new MemoryStore();
        store.initialize();
        conn = new SailRepository(store).getConnection();
    }
View Full Code Here

TOP

Related Classes of org.openrdf.repository.sail.SailRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.