use of org.apache.jena.query.spatial.SpatialIndexContext in project jena by apache.
the class spatialindexer method processModulesAndArgs.
@Override
protected void processModulesAndArgs() {
super.processModulesAndArgs();
// Two forms : with and without arg.
// Maximises similarity with other tools.
String file;
if (super.contains(assemblerDescDecl)) {
if (getValues(assemblerDescDecl).size() != 1)
throw new CmdException("Multiple assembler descriptions given");
if (getPositional().size() != 0)
throw new CmdException("Additional assembler descriptions given");
file = getValue(assemblerDescDecl);
} else {
if (getNumPositional() != 1)
throw new CmdException("Multiple assembler descriptions given");
file = getPositionalArg(0);
}
if (file == null)
throw new CmdException("No dataset specified");
// Assumes a single test daatset description in the assembler file.
Dataset ds = SpatialDatasetFactory.create(file);
if (ds == null)
throw new CmdException("No dataset description found");
// get index.
dataset = (DatasetGraphSpatial) (ds.asDatasetGraph());
spatialIndex = dataset.getSpatialIndex();
if (spatialIndex == null)
throw new CmdException("Dataset has no spatial index");
context = new SpatialIndexContext(spatialIndex);
}
Aggregations