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

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

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

Query.getAST介绍

暂无

代码示例

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

MappingsGraph(Mappings m){
  map = m;
  graph = Graph.create();
  query = map.getQuery();
  ast = (ASTQuery) query.getAST();
  var = new HashMap<String, Node>();
}

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

void before(Query q) {
  ASTQuery ast = (ASTQuery) q.getAST();
  for (fr.inria.corese.sparql.api.QueryVisitor vis : ast.getVisitorList()) {
    vis.before(q);
  }       
}

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

public Object getAST() {
  if (getQuery() == null) {
    return null;
  }
  return getQuery().getAST();
}

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

void update(Query  q){
  ASTQuery ast = (ASTQuery) q.getAST();
  trace("Update: " + update.size() + " " + ast.getText());
  if (isUpdate){
    update.add(ast.getText());
  }
}

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

public void trace() {
  System.out.println("PP nb templates: " + qe.getQueries().size());
  for (Query q : qe.getQueries()) {
    if (q.hasPragma(Pragma.FILE)) {
      System.out.println(name(q));
    }
    ASTQuery ast = (ASTQuery) q.getAST();
    System.out.println(ast);
  }
}

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

public Mappings sparqlQuery(Query q, Mapping map) throws EngineException {
  if (q.isUpdate()) {
    throw new EngineException("Unauthorized Update in SPARQL Query:\n" + q.getAST().toString());
  }
  return eval(q, map);
}

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

/**
 * service <db:/tmp/human_db> { GP }
 * service overloaded to query a database
 */
Mappings db(Query q, Node serv){
  QueryProcess exec = QueryProcess.dbCreate(Graph.create(), true, QueryProcess.DB_FACTORY, serv.getLabel().substring(DB.length()));
  return exec.query((ASTQuery) q.getAST());
}

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

/**
 * Generate predefined system filters that may be used by kgram Filters are
 * stored in a table, we can have several predefined filters pathNode()
 * generate a blank node for each path (PathFinder)
 */
void filters(Query q) {
  ASTQuery ast = (ASTQuery) q.getAST();
  Term t = Term.function(Processor.PATHNODE);
  q.setFilter(Query.PATHNODE, t.compile(ast));
}

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

void after(Mappings map) {
  ASTQuery ast = (ASTQuery) map.getQuery().getAST();
  for (fr.inria.corese.sparql.api.QueryVisitor vis : ast.getVisitorList()) {
    vis.after(map);
  }   
}

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

@Override
public void finish(Graph g, Query q, Mappings m) {
  if (m == null){
    m = Mappings.create(q);
  }
  exec(END, param(q, q.getAST(), m));
}

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

@Override
public void init(Query q) {
  // Visitor may be reused by let (?g = construct where)
  if (query == null) {
    query = q;
    ast = (ASTQuery) q.getAST();
    setSelect();
    initialize();
    callback(eval, INIT, toArray(q));
  }
}

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

IDatatype dataset(Expr exp, Environment env, Producer p){
  ASTQuery ast = (ASTQuery) env.getQuery().getAST();
  Dataset ds = ast.getDataset();
  
  switch (exp.oper()){
    case XT_FROM:
      return ds.getFromList();
    case XT_NAMED:
      return ds.getNamedList();
  }
  return null;
}

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

void relax(Query q) {
  ASTQuery ast = (ASTQuery) q.getAST();
  for (Expression exp : ast.getRelax()) {
    if (exp.isConstant()) {
      Constant p = exp.getConstant();
      Node n = compiler.createNode(p);
      q.addRelax(n);
    }
  }
}

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

public static JSOND3Format create(Mappings map) {
  Graph g = (Graph) map.getGraph();
  if (g != null) {
    Query q = map.getQuery();
    NSManager nsm = ((ASTQuery) q.getAST()).getNSM();
    return create(g, nsm);
  }
  return create(Graph.create());
}

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

void pragma(Eval kgram, Query query){
  ASTQuery ast = (ASTQuery) query.getAST();
  Pragma pg = new Pragma(kgram, query, ast);
  if (getPragma() != null) {
    pg.parse(getPragma());
  }
  if (ast!=null && ast.getPragma() != null){
    pg.parse();
  }
}

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

@Override
public void finish(Graph g, Query q, Mappings m) {
  if (isListen(FINISH)) {
    log("Finish:\n" + q.getAST());
    if (m != null && isListen(RESULT)) {
      log(m);
      log("map size: " + m.size());
    }
  }
}

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

Mappings send(Query q, Node serv, Environment env, int timeout) throws IOException, ParserConfigurationException, SAXException {
  ASTQuery ast = (ASTQuery) q.getAST();
  boolean trap = ast.isFederate() || ast.getGlobalAST().hasMetadata(Metadata.TRAP);
  String query = ast.toString();
  InputStream stream = doPost(serv.getLabel(), query, timeout);       
  return parse(stream, trap);
}

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

Mappings send(Query q, Node serv, Environment env, int timeout) throws IOException, ParserConfigurationException, SAXException {
  ASTQuery ast = (ASTQuery) q.getAST();
  boolean trap = ast.isFederate() || ast.getGlobalAST().hasMetadata(Metadata.TRAP);
  String query = ast.toString();
  InputStream stream = doPost(serv.getLabel(), query, timeout);       
  return parse(stream, trap);
}

相关文章