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


Java QueryExecution.execAsk方法代码示例

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


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

示例1: checkContainment

import com.hp.hpl.jena.query.QueryExecution; //导入方法依赖的package包/类
public static boolean checkContainment(CompanyModel c){
	String queryString = 
		"ASK" +
			// check whether any manager is an employee in any other department
			"{?dept1"        + " <" + c.MANAGER   + "> " + "?manager"         + ". " +
			" ?dept2"		 + " <" + c.EMPLOYEES + "> " + "?employees1"      + ". " +
			" ?employees1"   + " <" + RDFS.member + "> " + "?employee1"       + ". " +
			" FILTER (?manager = ?employee1) " +
			
			// check whether any employee occurs more than once
			" ?dept3 "		 + " <" + c.EMPLOYEES + "> " + "?employees2"      + ". " +
			" ?employees2"   + " <" + RDFS.member + "> " + "?employee2"       + ". " +
			" FILTER (?employee1 = ?employee2)" +
			
			// check whether any department occurs more than once
			" ?upperDept1"   + " <" + c.DEPTS     + "> " + "?dept4"           + ". " +
			" ?upperDept2"   + " <" + c.DEPTS     + "> " + "?dept5"           + ". " +
			" FILTER (?dept4 = ?dept5) " +
			"}";
	
	Query query = QueryFactory.create(queryString);
	QueryExecution qe = QueryExecutionFactory.create(query, c.getModel());
	boolean out = qe.execAsk();
	qe.close();
	return !out;
}
 
开发者ID:amritbhat786,项目名称:DocIT,代码行数:27,代码来源:Containment.java

示例2: askcontainsStatement

import com.hp.hpl.jena.query.QueryExecution; //导入方法依赖的package包/类
public boolean askcontainsStatement(Statement st, Model m)
{
	String q = "ASK{?subject ?predicate ?object.";
	if (st.getSubject().isAnon())
		q += " FILTER isBlank(?subject)";
	if (st.getObject().isAnon())
		q += " FILTER isBlank(?object)";
	q += "}";

	QuerySolutionMap args = new QuerySolutionMap();
	if (!st.getSubject().isAnon())
		args.add("subject", st.getSubject());
	if (!st.getObject().isAnon())
		args.add("object", st.getObject());
	// QueryExecution qe = QueryExecutionFactory.create(q, m, args);

	Query query = QueryFactory.create(q);
	QueryExecution qe = QueryExecutionFactory.create(query, m, args);

	return qe.execAsk();
}
 
开发者ID:emir-munoz,项目名称:uraptor,代码行数:22,代码来源:ChallengeValidator.java

示例3: sparqlAsk

import com.hp.hpl.jena.query.QueryExecution; //导入方法依赖的package包/类
@Override
public boolean sparqlAsk(String queryString) throws ModelRuntimeException {
	assertModel();
	log.debug("Query " + queryString);
	Query query = QueryFactory.create(queryString);
	
	if(!query.isAskType()) {
		throw new ModelRuntimeException("The given query is not an ASK query");
	}
	// else
	QueryExecution qexec = QueryExecutionFactory.create(query, this.jenaModel);
	return qexec.execAsk();
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:14,代码来源:ModelImplJena.java

示例4: sparqlAsk

import com.hp.hpl.jena.query.QueryExecution; //导入方法依赖的package包/类
@Override
public boolean sparqlAsk(String query) throws ModelRuntimeException,
		MalformedQueryException {
	Query jenaQuery = QueryFactory.create(query);
	QueryExecution qexec = QueryExecutionFactory.create(jenaQuery,
			this.dataset);

	if (jenaQuery.isAskType()) {
		return qexec.execAsk();
	} else {
		throw new RuntimeException(
				"Cannot handle this type of query! Please use ASK.");
	}
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:15,代码来源:ModelSetImplJena.java

示例5: checkResourceInterpretability

import com.hp.hpl.jena.query.QueryExecution; //导入方法依赖的package包/类
private void checkResourceInterpretability(Node node,
		TriplePosition pos, Triple triple, SparqlifyDataset dataset)
		throws NotImplementedException, SQLException {
	
	boolean ontPropStatementFound = false;
	
	// check if resource is further described using one of the proposed
	// properties
	for (Property ontProp : ontDefProperties) {
		String queryStr = "ASK { <" + node.getURI() + "> <" + ontProp.getURI() + "> ?o }";
		
		Query query = QueryFactory.create(queryStr);
		
		QueryExecution qe;
		if (dataset.isSparqlService() && dataset.getSparqlServiceUri()!=null) {
			qe = QueryExecutionFactory.createServiceRequest(
					dataset.getSparqlServiceUri(), query);
		} else {
			qe = QueryExecutionFactory.create(query, dataset);
		}
		
		ontPropStatementFound = qe.execAsk();
		qe.close();
		if (ontPropStatementFound) break;
	}
	
	if (!ontPropStatementFound) {
		Set<ViewQuad<ViewDefinition>> viewQuads = pinpointer
				.getViewCandidates(triple.asTriple());
		
		writeNodeTripleMeasureToSink(0, pos, triple.asTriple(), viewQuads);
	}
}
 
开发者ID:SmartDataAnalytics,项目名称:R2RLint,代码行数:34,代码来源:OWLOntologyDeclarations.java

示例6: sparqlAsk

import com.hp.hpl.jena.query.QueryExecution; //导入方法依赖的package包/类
/**
 * Query execution
 */

public static boolean sparqlAsk(String q, Model m) {
	Query query = QueryFactory.create(q) ;
	m.enterCriticalSection(Lock.READ);
	QueryExecution qExec = QueryExecutionFactory.create(query, m);
	boolean rs =  qExec.execAsk();
	m.leaveCriticalSection();
	return rs;	
}
 
开发者ID:tetherless-world,项目名称:s2s,代码行数:13,代码来源:Queries.java


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