• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NativeStore类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initializeRepository

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
private void initializeRepository( File dataDir )
    throws RepositoryException
{
    String tripleIndexes = configuration.get().tripleIndexes().get();
    if( tripleIndexes == null )
    {
        tripleIndexes = "";
        configuration.get().tripleIndexes().set( tripleIndexes );
    }
    boolean forceSync = configuration.get().forceSync().get();

    NativeStore store = (NativeStore) repo.getSail();
    store.setDataDir( dataDir );
    store.setTripleIndexes( tripleIndexes );
    store.setForceSync( forceSync );
    repo.initialize();
    isNotInitialized = false;
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:19,代码来源:NativeRepositoryService.java


示例2: rep

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
/***
 * Starts up repository (which stores in rdfDBPath) and loads ontology into it.
 * @param rdfDBPath
 * @return  0 = success
	   		1 = Repository Exception - if something went wrong with connecting to rep (such as rep doesn't exist)
	        2 = if an error was found parsing the ontology (i.e wrong format)
	   	    3 = if data couldn't be written into rep (i.e rep not writable, data stream failed to write).
            4 = if connection couldn't close.
 */
public static int init(String rdfDBPath)
{
	/*input: receives rdfDBPath - a path to store ontologies.
	 * output: starts up the repository, and loads ontology into it. 
	 * 		   0 = success
	   		   1 = Repository Exception - if something went wrong with connecting to rep (such as rep doesn't exist)
	   		   2 = if an error was found parsing the ontology (i.e wrong format)
	   		   3 = if data couldn't be written into rep (i.e rep not writable, data stream failed to write).
	   		   4 = if connection couldn't close.
	   		   */
	
	int res = 0;
	File dataDir = new File (rdfDBPath);
	System.out.println(dataDir);
	try 
	{
		rep = new SailRepository(new NativeStore(dataDir));
		rep.initialize();			
	} catch (RepositoryException e) 
	{
		return 3;
	}
	return res;
}
 
开发者ID:matanso,项目名称:OASSIS,代码行数:34,代码来源:SPARQLQueryManager.java


示例3: main

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
public static void main(String[] args) {
	// KnowledgeStore ks = new SesameKnowledgeStore(new SailRepository(
	// new MemoryStore()));

	// KnowledgeStore ks = new SesameKnowledgeStore(new SailRepository(
	// new MemoryStore(new File("/tmp/ks"))));

	KnowledgeStore ks = new SesameKnowledgeStore(new SailRepository(
			new NativeStore(new File("/tmp/ks"))));

	ks.addDataset(dataset1());
	ks.addDataset(dataset2());
	ks.addDataset(dataset3());

	ks.close();
}
 
开发者ID:markusstocker,项目名称:emrooz,代码行数:17,代码来源:DatasetSpecificationExample.java


示例4: main

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
public static void main(String[] args) {
	EntityFactory f = EntityFactory.getInstance("http://example.org#");

	// Repository r = new SailRepository(new MemoryStore());
	Repository r = new SailRepository(new NativeStore(new File("/tmp/ks")));
	KnowledgeStore ks = new SesameKnowledgeStore(r);

	ks.addSensor(f.createSensor("thermometer", "temperature", "air", 1.0));
	ks.addSensor(f.createSensor("hygrometer", "humidity", "air", 1.0));

	Emrooz emrooz = new Emrooz(ks, new CassandraDataStore());

	emrooz.add(f.createSensorObservation("thermometer", "temperature",
			"air", 7.6, "2015-04-21T01:00:00.000+03:00"));
	emrooz.add(f.createSensorObservation("hygrometer", "humidity", "air",
			76.0, "2015-04-21T01:00:00.000+03:00"));

	emrooz.add(f.createSensorObservation("thermometer", "temperature",
			"air", 7.4, f.createUnit(QUDTUnit.DegreeCelsius),
			"2015-04-21T01:30:00.000+03:00"));
	emrooz.add(f.createSensorObservation("hygrometer", "humidity", "air",
			84.0, QUDTUnit.RelativeHumidity,
			"2015-04-21T01:30:00.000+03:00"));

	emrooz.close();
}
 
开发者ID:markusstocker,项目名称:emrooz,代码行数:27,代码来源:AddSensorObservationExample.java


示例5: initialize

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
@Override
public void initialize() {
    if (!storageDir.exists() && !storageDir.mkdirs()){
        log.error("Could not create storage directory: " + storageDir.getPath());
    } else if (!storageDir.isDirectory()) {
        log.error(storageDir.getPath() + " is not a directory");
    }

    File tripleDir = new File(storageDir,"triples");

    try {
        cacheRepository = new SailRepository(new NativeStore(tripleDir, "spoc"));
        cacheRepository.initialize();
    } catch (RepositoryException ex) {
        log.error("could not initialize cache directory",ex);
    }
}
 
开发者ID:apache,项目名称:marmotta,代码行数:18,代码来源:LDCachingFileBackend.java


示例6: main

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
public static void main(String[] args) {
	e = new Emrooz(new SesameKnowledgeStore(new SailRepository(
			new NativeStore(new File("/tmp/ks")))),
			new CassandraDataStore());

	add(); // Comment to query again after adding the data
	query();

	e.close();
}
 
开发者ID:markusstocker,项目名称:emrooz,代码行数:11,代码来源:CompletePersistentExample.java


示例7: init

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
public static void init() {
	Repository r = new SailRepository(new NativeStore(new File(
			KNOWLEDGE_STORE_FILE_DIRECTORY)));
	KnowledgeStore ks = new SesameKnowledgeStore(r);

	DataStore ds = new CassandraDataStore();

	emrooz = new Emrooz(ks, ds);
}
 
开发者ID:markusstocker,项目名称:emrooz,代码行数:10,代码来源:Connection.java


示例8: createNativeStoreConnection

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
public static SailRepository createNativeStoreConnection(String directory) throws RepositoryException {
    File f = new File(directory);
    if (f.exists()) {
        f.delete();
    }

    NativeStore sail = new NativeStore(f);
    SailRepository sr = new SailRepository(sail);
    sr.initialize();
    return sr;
}
 
开发者ID:ale003,项目名称:testGraphDbs,代码行数:12,代码来源:App.java


示例9: createStore

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
/**
 * Create the store provided by this SailProvider
 *
 * @return a new instance of the store
 */
@Override
public NotifyingSail createStore() {
    log.info("Initializing Backend: Native Store");

    File dataDir = new File(configurationService.getHome() + File.separator + "triples");
    return new NativeStore(dataDir);
}
 
开发者ID:apache,项目名称:marmotta,代码行数:13,代码来源:NativeStoreProvider.java


示例10: NativeRepositoryMixin

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
public NativeRepositoryMixin()
{
    isNotInitialized = true;
    repo = new SailRepository( new NativeStore() );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:6,代码来源:NativeRepositoryService.java


示例11: main

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
public static void main(String[] args) {
	if (args.length == 0)
		help();

	File file = null;
	URI ns = null;
	URI gasDatasetId = null;
	URI biometDatasetId = null;
	File knowledgeStoreFile = null;
	String dataStoreHost = "localhost";

	for (int i = 0; i < args.length; i++) {
		if (args[i].equals("-f"))
			file = new File(args[++i]);
		if (args[i].equals("-ns"))
			ns = vf.createURI(args[++i]);
		if (args[i].equals("-gd"))
			gasDatasetId = vf.createURI(args[++i]);
		if (args[i].equals("-bd"))
			biometDatasetId = vf.createURI(args[++i]);
		if (args[i].equals("-ks"))
			knowledgeStoreFile = new File(args[++i]);
		if (args[i].equals("-ds"))
			dataStoreHost = args[++i];
	}

	if (file == null || ns == null || gasDatasetId == null
			|| biometDatasetId == null || knowledgeStoreFile == null)
		help();

	SesameKnowledgeStore ks = new SesameKnowledgeStore(new SailRepository(
			new NativeStore(knowledgeStoreFile)));
	ks.addDataset(new Dataset(gasDatasetId, new QuantityValue(_id(ns),
			GAS_ANALYZER_SAMPLING_FREQUENCY, new Unit(QUDTUnit.Hertz))));
	ks.addDataset(new Dataset(biometDatasetId, new QuantityValue(_id(ns),
			BIOMET_SAMPLING_FREQUENCY, new Unit(QUDTUnit.Hertz))));

	CassandraDataStore ds = new CassandraDataStore(dataStoreHost);

	Emrooz e = new Emrooz(ks, ds);

	long start = System.currentTimeMillis();

	status("Processing: " + file);

	GHGDatasetObservationReader reader = new GHGDatasetObservationReader(
			file, ns, gasDatasetId, biometDatasetId);

	long numOfObservations = 0;

	while (reader.hasNext()) {
		e.add(reader.next());
		numOfObservations++;
	}

	long end = System.currentTimeMillis();

	e.close();

	summary(start, end, numOfObservations, dataStoreHost);
}
 
开发者ID:markusstocker,项目名称:emrooz,代码行数:62,代码来源:GHGDatasetObservationReader.java


示例12: main

import org.openrdf.sail.nativerdf.NativeStore; //导入依赖的package包/类
public static void main(String[] args) {
	if (args.length == 0)
		help();

	File file = null;
	URI ns = null;
	URI carbonDioxideAndWaterAnalyzerId = null;
	URI methaneAnalyzerId = null;
	File knowledgeStoreFile = null;
	String dataStoreHost = "localhost";

	for (int i = 0; i < args.length; i++) {
		if (args[i].equals("-f"))
			file = new File(args[++i]);
		if (args[i].equals("-ns"))
			ns = vf.createURI(args[++i]);
		if (args[i].equals("-ca"))
			carbonDioxideAndWaterAnalyzerId = vf.createURI(args[++i]);
		if (args[i].equals("-ma"))
			methaneAnalyzerId = vf.createURI(args[++i]);
		if (args[i].equals("-ks"))
			knowledgeStoreFile = new File(args[++i]);
		if (args[i].equals("-ds"))
			dataStoreHost = args[++i];
	}

	if (file == null || ns == null
			|| carbonDioxideAndWaterAnalyzerId == null
			|| methaneAnalyzerId == null || knowledgeStoreFile == null)
		help();

	Sensor carbonDioxideAndWaterAnalyzer = new Sensor(
			carbonDioxideAndWaterAnalyzerId, density,
			new MeasurementCapability(_id(ns), new Frequency(_id(ns),
					new QuantityValue(_id(ns),
							GAS_ANALYZER_SAMPLING_FREQUENCY, new Unit(
									QUDTUnit.Hertz)))));
	Sensor methaneAnalyzer = new Sensor(methaneAnalyzerId, density,
			new MeasurementCapability(_id(ns), new Frequency(_id(ns),
					new QuantityValue(_id(ns),
							GAS_ANALYZER_SAMPLING_FREQUENCY, new Unit(
									QUDTUnit.Hertz)))));

	SesameKnowledgeStore ks = new SesameKnowledgeStore(new SailRepository(
			new NativeStore(knowledgeStoreFile)));
	ks.addSensor(carbonDioxideAndWaterAnalyzer);
	ks.addSensor(methaneAnalyzer);

	CassandraDataStore ds = new CassandraDataStore(dataStoreHost);

	Emrooz e = new Emrooz(ks, ds);

	long start = System.currentTimeMillis();

	status("Processing: " + file);

	GHGSensorObservationReader reader = new GHGSensorObservationReader(
			file, ns, carbonDioxideAndWaterAnalyzer, methaneAnalyzer);

	long numOfObservations = 0;

	while (reader.hasNext()) {
		e.add(reader.next());
		numOfObservations++;
	}

	long end = System.currentTimeMillis();

	e.close();

	summary(start, end, numOfObservations, dataStoreHost);
}
 
开发者ID:markusstocker,项目名称:emrooz,代码行数:73,代码来源:GHGSensorObservationReader.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MusicManager类代码示例发布时间:2022-05-22
下一篇:
Java BlockEntityDataPacket类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap