Search in sources :

Example 1 with SparqlFluoQueryBuilder

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;
}
Also used : UnsupportedQueryException(org.apache.rya.indexing.pcj.fluo.app.query.UnsupportedQueryException) SparqlFluoQueryBuilder(org.apache.rya.indexing.pcj.fluo.app.query.SparqlFluoQueryBuilder) FluoQuery(org.apache.rya.indexing.pcj.fluo.app.query.FluoQuery)

Aggregations

FluoQuery (org.apache.rya.indexing.pcj.fluo.app.query.FluoQuery)1 SparqlFluoQueryBuilder (org.apache.rya.indexing.pcj.fluo.app.query.SparqlFluoQueryBuilder)1 UnsupportedQueryException (org.apache.rya.indexing.pcj.fluo.app.query.UnsupportedQueryException)1