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

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

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

Query.getSelect介绍

[英]PRAGMA: do not use at compile time (use getSelectFun())
[中]PRAGMA:编译时不要使用(使用getSelectFun())

代码示例

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

public Mappings distinct(List<Node> list) {
  Mappings map = distinct(query.getSelect(), list);
  //map.setNodeList(list);
  return map;
}

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

public Mappings distinctAll() {
  List<Node> list = query.getSelectNodes();
  if (list.isEmpty()) {
    list = query.getSelect();
  }
  if (list.isEmpty()) {
    list = getSelect();
  }
  return distinct(list, list);
}

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

void initiate(Query q,  boolean b, boolean all){
  this.query = q;
  isDistinct = b;
  isListGroup = q.isListGroup();
  setSelect(q.getSelect());
  if (isDistinct) {
    if (all) {
      List<Node> list = q.getSelectNodes();
      if (list.isEmpty()){
        distinct = group(q.getSelectFun()); 
      }
      else {
        distinct = group(q.toExp(list)); 
      }
    }
    else {
      distinct = group(q.getSelectFun());
    }
    distinct.setDistinct(true);
    distinct.setDuplicate(q.isDistribute());
  }
}

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

subNode = subQuery.getSelect().get(i);
outNode = qq.getOuterNodeSelf(subNode);
Node value = res.getNode(subNode);

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

void setQuery(Query q){
  query = q;
  select = new Vector<String> ();
  for (Node node : q.getSelect()){
    select.add(node.getLabel());
  }
}

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

public List<String> getVariables() {
  List<String> list = new ArrayList<String>();
  for (Node node : getSelect()) {
    list.add(node.getLabel());
  }
  return list;
}

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

void setQuery(Query q){
  query = q;
  select = new ArrayList<String> ();
  for (Node node : q.getSelect()){
    select.add(node.getLabel());
  }
}

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

/**
 * Project on select variables of query Modify this Mapping
 */
public void project(Query q) {
  ArrayList<Node> lqNodes = new ArrayList<Node>();
  ArrayList<Node> ltNodes = new ArrayList<Node>();
  for (Node qNode : q.getSelect()) {
    Node tNode = getNode(qNode);
    if (tNode != null) {
      lqNodes.add(qNode);
      ltNodes.add(tNode);
    }
  }
  init(lqNodes, ltNodes);
}

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

for (Node qv : q.getSelect()) {
  sb.append(qv.getLabel());
  sb.append(SPACE);
  for (Node var : q.getSelect()) {
    Node val = m.getNode(var);
    if (val == null) {

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

void body() {
  Node resultVariable = graph.addProperty(RESULTVARIABLE);
    for (Node n : query.getSelect()) {
    graph.addEdge(root, resultVariable, getVariable(n));
  }
  int i = 0;
  for (Mapping m : map) {
    process(m,  i++);
  }
}

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

/**
 * pop select nodes of sub query
 */
private void pop(Query subQuery, Mapping ans) {
  Memory env = memory;
  Query qq = query;
  for (Node subNode : subQuery.getSelect()) {
    if (ans.isBound(subNode)) {
      Node outNode = qq.getOuterNodeSelf(subNode);
      env.pop(outNode);
      env.popPath(outNode);
    }
  }
}

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

void body(Serializer sb) {
  Query q = map.getQuery();
  for (Node n : q.getSelect()) {
    sb.append("rs:resultVariable '", getName(n));
    sb.appendPNL("'");
  }
  int i = 0;
  for (Mapping m : map) {
    process(m, sb, i++);
  }
}

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

/**
 * Is one node of subquery select already bound in memory ?
 */
private boolean isBound(Query subQuery, Memory env) {
  Query qq = query;
  for (Node subNode : subQuery.getSelect()) {
    if (env.isBound(subNode)){
      return true;
    }
    // get outer node:
    Node outNode = qq.getOuterNodeSelf(subNode);            
    if (outNode != null && env.isBound(outNode)) {
      return true;
    }
    if (env.getBind() != null && env.getBind().isBound(subNode.getLabel())){
      return true;
    }
  }
  return false;
}

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

void fillTable(Mappings map) {
  Query q = map.getQuery();
  List<fr.inria.corese.kgram.api.core.Node> vars = q.getSelect();
  if (q.isUpdate() && map.size() > 0){            
    vars = map.get(0).getQueryNodeList();

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

for (Node subNode : sub.getSelect()) {

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

int index = memory.getIndex(query.getSelect());
if (index != -1) {
  backtrack = index;

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

void process(Mapping m, Serializer sb, int i){
  Query q = map.getQuery();        
  sb.appendNL("rs:solution [");
  sb.appendPNL("rs:index ", i);
  for (Node n : q.getSelect()){
    if (m.getNode(n) != null){
      sb.appendNL("rs:binding [");
      sb.append("rs:variable '", getName(n));
      sb.appendPNL("'");
      sb.appendNL("rs:value ",     m.getValue(n));
      sb.appendPNL("]");
    }
  }
  sb.appendPNL("]");
}

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

void process(Mapping m,  int i){
  Node solution   = graph.addProperty(SOLUTION);        
  Node index      = graph.addProperty(INDEX);
  Node binding    = graph.addProperty(BINDING);
  Node variable   = graph.addProperty(VARIABLE);
  Node value      = graph.addProperty(VALUE);
  
  Node sol = graph.addBlank(bnid());
  graph.addEdge(root, solution, sol);
  graph.addEdge(sol, index, graph.addLiteral(i));
  for (Node n : query.getSelect()){
    if (m.getNode(n) != null){
      Node bind = graph.addBlank(bnid());
      graph.addEdge(sol, binding, bind);
      graph.addEdge(bind, variable, getVariable(n));
      graph.addEdge(bind, value, graph.addNode((IDatatype) m.getValue(n)));               
    }
  }
}

相关文章