use of org.apache.rya.indexing.pcj.fluo.app.query.SparqlFluoQueryBuilder in project incubator-rya by apache.
the class CreateFluoPcj method makeFluoQuery.
private FluoQuery makeFluoQuery(String sparql, String pcjId, Set<ExportStrategy> strategies) throws MalformedQueryException, UnsupportedQueryException {
String queryId = NodeType.generateNewIdForType(NodeType.QUERY, pcjId);
SparqlFluoQueryBuilder builder = new SparqlFluoQueryBuilder().setExportStrategies(strategies).setFluoQueryId(queryId).setSparql(sparql).setJoinBatchSize(joinBatchSize);
FluoQuery query = builder.build();
if (query.getQueryType() == QueryType.PERIODIC && !Sets.newHashSet(ExportStrategy.PERIODIC).containsAll(strategies)) {
throw new UnsupportedQueryException("Periodic Queries must only utilize the PeriodicExport or the NoOpExport ExportStrategy.");
}
if (query.getQueryType() != QueryType.PERIODIC && strategies.contains(ExportStrategy.PERIODIC)) {
throw new UnsupportedQueryException("Only Periodic Queries can utilize the PeriodicExport ExportStrategy.");
}
return query;
}
Aggregations