Package org.aksw.jenax.sparql.query.rx
Class RDFDataMgrRx
java.lang.Object
org.aksw.jenax.sparql.query.rx.RDFDataMgrRx
Reactive extensions of RDFDataMgr
- Author:
- Claus Stadler, Nov 12, 2018
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.jena.riot.RDFParserBuilderapplyParserDefaults(org.apache.jena.riot.RDFParserBuilder builder) static <C extends Collection<? extends org.apache.jena.query.Dataset>>
io.reactivex.rxjava3.core.FlowableTransformer<C,Throwable> createBatchWriterDataset(OutputStream out, org.apache.jena.riot.RDFFormat format) static <C extends Collection<org.apache.jena.sparql.core.Quad>>
io.reactivex.rxjava3.core.FlowableTransformer<C,Throwable> createBatchWriterQuads(OutputStream out, org.apache.jena.riot.RDFFormat format) static <C extends Collection<org.apache.jena.sparql.core.Quad>>
io.reactivex.rxjava3.core.FlowableTransformer<C,Throwable> createBatchWriterQuads2(OutputStream out, org.apache.jena.riot.RDFFormat format) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>createFlowableBindings(String filenameOrURI, org.apache.jena.riot.Lang lang) Create a Flowable for a SPARQL result set backed by a filestatic io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>createFlowableBindings(Callable<InputStream> inSupp, org.apache.jena.riot.Lang lang) Create a Flowable for a SPARQL result set backed by an supplier of input streamsstatic io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>createFlowableBindings(Callable<org.apache.jena.atlas.web.TypedInputStream> inSupp) Create a Flowable for a SPARQL result set backed by a supplier of TypedInputStreamstatic io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.Dataset>createFlowableDatasets(String filenameOrURI, org.apache.jena.riot.Lang lang, String baseIRI) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.Dataset>createFlowableDatasets(Callable<InputStream> inSupplier, org.apache.jena.riot.Lang lang, String baseIRI) Groups consecutive quads with the same graph yeld by createFlowableQuads into datasetsstatic io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.Dataset>createFlowableDatasets(Callable<org.apache.jena.atlas.web.TypedInputStream> inSupplier) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad>createFlowableQuads(String filenameOrURI, org.apache.jena.riot.Lang lang, String baseIRI) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad>createFlowableQuads(Path path, Iterable<org.apache.jena.riot.Lang> probeLangs) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad>createFlowableQuads(Callable<InputStream> inSupplier, org.apache.jena.riot.Lang lang, String baseIRI) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad>createFlowableQuads(Callable<org.apache.jena.atlas.web.TypedInputStream> inSupplier) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.Resource>createFlowableResources(String filenameOrURI, org.apache.jena.riot.Lang lang, String baseIRI) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.Resource>createFlowableResources(Callable<InputStream> inSupplier, org.apache.jena.riot.Lang lang, String baseIRI) Creates resources by grouping consecutive quads with the same graph into a Model, and then returning a resource for that graph IRI.static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple>createFlowableTriples(String filenameOrURI, org.apache.jena.riot.Lang lang, String baseIRI) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad>createFlowableTriples(Path path, Iterable<org.apache.jena.riot.Lang> probeLangs) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple>createFlowableTriples(Callable<InputStream> inSupplier, org.apache.jena.riot.Lang lang, String baseIRI) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple>createFlowableTriples(Callable<org.apache.jena.atlas.web.TypedInputStream> inSupplier) static org.apache.jena.riot.lang.LabelToNodeLabel to node strategy that passes existing labels on as given but allocation of fresh nodes uses a pair comprising a jvm-global random value and an increment.static org.apache.jena.riot.system.ParserProfilecreateParserProfile(org.apache.jena.riot.system.FactoryRDF factory, org.apache.jena.riot.system.ErrorHandler errorHandler, boolean checking) static io.reactivex.rxjava3.core.FlowableTransformer<? super org.apache.jena.query.Dataset,Throwable> createWriterDataset(OutputStream out, org.apache.jena.riot.RDFFormat format) static org.apache.jena.riot.system.ErrorHandlerstatic org.apache.jena.riot.system.ParserProfilestatic voidparseFromInputStream(org.apache.jena.riot.system.StreamRDF destination, InputStream in, String baseUri, org.apache.jena.riot.Lang lang, org.apache.jena.sparql.util.Context context) Adaption from RDFDataMgr.createIteratorQuads that waits for data on the input stream indefinitely and allows for thread handling Creates an iterator over parsing of quadsstatic org.apache.jena.riot.system.ParserProfilestatic org.apache.jena.riot.system.ParserProfilestatic voidwriteDatasets(io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.Dataset> flowable, OutputStream out, org.apache.jena.riot.RDFFormat format) Does not close the output stream Note that you can use .createDatasetBatchWriter() ....blockingForEach(createDatasetBatchWriter()) This does not break the chain and gives freedom over the choice of forEach type (non-/blocking)static voidwriteDatasets(io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.Dataset> flowable, Path file, org.apache.jena.riot.RDFFormat format) static voidwriteQuads(io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad> flowable, OutputStream out, org.apache.jena.riot.RDFFormat format) static voidwriteResources(io.reactivex.rxjava3.core.Flowable<? extends org.apache.jena.rdf.model.Resource> flowable, OutputStream out, org.apache.jena.riot.RDFFormat format) static voidwriteResources(io.reactivex.rxjava3.core.Flowable<? extends org.apache.jena.rdf.model.Resource> flowable, Path file, org.apache.jena.riot.RDFFormat format)
-
Constructor Details
-
RDFDataMgrRx
public RDFDataMgrRx()
-
-
Method Details
-
createFlowableTriples
-
createFlowableBindings
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding> createFlowableBindings(String filenameOrURI, org.apache.jena.riot.Lang lang) Create a Flowable for a SPARQL result set backed by a file- Parameters:
filenameOrURI-lang-- Returns:
-
createFlowableBindings
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding> createFlowableBindings(Callable<InputStream> inSupp, org.apache.jena.riot.Lang lang) Create a Flowable for a SPARQL result set backed by an supplier of input streams- Parameters:
filenameOrURI-lang-- Returns:
-
createFlowableBindings
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding> createFlowableBindings(Callable<org.apache.jena.atlas.web.TypedInputStream> inSupp) Create a Flowable for a SPARQL result set backed by a supplier of TypedInputStream- Parameters:
filenameOrURI-lang-- Returns:
-
createFlowableTriples
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple> createFlowableTriples(Callable<InputStream> inSupplier, org.apache.jena.riot.Lang lang, String baseIRI) -
createFlowableResources
-
createFlowableDatasets
-
createLabelToNodeAsGivenOrRandom
public static org.apache.jena.riot.lang.LabelToNode createLabelToNodeAsGivenOrRandom()Label to node strategy that passes existing labels on as given but allocation of fresh nodes uses a pair comprising a jvm-global random value and an increment. (i.e. incremental numbers scoped within some random value) This strategy is needed when processing RDF files in splits such as with Apache Spark: Any mentioned labels should be retaine globally, but fresh nodes allocated for the splits must not clash.- Returns:
-
dftErrorHandler
public static org.apache.jena.riot.system.ErrorHandler dftErrorHandler() -
dftProfile
public static org.apache.jena.riot.system.ParserProfile dftProfile() -
applyParserDefaults
public static org.apache.jena.riot.RDFParserBuilder applyParserDefaults(org.apache.jena.riot.RDFParserBuilder builder) -
createParserProfile
public static org.apache.jena.riot.system.ParserProfile createParserProfile(org.apache.jena.riot.system.FactoryRDF factory, org.apache.jena.riot.system.ErrorHandler errorHandler, boolean checking) -
strictProfile
public static org.apache.jena.riot.system.ParserProfile strictProfile() -
permissiveProfile
public static org.apache.jena.riot.system.ParserProfile permissiveProfile() -
parseFromInputStream
public static void parseFromInputStream(org.apache.jena.riot.system.StreamRDF destination, InputStream in, String baseUri, org.apache.jena.riot.Lang lang, org.apache.jena.sparql.util.Context context) Adaption from RDFDataMgr.createIteratorQuads that waits for data on the input stream indefinitely and allows for thread handling Creates an iterator over parsing of quads- Parameters:
input- Input Streamlang- LanguagebaseIRI- Base IRI
-
createFlowableQuads
-
createFlowableQuads
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad> createFlowableQuads(Callable<InputStream> inSupplier, org.apache.jena.riot.Lang lang, String baseIRI) -
createFlowableResources
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.Resource> createFlowableResources(Callable<InputStream> inSupplier, org.apache.jena.riot.Lang lang, String baseIRI) Creates resources by grouping consecutive quads with the same graph into a Model, and then returning a resource for that graph IRI.GRAPH :s { :s :p :o . :o :x :y }- Parameters:
inSupplier-lang-baseIRI-- Returns:
-
createFlowableDatasets
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.Dataset> createFlowableDatasets(Callable<InputStream> inSupplier, org.apache.jena.riot.Lang lang, String baseIRI) Groups consecutive quads with the same graph yeld by createFlowableQuads into datasets- Parameters:
inSupplier-lang-baseIRI-- Returns:
-
createFlowableDatasets
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.Dataset> createFlowableDatasets(Callable<org.apache.jena.atlas.web.TypedInputStream> inSupplier) -
createFlowableQuads
-
createFlowableQuads
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad> createFlowableQuads(Callable<org.apache.jena.atlas.web.TypedInputStream> inSupplier) -
createFlowableTriples
-
createFlowableTriples
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple> createFlowableTriples(Callable<org.apache.jena.atlas.web.TypedInputStream> inSupplier) -
writeResources
public static void writeResources(io.reactivex.rxjava3.core.Flowable<? extends org.apache.jena.rdf.model.Resource> flowable, Path file, org.apache.jena.riot.RDFFormat format) throws Exception - Throws:
Exception
-
writeResources
public static void writeResources(io.reactivex.rxjava3.core.Flowable<? extends org.apache.jena.rdf.model.Resource> flowable, OutputStream out, org.apache.jena.riot.RDFFormat format) throws Exception - Throws:
Exception
-
writeDatasets
public static void writeDatasets(io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.Dataset> flowable, Path file, org.apache.jena.riot.RDFFormat format) throws Exception - Throws:
Exception
-
createWriterDataset
public static io.reactivex.rxjava3.core.FlowableTransformer<? super org.apache.jena.query.Dataset,Throwable> createWriterDataset(OutputStream out, org.apache.jena.riot.RDFFormat format) -
createBatchWriterDataset
public static <C extends Collection<? extends org.apache.jena.query.Dataset>> io.reactivex.rxjava3.core.FlowableTransformer<C,Throwable> createBatchWriterDataset(OutputStream out, org.apache.jena.riot.RDFFormat format) -
createBatchWriterQuads
public static <C extends Collection<org.apache.jena.sparql.core.Quad>> io.reactivex.rxjava3.core.FlowableTransformer<C,Throwable> createBatchWriterQuads(OutputStream out, org.apache.jena.riot.RDFFormat format) - Type Parameters:
C-- Parameters:
out-format- Only NQuads is currently supported- Returns:
-
createBatchWriterQuads2
public static <C extends Collection<org.apache.jena.sparql.core.Quad>> io.reactivex.rxjava3.core.FlowableTransformer<C,Throwable> createBatchWriterQuads2(OutputStream out, org.apache.jena.riot.RDFFormat format) -
writeQuads
public static void writeQuads(io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad> flowable, OutputStream out, org.apache.jena.riot.RDFFormat format) throws IOException - Throws:
IOException
-
writeDatasets
public static void writeDatasets(io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.Dataset> flowable, OutputStream out, org.apache.jena.riot.RDFFormat format) throws IOException Does not close the output stream Note that you can use .createDatasetBatchWriter() ....blockingForEach(createDatasetBatchWriter()) This does not break the chain and gives freedom over the choice of forEach type (non-/blocking)- Throws:
IOException
-