本文整理汇总了Java中org.openrdf.query.parser.ParsedBooleanQuery类的典型用法代码示例。如果您正苦于以下问题:Java ParsedBooleanQuery类的具体用法?Java ParsedBooleanQuery怎么用?Java ParsedBooleanQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParsedBooleanQuery类属于org.openrdf.query.parser包,在下文中一共展示了ParsedBooleanQuery类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getQueryTask
import org.openrdf.query.parser.ParsedBooleanQuery; //导入依赖的package包/类
public QueryTask getQueryTask(QueryDefinition query,
WriterConfig config, OutputStream out)
throws MalformedQueryException, RepositoryException {
QueryParser parser = new SPARQLParserFactory().getParser();
ParsedQuery parsedQuery = parser.parseQuery(query.getQuery(),
config.getBaseUri());
RepositoryConnection conn = cf.getConnection();
try {
if (parsedQuery instanceof ParsedTupleQuery) {
return new TupleQueryTask(conn, query, config, out);
} else if (parsedQuery instanceof ParsedBooleanQuery) {
return new AskQueryTask(conn, query, config, out);
} else if (parsedQuery instanceof ParsedGraphQuery) {
return new GraphQueryTask(conn, query, config, out);
}
} finally {
// conn.close();
}
throw new MalformedQueryException("Unknown query type: "
+ ParsedQuery.class.getName());
}
示例2: prepareQuery
import org.openrdf.query.parser.ParsedBooleanQuery; //导入依赖的package包/类
@Override
public Query prepareQuery(QueryLanguage ql, String query, String baseURI)
throws RepositoryException, MalformedQueryException
{
validateQueryLanguage(ql);
ParsedQuery parsedQuery = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, baseURI);
if (parsedQuery instanceof ParsedTupleQuery) {
return prepareTupleQuery(ql, query, baseURI);
}
else if (parsedQuery instanceof ParsedBooleanQuery) {
return prepareBooleanQuery(ql, query, baseURI);
}
else if (parsedQuery instanceof ParsedGraphQuery) {
return prepareGraphQuery(ql, query, baseURI);
}
throw new MalformedQueryException("Unrecognized query type:\n" + query); //$NON-NLS-1$
}
示例3: getExprQuery
import org.openrdf.query.parser.ParsedBooleanQuery; //导入依赖的package包/类
/**
* Creates a new query based on a tuple expression and original query. The
* new query will have the same type null
* ({@link org.openrdf.query.TupleQuery},
* {@link org.openrdf.query.GraphQuery} or
* {@link org.openrdf.query.BooleanQuery}) as the given original query.
*
* @param orig the original query
* @param expr the expression used for the new query
* @return new query based on expression
*/
protected Query getExprQuery(ParsedQuery orig, TupleExpr expr) {
if (orig instanceof ParsedTupleQuery) {
return new SailTupleExprQuery(
new ParsedTupleQuery(expr), conn);
} else if (orig instanceof ParsedGraphQuery) {
return new SailGraphExprQuery(
new ParsedGraphQuery(expr), conn);
} else {
return new SailBooleanExprQuery(
new ParsedBooleanQuery(expr), conn);
}
}
示例4: getQueryType
import org.openrdf.query.parser.ParsedBooleanQuery; //导入依赖的package包/类
public QueryType getQueryType(ParsedQuery parsedQuery) {
if (parsedQuery instanceof ParsedTupleQuery) {
return QueryType.SELECT;
} else if (parsedQuery instanceof ParsedBooleanQuery) {
return QueryType.ASK;
} else if (parsedQuery instanceof ParsedGraphQuery) {
return QueryType.CONSTRUCT;
} else {
return null;
}
}
示例5: SailBooleanExprQuery
import org.openrdf.query.parser.ParsedBooleanQuery; //导入依赖的package包/类
public SailBooleanExprQuery(ParsedBooleanQuery booleanQuery, SailRepositoryConnection sailConnection) {
super(booleanQuery, sailConnection);
}
示例6: isBooleanQuery
import org.openrdf.query.parser.ParsedBooleanQuery; //导入依赖的package包/类
public boolean isBooleanQuery() {
return query instanceof ParsedBooleanQuery;
}