Package com.complexible.common.rdf
Class StatementSources
java.lang.Object
com.complexible.common.rdf.StatementSources
Utility class for working with StatementSources
- Since:
- 0.8
- Version:
- 6.0
- Author:
- Michael Grove
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseQuietly(StatementSource theSource) Quietly close the statement source, ignoring an exceptions and simply logging them rather than re-throwing.static StatementSourceconcat(StatementSource theSource, StatementSource theOther, StatementSource... theRest) static StatementSourceconcat(Iterable<StatementSource> theSource) static StatementSourcecopyContext(StatementSource theSrc, Resource theSourceContext, Resource theTargetContext) static StatementSourceempty()static StatementSourcefilter(StatementSource theSource, Predicate<Statement> theFilter) static StatementSourceobfuscated(StatementSource theSource, RDFObfuscator theObfuscator) static longsize(StatementSource theSrc) Return the size (number of triples) in the StatementSourcetoModel(StatementSource theSrc) Read the contents of a StatementSource into a graph.static StatementSourceusingContext(StatementSource theSrc, Resource theContext) static StatementSourcevirtual(StatementSource theSource) static StatementSourcewithFallbackContext(StatementSource theSrc, Resource theContext) static longwrite(StatementSource theSource, RDFFormat theFormat, OutputStream theOutputStream, ProgressReporter theReporter) Write the contents of the StatementSource in the specified format to the output streamstatic longwrite(StatementSource theSource, RDFWriter theWriter, ProgressReporter theReporter) Write the contents of the StatementSource to the Rio writerstatic longwrite(StatementSource theSource, Optional<Iterable<Namespace>> theNamespaces, RDFWriter theWriter, ProgressReporter theReporter)
-
Method Details
-
closeQuietly
Quietly close the statement source, ignoring an exceptions and simply logging them rather than re-throwing.- Parameters:
theSource- the source to close.
-
empty
-
concat
-
concat
public static StatementSource concat(StatementSource theSource, StatementSource theOther, StatementSource... theRest) -
copyContext
public static StatementSource copyContext(StatementSource theSrc, Resource theSourceContext, Resource theTargetContext) -
usingContext
-
withFallbackContext
-
toModel
Read the contents of a StatementSource into a graph. Be careful when calling this method as this will put the entire contents of the StatementSource into memory as a Graph, so large StatementSources could cause OOM errors.- Parameters:
theSrc- the source to read into a graph- Returns:
- the contents of the source as a graph
- Throws:
IOException- if there was an error while reading from the source
-
size
Return the size (number of triples) in the StatementSource- Parameters:
theSrc- the source- Returns:
- the size in triples
- Throws:
IOException- if there was an error reading from the source
-
write
public static long write(StatementSource theSource, RDFFormat theFormat, OutputStream theOutputStream, ProgressReporter theReporter) throws IOException Write the contents of the StatementSource in the specified format to the output stream- Parameters:
theSource- the source whose contents should be writtentheFormat- the RDF format to use when writingtheOutputStream- the stream to write to- Throws:
IOException- if there was an error getting a statement from the source
-
write
public static long write(StatementSource theSource, RDFWriter theWriter, ProgressReporter theReporter) throws IOException Write the contents of the StatementSource to the Rio writer- Parameters:
theSource- the source to writetheWriter- the writer to write the source to- Throws:
IOException- if there is an error while writing
-
write
public static long write(StatementSource theSource, Optional<Iterable<Namespace>> theNamespaces, RDFWriter theWriter, ProgressReporter theReporter) throws IOException - Throws:
IOException
-
filter
-
obfuscated
-
virtual
-