Search in sources :

Example 1 with InverseURI

use of org.apache.rya.rdftriplestore.inference.InverseURI in project incubator-rya by apache.

the class PropertyChainTest method testGraphConfiguration.

@Test
public void testGraphConfiguration() throws Exception {
    // build a connection
    RdfCloudTripleStore store = new RdfCloudTripleStore();
    store.setConf(conf);
    store.setRyaDAO(ryaDAO);
    InferenceEngine inferenceEngine = new InferenceEngine();
    inferenceEngine.setRyaDAO(ryaDAO);
    store.setInferenceEngine(inferenceEngine);
    inferenceEngine.refreshGraph();
    store.initialize();
    SailRepository repository = new SailRepository(store);
    SailRepositoryConnection conn = repository.getConnection();
    String query = // 
    "INSERT DATA\n" + // 
    "{ GRAPH <http://updated/test> {\n" + "  <urn:greatMother> owl:propertyChainAxiom <urn:12342>  . " + " <urn:12342> <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:node1atjakcvbx15023 . " + " _:node1atjakcvbx15023 <http://www.w3.org/2002/07/owl#inverseOf> <urn:isChildOf> . " + " <urn:12342> <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:node1atjakcvbx15123 . " + " _:node1atjakcvbx15123 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . " + " _:node1atjakcvbx15123 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <urn:MotherOf> .  }}";
    Update update = conn.prepareUpdate(QueryLanguage.SPARQL, query);
    update.execute();
    inferenceEngine.refreshGraph();
    List<URI> chain = inferenceEngine.getPropertyChain(vf.createURI("urn:greatMother"));
    Assert.assertEquals(chain.size(), 2);
    Assert.assertEquals(chain.get(0), new InverseURI(vf.createURI("urn:isChildOf")));
    Assert.assertEquals(chain.get(1), vf.createURI("urn:MotherOf"));
}
Also used : RdfCloudTripleStore(org.apache.rya.rdftriplestore.RdfCloudTripleStore) InferenceEngine(org.apache.rya.rdftriplestore.inference.InferenceEngine) SailRepository(org.openrdf.repository.sail.SailRepository) InverseURI(org.apache.rya.rdftriplestore.inference.InverseURI) SailRepositoryConnection(org.openrdf.repository.sail.SailRepositoryConnection) Update(org.openrdf.query.Update) URI(org.openrdf.model.URI) InverseURI(org.apache.rya.rdftriplestore.inference.InverseURI) Test(org.junit.Test)

Aggregations

RdfCloudTripleStore (org.apache.rya.rdftriplestore.RdfCloudTripleStore)1 InferenceEngine (org.apache.rya.rdftriplestore.inference.InferenceEngine)1 InverseURI (org.apache.rya.rdftriplestore.inference.InverseURI)1 Test (org.junit.Test)1 URI (org.openrdf.model.URI)1 Update (org.openrdf.query.Update)1 SailRepository (org.openrdf.repository.sail.SailRepository)1 SailRepositoryConnection (org.openrdf.repository.sail.SailRepositoryConnection)1