use of org.apache.jena.query.spatial.SpatialIndex in project jena by apache.
the class SpatialDatasetAssembler method open.
// private DatasetAssembler datasetAssembler = new DatasetAssembler() ;
//
// public static Resource getType() { return textDataset ; }
/*
<#spatial_dataset> rdf:type spatial:SpatialDataset ;
spatial:dataset <#dataset> ;
spatial:index <#index> ;
.
*/
@Override
public Dataset open(Assembler a, Resource root, Mode mode) {
Resource dataset = GraphUtils.getResourceValue(root, pDataset);
Resource index = GraphUtils.getResourceValue(root, pIndex);
Dataset ds = (Dataset) a.open(dataset);
SpatialIndex textIndex = (SpatialIndex) a.open(index);
Dataset dst = SpatialDatasetFactory.create(ds, textIndex);
return dst;
}
use of org.apache.jena.query.spatial.SpatialIndex in project jena by apache.
the class SpatialOperationPFBase method chooseTextIndex.
protected SpatialIndex chooseTextIndex(ExecutionContext execCxt, DatasetGraph dsg) {
Object obj = dsg.getContext().get(SpatialQuery.spatialIndex);
if (obj != null) {
try {
return (SpatialIndex) obj;
} catch (ClassCastException ex) {
Log.warn(SpatialOperationWithCircleBase.class, "Context setting '" + SpatialQuery.spatialIndex + "'is not a SpatialIndex");
}
}
if (dsg instanceof DatasetGraphSpatial) {
DatasetGraphSpatial x = (DatasetGraphSpatial) dsg;
return x.getSpatialIndex();
}
Log.warn(SpatialOperationWithCircleBase.class, "Failed to find the spatial index : tried context and as a spatial-enabled dataset");
return null;
}
Aggregations