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


Java ResultSetFormatter.toList方法代码示例

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


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

示例1: getResult

import com.hp.hpl.jena.query.ResultSetFormatter; //导入方法依赖的package包/类
public List<String> getResult(InputStream in, String query){
	Model model=ModelFactory.createDefaultModel();
	model.read(in,null,"TTL");
	Query q = QueryFactory.create(query);
	QueryExecution qe = QueryExecutionFactory.create(q, model);
	ResultSet qresults = qe.execSelect();
	List<QuerySolution> solutions=ResultSetFormatter.toList(qresults);
	List<String> results=new ArrayList<String>();
	for(QuerySolution qs:solutions){
		results.add(qs.toString());
	}
	return results;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:14,代码来源:Server.java

示例2: getInstances

import com.hp.hpl.jena.query.ResultSetFormatter; //导入方法依赖的package包/类
private void getInstances() {
	File metricFile = new File(
			System.getProperty("user.dir") + "/sparql/queries/getInstances.sparql");

	List<String> lines = null;

	try {
		lines = Files.readAllLines(metricFile.toPath());
	} catch (IOException ex) {
		Logger.getLogger(Ontogui.class.getName()).log(Level.SEVERE, null, ex);
	}
	String queryString = "";
	for (String line : lines) {
		queryString += line + System.lineSeparator();
	}
	ParameterizedSparqlString pss = new ParameterizedSparqlString();
	pss.setCommandText(queryString);
	pss.setLiteral("typename", typename);
	data.begin(ReadWrite.READ);
	List<QuerySolution> rlist = null;
	try (QueryExecution qe = QueryExecutionFactory.create(pss.asQuery(), data)) {
		ResultSet results = qe.execSelect();
		rlist = ResultSetFormatter.toList(results);
	} catch (Exception e) {
		JOptionPane.showMessageDialog(null, "Writting to textarea failed!");
		e.printStackTrace();
	}
	instances = new String[rlist.size()];
	for(int j = 0; j < rlist.size(); j++){
		instances[j] = rlist.get(j).getLiteral("iname").getString();
	}
	data.end();
}
 
开发者ID:MarcelH91,项目名称:WikiOnto,代码行数:34,代码来源:DissolveGUI.java

示例3: getSubtypes

import com.hp.hpl.jena.query.ResultSetFormatter; //导入方法依赖的package包/类
private void getSubtypes() {
	File metricFile = new File(
			System.getProperty("user.dir") + "/sparql/queries/getSubtypes.sparql");

	List<String> lines = null;

	try {
		lines = Files.readAllLines(metricFile.toPath());
	} catch (IOException ex) {
		Logger.getLogger(Ontogui.class.getName()).log(Level.SEVERE, null, ex);
	}
	String queryString = "";
	for (String line : lines) {
		queryString += line + System.lineSeparator();
	}
	ParameterizedSparqlString pss = new ParameterizedSparqlString();
	pss.setCommandText(queryString);
	pss.setLiteral("typename", typename);
	data.begin(ReadWrite.READ);
	List<QuerySolution> rlist = null;
	try (QueryExecution qe = QueryExecutionFactory.create(pss.asQuery(), data)) {
		ResultSet results = qe.execSelect();
		rlist = ResultSetFormatter.toList(results);
	} catch (Exception e) {
		JOptionPane.showMessageDialog(null, "Writting to textarea failed!");
		e.printStackTrace();
	}
	data.end();
	subtypes= new String[rlist.size()];
	for(int j = 0; j < rlist.size(); j++){
		subtypes[j] = rlist.get(j).getLiteral("sname").getString();
	}
}
 
开发者ID:MarcelH91,项目名称:WikiOnto,代码行数:34,代码来源:DissolveGUI.java

示例4: getDistantEntities

import com.hp.hpl.jena.query.ResultSetFormatter; //导入方法依赖的package包/类
private void getDistantEntities(){
	File metricFile = new File(
			System.getProperty("user.dir") + "/sparql/smells/SemanticallyDistantEntity.sparql");

	List<String> lines = null;

	try {
		lines = Files.readAllLines(metricFile.toPath());
	} catch (IOException ex) {
		Logger.getLogger(Ontogui.class.getName()).log(Level.SEVERE, null, ex);
	}
	String queryString = "";
	for (String line : lines) {
		queryString += line + System.lineSeparator();
	}
	
	data.begin(ReadWrite.READ);
	List<QuerySolution> rlist = null;
	Query query = QueryFactory.create(queryString, Syntax.syntaxARQ);
	try (QueryExecution qe = QueryExecutionFactory.create(query, data)) {
		ResultSet results = qe.execSelect();
		rlist = ResultSetFormatter.toList(results);
	} catch (Exception e) {
		JOptionPane.showMessageDialog(null, "Writting to textarea failed!");
		e.printStackTrace();
	}
	instances = new String[rlist.size()];
	for(int j = 0; j < rlist.size(); j++){
		instances[j] = rlist.get(j).getLiteral("entityname").getString();
	}
	data.end();
}
 
开发者ID:MarcelH91,项目名称:WikiOnto,代码行数:33,代码来源:SemDistGUI.java

示例5: getDistantTypes

import com.hp.hpl.jena.query.ResultSetFormatter; //导入方法依赖的package包/类
private void getDistantTypes(){
	File metricFile = new File(
			System.getProperty("user.dir") + "/sparql/smells/SemanticallyDistantType.sparql");

	List<String> lines = null;

	try {
		lines = Files.readAllLines(metricFile.toPath());
	} catch (IOException ex) {
		Logger.getLogger(Ontogui.class.getName()).log(Level.SEVERE, null, ex);
	}
	String queryString = "";
	for (String line : lines) {
		queryString += line + System.lineSeparator();
	}
	
	data.begin(ReadWrite.READ);
	List<QuerySolution> rlist = null;
	Query query = QueryFactory.create(queryString, Syntax.syntaxARQ);
	try (QueryExecution qe = QueryExecutionFactory.create(query, data)) {
		ResultSet results = qe.execSelect();
		rlist = ResultSetFormatter.toList(results);
	} catch (Exception e) {
		JOptionPane.showMessageDialog(null, "Writting to textarea failed!");
		e.printStackTrace();
	}
	subtypes = new String[rlist.size()];
	for(int j = 0; j < rlist.size(); j++){
		subtypes[j] = rlist.get(j).getLiteral("typename").getString();
	}
	data.end();
}
 
开发者ID:MarcelH91,项目名称:WikiOnto,代码行数:33,代码来源:SemDistGUI.java

示例6: executeQuery

import com.hp.hpl.jena.query.ResultSetFormatter; //导入方法依赖的package包/类
public void executeQuery() {
    Query query = this.geraConsultaSPARQL(this.listaDePalavrasParaPesquisa);

    QueryExecution qe = QueryExecutionFactory.create(query, this.getOntologia());
    ResultSet results = qe.execSelect();

    this.lstResultados = ResultSetFormatter.toList(results);

    qe.close();
}
 
开发者ID:PenseClassi,项目名称:pense-semantic-analiser,代码行数:11,代码来源:AbstractSemanticEngine.java


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