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


Java Sail类代码示例

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


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

示例1: installRyaInstance

import org.openrdf.sail.Sail; //导入依赖的package包/类
private void installRyaInstance() throws Exception {
    final MiniAccumuloCluster cluster = super.getMiniAccumuloCluster();
    final String instanceName = cluster.getInstanceName();
    final String zookeepers = cluster.getZooKeepers();

    // Install the Rya instance to the mini accumulo cluster.
    final RyaClient ryaClient = AccumuloRyaClientFactory.build(
            new AccumuloConnectionDetails(ACCUMULO_USER, ACCUMULO_PASSWORD.toCharArray(), instanceName, zookeepers),
            super.getAccumuloConnector());

    ryaClient.getInstall().install(RYA_INSTANCE_NAME,
            InstallConfiguration.builder().setEnableTableHashPrefix(false).setEnableFreeTextIndex(false)
                    .setEnableEntityCentricIndex(false).setEnableGeoIndex(false).setEnableTemporalIndex(false).setEnablePcjIndex(true)
                    .setFluoPcjAppName(super.getFluoConfiguration().getApplicationName()).build());

    // Connect to the Rya instance that was just installed.
    final AccumuloRdfConfiguration conf = makeConfig(instanceName, zookeepers);
    final Sail sail = RyaSailFactory.getInstance(conf);
    dao = RyaSailFactory.getAccumuloDAOWithUpdatedConfig(conf);
    ryaSailRepo = new RyaSailRepository(sail);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:22,代码来源:KafkaExportITBase.java

示例2: connectToRya

import org.openrdf.sail.Sail; //导入依赖的package包/类
private Sail connectToRya(final String ryaInstanceName) throws RyaClientException {
    try {
        final AccumuloConnectionDetails connectionDetails = super.getAccumuloConnectionDetails();

        final AccumuloRdfConfiguration ryaConf = new AccumuloRdfConfiguration();
        ryaConf.setTablePrefix(ryaInstanceName);
        ryaConf.set(ConfigUtils.CLOUDBASE_USER, connectionDetails.getUsername());
        ryaConf.set(ConfigUtils.CLOUDBASE_PASSWORD, new String(connectionDetails.getUserPass()));
        ryaConf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, connectionDetails.getZookeepers());
        ryaConf.set(ConfigUtils.CLOUDBASE_INSTANCE, connectionDetails.getInstanceName());

        // Turn PCJs off so that we will only scan the core Rya tables while building the PCJ results.
        ryaConf.set(ConfigUtils.USE_PCJ, "false");

        return RyaSailFactory.getInstance(ryaConf);
    } catch (SailException | AccumuloException | AccumuloSecurityException | RyaDAOException | InferenceEngineException e) {
        throw new RyaClientException("Could not connect to the Rya instance named '" + ryaInstanceName + "'.", e);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:20,代码来源:AccumuloBatchUpdatePCJ.java

示例3: ensureInEntityStore_Test

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

    try(MongoEntityIndexer indexer = new MongoEntityIndexer()) {
        indexer.setConf(conf);
        indexer.init();

        setupTypes(indexer);
        addStatements(conn);

        final EntityStorage entities = indexer.getEntityStorage();
        final RyaURI subject = new RyaURI("urn:alice");
        final Optional<Entity> alice = entities.get(subject);
        assertTrue(alice.isPresent());
    } finally {
        conn.close();
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:22,代码来源:MongoEntityIndexIT.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: getSail

import org.openrdf.sail.Sail; //导入依赖的package包/类
@Override
public synchronized Sail getSail() throws SailException {
	if (repository == null) {
		try {
			virtuoso = new VirtuosoRepository("jdbc:virtuoso://localhost:1111", "dba", "dba", true);
			repository = new RepositorySail(virtuoso);
			
			// Needed for inferencing...
			URL schema = Thread.currentThread().getContextClassLoader().getResource("/org/waag/ah/rdf/schema/artsholland.rdf");
			RepositoryConnection connection = virtuoso.getConnection();
			connection.add(schema, null, RDFFormat.RDFXML);
			virtuoso.createRuleSet("artsholland", "http://purl.org/artsholland/1.0/");
			connection.close();
			
		} catch (Exception e) {
			throw new SailException(e);
		}
	}
	return repository;
}
 
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:21,代码来源:Virtuoso.java

示例9: getSail

import org.openrdf.sail.Sail; //导入依赖的package包/类
@Override
	public synchronized Sail getSail() throws SailException {
		if (sail == null) {
			try {
				config = PlatformConfigHelper.getConfig();
				Properties properties = ConfigurationConverter.getProperties(loadProperties());
//				BigdataSailRepository repository = new BigdataSailRepository(new com.bigdata.rdf.sail.BigdataSail(properties));
//				repo = new BigdataSail(repository);
				sail = new SimpleTypeInferencingSail(
//					   new SmartSailWrapper(
					   new BigdataSail(properties));
//				sail.setPipelineTypes(Arrays.asList(
//						"getReadOnlyConnection", 
//						"getReadWriteConnection",
//						"getUnisolatedConnection"));
			} catch (Exception e) {
				throw new SailException(e);
			} 
		}
		return sail;
	}
 
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:22,代码来源:Bigdata.java

示例10: GenerateRdf

import org.openrdf.sail.Sail; //导入依赖的package包/类
public GenerateRdf(String currentNameSpace, String outputFileName) throws RepositoryException {
    rand = new Random(System.currentTimeMillis());

    if (!outputFileName.contains(".rdf")) {
        outputFileName += ".rdf";
    }

    java.io.File outFile = new java.io.File("tmp/" + outputFileName.replace(".rdf", "")+ UUID.randomUUID());
    Sail sailInMemory = new MemoryStore(outFile);
    sr = new SailRepository(sailInMemory);
    sr.initialize();
    src = sr.getConnection();
    vf = sr.getValueFactory();

    try {
        currentNamespaceUri = vf.createURI(currentNameSpace);
        _currentNamespace = currentNameSpace;
    } catch (IllegalArgumentException ex) {
        Logger.getLogger(App.class.getName()).warning("The uri was invalid. Using the default one: " + DEFAULT_NAMESPACE);
        currentNamespaceUri = vf.createURI(DEFAULT_NAMESPACE);
        _currentNamespace = DEFAULT_NAMESPACE;
    }

    this.outputFileName = outputFileName;
}
 
开发者ID:ale003,项目名称:testGraphDbs,代码行数:26,代码来源:GenerateRdf.java

示例11: getSail

import org.openrdf.sail.Sail; //导入依赖的package包/类
public Sail getSail(SailImplConfig config)
	throws SailConfigException
{
	if (!SAIL_TYPE.equals(config.getType())) {
		throw new SailConfigException("Invalid Sail type: " + config.getType());
	}

	BEDFileStore memoryStore = new BEDFileStore();

	if (config instanceof BEDFileConfig) {
		BEDFileConfig memConfig = (BEDFileConfig)config;

		memoryStore.setBedFile(new File(memConfig.getFile()));
	}

	return memoryStore;
}
 
开发者ID:JervenBolleman,项目名称:sparql-bed,代码行数:18,代码来源:BEDFileStoreFactory.java

示例12: RepositoryRegistry

import org.openrdf.sail.Sail; //导入依赖的package包/类
/**
 * Initializes Sesame repository for Neo4j based on Blueprints
 * implementation.
 *
 * @param database Neo4j database service
 * @throws RepositoryException if there was a problem initializing the
 * Sesame repository
 */
private RepositoryRegistry(GraphDatabaseService database)
		throws RepositoryException {
	initRio();
	Graph graph = new Neo4j2Graph(database);
	String patterns = SPARQLExtensionProps.getProperty("query.patterns");
	Sail sail = new GraphSail((KeyIndexableGraph) graph, patterns);
	this.rep = new SailRepository(sail);
	rep.initialize();
}
 
开发者ID:lszeremeta,项目名称:neo4j-sparql-extension-yars,代码行数:18,代码来源:RepositoryRegistry.java

示例13: createRc

import org.openrdf.sail.Sail; //导入依赖的package包/类
@Override
protected final void createRc( Properties p ) {
	if ( null != rc ) {
		// we've already have our rc created, so there's nothing to do here
		return;
	}

	Security.getSecurity().associateUser( this, new LocalUserImpl() );

	MemoryStore memstore = ( p.containsKey( MEMSTORE_DIR )
			? new MemoryStore( new File( p.getProperty( MEMSTORE_DIR ) ) )
			: new MemoryStore() );

	if ( p.containsKey( SYNC_DELAY ) ) {
		memstore.setSyncDelay( Long.parseLong( p.getProperty( SYNC_DELAY ) ) );
	}

	Sail sail = ( p.containsKey( INFER )
			? new ForwardChainingRDFSInferencer( memstore )
			: memstore );

	Repository repo = new SailRepository( sail );

	try {
		repo.initialize();
		rc = repo.getConnection();
	}
	catch ( Exception e ) {
		try {
			repo.shutDown();
		}
		catch ( Exception ex ) {
			log.error( ex, ex );
		}
	}

	setRepositoryConnection( rc, true );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:39,代码来源:InMemorySesameEngine.java

示例14: createRepository

import org.openrdf.sail.Sail; //导入依赖的package包/类
private ObjectRepository createRepository() throws Exception {
	Sail sail = new MemoryStore();
	sail = new AuditingSail(sail);
	Repository repo = new OptimisticRepository(sail);
	repo.initialize();
	ObjectRepositoryFactory factory = new ObjectRepositoryFactory();
	return factory.createRepository(config, repo);
}
 
开发者ID:mowjoothfm,项目名称:persistenturls,代码行数:9,代码来源:MirrorPURLTest.java

示例15: testCollect

import org.openrdf.sail.Sail; //导入依赖的package包/类
@Test
public void testCollect() throws ProvenanceCollectionException, RepositoryException, MalformedQueryException, QueryEvaluationException {
	Sail ms = new MemoryStore();
	SailRepository repo = new SailRepository(ms);
	repo.initialize();
	TriplestoreProvenanceCollector coll = new TriplestoreProvenanceCollector(repo, "fakeUser", "SPARQL");
	coll.recordQuery("fakeQuery");
	String queryString = "SELECT ?x ?y WHERE { ?x ?p ?y } ";
	TupleQuery tupleQuery = repo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString);
	TupleQueryResult result = tupleQuery.evaluate();
	// TODO not asserting on the results.
	assertTrue(result.hasNext());
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:14,代码来源:TriplestoreProvenanceCollectorTest.java


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