本文整理了Java中org.apache.jena.query.Query.setConstructTemplate
方法的一些代码示例,展示了Query.setConstructTemplate
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setConstructTemplate
方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:setConstructTemplate
[英]Set triple patterns for a construct query
[中]为构造查询设置三重模式
代码示例来源:origin: apache/jena
@Override
public void exec(ARQParser parser) throws Exception
{
Template t = parser.ConstructTemplate() ;
query.setConstructTemplate(t) ;
}
} ;
代码示例来源:origin: apache/jena
/**
* Add a triple to the construct statement.
* @param t The triple to add.
*/
public void addConstruct(Triple t) {
constructs.add(t);
query.setConstructTemplate(new Template(BasicPattern.wrap(constructs)));
}
代码示例来源:origin: apache/jena
/**
* Add all the construct handlers from the handler argument to this construct.
* @param handler The construct handler to copy from.
*/
public void addAll(ConstructHandler handler) {
constructs.addAll(handler.constructs);
query.setConstructTemplate(new Template(BasicPattern.wrap(constructs)));
}
代码示例来源:origin: org.apache.jena/jena-querybuilder
/**
* Add a triple to the construct statement.
* @param t The triple to add.
*/
public void addConstruct(Triple t) {
constructs.add(t);
query.setConstructTemplate(new Template(BasicPattern.wrap(constructs)));
}
代码示例来源:origin: org.apache.jena/jena-querybuilder
/**
* Add all the construct handlers from the handler argument to this construct.
* @param handler The construct handler to copy from.
*/
public void addAll(ConstructHandler handler) {
constructs.addAll(handler.constructs);
query.setConstructTemplate(new Template(BasicPattern.wrap(constructs)));
}
代码示例来源:origin: apache/jena
@Override
public void visitConstructResultForm(Query query) {
newQuery.setQueryConstructType();
newQuery.setConstructTemplate(query.getConstructTemplate());
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public void visitConstructResultForm(Query query) {
newQuery.setQueryConstructType() ;
newQuery.setConstructTemplate(query.getConstructTemplate()) ;
}
代码示例来源:origin: apache/jena
@Override
public void setVars(Map<Var, Node> values) {
if (values.isEmpty()) {
return;
}
AbstractRewriter<Node> rw = new AbstractRewriter<Node>(values) {
};
query.setConstructTemplate(new Template(BasicPattern.wrap(rw
.rewrite(constructs))));
}
代码示例来源:origin: org.apache.jena/jena-querybuilder
@Override
public void setVars(Map<Var, Node> values) {
if (values.isEmpty()) {
return;
}
AbstractRewriter<Node> rw = new AbstractRewriter<Node>(values) {
};
query.setConstructTemplate(new Template(BasicPattern.wrap(rw
.rewrite(constructs))));
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
/**
* Deprecated, because with the construct approach we cannot get a tripe's context resource
*
* @param concepts
* @param filter
* @return
*/
@Deprecated
public static Query createQueryConstruct(List<Concept> concepts, Concept filter) {
Template template = new Template(BasicPattern.wrap(Collections.singletonList(Triples.spo)));
List<Concept> tmps = new ArrayList<Concept>();
for(Concept concept : concepts) {
Concept tmp = ConceptOps.intersect(concept, filter, null);
tmps.add(tmp);
}
List<Element> elements = new ArrayList<Element>();
for(Concept concept : tmps) {
Element e = concept.getElement();
elements.add(e);
}
Element element = ElementUtils.union(elements);
Query result = new Query();
result.setQueryConstructType();
result.setConstructTemplate(template);
result.setQueryPattern(element);
return result;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Query constructBySubjects(Collection<Node> ss) {
ExprVar vs = new ExprVar(s);
Query query = QueryFactory.create();
query.setQueryConstructType();
query.setDistinct(true);
Triple triple = new Triple(s, p, o);
ElementGroup group = new ElementGroup();
group.addTriplePattern(triple);
List<Expr> exprs = new ArrayList<Expr>();
for(Node item : ss) {
if(!item.isURI()) {
continue;
}
exprs.add(new E_Equals(vs, NodeValue.makeNode(item)));
}
if(exprs.isEmpty()) {
return null;
}
Expr or = ExprUtils.orifyBalanced(exprs);
group.addElementFilter(new ElementFilter(or));
BasicPattern bgp = new BasicPattern();
bgp.add(triple);
query.setConstructTemplate(new Template(bgp));
query.setQueryPattern(group);
return query;
}
代码示例来源:origin: apache/jena
final public void ConstructQuery() throws ParseException {
Template t ;
jj_consume_token(CONSTRUCT);
getQuery().setQueryConstructType() ;
t = ConstructTemplate();
getQuery().setConstructTemplate(t) ;
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case FROM:
;
break;
default:
jj_la1[8] = jj_gen;
break label_4;
}
DatasetClause();
}
WhereClause();
SolutionModifier();
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Query constructBySubject(Node s) {
Triple triple = new Triple(s, p, o);
BasicPattern basicPattern = new BasicPattern();
basicPattern.add(triple);
Template template = new Template(basicPattern);
ElementGroup elementGroup = new ElementGroup();
ElementPathBlock pathBlock = new ElementPathBlock();
elementGroup.addElement(pathBlock);
pathBlock.addTriple(triple);
Query query = new Query();
query.setQueryConstructType();
query.setConstructTemplate(template);
query.setQueryPattern(elementGroup);
return query;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Query createQueryTriple(Triple m) {
Query query = new Query();
query.setQueryConstructType();
/*
Node s = m.getMatchSubject();
Node p = m.getMatchPredicate();
Node o = m.getMatchObject();
*/
Node s = m.getSubject();
Node p = m.getPredicate();
Node o = m.getObject();
s = s == null || s.equals(Node.ANY) ? Vars.s : s;
p = p == null || p.equals(Node.ANY) ? Vars.p : p;
o = o == null || o.equals(Node.ANY) ? Vars.o : o;
Triple triple = new Triple(s, p, o);
BasicPattern bgp = new BasicPattern();
bgp.add(triple);
Template template = new Template(bgp);
Element element = new ElementTriplesBlock(bgp);
query.setConstructTemplate(template);
query.setQueryPattern(element);
return query;
}
代码示例来源:origin: apache/jena
case LBRACE:
t = ConstructTemplate();
getQuery().setConstructTemplate(t) ;
label_4:
while (true) {
SolutionModifier();
t = new Template(acc) ;
getQuery().setConstructTemplate(t) ;
ElementGroup elg = createQueryPattern(t);
getQuery().setQueryPattern(elg) ;
代码示例来源:origin: com.github.galigator.openllet/openllet-jena
q.setConstructTemplate( constructTemplate46 );
代码示例来源:origin: Galigator/openllet
q.setConstructTemplate( constructTemplate46 );
代码示例来源:origin: com.marklogic/marklogic-jena
query.setConstructTemplate(template);
代码示例来源:origin: apache/jena
case LBRACE:
t = ConstructTemplate();
getQuery().setConstructTemplate(t) ;
label_4:
while (true) {
SolutionModifier();
t = new Template(acc.getBGP()) ;
getQuery().setConstructTemplate(t) ;
ElementPathBlock epb = new ElementPathBlock(acc.getBGP()) ;
ElementGroup elg = new ElementGroup() ;
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Query inOutTemplate(Node s, Node p, Node o)
{
Query query = QueryFactory.create();
query.setQueryConstructType();
query.setDistinct(true);
Triple triple = new Triple(s, p, o);
ElementGroup group = new ElementGroup();
group.addTriplePattern(triple);
// Avoid non-uris as objects
if(o.isVariable()) {
group.addElementFilter(new ElementFilter(new E_IsURI(new ExprVar(o))));
group.addElementFilter(new ElementFilter(new E_LogicalNot(new E_IsBlank(new ExprVar(o)))));
}
BasicPattern bgp = new BasicPattern();
bgp.add(triple);
query.setConstructTemplate(new Template(bgp));
query.setQueryPattern(group);
return query;
}
内容来源于网络,如有侵权,请联系作者删除!