fr.inria.corese.kgram.core.Query类的使用及代码示例

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

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

Query介绍

[英]KGRAM Query also used for subquery
[中]KGRAM查询也用于子查询

代码示例

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

Query complete(Query q1, Query q2) {
  q1.setOuterQuery(this);
  q2.setOuterQuery(this);
  setGlobalQuery(getBody());
  setSelect(q1, q2);
  collect();
  setAST(q2.getAST());
  return this;
}

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

void count(Query q){
  if (q.getSelectFun().size() == 1
      && q.getGroupBy().isEmpty()
      && q.getLimit() == Integer.MAX_VALUE
      && ! q.isTemplate()){
    Exp exp = q.getSelectFun().get(0);
    Filter f = exp.getFilter();
    if (f != null 
        && f.getExp().oper() == ExprType.COUNT
        && ! f.getExp().isDistinct()
        && f.getExp().getExpList().isEmpty()){
      q.setQueryProfile(Query.COUNT_PROFILE);
    }
  }
}

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

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

代码示例来源: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/compiler

Query create(Exp exp) {
  Query q = Query.create(exp);
  if (sort != null) {
    q.set(sort);
  }
  return q;
}

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

query.setTest(value(object));
  query.setOptimize(value(object));
  query.setDebug(value(object));	
  query.setSort(value(object));	
  query.setListGroup(value(object));
  query.setDetail(value(object));
if (property.equals(MODE)){
  int mode = getMode(object);
  query.setMode(mode);
  query.setListPath(value(object));
  query.setPathType(value(object));
  query.setStorePath(value(object));
  query.setCachePath(value(object));
  query.setCountPath(value(object));
  query.setCheckLoop(! value(object));
  query.addInfo("AST:\n", ast);

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

for (int i = 0; i < exp.nbNode(); i++) {
  Node node = exp.getNode(i);
  n = qIndex(query, node);
  min = Math.min(min, n);
  for (int i = 0; i < ep.nbNode(); i++) {
    Node node = ep.getNode(i);
    n = qIndex(query, node);
    min = Math.min(min, n);
  n = qIndex(query, node);
  min = Math.min(min, n);
min = qIndex(query, node);
break;
min = qIndex(query, qn);
if (exp.getNodeList() != null){
  for (Node bn : exp.getNodeList()){
    int ii = qIndex(query, bn);
    min = Math.min(min, ii);
boolean hasExist = index(query, exp.getFilter());
  Node qNode = query.getProperAndSubSelectNode(var);
  if (qNode != null) {
    n = qIndex(query, qNode);
    min = Math.min(min, n);
  } else if (!isExist && !hasExist) {

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

Query gq = q.getGlobalQuery();
try {
    if (gq.isDebug()) {logger.info("Skip slice for absence of relevant binding");}
    return Mappings.create(q);
  if (gq.isDebug()) {
    logger.info("** Provider query: \n" + q.getAST());
  if (gq.isDebug()) {
    if (res.size() <= 100 || gq.isDetail()) {
      logger.info("** Provider result: \n" + res.toString(true));
  logger.error(q.getAST().toString(), e);
  gq.addError(SERVICE_ERROR, e);
} catch (ParserConfigurationException e) {
if (gq.isDebug()) {
  logger.info("** Provider error");

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

ASTQuery ast = (ASTQuery) q.getAST();
boolean oneValue = !map.getQuery().isListGroup();
resultXML = toString(map);
textAreaXMLResult.setText(resultXML.toString());
if (q.isTemplate() || ast.isAsk() || ast.getErrors() != null){
  tabbedPaneResults.setSelectedIndex(XML_PANEL);
} else{
if (q.isConstruct()) {
  displayGraph((Graph) map.getGraph(), ast.getNSM());
else if (map.getQuery().isTemplate() && map.getQuery().isPragma(KGGRAPH)) {
  display(map, ast.getNSM());

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

/**
 * Compile Graph into a BGP Generate a Query
 */
public Query getQuery() {
  Transformer t = Transformer.create();
  ASTQuery ast = ASTQuery.create();
  ast.setSelectAll(true);
  ast.setBody(BasicGraphPattern.create());
  ast = visitor.visit(ast);
  graph = visitor.visit(graph);
  Exp exp = getExp(graph);
  Query q = Query.create(exp);
  q.setAST(ast);
  q = t.transform(q, ast);
  q.setDebug(isDebug);
  q = visitor.visit(q);
  if (isConstruct()) {
    // TODO: blanks in construct should be renamed
    q.setConstruct(q.getBody());
    q.setConstruct(true);
  }
  return q;
}

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

Exp pat = q.getPattern(exp);
Node gNode = env.getGraphNode();
Memory memory = null;
    qq.setFun(true);              
    if (qq.isConstruct() || qq.isUpdate()) {
    if (qq.getService() != null) {

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

void debug(Query query){
  if (query.isDebug()){
    logger.debug(query.getBody().toString());
    logger.debug("limit " + query.getLimit());
    if (query.isFail()){
      logger.debug("Fail at compile time");
    }
  }
}

代码示例来源: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

void query(Query q, Mappings m){
  ASTQuery ast = (ASTQuery) q.getAST();
  trace("Query: " + query.size() + " " + ast.getText());
  if (isQuery){
    query.add(ast.getText());
  }
  
}

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

/**
 * For query and subquery Generate a new compiler for each (sub) query in
 * order to get fresh new nodes
 */
Query compile(ASTQuery ast) {
  Exp ee = compile(ast.getExtBody(), false);
  Query q = Query.create(ee);
  q.setUseBind(isUseBind);
  compileFunction(q, ast);
  q.setAST(ast);
  q.setHasFunctional(ast.hasFunctional());
  q.setService(ast.getService());
  // use same compiler
  values(q, ast);
  path(q, ast);
  return q;
}

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

m = createMapping(m, ds);
pragma(q);
if (q.getService() != null) {
if (q.isUpdate() || q.isRule()) {
  log(Log.UPDATE, q);
  map = synUpdate(q, m, ds);
  map = synQuery(q, m);
  if (q.isConstruct()) {

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

void bindings(Query q, ASTQuery ast) {
    Exp bind = bindings(ast.getValues());
    if (bind == null) {
      q.setCorrect(false);
      q.addError("Value Bindings: ", "#values != #variables");
    } else {
      q.setValues(bind);
      if (ast.getValues().isMoved()) {
        //q.setTemplateMappings(bind.getMappings());
        q.getValues().setPostpone(true);
      } 
//            else {
//                q.setMappings(bind.getMappings());
//                q.setBindingNodes(bind.getNodeList());
//            }
    }
  }

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

else if (map.getQuery().isTemplate()){
  return process(map, g, getTransformation(constructTransform));       
else if (map.getQuery().isUpdate() && graph != null){
  return process(map, graph, getTransformation(constructTransform));

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

/**
 * Select Query is empty and does nothing
 */
boolean isEmpty(){
  return isSelect()
      && getSelectFun().isEmpty()
      && getBody().size() == 0
      && getValues().getMappings() == null;            
}

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

public void defQuery(Query q) {
  if (q.isTemplate()) {
    defTemplate(q);
  } else {
    list.add(q);
  }
}

相关文章