本文整理匯總了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;
}
示例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();
}
示例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();
}
示例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.");
}
}
示例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);
}
}
示例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;
}