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


Java SPARQLResultsTSVWriter类代码示例

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


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

示例1: querySensorObservations

import org.openrdf.query.resultio.text.tsv.SPARQLResultsTSVWriter; //导入依赖的package包/类
private static void querySensorObservations() {
	String sparql = "prefix ssn: <http://purl.oclc.org/NET/ssnx/ssn#>"
			+ "prefix time: <http://www.w3.org/2006/time#>"
			+ "prefix dul: <http://www.loa-cnr.it/ontologies/DUL.owl#>"
			+ "select ?time ?value ?sensor ?property ?feature "
			+ "where {"
			+ "["
			+ "ssn:observedBy ?sensor ;"
			+ "ssn:observedProperty ?property ;"
			+ "ssn:featureOfInterest ?feature ;"
			+ "ssn:observationResultTime [ time:inXSDDateTime ?time ] ;"
			+ "ssn:observationResult [ ssn:hasValue [ dul:hasRegionDataValue ?value ] ]"
			+ "]"
			+ "filter (?time >= \"2015-05-18T00:00:30.000+03:00\"^^xsd:dateTime && ?time < \"2015-05-18T00:00:35.000+03:00\"^^xsd:dateTime)"
			+ "} order by ?sensor asc (?time)";

	System.out.println("== QUERY SENSOR OBSERVATIONS ==");

	long start = System.currentTimeMillis();

	// In addition to the SPARQL writer, there are also CSV, JSON, and XML
	// writers
	e.evaluate(QueryType.SENSOR_OBSERVATION, sparql,
			new SPARQLResultsTSVWriter(System.out));

	long end = System.currentTimeMillis();

	System.out.println("Time (s): " + elapsed(start, end));
}
 
开发者ID:markusstocker,项目名称:emrooz,代码行数:30,代码来源:CompletePersistentExample.java

示例2: queryDatasetObservations

import org.openrdf.query.resultio.text.tsv.SPARQLResultsTSVWriter; //导入依赖的package包/类
private static void queryDatasetObservations() {
	String sparql = "prefix qb: <http://purl.org/linked-data/cube#>"
			+ "prefix sdmx-dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>"
			+ "prefix time: <http://www.w3.org/2006/time#>"
			+ "prefix qudt: <http://qudt.org/schema/qudt#>"
			+ "prefix ex: <http://example.org#>"
			+ "select ?time ?temperature ?temperatureUnit ?humidity ?humidityUnit ?vibration ?vibrationUnit ?carbonDioxide ?carbonDioxideUnit ?waterVapor ?waterVaporUnit "
			+ "where {"
			+ "["
			+ "qb:dataSet ex:d1 ;"
			+ "sdmx-dimension:timePeriod [ time:inXSDDateTime ?time ] ;"
			+ "ex:temperature [ qudt:numericValue ?temperature; qudt:unit ?temperatureUnit ] ;"
			+ "ex:humidity [ qudt:numericValue ?humidity; qudt:unit ?humidityUnit ] ;"
			+ "ex:vibration [ qudt:numericValue ?vibration; qudt:unit ?vibrationUnit ] ;"
			+ "ex:carbonDioxide [ qudt:numericValue ?carbonDioxide; qudt:unit ?carbonDioxideUnit ] ;"
			+ "ex:waterVapor [ qudt:numericValue ?waterVapor; qudt:unit ?waterVaporUnit ]"
			+ "]"
			+ "filter (?time >= \"2015-05-18T00:00:30.000+03:00\"^^xsd:dateTime && ?time < \"2015-05-18T00:00:35.000+03:00\"^^xsd:dateTime)"
			+ "} order by asc (?time)";

	System.out.println("== QUERY DATASET OBSERVATIONS ==");

	long start = System.currentTimeMillis();

	e.evaluate(QueryType.DATASET_OBSERVATION, sparql,
			new SPARQLResultsTSVWriter(System.out));

	long end = System.currentTimeMillis();

	System.out.println("Time (s): " + elapsed(start, end));
}
 
开发者ID:markusstocker,项目名称:emrooz,代码行数:32,代码来源:CompletePersistentExample.java

示例3: main

import org.openrdf.query.resultio.text.tsv.SPARQLResultsTSVWriter; //导入依赖的package包/类
public static void main(String[] args) {
	if (args.length == 0)
		help();

	boolean isSensorQuery = false;
	File queryFileName = null;
	File knowledgeStoreFile = null;
	String dataStoreHost = "localhost";

	for (int i = 0; i < args.length; i++) {
		if (args[i].equals("-sq")) {
			queryFileName = new File(args[++i]);
			isSensorQuery = true;
		} else if (args[i].equals("-dq")) {
			queryFileName = new File(args[++i]);
			isSensorQuery = false;
		} else if (args[i].equals("-ks")) {
			knowledgeStoreFile = new File(args[++i]);
		} else if (args[i].equals("-ds")) {
			dataStoreHost = args[++i];
		}
	}

	if (queryFileName == null || knowledgeStoreFile == null)
		help();

	Emrooz e = new Emrooz(new SesameKnowledgeStore(new SailRepository(
			new MemoryStore(knowledgeStoreFile))), new CassandraDataStore(
			dataStoreHost));

	long start = System.currentTimeMillis();

	try {
		if (isSensorQuery)
			e.evaluate(QueryType.SENSOR_OBSERVATION,
					FileUtils.readFileToString(queryFileName),
					new SPARQLResultsTSVWriter(System.out));
		else
			e.evaluate(QueryType.DATASET_OBSERVATION,
					FileUtils.readFileToString(queryFileName),
					new SPARQLResultsTSVWriter(System.out));
	} catch (IOException e1) {
		e1.printStackTrace();
	}

	long end = System.currentTimeMillis();

	e.close();

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


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