本文整理了Java中fr.inria.corese.kgram.core.Query.isTemplate
方法的一些代码示例,展示了Query.isTemplate
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.isTemplate
方法的具体详情如下:
包路径:fr.inria.corese.kgram.core.Query
类名称:Query
方法名:isTemplate
暂无
代码示例来源:origin: Wimmics/corese
public void defQuery(Query q) {
if (q.isTemplate()) {
defTemplate(q);
} else {
list.add(q);
}
}
代码示例来源:origin: Wimmics/corese
/**
* 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: Wimmics/corese
@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: Wimmics/corese
@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.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
void template(Evaluator eval, Query q, Memory mem, Producer p) {
if (size() > 0 && !isFake() && q.isTemplate()) {
setTemplateResult(apply(eval, q.getTemplateGroup(), mem, p));
}
}
代码示例来源:origin: Wimmics/corese
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: Wimmics/corese
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: Wimmics/corese
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: Wimmics/corese
@Override
public String stringValue(Data data) {
Mappings m = data.getMappings();
if (m == null){
ResultFormat f = ResultFormat.create(data.getGraph(), getFormat());
return f.toString();
}
if (m.getQuery().isTemplate()){
return m.getTemplateStringResult();
}
ResultFormat f = ResultFormat.create(m, getFormat());
return f.toString();
}
代码示例来源: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: fr.inria.corese/corese-core
else if (map.getQuery().isTemplate()){
代码示例来源:origin: Wimmics/corese
else if (map.getQuery().isTemplate()){
代码示例来源:origin: Wimmics/corese
@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(data.getBinding());
if (dt != null){
res.setTemplateResult(dt.getLabel());
res.setDatatypeValue(dt);
}
res.setProcess(this);
res.setBinding(t.getBinding());
complete(t, data, res);
return res;
}
内容来源于网络,如有侵权,请联系作者删除!