SpatialIndexLuceneAssembler extends AssemblerBase { @SuppressWarnings("resource") @Override public SpatialIndex open(Assembler a, Resource root, Mode mode) { try { if ( ! GraphUtils.exactlyOneProperty(root, pDirectory) ) throw new SpatialIndexException("No 'spatial:directory' property on "+root) ; Directory directory ; RDFNode n = root.getProperty(pDirectory).getObject() ; if ( n.isLiteral() ) { if ( ! "mem".equals(n.asLiteral().getLexicalForm()) ) throw new SpatialIndexException("No 'spatial:directory' property on "+root+ " is a literal and not \"mem\"") ; directory = new RAMDirectory() ; } else { Resource x = n.asResource() ; String path = IRILib.IRIToFilename(x.getURI()) ; File dir = new File(path) ; directory = FSDirectory.open(dir.toPath()) ; } Resource r = GraphUtils.getResourceValue(root, pDefinition) ; EntityDefinition docDef = (EntityDefinition)a.open(r) ; return SpatialDatasetFactory.createLuceneIndex(directory, docDef) ; } catch (IOException e) { IO.exception(e) ; return null ;} }  @SuppressWarnings("resource") @Override SpatialIndex open(Assembler a, Resource root, Mode mode);  }
@Test public void testIndexHasEntityMap() { SpatialIndexLucene indexLucene = (SpatialIndexLucene) Assembler.general.open(SIMPLE_LUCENE_INDEX_SPEC); assertEquals("uri", indexLucene.getDocDef().getEntityField()); assertEquals("geo", indexLucene.getDocDef().getGeoField()); }