org.apache.jena.query.Query.hasOrderBy()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(214)

本文整理了Java中org.apache.jena.query.Query.hasOrderBy方法的一些代码示例,展示了Query.hasOrderBy的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.hasOrderBy方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:hasOrderBy

Query.hasOrderBy介绍

暂无

代码示例

代码示例来源:origin: apache/tinkerpop

/**
 * Extracts any {@code SortCondition} instances from the SPARQL query and holds them in an index of their keys
 * where the value is that keys sorting direction.
 */
private static Map<String, Order> createOrderIndexFromQuery(final Query query) {
  final Map<String, Order> orderingIndex = new HashMap<>();
  if (query.hasOrderBy()) {
    final List<SortCondition> sortingConditions = query.getOrderBy();
    for (SortCondition sortCondition : sortingConditions) {
      final Expr expr = sortCondition.getExpression();
      // by default, the sort will be ascending. getDirection() returns -2 if the DESC/ASC isn't
      // supplied - weird
      orderingIndex.put(expr.getVarName(), sortCondition.getDirection() == -1 ? Order.decr : Order.incr);
    }
  }
  return orderingIndex;
}

代码示例来源:origin: apache/tinkerpop

if (query.hasOrderBy() && query.hasGroupBy())
  orderingIndex.forEach((k, v) -> traversal = traversal.order().by(__.select(k), v));
    offset = query.getOffset();
  if (query.hasGroupBy() && query.hasOrderBy())
    traversal = traversal.range(Scope.local, offset, offset + limit);
  else

代码示例来源:origin: apache/jena

public boolean isOrdered()         { return hasOrderBy() ; }

代码示例来源:origin: apache/jena

@Override
public void visitOrderBy(Query query) {
  if (query.hasOrderBy()) {
    for (SortCondition sc : query.getOrderBy())
      newQuery.addOrderBy(sc);
  }
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

@Override
public void visitOrderBy(Query query) {
  if ( query.hasOrderBy() ) {
    for (SortCondition sc : query.getOrderBy())
      newQuery.addOrderBy(sc) ;
  }
}

代码示例来源:origin: apache/jena

@Override
public void visitOrderBy(Query query)
{
  if ( query.hasOrderBy() )
  {
    out.print("ORDER BY ") ;
    boolean first = true ;
    for (SortCondition sc : query.getOrderBy())
    {
      if ( ! first )
        out.print(" ") ;
      sc.format(fmtExpr, out) ;
      first = false ;
    }
    out.println() ;
  }
}

相关文章