本文整理汇总了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;
}