本文整理了Java中com.hp.hpl.jena.query.Query.getConstructTemplate
方法的一些代码示例,展示了Query.getConstructTemplate
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getConstructTemplate
方法的具体详情如下:
包路径:com.hp.hpl.jena.query.Query
类名称:Query
方法名:getConstructTemplate
[英]Get the template pattern for a construct query
[中]获取构造查询的模板模式
代码示例来源:origin: com.hp.hpl.jena/arq
public void visitConstructResultForm(Query query)
{
x ^= query.getConstructTemplate().hashCode() ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public void visitConstructResultForm(Query query)
{
x ^= query.getConstructTemplate().hashCode() ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
public static Template parseTemplate(String string)
{
final Query query = new Query () ;
Action action = new Action() {
@Override
public void exec(SPARQLParser11 parser) throws Exception
{
Template t = parser.ConstructTemplate() ;
query.setConstructTemplate(t) ;
}
} ;
perform(query, string, action) ;
return query.getConstructTemplate() ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
public static Template parseTemplate(String string)
{
final Query query = new Query () ;
Action action = new Action() {
@Override
public void exec(SPARQLParser10 parser) throws Exception
{
Template t = parser.ConstructTemplate() ;
query.setConstructTemplate(t) ;
}
} ;
perform(query, string, action) ;
return query.getConstructTemplate() ;
}
代码示例来源:origin: com.hp.hpl.jena/arq
public static Template parseTemplate(String string)
{
final Query query = new Query () ;
Action action = new Action() {
public void exec(SPARQLParser11 parser) throws Exception
{
Template t = parser.ConstructTemplate() ;
query.setConstructTemplate(t) ;
}
} ;
perform(query, string, action) ;
return query.getConstructTemplate() ;
}
代码示例来源:origin: com.hp.hpl.jena/arq
public static Template parseTemplate(String string)
{
final Query query = new Query () ;
Action action = new Action() {
public void exec(SPARQLParser10 parser) throws Exception
{
Template t = parser.ConstructTemplate() ;
query.setConstructTemplate(t) ;
}
} ;
perform(query, string, action) ;
return query.getConstructTemplate() ;
}
代码示例来源:origin: com.hp.hpl.jena/arq
public static Template parseTemplate(String string)
{
final Query query = new Query () ;
Action action = new Action() {
public void exec(ARQParser parser) throws Exception
{
Template t = parser.ConstructTemplate() ;
query.setConstructTemplate(t) ;
}
} ;
perform(query, string, action) ;
return query.getConstructTemplate() ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
public static Template parseTemplate(String string)
{
final Query query = new Query () ;
Action action = new Action() {
@Override
public void exec(ARQParser parser) throws Exception
{
Template t = parser.ConstructTemplate() ;
query.setConstructTemplate(t) ;
}
} ;
perform(query, string, action) ;
return query.getConstructTemplate() ;
}
代码示例来源:origin: com.hp.hpl.jena/arq
public void visitConstructResultForm(Query query1)
{
check("Not both CONSTRUCT queries", query2.isConstructType()) ;
check("CONSTRUCT templates",
query1.getConstructTemplate().equalIso(query2.getConstructTemplate(), new NodeIsomorphismMap()) ) ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public void visitConstructResultForm(Query query1)
{
check("Not both CONSTRUCT queries", query2.isConstructType()) ;
check("CONSTRUCT templates",
query1.getConstructTemplate().equalIso(query2.getConstructTemplate(), new NodeIsomorphismMap()) ) ;
}
代码示例来源:origin: fr.lirmm.graphik/graal-io-sparql
private void execute(String sparqlQuery) {
Query sparql = QueryFactory.create(sparqlQuery);
this.prefixes = new LinkedList<Prefix>();
for(Map.Entry<String,String> e : sparql.getPrefixMapping().getNsPrefixMap().entrySet()) {
this.prefixes.add(new Prefix(e.getKey(), e.getValue()));
}
Rule rule = new DefaultRule();
if (sparql.isConstructType()) {
Template template = sparql.getConstructTemplate();
for (Triple triple : template.getTriples()) {
rule.getHead().add(SparqlUtils.triple2Atom(triple));
}
}
ElementVisitorImpl visitor = new ElementVisitorImpl(rule.getBody());
sparql.getQueryPattern().visit(visitor);
this.rule = rule;
}
代码示例来源:origin: com.hp.hpl.jena/arq
public void visitConstructResultForm(Query query)
{
out.print("CONSTRUCT ") ;
// if ( query.isQueryResultStar() )
// {
// out.print("*") ;
// out.newline() ;
// }
// else
{
out.incIndent(BLOCK_INDENT) ;
out.newline() ;
Template t = query.getConstructTemplate() ;
fmtTemplate.format(t) ;
out.decIndent(BLOCK_INDENT) ;
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public void visitConstructResultForm(Query query)
{
out.print("CONSTRUCT ") ;
// if ( query.isQueryResultStar() )
// {
// out.print("*") ;
// out.newline() ;
// }
// else
{
out.incIndent(BLOCK_INDENT) ;
out.newline() ;
Template t = query.getConstructTemplate() ;
fmtTemplate.format(t) ;
out.decIndent(BLOCK_INDENT) ;
}
}
代码示例来源:origin: com.hp.hpl.jena/arq
Template template = query.getConstructTemplate() ;
代码示例来源:origin: Quetzal-RDF/quetzal
public RuleforJena(Query constructQuery, int id) {
this.id = id;
antecedent = Algebra.compile(constructQuery);
// KAVITHA: the consequent should be a single triple
List<Triple> list = constructQuery.getConstructTemplate().getBGP()
.getList();
consequent = new OpTriple(list.get(0));
if (SPARQLRewriterForJena.GENERATE_TRACE == true) {
Op bind = null;
VarExprList expr = new VarExprList();
expr.add(
Var.alloc("RULEID"),
new NodeValueNode(Node_Literal.createLiteral(String
.valueOf(id))));
bind = OpExtend.extend(antecedent, expr);
antecedent = bind;
}
}
代码示例来源:origin: com.github.ansell.pellet/pellet-query
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public Model execConstruct(Model model) {
ensureQueryType( QueryType.CONSTRUCT );
ResultSet results = exec();
if( results == null ) {
QueryExecutionFactory.create( query, source, initialBinding ).execConstruct( model );
}
else {
model.setNsPrefixes( source.getDefaultModel() );
model.setNsPrefixes( query.getPrefixMapping() );
Set set = new HashSet();
Template template = query.getConstructTemplate();
while( results.hasNext() ) {
Map bNodeMap = new HashMap();
Binding binding = results.nextBinding();
template.subst( set, bNodeMap, binding );
}
for( Iterator iter = set.iterator(); iter.hasNext(); ) {
Triple t = (Triple) iter.next();
Statement stmt = ModelUtils.tripleToStatement( model, t );
if( stmt != null )
model.add( stmt );
}
close();
}
return model;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public Iterator<Triple> execConstructTriples()
{
if ( ! query.isConstructType() )
throw new QueryExecException("Attempt to get a CONSTRUCT model from a "+labelForQuery(query)+" query") ;
// This causes there to be no PROJECT around the pattern.
// That in turn, exposes the initial bindings.
query.setQueryResultStar(true) ;
startQueryIterator() ;
Template template = query.getConstructTemplate() ;
return TemplateLib.calcTriples(template.getTriples(), queryIterator);
}
内容来源于网络,如有侵权,请联系作者删除!