本文整理了Java中org.apache.jena.query.Query.setLimit
方法的一些代码示例,展示了Query.setLimit
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setLimit
方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:setLimit
暂无
代码示例来源:origin: apache/jena
/**
* Set the limit for the number of results to return.
* Setting the limit to zero (0) or removes the limit.
* @param limit The limit to set.
*/
public void setLimit(int limit) {
query.setLimit(limit < 1 ? Query.NOLIMIT : limit);
}
代码示例来源:origin: org.apache.jena/jena-querybuilder
/**
* Set the limit for the number of results to return.
* Setting the limit to zero (0) or removes the limit.
* @param limit The limit to set.
*/
public void setLimit(int limit) {
query.setLimit(limit < 1 ? Query.NOLIMIT : limit);
}
代码示例来源:origin: apache/jena
@Override
public void visitLimit(Query query) {
newQuery.setLimit(query.getLimit());
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public void visitLimit(Query query) {
newQuery.setLimit(query.getLimit()) ;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public boolean execAsk() {
Query query = queryIterator.next();
query.setLimit(Query.NOLIMIT);
QueryExecution qe = factory.createQueryExecution(query);
boolean result = qe.execAsk();
return result;
}
代码示例来源:origin: tarql/tarql
public void makeTest() {
for (Query q: queries) {
if (q.isConstructType()) {
q.setQuerySelectType();
}
q.setLimit(5);
}
}
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static void applyRange(Query query, Range<Long> range) {
long offset = rangeToOffset(range);
long limit = rangeToLimit(range);
query.setOffset(offset);
query.setLimit(limit);
}
代码示例来源:origin: apache/jena
final public void LimitClause() throws ParseException {
Token t ;
jj_consume_token(LIMIT);
t = jj_consume_token(INTEGER);
getQuery().setLimit(integerValue(t.image)) ;
}
代码示例来源:origin: apache/jena
final public void LimitClause() throws ParseException {
Token t ;
jj_consume_token(LIMIT);
t = jj_consume_token(INTEGER);
getQuery().setLimit(integerValue(t.image)) ;
}
代码示例来源:origin: apache/jena
final public void LimitClause() throws ParseException {
Token t ;
jj_consume_token(LIMIT);
t = jj_consume_token(INTEGER);
getQuery().setLimit(integerValue(t.image)) ;
}
代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache
public static Element limitElement(Element e, long limit) {
Query subQuery = new Query();
subQuery.setQuerySelectType();
subQuery.setQueryResultStar(true);
subQuery.setQueryPattern(e);
subQuery.setLimit(limit);
Element result = new ElementSubQuery(subQuery);
return result;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Element limitElement(Element e, long limit) {
Query subQuery = new Query();
subQuery.setQuerySelectType();
subQuery.setQueryResultStar(true);
subQuery.setQueryPattern(e);
subQuery.setLimit(limit);
Element result = new ElementSubQuery(subQuery);
return result;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
@Override
public Model extractFragment(OWLClass cls, int maxFragmentDepth) {
startTime = System.currentTimeMillis();
Model fragment = ModelFactory.createDefaultModel();
Query query = buildConstructQuery(cls, maxFragmentDepth);
long pageSize = PaginationUtils.adjustPageSize(qef, 10000);
query.setLimit(pageSize);
int offset = 0;
while(getRemainingRuntime() > 0){
query.setOffset(offset);System.out.println(query);
Model model = qef.createQueryExecution(query).execConstruct();
fragment.add(model);
offset += pageSize;
}
return fragment;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public QueryExecutionCompare createQueryExecution(Query query) {
if(removeSlices) {
query = (Query)query.clone();
query.setLimit(Query.NOLIMIT);
query.setOffset(Query.NOLIMIT);
}
//boolean isOrdered = !query.getOrderBy().isEmpty();
QueryExecution qea = a.createQueryExecution(query);
QueryExecution qeb = b.createQueryExecution(query);
QueryExecutionCompare result = new QueryExecutionCompare(query, qea, qeb, false);
//QueryExecution result = QueryExecutionWrapper.wrap(tmp);
return result;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public PaginationQueryIterator createQueryIterator(Long offset, Long limit) {
long o = offset == null ? 0 : offset;
long l = limit == null ? Long.MAX_VALUE : limit;
long queryOffset = proto.getOffset() == Query.NOLIMIT ? 0 : proto.getOffset();
long itemOffset = queryOffset + o;
long queryLimit = proto.getLimit() == Query.NOLIMIT ? Long.MAX_VALUE : proto.getLimit() - o;
long itemLimit = Math.min(queryLimit, l);
itemLimit = itemLimit == Long.MAX_VALUE ? Query.NOLIMIT : itemLimit;
Query clone = proto.cloneQuery();
clone.setOffset(itemOffset);
clone.setLimit(itemLimit);
PaginationQueryIterator result = new PaginationQueryIterator(clone, pageSize);
return result;
}
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public void visit(OpSlice opSlice)
{
if ( opSlice.getStart() != Query.NOLIMIT )
query.setOffset(opSlice.getStart()) ;
if ( opSlice.getLength() != Query.NOLIMIT )
query.setLimit(opSlice.getLength()) ;
opSlice.getSubOp().visit(this) ;
}
代码示例来源:origin: apache/jena
/**
* Copy all the modifications from the Solution Modifier argument
* @param solutionModifier The solution modifier to copy from.
*/
public void addAll(SolutionModifierHandler solutionModifier) {
List<SortCondition> lst = solutionModifier.query.getOrderBy();
if (lst != null) {
for (SortCondition sc : lst) {
query.addOrderBy(sc);
}
}
query.getGroupBy().addAll(solutionModifier.query.getGroupBy());
query.getHavingExprs().addAll(solutionModifier.query.getHavingExprs());
query.setLimit(solutionModifier.query.getLimit());
query.setOffset(solutionModifier.query.getOffset());
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
private Set<SortedSet<Node>> query(String qStr, QueryExecutionFactory qef) {
Query query = QueryFactory.create(qStr);
query.setLimit(queryLimit);
Set<SortedSet<Node>> result = new HashSet<>();
try(QueryExecution qe = qef.createQueryExecution(query)) {
ResultSet rs = qe.execSelect();
while(rs.hasNext()) {
QuerySolution qs = rs.next();
result.add(toSet(qs));
}
} catch(Exception e) {
System.err.println("Query execution failed for\n" + query);
}
return result;
}
代码示例来源:origin: org.apache.jena/jena-querybuilder
/**
* Copy all the modifications from the Solution Modifier argument
* @param solutionModifier The solution modifier to copy from.
*/
public void addAll(SolutionModifierHandler solutionModifier) {
List<SortCondition> lst = solutionModifier.query.getOrderBy();
if (lst != null) {
for (SortCondition sc : lst) {
query.addOrderBy(sc);
}
}
query.getGroupBy().addAll(solutionModifier.query.getGroupBy());
query.getHavingExprs().addAll(solutionModifier.query.getHavingExprs());
query.setLimit(solutionModifier.query.getLimit());
query.setOffset(solutionModifier.query.getOffset());
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Query createQueryList(UnaryRelation concept, Long limit, Long offset) {
Query result = new Query();
result.setQuerySelectType();
result.setDistinct(true);
result.setLimit(limit == null ? Query.NOLIMIT : limit);
result.setOffset(offset == null ? Query.NOLIMIT : offset);
result.getProject().add(concept.getVar());
Element e = concept.getElement();
if(e instanceof ElementSubQuery) {
e = ElementUtils.createElementGroup(e);
}
result.setQueryPattern(e);
// String str = result.toString();
// System.out.println(str);
return result;
}
内容来源于网络,如有侵权,请联系作者删除!