本文整理了Java中org.apache.jena.query.Query.isDistinct
方法的一些代码示例,展示了Query.isDistinct
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.isDistinct
方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:isDistinct
暂无
代码示例来源:origin: apache/tinkerpop
final String[] all = new String[vars.size()];
vars.toArray(all);
if (query.isDistinct()) {
traversal = traversal.dedup(all);
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static boolean isDistinctConceptVar(Query query, Var conceptVar) {
boolean isDistinct = query.isDistinct();
Collection<Var> projectVars = query.getProjectVars();
boolean hasSingleVar = !query.isQueryResultStar() && projectVars != null && projectVars.size() == 1;
boolean result = isDistinct && hasSingleVar && projectVars.iterator().next().equals(conceptVar);
return result;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
/**
* <sparql xmlns="http://www.w3.org/2005/sparql-results#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/sw/DataAccess/rf1/result2.xsd">
* <head>
* <variable name="s"/>
* <variable name="p"/>
* <variable name="o"/>
* </head>
* <results distinct="false" ordered="true">
* @see org.springframework.batch.item.file.FlatFileHeaderCallback#writeHeader(java.io.Writer)
*/
@Override
public void writeHeader(Writer writer) throws IOException {
PrintWriter pw = new PrintWriter(writer);
pw.println("<?xml version=\"1.0\"?>") ;
pw.println("<sparql xmlns=\"http://www.w3.org/2005/sparql-results#\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.w3.org/2001/sw/DataAccess/rf1/result2.xsd\">");
pw.println(" <head>") ;
List<String> varNames = query.getResultVars();
for(String varName : varNames) {
pw.println(" <variable name=\"" + varName + "\" />") ;
}
pw.println(" </head>") ;
pw.print(" <results distinct=\"" + query.isDistinct() + "\" " + "ordered=\"" + !CollectionUtils.isEmpty(query.getOrderBy()) + "\">");
pw.flush();
}
});
代码示例来源:origin: dkuppitz/sparql-gremlin
throw new IllegalStateException();
case 1:
if (query.isDistinct()) {
traversal = traversal.dedup(vars.get(0));
break;
case 2:
if (query.isDistinct()) {
traversal = traversal.dedup(vars.get(0), vars.get(1));
final String[] all = new String[vars.size()];
vars.toArray(all);
if (query.isDistinct()) {
traversal = traversal.dedup(all);
if (query.isDistinct()) {
traversal = traversal.dedup();
代码示例来源:origin: org.apache.jena/jena-querybuilder
/**
* Constructor.
*
* @param aggHandler The aggregate handler that wraps the query we want to handle.
*/
public SelectHandler(AggregationHandler aggHandler) {
this.query = aggHandler.getQuery();
this.aggHandler = aggHandler;
setDistinct(query.isDistinct());
setReduced(query.isReduced());
}
代码示例来源:origin: apache/jena
/**
* Constructor.
*
* @param aggHandler The aggregate handler that wraps the query we want to handle.
*/
public SelectHandler(AggregationHandler aggHandler) {
this.query = aggHandler.getQuery();
this.aggHandler = aggHandler;
setDistinct(query.isDistinct());
setReduced(query.isReduced());
}
代码示例来源:origin: apache/jena
@Override
public void visitSelectResultForm(Query query1)
{
check("Not both SELECT queries", query2.isSelectType()) ;
check("DISTINCT modifier",
query1.isDistinct() == query2.isDistinct()) ;
check("SELECT *", query1.isQueryResultStar() == query2.isQueryResultStar()) ;
check("Result variables", query1.getProject(), query2.getProject() ) ;
}
代码示例来源:origin: apache/jena
@Override
public void visitSelectResultForm(Query query) {
newQuery.setQuerySelectType();
newQuery.setDistinct(query.isDistinct());
VarExprList x = query.getProject();
for (Var v : x.getVars()) {
Expr expr = x.getExpr(v);
if (expr == null)
newQuery.addResultVar(v);
else
newQuery.addResultVar(v, expr);
}
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public void visitSelectResultForm(Query query) {
newQuery.setQuerySelectType() ;
newQuery.setDistinct(query.isDistinct()) ;
VarExprList x = query.getProject() ;
for (Var v : x.getVars()) {
Expr expr = x.getExpr(v) ;
if ( expr == null )
newQuery.addResultVar(v) ;
else
newQuery.addResultVar(v, expr) ;
}
}
代码示例来源:origin: com.github.galigator.openllet/openllet-jena
return parse(triples, sparql.getResultVars(), kb, sparql.isDistinct());
代码示例来源:origin: Galigator/openllet
return parse(triples, sparql.getResultVars(), kb, sparql.isDistinct());
代码示例来源:origin: Galigator/openllet
return parse(triples, sparql.getResultVars(), kb, sparql.isDistinct());
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
boolean isDistinct = rawQuery.isDistinct();
代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache
boolean isDistinct = rawQuery.isDistinct();
代码示例来源:origin: apache/jena
@Override
public void visitSelectResultForm(Query query)
{
out.print("SELECT ") ;
if ( query.isDistinct() )
out.print("DISTINCT ") ;
if ( query.isReduced() )
out.print("REDUCED ") ;
out.print(" ") ; //Padding
if ( query.isQueryResultStar() )
out.print("*") ;
else
appendNamedExprList(query, out, query.getProject()) ;
out.newline() ;
}
代码示例来源:origin: apache/jena
/**
* Add all the variables from the select handler variable.
*
* @param selectHandler
* The select handler to copy the variables from.
*/
public void addAll(SelectHandler selectHandler) {
setReduced(selectHandler.query.isReduced());
setDistinct(selectHandler.query.isDistinct());
query.setQueryResultStar(selectHandler.query.isQueryResultStar());
VarExprList shProjectVars = selectHandler.query.getProject();
VarExprList qProjectVars = query.getProject();
for (Var var : shProjectVars.getVars()) {
// make sure there are no duplicates
if (!qProjectVars.contains(var)) {
qProjectVars.add(var, shProjectVars.getExpr(var));
}
}
aggHandler.addAll( selectHandler.aggHandler );
}
代码示例来源:origin: org.apache.jena/jena-querybuilder
/**
* Add all the variables from the select handler variable.
*
* @param selectHandler
* The select handler to copy the variables from.
*/
public void addAll(SelectHandler selectHandler) {
setReduced(selectHandler.query.isReduced());
setDistinct(selectHandler.query.isDistinct());
query.setQueryResultStar(selectHandler.query.isQueryResultStar());
VarExprList shProjectVars = selectHandler.query.getProject();
VarExprList qProjectVars = query.getProject();
for (Var var : shProjectVars.getVars()) {
// make sure there are no duplicates
if (!qProjectVars.contains(var)) {
qProjectVars.add(var, shProjectVars.getExpr(var));
}
}
aggHandler.addAll( selectHandler.aggHandler );
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static long countQuery(Query query, QueryExecutionFactory qef) {
boolean needsWrapping = !query.getGroupBy().isEmpty() || !query.getAggregators().isEmpty();
boolean useCountDistinct = !needsWrapping && query.isDistinct() && query.isQueryResultStar();
代码示例来源:origin: apache/jena
if ( query.isDistinct() )
op = OpDistinct.create(op) ;
内容来源于网络,如有侵权,请联系作者删除!