Package org.aksw.jenax.engine.qlever
Class RDFDatabaseBuilderQlever<X extends RDFDatabaseBuilderQlever<X>>
java.lang.Object
org.aksw.jenax.engine.qlever.RDFDatabaseBuilderQlever<X>
- All Implemented Interfaces:
org.aksw.commons.util.obj.HasSelf<X>,RDFDatabaseBuilder<X>
public class RDFDatabaseBuilderQlever<X extends RDFDatabaseBuilderQlever<X>>
extends Object
implements RDFDatabaseBuilder<X>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRecord to hold either a command for a ProcessBuilder that produces output or a ByteSource.static final recordhostFileWriterTask: The name of a regular file or a named pipe on the host.static final recordstatic final recordRecord to capture arguments passed to this builderstatic final recordA list of file binds and arguments to process themstatic final recordstatic final recordRecord to capture a set of files that make up a Qlever database. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<RDFDatabaseBuilderQlever.FileArg>protected StringBase path within the container where to mount any named pipes.protected ContainerPathResolverA resolver for host paths if the database builder is used from within docker (dind).protected Stringprotected Stringprotected Stringprotected Pathprotected org.aksw.jenax.arq.util.prefix.ShortNameMgrMapping from absolute file paths on the host names to file names.protected Stringstatic final List<org.apache.jena.riot.Lang>protected SysRuntime -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddPath(Path source, org.apache.jena.graph.Node graph, List<String> encodings, org.apache.jena.riot.Lang lang) build()Determine the types of arguments: If all files are directly nq or ttl then use them as file arguments.protected RDFDatabaseBuilderQlever.ByteSourceSpecbuildByteSourceCmd(List<StreamOp> args, org.apache.jena.riot.Lang lang) On the host side: create a FileWriter for a file that can be mounted into the container bridge: create a bind of the host file to a container path.protected RDFDatabaseBuilderQlever.FileAndCmdbuildCmdPart(String containerBasePath, StreamOp containerOp, String fileArg, org.apache.jena.graph.Node graph, org.apache.jena.riot.Lang lang) buildHostToContainerDataBridge(Supplier<Path> hostTempPathSupp, StreamOp op, org.apache.jena.graph.Node graph, org.apache.jena.riot.Lang lang) protected RDFDatabaseBuilderQlever.InputSpecbuildInputSpec(Supplier<Path> hostTempPath) protected FileWriterTaskcreateHostFileWriter(Supplier<Path> tempPathSupp, StreamOp sysCallOp) protected SysRuntimeprotected StringlangToFormat(org.apache.jena.riot.Lang lang) protected voidrunContainerViaSysCall(CmdOp generatorCmd, org.apache.jena.riot.Lang lang) protected voidrunContainerViaSysCallWithInputStream(com.google.common.io.ByteSource byteSource, org.apache.jena.riot.Lang lang) protected voidprotected voidrunContainerWithInputStream(com.google.common.io.ByteSource byteSource, org.apache.jena.riot.Lang lang) setDockerImageName(String dockerImageName) setDockerImageTag(String dockerImageTag) setIndexName(String name) setOutputFolder(Path outputFolder) setStxxlMemory(String stxxlMemory) setSysRuntime(SysRuntime sysRuntime) protected org.testcontainers.containers.GenericContainer<?>setupContainer(String indexName, String cmdStr) protected GenericContainer<?>setupContainerSysCall(String fileName, org.apache.jena.riot.Lang lang) protected StreamOpTransformToCmdOpMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aksw.commons.util.obj.HasSelf
selfMethods inherited from interface org.aksw.jenax.dataaccess.sparql.creator.RDFDatabaseBuilder
addPath, addPath
-
Field Details
-
supportedLangs
-
dockerImageName
-
dockerImageTag
-
shortNameMgr
protected org.aksw.jenax.arq.util.prefix.ShortNameMgr shortNameMgrMapping from absolute file paths on the host names to file names. -
sysRuntime
-
outputFolder
-
args
-
errorCollector
-
indexName
-
stxxlMemory
-
containerFifoPath
Base path within the container where to mount any named pipes. Must end with '/'. -
containerPathResolver
A resolver for host paths if the database builder is used from within docker (dind).
-
-
Constructor Details
-
RDFDatabaseBuilderQlever
public RDFDatabaseBuilderQlever()
-
-
Method Details
-
setSysRuntime
-
setDockerImageName
-
getDockerImageName
-
setDockerImageTag
-
getDockerImageTag
-
setName
- Specified by:
setNamein interfaceRDFDatabaseBuilder<X extends RDFDatabaseBuilderQlever<X>>
-
setIndexName
-
setOutputFolder
- Specified by:
setOutputFolderin interfaceRDFDatabaseBuilder<X extends RDFDatabaseBuilderQlever<X>>
-
setStxxlMemory
-
getStxxlMemory
-
addPath
- Specified by:
addPathin interfaceRDFDatabaseBuilder<X extends RDFDatabaseBuilderQlever<X>>- Throws:
IOException
-
addPath
-
convertArgToOp
-
getRuntime
-
sysCallTransform
-
buildByteSourceCmd
protected RDFDatabaseBuilderQlever.ByteSourceSpec buildByteSourceCmd(List<StreamOp> args, org.apache.jena.riot.Lang lang) On the host side: create a FileWriter for a file that can be mounted into the container bridge: create a bind of the host file to a container path. (the host file is not required to exist at this stage) On the container side: create a StreamOp that reads the container file.- Returns:
-
buildInputSpec
protected RDFDatabaseBuilderQlever.InputSpec buildInputSpec(Supplier<Path> hostTempPath) throws NoSuchFileException - Throws:
NoSuchFileException
-
buildCmdPart
protected RDFDatabaseBuilderQlever.FileAndCmd buildCmdPart(String containerBasePath, StreamOp containerOp, String fileArg, org.apache.jena.graph.Node graph, org.apache.jena.riot.Lang lang) -
createHostFileWriter
protected FileWriterTask createHostFileWriter(Supplier<Path> tempPathSupp, StreamOp sysCallOp) throws NoSuchFileException - Throws:
NoSuchFileException
-
buildHostToContainerDataBridge
protected RDFDatabaseBuilderQlever.DockerDataArgumentBridge buildHostToContainerDataBridge(Supplier<Path> hostTempPathSupp, StreamOp op, org.apache.jena.graph.Node graph, org.apache.jena.riot.Lang lang) throws NoSuchFileException - Throws:
NoSuchFileException
-
setupContainer
protected org.testcontainers.containers.GenericContainer<?> setupContainer(String indexName, String cmdStr) throws NumberFormatException, IOException, InterruptedException -
runContainerWithInputStream
protected void runContainerWithInputStream(com.google.common.io.ByteSource byteSource, org.apache.jena.riot.Lang lang) throws InterruptedException, IOException - Throws:
InterruptedExceptionIOException
-
runContainerWithFileArgs
protected void runContainerWithFileArgs(RDFDatabaseBuilderQlever.FileSpec fileSpec) throws NumberFormatException, IOException, InterruptedException -
langToFormat
-
setupContainerSysCall
protected GenericContainer<?> setupContainerSysCall(String fileName, org.apache.jena.riot.Lang lang) throws NumberFormatException, IOException, InterruptedException -
runContainerViaSysCallWithInputStream
protected void runContainerViaSysCallWithInputStream(com.google.common.io.ByteSource byteSource, org.apache.jena.riot.Lang lang) throws InterruptedException, IOException - Throws:
InterruptedExceptionIOException
-
runContainerViaSysCall
protected void runContainerViaSysCall(CmdOp generatorCmd, org.apache.jena.riot.Lang lang) throws NumberFormatException, IOException, InterruptedException -
getFinalIndexName
-
build
Determine the types of arguments: If all files are directly nq or ttl then use them as file arguments. Otherwise, build a stream from the argument: - A mix of nq and ttl is not supported. - Use cat or a codec to decode files - Use a flag whether to use process substitution or command grouping.- Specified by:
buildin interfaceRDFDatabaseBuilder<X extends RDFDatabaseBuilderQlever<X>>- Returns:
- Throws:
IOExceptionInterruptedException
-