GeoSPARQLOperations { public static final Dataset convertGeoPredicates(Dataset dataset, boolean isRemoveGeoPredicate) { LOGGER.info("Convert Geo Predicates - Started"); Dataset outputDataset = DatasetFactory.createTxnMem(); outputDataset.begin(ReadWrite.WRITE); dataset.begin(ReadWrite.READ); Model defaultModel = dataset.getDefaultModel(); Model convertedModel = convertGeoPredicates(defaultModel, isRemoveGeoPredicate); convertedModel.setNsPrefixes(defaultModel.getNsPrefixMap()); outputDataset.setDefaultModel(convertedModel); Iterator<String> graphNames = dataset.listNames(); while (graphNames.hasNext()) { String graphName = graphNames.next(); Model namedModel = dataset.getNamedModel(graphName); Model convertedNamedModel = convertGeoPredicates(namedModel, isRemoveGeoPredicate); convertedNamedModel.setNsPrefixes(namedModel.getNsPrefixMap()); outputDataset.addNamedModel(graphName, convertedNamedModel); } LOGGER.info("Convert Geo Predicates - Completed"); dataset.end(); outputDataset.commit(); outputDataset.end(); return outputDataset; }  static final void applySubPropertyDefaultGeometry(Model model); static final void applyDefaultGeometry(Dataset dataset); static final void applyDefaultGeometry(Model model); static final void applyDefaultGeometry(File inputFile, Lang inputLang, File outputFile, Lang outputLang); static final Model applyDefaultGeometry(File inputFile, Lang inputLang); static final void applyDefaultGeometryFolder(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang); static final Model loadGeoSPARQLSchema(); static final void applyInferencing(Dataset dataset); static final void applyInferencing(Model geosparqlSchema, Dataset dataset); static final void applyInferencing(Model dataModel); static final void applyInferencing(Model geosparqlSchema, Model model); static final void applyInferencing(Model geosparqlSchema, Model model, String graphName); static final InfModel prepare(); static final InfModel prepareRDFS(Model model); static final InfModel prepare(Model model, Reasoner reasoner); static final InfModel prepareRDFS(InputStream inputStream); static final InfModel prepare(InputStream inputStream, Reasoner reasoner); static final InfModel prepare(InputStream geosparqlSchemaInputStream, Model model, Reasoner reasoner); static final boolean validateGeometryLiteral(Dataset dataset); static final boolean validateGeometryLiteral(Model model); static final String findModeSRS(Dataset dataset); static final String findModeSRS(Model model); static final void convertFile(File inputFile, Lang inputLang, File outputFile, Lang outputLang, String outputSrsURI); static final void convertFile(File inputFile, Lang inputLang, File outputFile, Lang outputLang); static final void convertFile(File inputFile, Lang inputLang, File outputFile, Lang outputLang, String outputSrsURI, GeometryDatatype outputDatatype); static final void convertFile(File inputFile, Lang inputLang, File outputFile, Lang outputLang, GeometryDatatype outputDatatype); static final List<String> convertGeometryLiterals(List<String> geometryLiterals, String outputSrsURI, GeometryDatatype outputDatatype); static void writeOutputModel(Model outputModel, File outputFile, Lang outputLang, File inputFile); static final void convertFolder(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang, String outputSrsURI); static final void convertFolder(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang); static final void convertFolder(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang, String outputSrsURI, GeometryDatatype outputDatatype); static final void convertFolder(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang, GeometryDatatype outputDatatype); static final Dataset convertGeoPredicates(Dataset dataset, boolean isRemoveGeoPredicate); static final Model convertGeoPredicates(Model model, boolean isRemoveGeoPredicates); static final Dataset convertGeometryStructure(Dataset dataset); static final Model convertGeometryStructure(Model model); static final String convertGeometryLiteral(String geometryLiteral, String outputSrsURI, GeometryDatatype outputDatatype); static final Model convert(Model inputModel); static final Model convert(Model inputModel, String outputSrsURI); static final Model convert(Model inputModel, GeometryDatatype outputDatatype); static final Model convert(Model inputModel, String outputSrsURI, GeometryDatatype outputDatatype); static final Model convert(Model inputModel, String outputSrsURI, String outputDatatypeURI); static final Dataset convert(Dataset dataset); static final Dataset convert(Dataset dataset, String outputSrsURI); static final Dataset convert(Dataset dataset, GeometryDatatype outputDatatype); static final Dataset convert(Dataset inputDataset, String outputSrsURI, GeometryDatatype outputDatatype); static final int countGeometryLiterals(Model model, String graphName); static final int countGeometryLiterals(Dataset dataset); static final void applyPrefixes(Model model); static final void applyPrefixes(Dataset dataset); static double cleanUpPrecision(double value);  }
@Test public void testConvertGeoPredicates_Dataset_remove() { Dataset dataset = GEO_DATASET; boolean isRemoveGeoPredicate = true; TreeSet<String> expResult = extract(CONVERTED_SRS_DATASET); Dataset instance = GeoSPARQLOperations.convertGeoPredicates(dataset, isRemoveGeoPredicate); TreeSet<String> result = extract(instance); assertEquals(expResult, result); }
@Test public void testConvertGeoPredicates_Model_remove() { Model model = GEO_DATA; boolean isRemoveGeoPredicates = true; TreeSet<String> expResult = extract(CONVERTED_SRS_DATA); Model instance = GeoSPARQLOperations.convertGeoPredicates(model, isRemoveGeoPredicates); TreeSet<String> result = extract(instance); assertEquals(expResult, result); }
@Test public void testConvertGeoPredicates_Dataset_keep() { Dataset dataset = GEO_DATASET; boolean isRemoveGeoPredicate = false; TreeSet<String> expResult = extract(GEO_ALL_DATASET); Dataset instance = GeoSPARQLOperations.convertGeoPredicates(dataset, isRemoveGeoPredicate); TreeSet<String> result = extract(instance); assertEquals(expResult, result); }
@Test public void testConvertGeoPredicates_Model_keep() { Model model = GEO_DATA; boolean isRemoveGeoPredicates = false; TreeSet<String> expResult = extract(GEO_ALL_DATA); Model instance = GeoSPARQLOperations.convertGeoPredicates(model, isRemoveGeoPredicates); TreeSet<String> result = extract(instance); assertEquals(expResult, result); }