fr.inria.corese.kgram.core.Query.isConstruct()方法的使用及代码示例

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

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

Query.isConstruct介绍

暂无

代码示例

代码示例来源:origin: fr.inria.corese/kgram

public boolean isSelect(){
  return ! (isConstruct() || isUpdate() || isDelete());
}

代码示例来源:origin: Wimmics/corese

public static Construct create(Query q) {
  Construct cons = new Construct(q);
  if (q.isDetail()) {
    if (q.isConstruct()) {
      cons.setInsertList(new ArrayList<Edge>());
    } else {
      cons.setDeleteList(new ArrayList<Edge>());
    }
  }
  return cons;
}

代码示例来源:origin: fr.inria.corese/kgram

public int getLimitOffset() {
  // when order by/group by/count(), return all results, group sort agg, and then apply offset/limit
  if (!isConstruct()
      && (isOrderBy() || hasGroupBy() || isAggregate())) {
    return Integer.MAX_VALUE;
  }
  if (limit < Integer.MAX_VALUE - offset) {
    return limit + offset;
  } else {
    return limit;
  }
}

代码示例来源:origin: fr.inria.corese/kgram

void finish(Query qq) {
  setNbsolutions(size());
  if (qq.hasGroupBy() && !qq.isConstruct()) {
    // after group by (and aggregate), leave one Mapping for each group
    // with result of the group
    groupBy();
  } else if (qq.getHaving() != null) {
    // clause 'having' with no group by
    // select (max(?x) as ?max where {}
    // having(?max > 100)
    having();
  } else if (qq.isAggregate() && !qq.isConstruct()) {
    clean();
  }
}

代码示例来源:origin: Wimmics/corese

if (q.isConstruct()) {
  displayGraph((Graph) map.getGraph(), ast.getNSM());

代码示例来源:origin: Wimmics/corese

/**
 * pname is property name queries are construct where find a query with
 * construct {?x pname ?y} process the query use case: ProducerImpl
 * getEdges() computed by construct-where
 */
Mappings process(Node start, String pname, int index) {
  for (Query q : getQueries()) {
    if (q.isConstruct()) {
      Exp cons = q.getConstruct();
      for (Exp ee : cons.getExpList()) {
        if (ee.isEdge()) {
          Edge edge = ee.getEdge();
          if (edge.getLabel().equals(pname)) {
            Mapping bind = null;
            if (start != null) {
              bind = Mapping.create(edge.getNode(index), start);
            }
            Mappings map = process(q, bind);
            return map;
          }
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: Wimmics/corese

String mapToString(){
  Query q = map.getQuery();
  if (q == null) {
    return "";
  }
  
  ASTQuery ast = (ASTQuery) q.getAST();
  if (q.isTemplate()
      || (q.hasPragma(Pragma.TEMPLATE) && map.getGraph() != null)) {
    return TemplateFormat.create(map).toString();
  } else {
    if (type == UNDEF_FORMAT) {
      if (q.isConstruct()) {
        type = getConstructFormat();
      } 
      else {
        type = getSelectFormat();               
      }
    }
    
    return process(map, type);
  }
}

代码示例来源:origin: Wimmics/corese

String query(String query){
  try {
    Mappings map = exec.query(query);
    Query q = map.getQuery();
    ASTQuery ast = (ASTQuery) q.getAST();
    
    String str = null;
    if (q.isConstruct() && map.getGraph()!=null){
      Graph g = (Graph) map.getGraph();
      RDFFormat p = RDFFormat.create(g, ast.getNSM());
      str = p.toString();
    }
    else {
      XMLFormat f = XMLFormat.create(map);
      str = f.toString();
    }
    
    return str;
  } 
  catch (EngineException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return null;
}

代码示例来源:origin: fr.inria.corese/corese-core

/**
 * query is the global Query ast is the current update action use case:
 * delete insert data delete insert where In case of data, fake an empty
 * where and process as a where update.
 */
Mappings update(Query query, ASTQuery ast, Mapping m) {
  //System.out.println("** QP:\n" + m.getBind());
  exec.logStart(query);
  Query q = exec.compile(ast, ds);
  Mapping mm = m;
  if (m != null && m.size() == 0 && m.getBind() != null) {
    // m contains LDScript binding stack
    // generate appropriate Mapping for query q from this stack.
    mm = Mapping.create(q, m.getBind());
  }
  Mappings map = exec.query(q, mm);
  //Mappings map = exec.basicQuery(ast, null, ds);
  //Query q = map.getQuery();
  // PRAGMA: update can be both delete & insert
  if (q.isDelete()) {
    manager.delete(q, map, ds);
  }
  if (q.isConstruct()) {
    // insert
    manager.insert(q, map, ds);
  }
  exec.logFinish(query, map);
  return map;
}

代码示例来源:origin: Wimmics/corese

/**
 * query is the global Query ast is the current update action use case:
 * delete insert data delete insert where In case of data, fake an empty
 * where and process as a where update.
 */
Mappings update(Query query, ASTQuery ast, Mapping m) {
  //System.out.println("** QP:\n" + m.getBind());
  exec.logStart(query);
  Query q = exec.compile(ast, ds);
  Mapping mm = m;
  if (m != null && m.size() == 0 && m.getBind() != null) {
    // m contains LDScript binding stack
    // generate appropriate Mapping for query q from this stack.
    mm = Mapping.create(q, m.getBind());
  }
  Mappings map = exec.query(q, mm);
  //Mappings map = exec.basicQuery(ast, null, ds);
  //Query q = map.getQuery();
  // PRAGMA: update can be both delete & insert
  if (q.isDelete()) {
    manager.delete(q, map, ds);
  }
  if (q.isConstruct()) {
    // insert
    manager.insert(q, map, ds);
  }
  exec.logFinish(query, map);
  return map;
}

代码示例来源:origin: Wimmics/corese

map = synQuery(q, m);
if (q.isConstruct()) {

代码示例来源:origin: Wimmics/corese

Query qq = sub.getQuery();
qq.setFun(true);              
if (qq.isConstruct() || qq.isUpdate()) {

代码示例来源:origin: fr.inria.corese/compiler

Query qq = sub.getQuery();
qq.setFun(true);              
if (qq.isConstruct() || qq.isUpdate()) {

相关文章