public void testLocationMapperToModel2() { LocationMapper locMap1 = new LocationMapper(mapping) ; LocationMapper locMap2 = new LocationMapper(mapping) ; locMap1 = new LocationMapper(locMap1.toModel()) ; locMap2.addAltEntry("file:nowhere", "file:somewhere") ; assertFalse(locMap1.equals(locMap2)) ; assertFalse(locMap2.equals(locMap1)) ; } }
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 testLocationMapperClone1() { LocationMapper locMap1 = new LocationMapper(mapping) ; // See testLocationMapperURLtoFile // String alt = locMap.altMapping("http://example.org/file") ; // assertNotNull(alt) ; // assertEquals(alt, "file:"+testingDir+"/location-mapping-test-file") ; LocationMapper locMap2 = new LocationMapper(locMap1) ; // Remove from original locMap1.removeAltEntry("http://example.org/file") ; String alt = locMap2.altMapping("http://example.org/file") ; assertNotNull(alt) ; assertEquals(alt, "file:"+testingDir+"/location-mapping-test-file") ; }
/** Make a location mapper from the path settings */ static public LocationMapper makeGlobal() { LocationMapper lMap = new LocationMapper() ; if ( getGlobalConfigPath() != null ) lMap.initFromPath(getGlobalConfigPath(), false) ; return lMap ; }
public void testLocationMapperURLtoFile() { LocationMapper locMap = new LocationMapper(mapping) ; String alt = locMap.altMapping("http://example.org/file") ; assertNotNull(alt) ; assertEquals(alt, "file:"+testingDir+"/location-mapping-test-file") ; }
public void testLocationMapperEquals2() { LocationMapper locMap1 = new LocationMapper(mapping) ; LocationMapper locMap2 = new LocationMapper(mapping) ; locMap2.addAltEntry("file:nowhere", "file:somewhere") ; assertFalse(locMap1.equals(locMap2)) ; assertFalse(locMap2.equals(locMap1)) ; }
public void testLocationMapperClone2() { LocationMapper locMap1 = new LocationMapper(mapping) ; // See testLocationMapperURLtoFile // String alt = locMap.altMapping("http://example.org/file") ; // assertNotNull(alt) ; // assertEquals(alt, "file:"+testingDir+"/location-mapping-test-file") ; LocationMapper locMap2 = new LocationMapper(locMap1) ; // Change this one locMap2.addAltPrefix("http://example.org/OTHER", "file:OTHER") ; { String alt = locMap2.altMapping("http://example.org/OTHER/f") ; assertNotNull(alt) ; assertEquals(alt, "file:OTHER/f") ; } // Not the other { String alt = locMap1.altMapping("http://example.org/OTHER/f") ; assertNotNull(alt) ; // Did not change assertEquals(alt, "http://example.org/OTHER/f") ; } }
private LocationMapper getLocationMapper( Assembler a, Resource root ) { Resource lm = getUniqueResource( root, JA.locationMapper ); return lm == null ? new LocationMapper() : (LocationMapper) a.open( lm ); } }
public void testLocationMapperToModel1() { LocationMapper locMap1 = new LocationMapper(mapping) ; LocationMapper locMap2 = new LocationMapper(locMap1.toModel()) ; assertEquals(locMap1, locMap2) ; assertEquals(locMap1.hashCode(), locMap2.hashCode()) ; }
public void testLocationMapperEquals1() { LocationMapper locMap1 = new LocationMapper(mapping) ; LocationMapper locMap2 = new LocationMapper(mapping) ; assertEquals(locMap1, locMap2) ; assertEquals(locMap1.hashCode(), locMap2.hashCode()) ; }
/** * Test that @include supports fileManger redirections */ public void testIncludeRedirect() { assertFalse( checkIncludeFound("file:testing/reasoners/importTest.rules") ); LocationMapper lm = FileManager.get().getLocationMapper(); lm.addAltEntry("file:testing/reasoners/includeAlt.rules", "file:testing/reasoners/include.rules"); assertTrue( checkIncludeFound("file:testing/reasoners/importTest.rules") ); lm.removeAltEntry("file:testing/reasoners/includeAlt.rules"); }
String altName = mapping.getRequiredProperty(LocationMappingVocab.altName) .getString() ; addAltEntry(name, altName) ; log.debug("Mapping: "+name+" => "+altName) ; } catch (JenaException ex) String altPrefix = mapping.getRequiredProperty(LocationMappingVocab.altPrefix) .getString() ; addAltPrefix(prefix, altPrefix) ; log.debug("Prefix mapping: "+prefix+" => "+altPrefix) ; } catch (JenaException ex)
@Override public void registerURIMapping(final String fromURI, final String toURI) { _mapper.addAltEntry(fromURI, toURI); }
public String altMapping(String uri) { return altMapping(uri, uri) ; }
/** * <p> * Answer an iterator over the ontology document URI's that this document manager * knows to re-direct to other URL's. <strong>Note</strong> that being in this * iteration does <em>not</em> mean that a document with the given name is in * the set of cached models held by this document manager. * </p> * * @return An Iterator ranging over the public URI strings for the known * document URI's. */ public Iterator<String> listDocuments() { return getFileManager().getLocationMapper().listAltEntries(); }
/** * <p> * Remove all managed entries for the given document. Note does not side-effect * the prefixes table: this will have to be done separately. * </p> * * @param docURI The public URI for an ontology document */ public void forget( String docURI ) { getFileManager().getLocationMapper().removeAltEntry( docURI ); getFileManager().removeCacheModel( docURI ); }
public Model toModel() { Model m = ModelFactory.createDefaultModel() ; m.setNsPrefix("lmap", "http://jena.hpl.hp.com/2004/08/location-mapping#") ; toModel(m) ; return m ; }
public void testLocationMapper() { LocationMapper locMap = new LocationMapper(mapping) ; String alt = locMap.altMapping(filename1) ; assertNotNull(alt) ; assertEquals(alt, filename2) ; }
public void testLocationMapperEquals2() { LocationMapper locMap1 = new LocationMapper(mapping) ; LocationMapper locMap2 = new LocationMapper(mapping) ; locMap2.addAltEntry("file:nowhere", "file:somewhere") ; assertFalse(locMap1.equals(locMap2)) ; assertFalse(locMap2.equals(locMap1)) ; }
public void testLocationMapperClone2() { LocationMapper locMap1 = new LocationMapper(mapping) ; // See testLocationMapperURLtoFile // String alt = locMap.altMapping("http://example.org/file") ; // assertNotNull(alt) ; // assertEquals(alt, "file:"+testingDir+"/location-mapping-test-file") ; LocationMapper locMap2 = new LocationMapper(locMap1) ; // Change this one locMap2.addAltPrefix("http://example.org/OTHER", "file:OTHER") ; { String alt = locMap2.altMapping("http://example.org/OTHER/f") ; assertNotNull(alt) ; assertEquals(alt, "file:OTHER/f") ; } // Not the other { String alt = locMap1.altMapping("http://example.org/OTHER/f") ; assertNotNull(alt) ; // Did not change assertEquals(alt, "http://example.org/OTHER/f") ; } }