use of org.apache.jena.ontology.OntDocumentManager in project jena by apache.
the class DocumentManagerAssembler method open.
@Override
public Object open(Assembler a, Resource root, Mode irrelevant) {
checkType(root, JA.DocumentManager);
OntDocumentManager result = createDocumentManager();
result.setMetadataSearchPath(getPath(a, root), false);
result.configure(ResourceUtils.reachableClosure(root), false);
result.setFileManager(getFileManager(a, root));
return result;
}
use of org.apache.jena.ontology.OntDocumentManager in project jena by apache.
the class TestDocumentManagerAssembler method testSetsMetadata.
public void testSetsMetadata() {
// we set policyPath to avoid Ont default models being thrown at us
Resource root = resourceInModel("x rdf:type ja:DocumentManager; x ja:policyPath ''; x P a; a Q b; y R z");
final Model expected = model("x rdf:type ja:DocumentManager; x ja:policyPath ''; x P a; a Q b");
final List<String> history = new ArrayList<>();
Assembler a = new DocumentManagerAssembler() {
@Override
protected OntDocumentManager createDocumentManager() {
return new OntDocumentManager("") {
@Override
public void processMetadata(Model m) {
assertIsoModels(expected, m);
history.add("called");
super.processMetadata(m);
}
};
}
};
OntDocumentManager d = (OntDocumentManager) a.open(root);
assertEquals(listOfOne("called"), history);
}
use of org.apache.jena.ontology.OntDocumentManager in project jena by apache.
the class TestDocumentManagerAssembler method testSetsPolicyPath.
public void testSetsPolicyPath() {
Resource root = resourceInModel("x rdf:type ja:DocumentManager; x ja:policyPath 'somePath'");
final List<String> history = new ArrayList<>();
Assembler a = new DocumentManagerAssembler() {
@Override
protected OntDocumentManager createDocumentManager() {
return new OntDocumentManager("") {
@Override
public void setMetadataSearchPath(String path, boolean replace) {
assertEquals(false, replace);
history.add(path);
super.setMetadataSearchPath(path, replace);
}
};
}
};
OntDocumentManager d = (OntDocumentManager) a.open(root);
assertEquals(listOfOne("somePath"), history);
}
Aggregations