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

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

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

Query.setQuerySelectType介绍

暂无

代码示例

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

  1. /**
  2. * Constructor.
  3. */
  4. public SelectBuilder() {
  5. super();
  6. query.setQuerySelectType();
  7. handlerBlock = new HandlerBlock(query);
  8. }

代码示例来源:origin: org.apache.jena/jena-querybuilder

  1. /**
  2. * Constructor.
  3. */
  4. public SelectBuilder() {
  5. super();
  6. query.setQuerySelectType();
  7. handlerBlock = new HandlerBlock(query);
  8. }

代码示例来源:origin: stackoverflow.com

  1. Op op;
  2. BasicPattern pat = new BasicPattern(); // Make a pattern
  3. pat.add(pattern); // Add our pattern match
  4. op = new OpBGP(pat); // Make a BGP from this pattern
  5. op = OpFilter.filter(e, op); // Filter that pattern with our expression
  6. op = new OpProject(op, Arrays.asList(Var.alloc("s"))); // Reduce to just ?s
  7. Query q = OpAsQuery.asQuery(op); // Convert to a query
  8. q.setQuerySelectType(); // Make is a select query

代码示例来源:origin: tarql/tarql

  1. public void makeTest() {
  2. for (Query q: queries) {
  3. if (q.isConstructType()) {
  4. q.setQuerySelectType();
  5. }
  6. q.setLimit(5);
  7. }
  8. }
  9. }

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

  1. private static Query toQuery(Element pattern) {
  2. Query query = QueryFactory.make() ;
  3. query.setQueryPattern(pattern) ;
  4. query.setQuerySelectType() ;
  5. query.setQueryResultStar(true) ;
  6. return query ;
  7. }

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

  1. /**
  2. * Process for a single pattern below the modifiers.
  3. * Cleans up the ElementGroup produced.
  4. */
  5. private void processQueryPattern(QueryLevelDetails level) {
  6. Op op = level.pattern ;
  7. op.visit(this) ;
  8. ElementGroup eg = this.currentGroup ;
  9. Element e = fixupGroupsOfOne(eg) ;
  10. query.setQueryPattern(e) ;
  11. query.setQuerySelectType() ;
  12. }

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

  1. protected Query elementToQuery(Element pattern) {
  2. if ( pattern == null )
  3. return null;
  4. Query query = new Query();
  5. query.setQueryPattern(pattern);
  6. query.setQuerySelectType();
  7. query.setQueryResultStar(true);
  8. query.setResultVars();
  9. return query;
  10. }

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

  1. public static Query wrapAsSubQuery(Query query) {
  2. Element esq = new ElementSubQuery(query);
  3. Query result = new Query();
  4. result.setQuerySelectType();
  5. result.setQueryResultStar(true);
  6. result.setQueryPattern(esq);
  7. return result;
  8. }

代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache

  1. public static Element limitElement(Element e, long limit) {
  2. Query subQuery = new Query();
  3. subQuery.setQuerySelectType();
  4. subQuery.setQueryResultStar(true);
  5. subQuery.setQueryPattern(e);
  6. subQuery.setLimit(limit);
  7. Element result = new ElementSubQuery(subQuery);
  8. return result;
  9. }

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

  1. default Query asQuery() {
  2. Element e = getElement();
  3. List<Var> vs = getVars();
  4. Query result = new Query();
  5. result.setQuerySelectType();
  6. result.setQueryPattern(getElement());
  7. result.setDistinct(true);
  8. for(Var v : vs) {
  9. result.getProjectVars().add(v);
  10. }
  11. return result;
  12. }

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

  1. public static Element limitElement(Element e, long limit) {
  2. Query subQuery = new Query();
  3. subQuery.setQuerySelectType();
  4. subQuery.setQueryResultStar(true);
  5. subQuery.setQueryPattern(e);
  6. subQuery.setLimit(limit);
  7. Element result = new ElementSubQuery(subQuery);
  8. return result;
  9. }

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

  1. public static Query createSubQuery(Query query, Var var) {
  2. Element esq = new ElementSubQuery(query);
  3. Query result = new Query();
  4. result.setQuerySelectType();
  5. result.getProject().add(var);
  6. result.setQueryPattern(esq);
  7. return result;
  8. }

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

  1. public static Query wrapAsSubQuery(Query query, Var v) {
  2. Element esq = new ElementSubQuery(query);
  3. Query result = new Query();
  4. result.setQuerySelectType();
  5. result.getProject().add(v);
  6. result.setQueryPattern(esq);
  7. return result;
  8. }

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

  1. private void processQueryPattern(Op op, List<OpExtend> assignments) {
  2. op.visit(this) ;
  3. ElementGroup eg = this.currentGroup ;
  4. processExtends(assignments,(v,e)->eg.addElement(new ElementBind(v, e)) ) ;
  5. Element e = fixupGroupsOfOne(eg) ;
  6. query.setQueryPattern(e) ;
  7. query.setQuerySelectType() ;
  8. }

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

  1. @Override
  2. public void visitSelectResultForm(Query query) {
  3. newQuery.setQuerySelectType();
  4. newQuery.setDistinct(query.isDistinct());
  5. VarExprList x = query.getProject();
  6. for (Var v : x.getVars()) {
  7. Expr expr = x.getExpr(v);
  8. if (expr == null)
  9. newQuery.addResultVar(v);
  10. else
  11. newQuery.addResultVar(v, expr);
  12. }
  13. }

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

  1. @Override
  2. public void visitSelectResultForm(Query query) {
  3. newQuery.setQuerySelectType() ;
  4. newQuery.setDistinct(query.isDistinct()) ;
  5. VarExprList x = query.getProject() ;
  6. for (Var v : x.getVars()) {
  7. Expr expr = x.getExpr(v) ;
  8. if ( expr == null )
  9. newQuery.addResultVar(v) ;
  10. else
  11. newQuery.addResultVar(v, expr) ;
  12. }
  13. }

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

  1. public static Query createQueryCount(Var countVar, Element e, Long limit) {
  2. if(limit != null) {
  3. e = limitElement(e, limit);
  4. }
  5. Var tmpVar = Var.alloc(countVar.getName() + "_tmp_");
  6. Query result = new Query();
  7. result.setQuerySelectType();
  8. result.getProject().add(countVar, new ExprAggregator(tmpVar, new AggCount()));
  9. result.setQueryPattern(e);
  10. return result;
  11. }

代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache

  1. public static Query createQueryCount(Var countVar, Element e, Long limit) {
  2. if(limit != null) {
  3. e = limitElement(e, limit);
  4. }
  5. Var tmpVar = Var.alloc(countVar.getName() + "_tmp_");
  6. Query result = new Query();
  7. result.setQuerySelectType();
  8. result.getProject().add(countVar, new ExprAggregator(tmpVar, new AggCount()));
  9. result.setQueryPattern(e);
  10. return result;
  11. }

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

  1. public static Query createQueryList(UnaryRelation concept, Long limit, Long offset) {
  2. Query result = new Query();
  3. result.setQuerySelectType();
  4. result.setDistinct(true);
  5. result.setLimit(limit == null ? Query.NOLIMIT : limit);
  6. result.setOffset(offset == null ? Query.NOLIMIT : offset);
  7. result.getProject().add(concept.getVar());
  8. Element e = concept.getElement();
  9. if(e instanceof ElementSubQuery) {
  10. e = ElementUtils.createElementGroup(e);
  11. }
  12. result.setQueryPattern(e);
  13. // String str = result.toString();
  14. // System.out.println(str);
  15. return result;
  16. }

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

  1. public static Query createQueryCheckExistenceValues(Iterator<Quad> it) {
  2. Tables tables = createTablesForQuads(it);
  3. boolean useG = !tables.getNamedGraphTable().isEmpty();
  4. Element element = createElement(tables);
  5. Query result = new Query();
  6. result.setQuerySelectType();
  7. if(useG) {
  8. result.getProject().add(Vars.g);
  9. }
  10. result.getProject().add(Vars.s);
  11. result.getProject().add(Vars.p);
  12. result.getProject().add(Vars.o);
  13. result.setQueryPattern(element);
  14. return result;
  15. }

相关文章