Package com.hp.hpl.jena.util

Examples of com.hp.hpl.jena.util.FileManager


   
    public void testFollowJAImports()
        {
        final Model modelToLoad = model( "this hasMarker B5" );
        Model  m = model( "x ja:reasoner y; _x ja:imports eh:/loadMe" );
        FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad );
        Model m2 = new ImportManager().withImports( fm, m );
        assertInstanceOf( MultiUnion.class, m2.getGraph() );
        assertIsoModels( modelToLoad.union( m ), m2 );
        }
View Full Code Here


   
    public void testImportMayBeLiteral()
        {
        final Model modelToLoad = model( "this hasMarker B5" );
        Model  m = model( "x ja:reasoner y; _x ja:imports 'eh:/loadMe'" );
        FileManager fm = new FixedFileManager().add( "eh:/loadMe", modelToLoad );
        Model m2 = new ImportManager().withImports( fm, m );
        assertInstanceOf( MultiUnion.class, m2.getGraph() );
        assertIsoModels( modelToLoad.union( m ), m2 );
        }
View Full Code Here

    }

    public void testLocationMappingURLtoFileOpenNotFound()
    {
        LocationMapper locMap = new LocationMapper(TestLocationMapper.mapping) ;
        FileManager fileManager = new FileManager(locMap) ;
        fileManager.addLocatorClassLoader(fileManager.getClass().getClassLoader()) ;
        try {
            InputStream in = fileManager.open("http://example.org/file") ;
            closeInputStream(in) ;
            assertNull("Found nont-existant URL", null) ;
        } catch (NotFoundException ex) {}
    }
View Full Code Here

        {
        final Model
            m1 = model( "this hasMarker M1; _x owl:imports M2" ),
            m2 = model( "this hasMarker M2" );
        Model  m = model( "x ja:reasoner y; _x owl:imports M1" );
        FileManager fm = new FixedFileManager()
            .add( "eh:/M1", m1 ).add( "eh:/M2", m2 );
        Model result = new ImportManager().withImports( fm, m );
        assertInstanceOf( MultiUnion.class, result.getGraph() );
        assertIsoModels( m1.union(m2).union(m), result );
        }
View Full Code Here

    public void testCatchesCircularity()
        {
        final Model
            m1 = model( "this hasMarker Mx; _x owl:imports My" ),
            m2 = model( "this hasMarker My; _x owl:imports Mx" );
        FileManager fm = new FixedFileManager()
            .add( "eh:/Mx", m1 ).add( "eh:/My", m2 );
        Model result = new ImportManager().withImports( fm, m1 );
        assertIsoModels( m1.union( m2 ), result );
        }
View Full Code Here

    public void testCacheModels()
        {
        ImportManager im = new ImportManager();
        Model spec = model( "_x owl:imports M1" );
        Model m1 = model( "this isModel M1" );
        FileManager withM1 = new FixedFileManager().add( "eh:/M1", m1 );
        Model A = im.withImports( withM1, spec );
        FileManager none = new FixedFileManager();
        Model B = im.withImports( none, spec );
        assertIsoModels( A, B );
        }
View Full Code Here

        } catch (NotFoundException ex) {}
    }

    public void testCache1()
    {
        FileManager fileManager = new FileManager() ;
        fileManager.addLocatorFile(testingDir) ;
        Model m1 = fileManager.loadModel(fileModel) ;
        Model m2 = fileManager.loadModel(fileModel) ;
        assertNotSame(m1, m2) ;
    }
View Full Code Here

        assertNotSame(m1, m2) ;
    }
   
    public void testCache2()
    {
        FileManager fileManager = FileManager.get() ;
        fileManager.addLocatorFile(testingDir) ;
        fileManager.setModelCaching(true) ;
        Model m1 = fileManager.loadModel(fileModel) ;
        Model m2 = fileManager.loadModel(fileModel) ;
        assertSame(m1, m2) ;
    }
View Full Code Here

        assertSame(m1, m2) ;
    }
   
    public void testCache3()
    {
        FileManager fileManager = FileManager.get() ;
        fileManager.addLocatorFile(testingDir) ;
        fileManager.setModelCaching(true) ;
        Model m1 = fileManager.loadModel(fileModel) ;
        Model m2 = fileManager.loadModel(fileModel) ;
        assertSame(m1, m2) ;
       
        fileManager.removeCacheModel(fileModel) ;
        Model m3 = fileManager.loadModel(fileModel) ;
        assertNotSame(m1, m3) ;
       
        fileManager.resetCache() ;
        Model m4 = fileManager.loadModel(fileModel) ;
        Model m5 = fileManager.loadModel(fileModel) ;

        assertSame(m4, m5) ;
        assertNotSame(m1, m4) ;
        assertNotSame(m3, m4) ;
    }
View Full Code Here

import com.hp.hpl.jena.util.FileManager;

public class ExampleTDB_02 {

    public static void main(String[] args) {
        FileManager fm = FileManager.get();
        fm.addLocatorClassLoader(ExampleTDB_02.class.getClassLoader());
        InputStream in = fm.open("data/data.nt");

        Location location = new Location ("target/TDB");

        // Load some initial data
        TDBLoader.load(TDBInternal.getBaseDatasetGraphTDB(TDBFactory.createDatasetGraph(location)), in, false);
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.util.FileManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.