本文整理了Java中fr.inria.corese.kgram.core.Query.getSelectFun
方法的一些代码示例,展示了Query.getSelectFun
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getSelectFun
方法的具体详情如下:
包路径:fr.inria.corese.kgram.core.Query
类名称:Query
方法名:getSelectFun
暂无
代码示例来源:origin: fr.inria.corese/kgram
public boolean isSelectExpression(){
for (Exp e : getSelectFun()) {
if (e.getFilter() != null){
return true;
}
}
return false;
}
代码示例来源:origin: fr.inria.corese/kgram
public int nbFun() {
int nbfun = 0;
for (Exp e : getSelectFun()) {
if (e.getFilter() != null) {
nbfun++;
}
}
return nbfun;
}
代码示例来源:origin: fr.inria.corese/kgram
boolean inSelect(Node qNode) {
for (Exp exp : getSelectFun()) {
Node node = exp.getNode();
if (node == qNode) {
return true;
}
}
return false;
}
代码示例来源:origin: Wimmics/corese
@Deprecated
void profile(Query q){
init(q, q.getSelectFun());
}
代码示例来源:origin: fr.inria.corese/kgram
void setSelect(Query q1, Query q2) {
List<Exp> list = new ArrayList<Exp>();
list.addAll(q1.getSelectFun());
for (Exp exp : q2.getSelectFun()) {
if (!contain(list, exp.getNode())) {
list.add(exp);
}
}
setSelectFun(list);
}
代码示例来源:origin: fr.inria.corese/kgram
public Exp getSelectExp(String label) {
for (Exp exp : getSelectFun()) {
Node node = exp.getNode();
if (node.getLabel().equals(label)) {
return exp;
}
}
return null;
}
代码示例来源:origin: fr.inria.corese/kgram
public Query select(Node node) {
if (node != null && !contain(getSelectFun(), node)) {
addSelect(node);
}
return this;
}
代码示例来源:origin: fr.inria.corese/kgram
/**
* use case: select distinct ?x where add an ACCEPT ?x statement to check
* that ?x is new
*/
public void distinct() {
if (testJoin) {
// in case of JOIN() the ACCEPT(?x) cannot be set
// because evaluation occurs in kgram subEval
// where there is no Group to compute accept()
return;
}
if (isDistinct() && getSelectFun().size() == 1) {
Node qNode = getSelectFun().get(0).getNode();
for (Exp exp : this) {
if (exp.distinct(qNode)) {
return;
}
}
}
}
代码示例来源:origin: fr.inria.corese/kgram
public List<Node> getSelectNodeList() {
List<Node> list = new ArrayList<Node>();
for (Exp ee : getQuery().getSelectFun()) {
add(list, ee.getNode());
}
return list;
}
代码示例来源:origin: fr.inria.corese/kgram
public Exp getFunction() {
for (Exp exp : getSelectFun()) {
if (exp.getFilter() != null && exp.getFilter().isFunctional()) {
return exp;
}
}
return null;
}
代码示例来源:origin: fr.inria.corese/kgram
/**
* We just counted number of results: nbResult Just build a Mapping
*/
void countProfile() {
Node n = evaluator.cast(nbResult, memory, producer);
Mapping m = Mapping.create(query.getSelectFun().get(0).getNode(), n);
results.add(m);
}
代码示例来源:origin: fr.inria.corese/kgram
/**
* Check that select variables and expressions are compatible with group by
* & aggregates use case:
*
* SELECT ?P (COUNT(?O) AS ?C) WHERE { ?S ?P ?O }
*
* SELECT ((?O1 + ?O2) AS ?O12) (COUNT(?O1) AS ?C) WHERE { ?S :p ?O1; :q ?O2
* } GROUP BY (?S)
*
*
*/
public boolean check() {
if (getGroupBy().size() > 0) {
for (Exp exp : getSelectFun()) {
if (!checkGroupBy(exp)) {
return false;
}
}
} else {
return checkAggregate();
}
return true;
}
代码示例来源: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
/**
* Select Query is empty and does nothing
*/
boolean isEmpty(){
return isSelect()
&& getSelectFun().isEmpty()
&& getBody().size() == 0
&& getValues().getMappings() == null;
}
代码示例来源: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: fr.inria.corese/kgram
/**
* exp.first() is a subquery that implements a BIND() pop the binding at the
* end of group pattern
*/
private int pop(Node gNode, Exp exp, Stack stack, int n) {
for (Exp ee : exp.first().getQuery().getSelectFun()) {
Node node = ee.getNode();
memory.pop(node);
break;
}
return eval(gNode, stack, n + 1);
}
代码示例来源: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
/**
* additional filter of functional select xpath() as ?val xsd:integer(?val)
* as ?int
*/
private Mapping complete(Mapping map, Producer p) {
for (Exp ee : query.getSelectFun()) {
Filter f = ee.getFilter();
if (f != null && !f.isFunctional()) {
memory.push(map, -1);
Node node = evaluator.eval(f, memory, producer);
memory.pop(map);
map.setNode(ee.getNode(), node);
}
}
if (query.getOrderBy().size() > 0 || query.getGroupBy().size() > 0) {
memory.push(map, -1);
Mapping m = memory.store(query, p, true, true);
memory.pop(map);
map = m;
}
return map;
}
代码示例来源:origin: fr.inria.corese/kgram
/**
* Compile additional filters that may contain exists {}.
*/
void modifier(Query q) {
compile(q.getSelectFun());
compile(q.getOrderBy());
compile(q.getGroupBy());
if (q.getHaving() != null) {
compile(q.getHaving().getFilter());
}
for (Filter f : q.getFunList()) {
compile(f);
}
}
代码示例来源:origin: fr.inria.corese/kgram
public void setAggregate() {
for (Exp exp : getSelectFun()) {
if (exp.getFilter() != null) {
if (exp.isAggregate() && !exp.isExpGroupBy()) {
setAggregate(true);
} else if (exp.getFilter().isFunctional()) {
setFunctional(true);
getOuterQuery().setHasFunctional(true);
}
}
}
for (Exp exp : getOrderBy()) {
if (exp.getFilter() != null && exp.getFilter().isAggregate()) {
setAggregate(true);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!