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

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

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

Query.isTemplate介绍

暂无

代码示例

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

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

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

/**
 * Process type check queries
 */
void query(Graph g) {
  for (String q : QUERIES) {
    Mappings map = query(g, QUERY + q);
      if (map.getQuery().isTemplate()){
        System.out.println(map.getTemplateResult().getLabel());
      }
      else if (map.size() > 0) {
        System.out.println(map);
      }
    }
  }

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

@Override
public String toString(){
  if (query != null && query.isTemplate()){
    Node node = map.getTemplateResult();
    if (node != null){
      return node.getLabel();
    }
    return "";
  }
  if (graph == null){
    return "";
  }
  Transformer p = createPP();
  return p.toString();
}

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

@Override
public String stringValue(Data data) {
  Mappings m = data.getMappings();
  if (m.getQuery().isTemplate()){
    return m.getTemplateStringResult();
  }
  ResultFormat f = ResultFormat.format(m);
  return f.toString();
}

代码示例来源:origin: fr.inria.wimmics/kggui

if (q.isTemplate() || ast.isAsk() || ast.getErrors() != null){
  tabbedPaneResults.setSelectedIndex(XML_PANEL);
} else{
  displayGraph((Graph) map.getGraph(), ast.getNSM());
else if (map.getQuery().isTemplate() && map.getQuery().isPragma(KGGRAPH)) {
  display(map, ast.getNSM());

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

@Override
public String stringValue(Data data) {       
  Mappings m = data.getMappings();  
  if (m == null){
    ResultFormat f = ResultFormat.create(data.getGraph(), format);
    return f.toString();
  }
  if (m.getQuery().isTemplate()){
    return m.getTemplateStringResult();
  }
  ResultFormat f = ResultFormat.create(m, format);
  return f.toString();
}

代码示例来源:origin: fr.inria.wimmics/sparql

String format(Computer eval, Binding b, Environment env, Producer prod) {
  String sep = " ";
  if (getArg() != null) {
    // separator as an evaluable expression: st:nl()
    IDatatype dt = getArg().eval(eval, b, env, prod);
    sep = dt.getLabel();
  } else {
    if (getModality() != null) {
      sep = getModality();
    }
    if (env.getQuery().isTemplate()) {
      if (sep.equals("\n") || sep.equals("\n\n")) {
        // get the indentation by evaluating a predefined st:nl()
        // computed by PluginImpl/Transformer
        // same as: separator = 'st:nl()'
        Expression nl = (Expression) env.getQuery().getTemplateNL().getFilter().getExp();
        IDatatype dt = nl.eval(eval, b, env, prod);
        String str = dt.getLabel();
        if (sep.equals("\n\n")) {
          str = NL + str;
        }
        sep = str;
      }
    }
  }
  return sep;
}

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

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: fr.inria.wimmics/corese-core

@Override
public Data run(Data data) throws EngineException {      
  if (isDefault && data.getMappings() != null && data.getMappings().getQuery().isTemplate()){
    // former SPARQLProcess is a template {} where {}
    // this Transformer is default transformer : return former template result
    return data;
  }
  Transformer t = Transformer.create(data.getGraph(), getPath());
  setTransfomer(t);
  init(t, data, getContext());
  Data res = new Data(data.getGraph());
  IDatatype dt = t.process();
  if (dt != null){
    res.setTemplateResult(dt.getLabel());
    res.setDatatypeValue(dt);
  }
  res.setProcess(this);       
  complete(t, res);
  return res;
}

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

else if (map.getQuery().isTemplate()){

相关文章