public static LocationMapper copyConvert(org.apache.jena.util.LocationMapper locMap) { if ( locMap == null ) return null; LocationMapper lmap2 = new LocationMapper(); locMap.listAltEntries().forEachRemaining(k->lmap2.addAltEntry(k, locMap.getAltEntry(k))); locMap.listAltPrefixes().forEachRemaining(k->lmap2.addAltPrefix(k, locMap.getAltPrefix(k))); return lmap2; }
public void testLocationMapperFromModel() { Model model = FileManager.get().loadModel(testingDir+"/location-mapping-test.n3") ; LocationMapper loc = new LocationMapper(model) ; // Light test that the two location mappers are "the same" LocationMapper locMap = new LocationMapper(mapping) ; for ( Iterator<String> iter = loc.listAltEntries() ; iter.hasNext() ; ) { String e = iter.next() ; String v1 = locMap.getAltEntry(e) ; String v2 = loc.getAltEntry(e) ; assertEquals("Different entries", v1, v2) ; } for ( Iterator<String> iter = loc.listAltPrefixes() ; iter.hasNext() ; ) { String e = iter.next() ; String v1 = locMap.getAltPrefix(e) ; String v2 = loc.getAltPrefix(e) ; assertEquals("Different entries", v1, v2) ; } }
@Test public void testLocationMapperFromModel() { Model model = RDFDataMgr.loadModel(testingDir+"/location-mapping-test.ttl") ; LocationMapper loc = new LocationMapper(model) ; // Light test that the two location mappers are "the same" LocationMapper locMap = new LocationMapper(mapping) ; for ( Iterator<String> iter = loc.listAltEntries() ; iter.hasNext() ; ) { String e = iter.next() ; String v1 = locMap.getAltEntry(e) ; String v2 = loc.getAltEntry(e) ; assertEquals("Different entries", v1, v2) ; } for ( Iterator<String> iter = loc.listAltPrefixes() ; iter.hasNext() ; ) { String e = iter.next() ; String v1 = locMap.getAltPrefix(e) ; String v2 = loc.getAltPrefix(e) ; assertEquals("Different entries", v1, v2) ; } }
public void testLocationMapperFromModel() { Model model = FileManager.get().loadModel(testingDir+"/location-mapping-test.n3") ; LocationMapper loc = new LocationMapper(model) ; // Light test that the two location mappers are "the same" LocationMapper locMap = new LocationMapper(mapping) ; for ( Iterator<String> iter = loc.listAltEntries() ; iter.hasNext() ; ) { String e = iter.next() ; String v1 = locMap.getAltEntry(e) ; String v2 = loc.getAltEntry(e) ; assertEquals("Different entries", v1, v2) ; } for ( Iterator<String> iter = loc.listAltPrefixes() ; iter.hasNext() ; ) { String e = iter.next() ; String v1 = locMap.getAltPrefix(e) ; String v2 = loc.getAltPrefix(e) ; assertEquals("Different entries", v1, v2) ; } }
private void assertEqualMaps( LocationMapper expected, LocationMapper got ) { Set<String> eAltEntryKeys = IteratorCollection.iteratorToSet( expected.listAltEntries() ); Set<String> gAltEntryKeys = IteratorCollection.iteratorToSet( got.listAltEntries() ); Set<String> eAltPrefixKeys = IteratorCollection.iteratorToSet( expected.listAltPrefixes() ); Set<String> gAltPrefixKeys = IteratorCollection.iteratorToSet( got.listAltPrefixes() ); assertEquals( "altEntry keys dhould be equal", eAltEntryKeys, gAltEntryKeys ); assertEquals( "prefixEntry keys should be equal", eAltPrefixKeys, gAltPrefixKeys ); for ( String key : eAltEntryKeys ) { assertEquals( "alt entrys should be equal", expected.getAltEntry( key ), got.getAltEntry( key ) ); } for ( String key : eAltPrefixKeys ) { assertEquals( "prefix entiries should be equal", expected.getAltPrefix( key ), got.getAltPrefix( key ) ); } } }
private void assertEqualMaps( LocationMapper expected, LocationMapper got ) { Set<String> eAltEntryKeys = IteratorCollection.iteratorToSet( expected.listAltEntries() ); Set<String> gAltEntryKeys = IteratorCollection.iteratorToSet( got.listAltEntries() ); Set<String> eAltPrefixKeys = IteratorCollection.iteratorToSet( expected.listAltPrefixes() ); Set<String> gAltPrefixKeys = IteratorCollection.iteratorToSet( got.listAltPrefixes() ); assertEquals( "altEntry keys dhould be equal", eAltEntryKeys, gAltEntryKeys ); assertEquals( "prefixEntry keys should be equal", eAltPrefixKeys, gAltPrefixKeys ); for ( String key : eAltEntryKeys ) { assertEquals( "alt entrys should be equal", expected.getAltEntry( key ), got.getAltEntry( key ) ); } for ( String key : eAltPrefixKeys ) { assertEquals( "prefix entiries should be equal", expected.getAltPrefix( key ), got.getAltPrefix( key ) ); } } }