Search in sources :

Example 26 with FileManager

use of org.apache.jena.util.FileManager in project jena by apache.

the class TestImportManager method testFollowOwlImportsDeeply.

public void testFollowOwlImportsDeeply() {
    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);
}
Also used : Model(org.apache.jena.rdf.model.Model) FileManager(org.apache.jena.util.FileManager)

Example 27 with FileManager

use of org.apache.jena.util.FileManager in project jena by apache.

the class TestImportManager method testImportMayBeLiteral.

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);
}
Also used : Model(org.apache.jena.rdf.model.Model) FileManager(org.apache.jena.util.FileManager)

Example 28 with FileManager

use of org.apache.jena.util.FileManager in project jena by apache.

the class TestImportManager method testCatchesCircularity.

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);
}
Also used : Model(org.apache.jena.rdf.model.Model) FileManager(org.apache.jena.util.FileManager)

Example 29 with FileManager

use of org.apache.jena.util.FileManager in project jena by apache.

the class TestFileManager method testCache1.

public void testCache1() {
    FileManager fileManager = new FileManager();
    fileManager.addLocatorFile(testingDir);
    Model m1 = fileManager.loadModel(fileModel);
    Model m2 = fileManager.loadModel(fileModel);
    assertNotSame(m1, m2);
}
Also used : Model(org.apache.jena.rdf.model.Model) FileManager(org.apache.jena.util.FileManager)

Example 30 with FileManager

use of org.apache.jena.util.FileManager in project jena by apache.

the class TestFileManager method testCache2.

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);
}
Also used : Model(org.apache.jena.rdf.model.Model) FileManager(org.apache.jena.util.FileManager)

Aggregations

FileManager (org.apache.jena.util.FileManager)35 InputStream (java.io.InputStream)21 BaseTest (org.apache.jena.atlas.junit.BaseTest)13 Test (org.junit.Test)13 Model (org.apache.jena.rdf.model.Model)12 NotFoundException (org.apache.jena.shared.NotFoundException)12 LocationMapper (org.apache.jena.util.LocationMapper)4 OntModel (org.apache.jena.ontology.OntModel)3 TestLocationMapper (org.apache.jena.riot.stream.TestLocationMapper)2 File (java.io.File)1 DocumentManagerAssembler (org.apache.jena.assembler.assemblers.DocumentManagerAssembler)1 JenaException (org.apache.jena.shared.JenaException)1