当前位置: 首页>>代码示例>>Java>>正文


Java Sail.shutDown方法代码示例

本文整理汇总了Java中org.openrdf.sail.Sail.shutDown方法的典型用法代码示例。如果您正苦于以下问题:Java Sail.shutDown方法的具体用法?Java Sail.shutDown怎么用?Java Sail.shutDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openrdf.sail.Sail的用法示例。


在下文中一共展示了Sail.shutDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: near_invalidDistance

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
@Test(expected = MalformedQueryException.class)
public void near_invalidDistance() throws Exception {
    final Sail sail = GeoRyaSailFactory.getInstance(conf);
    final SailRepositoryConnection conn = new SailRepository(sail).getConnection();
    try {
        populateRya(conn);

        //Only captial
        final String query =
                "PREFIX geo: <http://www.opengis.net/ont/geosparql#>\n"
                        + "PREFIX geof: <http://www.opengis.net/def/function/geosparql/>\n"
                        + "SELECT * \n" //
                        + "WHERE { \n"
                        + "  <urn:geo> geo:asWKT ?point .\n"
                        + "  FILTER(geof:sfNear(?point, \"POINT(38.8895 77.0353)\"^^geo:wktLiteral, distance))"
                        + "}";

        conn.prepareTupleQuery(QueryLanguage.SPARQL, query).evaluate();
    } finally {
        conn.close();
        sail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:24,代码来源:MongoGeoIndexerFilterIT.java

示例2: near_negativeDistance

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void near_negativeDistance() throws Exception {
    final Sail sail = GeoRyaSailFactory.getInstance(conf);
    final SailRepositoryConnection conn = new SailRepository(sail).getConnection();
    try {
        populateRya(conn);

        //Only captial
        final String query =
                "PREFIX geo: <http://www.opengis.net/ont/geosparql#>\n"
                        + "PREFIX geof: <http://www.opengis.net/def/function/geosparql/>\n"
                        + "SELECT * \n" //
                        + "WHERE { \n"
                        + "  <urn:geo> geo:asWKT ?point .\n"
                        + "  FILTER(geof:sfNear(?point, \"POINT(38.8895 77.0353)\"^^geo:wktLiteral, -100))"
                        + "}";

        final TupleQueryResult rez = conn.prepareTupleQuery(QueryLanguage.SPARQL, query).evaluate();
        while(rez.hasNext()) {
            rez.next();
        }
    } finally {
        conn.close();
        sail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:27,代码来源:MongoGeoIndexerFilterIT.java

示例3: tooManyArgumentsTest

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
@Test(expected = QueryEvaluationException.class)
public void tooManyArgumentsTest() throws Exception {
    final Sail sail = GeoRyaSailFactory.getInstance(conf);
    final SailRepositoryConnection conn = new SailRepository(sail).getConnection();
    try {
        populateRya(conn);

        // Only captial
        final String query =
                "PREFIX geo: <http://www.opengis.net/ont/geosparql#>\n"
                        + "PREFIX geof: <http://www.opengis.net/def/function/geosparql/>\n"
                        + "SELECT * \n" //
                        + "WHERE { \n" + "  <urn:geo> geo:asWKT ?point .\n"
                        + "  FILTER(geof:sfNear(?point, \"POINT(38.8895 77.0353)\"^^geo:wktLiteral, 100, 1000, 10))"
                        + "}";

        conn.prepareTupleQuery(QueryLanguage.SPARQL, query).evaluate();
    } finally {
        conn.close();
        sail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:23,代码来源:MongoGeoIndexerFilterIT.java

示例4: ensureInEventStore_Test

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
@Test
public void ensureInEventStore_Test() throws Exception {
    final Sail sail = GeoRyaSailFactory.getInstance(conf);
    final SailRepository repo = new SailRepository(sail);
    try(final MongoGeoTemporalIndexer indexer = new MongoGeoTemporalIndexer()) {
        indexer.setConf(conf);
        indexer.init();

        addStatements(repo.getConnection());
        final EventStorage events = indexer.getEventStorage();
        final RyaURI subject = new RyaURI("urn:event1");
        final Optional<Event> event = events.get(subject);
        assertTrue(event.isPresent());
    } finally {
        sail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:18,代码来源:MongoGeoTemporalIndexIT.java

示例5: simpleQueryWithoutBindingSet

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
@Test
public void simpleQueryWithoutBindingSet() throws Exception {
    Sail sail = RyaSailFactory.getInstance(conf);
    MongoDBRyaDAO dao = new MongoDBRyaDAO();
    try {
        dao.setConf(conf);
        dao.init();

        final StatementMetadata metadata = new StatementMetadata();
        metadata.addMetadata(new RyaURI("http://createdBy"), new RyaType("Joe"));
        metadata.addMetadata(new RyaURI("http://createdOn"), new RyaType(XMLSchema.DATE, "2017-01-04"));

        final RyaStatement statement = new RyaStatement(new RyaURI("http://Joe"), new RyaURI("http://worksAt"),
                new RyaType("CoffeeShop"), new RyaURI("http://context"), "", metadata);
        dao.add(statement);

        SailRepositoryConnection conn = new SailRepository(sail).getConnection();
        final TupleQueryResult result = conn.prepareTupleQuery(QueryLanguage.SPARQL, query1).evaluate();

        final QueryBindingSet bs = new QueryBindingSet();
        bs.addBinding("x", new LiteralImpl("CoffeeShop"));
        bs.addBinding("y", new LiteralImpl("Joe"));

        final List<BindingSet> bsList = new ArrayList<>();
        while (result.hasNext()) {
            bsList.add(result.next());
        }

        assertEquals(1, bsList.size());
        assertEquals(bs, bsList.get(0));
        dao.delete(statement, conf);
    } finally {
        dao.destroy();
        sail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:37,代码来源:MongoStatementMetadataIT.java

示例6: simpleQueryWithoutBindingSetInvalidProperty

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
/**
 * Tests if results are filtered correctly using the metadata properties. In
 * this case, the date for the ingested RyaStatement differs from the date
 * specified in the query.
 *
 * @throws MalformedQueryException
 * @throws QueryEvaluationException
 * @throws RyaDAOException
 */
@Test
public void simpleQueryWithoutBindingSetInvalidProperty() throws Exception {
    Sail sail = RyaSailFactory.getInstance(conf);
    MongoDBRyaDAO dao = new MongoDBRyaDAO();
    try {
        dao.setConf(conf);
        dao.init();
        final StatementMetadata metadata = new StatementMetadata();
        metadata.addMetadata(new RyaURI("http://createdBy"), new RyaType("Doug"));
        metadata.addMetadata(new RyaURI("http://createdOn"), new RyaType(XMLSchema.DATE, "2017-02-15"));

        final RyaStatement statement = new RyaStatement(new RyaURI("http://Joe"), new RyaURI("http://worksAt"),
                new RyaType("CoffeeShop"), new RyaURI("http://context"), "", metadata);
        dao.add(statement);

        SailRepositoryConnection conn = new SailRepository(sail).getConnection();
        final TupleQueryResult result = conn.prepareTupleQuery(QueryLanguage.SPARQL, query1).evaluate();

        final List<BindingSet> bsList = new ArrayList<>();
        while (result.hasNext()) {
            bsList.add(result.next());
        }
        assertEquals(0, bsList.size());
        dao.delete(statement, conf);
    } finally {
        dao.destroy();
        sail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:39,代码来源:MongoStatementMetadataIT.java

示例7: constantSubjQuery_Test

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
@Test
public void constantSubjQuery_Test() throws Exception {
    final Sail sail = GeoRyaSailFactory.getInstance(conf);
    final SailRepositoryConnection conn = new SailRepository(sail).getConnection();

    try {
        addStatements(conn);

        final String query =
                "PREFIX time: <http://www.w3.org/2006/time#> \n"
                        + "PREFIX tempo: <tag:rya-rdf.org,2015:temporal#> \n"
                        + "PREFIX geo: <http://www.opengis.net/ont/geosparql#>"
                        + "PREFIX geof: <http://www.opengis.net/def/function/geosparql/>"
                        + "SELECT * "
                        + "WHERE { "
                        + "  <urn:event1> time:atTime ?time . "
                        + "  <urn:event1> geo:asWKT ?point . "
                        + "  FILTER(geof:sfWithin(?point, \"POLYGON((-3 -2, -3 2, 1 2, 1 -2, -3 -2))\"^^geo:wktLiteral)) "
                        + "  FILTER(tempo:equals(?time, \"2015-12-30T12:00:00Z\")) "
                        + "}";

        final TupleQueryResult rez = conn.prepareTupleQuery(QueryLanguage.SPARQL, query).evaluate();
        final Set<BindingSet> results = new HashSet<>();
        while(rez.hasNext()) {
            final BindingSet bs = rez.next();
            results.add(bs);
        }
        final MapBindingSet expected = new MapBindingSet();
        expected.addBinding("point", VF.createLiteral("POINT (0 0)"));
        expected.addBinding("time", VF.createLiteral("2015-12-30T12:00:00Z"));

        assertEquals(1, results.size());
        assertEquals(expected, results.iterator().next());
    } finally {
        conn.close();
        sail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:39,代码来源:MongoGeoTemporalIndexIT.java

示例8: userNotAddedCanNotInsert

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
/**
 * Ensure a user that has not been added to the Rya instance can not interact with it.
 */
@Test
public void userNotAddedCanNotInsert() throws Exception {
    final String user = testInstance.createUniqueUser();
    final SecurityOperations secOps = super.getConnector().securityOperations();

    final RyaClient userAClient = AccumuloRyaClientFactory.build(
            new AccumuloConnectionDetails(ADMIN_USER, ADMIN_USER.toCharArray(), getInstanceName(), getZookeepers()),
            super.getClusterInstance().getCluster().getConnector(ADMIN_USER, ADMIN_USER));

    // Install the instance of Rya.
    userAClient.getInstall().install(getRyaInstanceName(), InstallConfiguration.builder().build());

    // Create the user that will not be added to the instance of Rya, but will try to scan it.
    secOps.createLocalUser(user, new PasswordToken(user));

    //Try to add a statement the Rya instance with the unauthorized user. This should fail.
    boolean securityExceptionThrown = false;

    Sail sail = null;
    SailConnection sailConn = null;
    try {
        final AccumuloRdfConfiguration userCConf = makeRyaConfig(getRyaInstanceName(), user, user, getInstanceName(), getZookeepers());
        sail = RyaSailFactory.getInstance(userCConf);
        sailConn = sail.getConnection();

        final ValueFactory vf = sail.getValueFactory();
        sailConn.addStatement(vf.createURI("urn:Alice"), vf.createURI("urn:talksTo"), vf.createURI("urn:Bob"));

    } catch(final RuntimeException e) {
        final Throwable cause = e.getCause();
        if(cause instanceof AccumuloSecurityException) {
            securityExceptionThrown = true;
        }
    } finally {
        if(sailConn != null) {
            sailConn.close();
        }
        if(sail != null) {
            sail.shutDown();
        }
    }

    assertTrue(securityExceptionThrown);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:48,代码来源:AccumuloAddUserIT.java

示例9: userAddedCanInsert

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
/**
 * Ensure a user that has been added to the Rya instance can interact with it.
 */
@Test
public void userAddedCanInsert() throws Exception {
    final String user = testInstance.createUniqueUser();
    final SecurityOperations secOps = super.getConnector().securityOperations();

    final RyaClient userAClient = AccumuloRyaClientFactory.build(
            new AccumuloConnectionDetails(ADMIN_USER, ADMIN_USER.toCharArray(), getInstanceName(), getZookeepers()),
            super.getClusterInstance().getCluster().getConnector(ADMIN_USER, ADMIN_USER));

    // Create the user that will not be added to the instance of Rya, but will try to scan it.
    secOps.createLocalUser(user, new PasswordToken(user));

    // Install the instance of Rya.
    userAClient.getInstall().install(getRyaInstanceName(), InstallConfiguration.builder().build());

    // Add the user.
    userAClient.getAddUser().get().addUser(getRyaInstanceName(), user);

    // Try to add a statement to the Rya instance. This should succeed.
    Sail sail = null;
    SailConnection sailConn = null;

    try {
        final AccumuloRdfConfiguration userDConf = makeRyaConfig(getRyaInstanceName(), user, user, getInstanceName(), getZookeepers());
        sail = RyaSailFactory.getInstance(userDConf);
        sailConn = sail.getConnection();

        final ValueFactory vf = sail.getValueFactory();
        sailConn.begin();
        sailConn.addStatement(vf.createURI("urn:Alice"), vf.createURI("urn:talksTo"), vf.createURI("urn:Bob"));
        sailConn.close();

    } finally {
        if(sailConn != null) {
            sailConn.close();
        }
        if(sail != null) {
            sail.shutDown();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:45,代码来源:AccumuloAddUserIT.java

示例10: removedUserCanNotInsert

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
/**
 * Ensure a user that has been removed from the Rya instance can not interact with it.
 */
@Test
public void removedUserCanNotInsert() throws Exception {
    final String adminUser = testInstance.createUniqueUser();
    final String user = testInstance.createUniqueUser();
    final SecurityOperations secOps = super.getConnector().securityOperations();

    // Create the user that will install the instance of Rya.
    secOps.createLocalUser(adminUser, new PasswordToken(adminUser));
    secOps.grantSystemPermission(adminUser, SystemPermission.CREATE_TABLE);

    final RyaClient userAClient = AccumuloRyaClientFactory.build(
            new AccumuloConnectionDetails(adminUser, adminUser.toCharArray(), getInstanceName(), getZookeepers()),
            super.getClusterInstance().getCluster().getConnector(adminUser, adminUser));

    // Create the user that will be added to the instance of Rya.
    secOps.createLocalUser(user, new PasswordToken(user));

    final RyaClient userCClient = AccumuloRyaClientFactory.build(
            new AccumuloConnectionDetails(user, user.toCharArray(), getInstanceName(), getZookeepers()),
            super.getClusterInstance().getCluster().getConnector(user, user));

    // Install the instance of Rya.
    userAClient.getInstall().install(getRyaInstanceName(), InstallConfiguration.builder().build());

    // Add userC.
    userAClient.getAddUser().get().addUser(getRyaInstanceName(), user);

    // Remove userA.
    userCClient.getRemoveUser().get().removeUser(getRyaInstanceName(), adminUser);

    // Show that userA can not insert anything.
    boolean securityExceptionThrown = false;

    Sail sail = null;
    SailConnection sailConn = null;
    try {
        final AccumuloRdfConfiguration userAConf = makeRyaConfig(getRyaInstanceName(), adminUser, adminUser, getInstanceName(), getZookeepers());
        sail = RyaSailFactory.getInstance(userAConf);
        sailConn = sail.getConnection();

        final ValueFactory vf = sail.getValueFactory();
        sailConn.addStatement(vf.createURI("urn:Alice"), vf.createURI("urn:talksTo"), vf.createURI("urn:Bob"));

    } catch(final RuntimeException e) {
        final Throwable cause = e.getCause();
        if(cause instanceof AccumuloSecurityException) {
            securityExceptionThrown = true;
        }
    } finally {
        if(sailConn != null) {
            sailConn.close();
        }
        if(sail != null) {
            sail.shutDown();
        }
    }

    assertTrue(securityExceptionThrown);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:63,代码来源:AccumuloRemoveUserIT.java

示例11: testEvaluateSingleIndex

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
@Test
public void testEvaluateSingleIndex() throws Exception {
    final Sail nonPcjSail = RyaSailFactory.getInstance(conf);
    final MongoDBRdfConfiguration pcjConf = conf.clone();
    pcjConf.setBoolean(ConfigUtils.USE_PCJ, true);
    final Sail pcjSail = RyaSailFactory.getInstance(pcjConf);
    final SailRepositoryConnection conn = new SailRepository(nonPcjSail).getConnection();
    final SailRepositoryConnection pcjConn = new SailRepository(pcjSail).getConnection();
    addPCJS(pcjConn);
    try {
        final String indexSparqlString = ""//
                + "SELECT ?e ?l ?c " //
                + "{" //
                + "  ?e a ?c . "//
                + "  ?e <http://www.w3.org/2000/01/rdf-schema#label> ?l "//
                + "}";//

        PcjIntegrationTestingUtil.createAndPopulatePcj(conn, getMongoClient(), conf.getMongoDBName() + 1, conf.getRyaInstanceName(), indexSparqlString);

        final String queryString = ""//
                + "SELECT ?e ?c ?l ?o " //
                + "{" //
                + "  ?e a ?c . "//
                + "  ?e <http://www.w3.org/2000/01/rdf-schema#label> ?l . "//
                + "  ?e <uri:talksTo> ?o . "//
                + "}";//

        final CountingResultHandler crh1 = new CountingResultHandler();
        final CountingResultHandler crh2 = new CountingResultHandler();

        conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1);
        pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2);

        assertEquals(crh1.getCount(), crh2.getCount());
    } finally {
        conn.close();
        pcjConn.close();
        nonPcjSail.shutDown();
        pcjSail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:42,代码来源:MongoPcjIntegrationTest.java

示例12: testEvaluateOneIndex

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
@Test
public void testEvaluateOneIndex() throws Exception {
    final Sail nonPcjSail = RyaSailFactory.getInstance(conf);
    final MongoDBRdfConfiguration pcjConf = conf.clone();
    pcjConf.setBoolean(ConfigUtils.USE_PCJ, true);
    final Sail pcjSail = RyaSailFactory.getInstance(pcjConf);
    final SailRepositoryConnection conn = new SailRepository(nonPcjSail).getConnection();
    final SailRepositoryConnection pcjConn = new SailRepository(pcjSail).getConnection();
    addPCJS(pcjConn);
    try {
        final URI superclass = new URIImpl("uri:superclass");
        final URI superclass2 = new URIImpl("uri:superclass2");

        conn.add(subclass, RDF.TYPE, superclass);
        conn.add(subclass2, RDF.TYPE, superclass2);
        conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
        conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));

        final String indexSparqlString = ""//
                + "SELECT ?dog ?pig ?duck  " //
                + "{" //
                + "  ?pig a ?dog . "//
                + "  ?pig <http://www.w3.org/2000/01/rdf-schema#label> ?duck "//
                + "}";//

        final CountingResultHandler crh1 = new CountingResultHandler();
        final CountingResultHandler crh2 = new CountingResultHandler();

        PcjIntegrationTestingUtil.createAndPopulatePcj(conn, getMongoClient(), conf.getMongoDBName() + 1, conf.getRyaInstanceName(), indexSparqlString);

        conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1);
        PcjIntegrationTestingUtil.deleteCoreRyaTables(getMongoClient(), conf.getRyaInstanceName(), conf.getTriplesCollectionName());
        pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh2);

        assertEquals(crh1.count, crh2.count);
    } finally {
        conn.close();
        pcjConn.close();
        nonPcjSail.shutDown();
        pcjSail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:43,代码来源:MongoPcjIntegrationTest.java

示例13: testEvaluateTwoIndexValidate

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
@Test
public void testEvaluateTwoIndexValidate() throws Exception {
    final Sail nonPcjSail = RyaSailFactory.getInstance(conf);
    final MongoDBRdfConfiguration pcjConf = conf.clone();
    pcjConf.setBoolean(ConfigUtils.USE_PCJ, true);
    final Sail pcjSail = RyaSailFactory.getInstance(pcjConf);
    final SailRepositoryConnection conn = new SailRepository(nonPcjSail).getConnection();
    final SailRepositoryConnection pcjConn = new SailRepository(pcjSail).getConnection();
    addPCJS(pcjConn);
    try {
        final URI superclass = new URIImpl("uri:superclass");
        final URI superclass2 = new URIImpl("uri:superclass2");

        conn.add(subclass, RDF.TYPE, superclass);
        conn.add(subclass2, RDF.TYPE, superclass2);
        conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
        conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));

        final String indexSparqlString = ""//
                + "SELECT ?dog ?pig ?duck  " //
                + "{" //
                + "  ?pig a ?dog . "//
                + "  ?pig <http://www.w3.org/2000/01/rdf-schema#label> ?duck "//
                + "}";//

        final String indexSparqlString2 = ""//
                + "SELECT ?o ?f ?e ?c ?l  " //
                + "{" //
                + "  ?e <uri:talksTo> ?o . "//
                + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?l. "//
                + "  ?c a ?f . " //
                + "}";//

        final String queryString = ""//
                + "SELECT ?e ?c ?l ?f ?o " //
                + "{" //
                + "  ?e a ?c . "//
                + "  ?e <http://www.w3.org/2000/01/rdf-schema#label> ?l. "//
                + "  ?e <uri:talksTo> ?o . "//
                + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?l. "//
                + "  ?c a ?f . " //
                + "}";//

        PcjIntegrationTestingUtil.createAndPopulatePcj(conn, getMongoClient(), conf.getMongoDBName() + 1, conf.getRyaInstanceName(), indexSparqlString);
        final MongoPcjQueryNode ais1 = new MongoPcjQueryNode(conf, conf.getMongoDBName() + 1);

        PcjIntegrationTestingUtil.createAndPopulatePcj(conn, getMongoClient(), conf.getMongoDBName() + 2, conf.getRyaInstanceName(), indexSparqlString2);
        final MongoPcjQueryNode ais2 = new MongoPcjQueryNode(conf, conf.getMongoDBName() + 2);

        final List<ExternalTupleSet> index = new ArrayList<>();
        index.add(ais1);
        index.add(ais2);

        ParsedQuery pq = null;
        final SPARQLParser sp = new SPARQLParser();
        pq = sp.parseQuery(queryString, null);
        final List<TupleExpr> teList = Lists.newArrayList();
        final TupleExpr te = pq.getTupleExpr();

        final PCJOptimizer pcj = new PCJOptimizer(index, false, new MongoPcjIndexSetProvider(new StatefulMongoDBRdfConfiguration(conf, getMongoClient())));
        pcj.optimize(te, null, null);
        teList.add(te);

        final IndexPlanValidator ipv = new IndexPlanValidator(false);

        assertTrue(ipv.isValid(te));
    } finally {
        conn.close();
        pcjConn.close();
        nonPcjSail.shutDown();
        pcjSail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:74,代码来源:MongoPcjIntegrationTest.java

示例14: simpleQueryWithBindingSet

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
@Test
public void simpleQueryWithBindingSet() throws Exception {
    Sail sail = RyaSailFactory.getInstance(conf);
    MongoDBRyaDAO dao = new MongoDBRyaDAO();
    try {
        dao.setConf(conf);
        dao.init();
        final StatementMetadata metadata = new StatementMetadata();
        metadata.addMetadata(new RyaURI("http://createdBy"), new RyaType("Joe"));
        metadata.addMetadata(new RyaURI("http://createdOn"), new RyaType(XMLSchema.DATE, "2017-01-04"));

        final RyaStatement statement1 = new RyaStatement(new RyaURI("http://Joe"), new RyaURI("http://worksAt"),
                new RyaType("CoffeeShop"), new RyaURI("http://context"), "", metadata);
        final RyaStatement statement2 = new RyaStatement(new RyaURI("http://Joe"), new RyaURI("http://worksAt"),
                new RyaType("HardwareStore"), new RyaURI("http://context"), "", metadata);
        dao.add(statement1);
        dao.add(statement2);

        SailRepositoryConnection conn = new SailRepository(sail).getConnection();
        final TupleQueryResult result = conn.prepareTupleQuery(QueryLanguage.SPARQL, query1).evaluate();

        final Set<BindingSet> expected = new HashSet<>();
        final QueryBindingSet expected1 = new QueryBindingSet();
        expected1.addBinding("x", new LiteralImpl("CoffeeShop"));
        expected1.addBinding("y", new LiteralImpl("Joe"));
        final QueryBindingSet expected2 = new QueryBindingSet();
        expected2.addBinding("x", new LiteralImpl("HardwareStore"));
        expected2.addBinding("y", new LiteralImpl("Joe"));
        expected.add(expected1);
        expected.add(expected2);

        final Set<BindingSet> bsSet = new HashSet<>();
        while (result.hasNext()) {
            bsSet.add(result.next());
        }

        assertEquals(expected, bsSet);

        dao.delete(statement1, conf);
        dao.delete(statement2, conf);
    } finally {
        dao.destroy();
        sail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:46,代码来源:MongoStatementMetadataIT.java

示例15: simpleQueryWithBindingSetJoinPropertyToSubject

import org.openrdf.sail.Sail; //导入方法依赖的package包/类
/**
 * Tests to see if correct result is passed back when a metadata statement
 * is joined with a StatementPattern statement (i.e. a common variable
 * appears in a StatementPattern statement and a metadata statement).
 * StatementPattern statements have either rdf:subject, rdf:predicate, or
 * rdf:object as the predicate while a metadata statement is any statement
 * in the reified query whose predicate is not rdf:type and not a
 * StatementPattern predicate.
 *
 * @throws MalformedQueryException
 * @throws QueryEvaluationException
 * @throws RyaDAOException
 */
@Test
public void simpleQueryWithBindingSetJoinPropertyToSubject() throws Exception {
    Sail sail = RyaSailFactory.getInstance(conf);
    MongoDBRyaDAO dao = new MongoDBRyaDAO();
    try {
        dao.setConf(conf);
        dao.init();
        final StatementMetadata metadata1 = new StatementMetadata();
        metadata1.addMetadata(new RyaURI("http://createdBy"), new RyaURI("http://Doug"));
        metadata1.addMetadata(new RyaURI("http://createdOn"), new RyaType(XMLSchema.DATE, "2017-01-04"));
        final StatementMetadata metadata2 = new StatementMetadata();
        metadata2.addMetadata(new RyaURI("http://createdBy"), new RyaURI("http://Bob"));
        metadata2.addMetadata(new RyaURI("http://createdOn"), new RyaType(XMLSchema.DATE, "2017-02-04"));

        final RyaStatement statement1 = new RyaStatement(new RyaURI("http://Joe"), new RyaURI("http://worksAt"),
                new RyaURI("http://BurgerShack"), new RyaURI("http://context"), "", metadata1);
        final RyaStatement statement2 = new RyaStatement(new RyaURI("http://Joe"), new RyaURI("http://talksTo"),
                new RyaURI("http://Betty"), new RyaURI("http://context"), "", metadata1);
        final RyaStatement statement3 = new RyaStatement(new RyaURI("http://Fred"), new RyaURI("http://talksTo"),
                new RyaURI("http://Amanda"), new RyaURI("http://context"), "", metadata1);
        final RyaStatement statement4 = new RyaStatement(new RyaURI("http://Joe"), new RyaURI("http://talksTo"),
                new RyaURI("http://Wanda"), new RyaURI("http://context"), "", metadata2);
        dao.add(statement1);
        dao.add(statement2);
        dao.add(statement3);
        dao.add(statement4);

        SailRepositoryConnection conn = new SailRepository(sail).getConnection();
        final TupleQueryResult result = conn.prepareTupleQuery(QueryLanguage.SPARQL, query2).evaluate();

        final Set<BindingSet> expected = new HashSet<>();
        final QueryBindingSet expected1 = new QueryBindingSet();
        expected1.addBinding("b", new URIImpl("http://Betty"));
        expected1.addBinding("a", new URIImpl("http://Joe"));
        expected1.addBinding("c", new URIImpl("http://Doug"));
        expected.add(expected1);

        final Set<BindingSet> bsSet = new HashSet<>();
        while (result.hasNext()) {
            bsSet.add(result.next());
        }

        assertEquals(expected, bsSet);

        dao.delete(statement1, conf);
        dao.delete(statement2, conf);
        dao.delete(statement3, conf);
        dao.delete(statement4, conf);
    } finally {
        dao.destroy();
        sail.shutDown();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:67,代码来源:MongoStatementMetadataIT.java


注:本文中的org.openrdf.sail.Sail.shutDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。