use of org.apache.jena.assembler.Assembler in project jena by apache.
the class TestAssemblerGroup method testPassesSelfIn.
public void testPassesSelfIn() {
final AssemblerGroup group = AssemblerGroup.create();
final Object result = new Object();
Assembler fake = new AssemblerBase() {
@Override
public Object open(Assembler a, Resource root, Mode irrelevant) {
assertSame("nested call should pass in assembler group:", group, a);
return result;
}
};
group.implementWith(JA.Object, fake);
assertSame(result, group.open(resourceInModel("x rdf:type ja:Object")));
}
use of org.apache.jena.assembler.Assembler in project jena by apache.
the class InitGeoSPARQL method start.
@Override
public void start() {
// SIS uses JUL for logging.
LogCtlJUL.routeJULtoSLF4J();
JenaSystem.logLifecycle("InitGeoSPARQL - start");
GeometryDatatype.registerDatatypes();
// Logs "SIS_DATA is not set"
GeoSPARQLConfig.loadFunctions();
Assembler assembler = new GeoAssembler();
AssemblerUtils.registerDataset(VocabGeoSPARQL.tGeoDataset, assembler);
AssemblerUtils.registerDataset(VocabGeoSPARQL.tGeoDatasetAlt, assembler);
JenaSystem.logLifecycle("InitGeoSPARQL - finish");
}
use of org.apache.jena.assembler.Assembler in project jena by apache.
the class TestModelSourceAssembler method testMemModelMakerSource.
public void testMemModelMakerSource() {
Assembler a = new ModelSourceAssembler();
ModelGetter g = (ModelGetter) a.open(resourceInModel("mg rdf:type ja:ModelSource"));
assertInstanceOf(MemoryModelGetter.class, g);
}
use of org.apache.jena.assembler.Assembler in project jena by apache.
the class FusekiConfig method readConfigurationDirectory.
// ---- Directory of assemblers
/**
* Read service descriptions in the given directory
*/
public static List<DataAccessPoint> readConfigurationDirectory(String dir) {
Path pDir = Path.of(dir).normalize();
File dirFile = pDir.toFile();
if (!dirFile.exists()) {
log.warn("Not found: directory for assembler files for services: '" + dir + "'");
return Collections.emptyList();
}
if (!dirFile.isDirectory()) {
log.warn("Not a directory: '" + dir + "'");
return Collections.emptyList();
}
// Files that are not hidden.
DirectoryStream.Filter<Path> filter = (entry) -> {
File f = entry.toFile();
final Lang lang = filenameToLang(f.getName());
return !f.isHidden() && f.isFile() && lang != null && isRegistered(lang);
};
List<DataAccessPoint> dataServiceRef = new ArrayList<>();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(pDir, filter)) {
for (Path p : stream) {
DatasetDescriptionMap dsDescMap = new DatasetDescriptionMap();
String fn = IRILib.filenameToIRI(p.toString());
log.info("Load configuration: " + fn);
Model m = readAssemblerFile(fn);
readConfiguration(m, dsDescMap, dataServiceRef);
}
} catch (IOException ex) {
log.warn("IOException:" + ex.getMessage(), ex);
}
return dataServiceRef;
}
Aggregations