MappingFileParser { public Map<URI, URI> getMappings() { assert mappingFile != null; return cz.cvut.kbss.jopa.util.MappingFileParser.getMappings(mappingFile, delimiter); } MappingFileParser(DriverConfiguration configuration); Map<URI, URI> getMappings();  }
@Test public void mappingFileParserAlsoAcceptsURIAsMappingFilePath() throws Exception { final String ontUri = "http: final String content = ontUri + " " + OwlapiOntoDriverProperties.DEFAULT_IRI_MAPPING_DELIMITER + " ./file.owl"; final File mappingFile = createMappingFile(content); configuration.setProperty(OwlapiConfigParam.MAPPING_FILE_LOCATION, mappingFile.toURI().toString()); final Map<URI, URI> mappings = new MappingFileParser(configuration).getMappings(); assertEquals(1, mappings.size()); }
@Test public void usesDefaultDelimiterWhenNoneIsProvided() throws Exception { final String ontUri = "http: final String content = ontUri + " " + OwlapiOntoDriverProperties.DEFAULT_IRI_MAPPING_DELIMITER + " ./file.owl"; final File mappingFile = createMappingFile(content); configuration.setProperty(OwlapiConfigParam.MAPPING_FILE_LOCATION, mappingFile.getPath()); final Map<URI, URI> mappings = new MappingFileParser(configuration).getMappings(); assertEquals(1, mappings.size()); assertTrue(mappings.get(URI.create(ontUri)).toASCIIString().endsWith("file.owl")); }
@Test public void usesCustomDelimiterWhenProvided() throws Exception { final String ontUri = "http: final String content = ontUri + " - ./file.owl"; final File mappingFile = createMappingFile(content); configuration.setProperty(OwlapiConfigParam.MAPPING_FILE_LOCATION, mappingFile.getPath()); configuration.setProperty(OwlapiConfigParam.IRI_MAPPING_DELIMITER, "-"); final Map<URI, URI> mappings = new MappingFileParser(configuration).getMappings(); assertEquals(1, mappings.size()); assertTrue(mappings.get(URI.create(ontUri)).toASCIIString().endsWith("file.owl")); }