當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。