Package com.complexible.common.rdf
Class StatementSources
- java.lang.Object
-
- com.complexible.common.rdf.StatementSources
-
public final class StatementSources extends java.lang.Object
Utility class for working with StatementSources
- Since:
- 0.8
- Version:
- 6.0
- Author:
- Michael Grove
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StatementSources.RDFStreamStatementSource
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
closeQuietly(StatementSource theSource)
Quietly close the statement source, ignoring an exceptions and simply logging them rather than re-throwing.static StatementSource
concat(StatementSource theSource, StatementSource theOther, StatementSource... theRest)
static StatementSource
concat(java.lang.Iterable<StatementSource> theSource)
static StatementSource
copyContext(StatementSource theSrc, Resource theSourceContext, Resource theTargetContext)
static StatementSource
empty()
static StatementSource
filter(StatementSource theSource, java.util.function.Predicate<Statement> theFilter)
static StatementSource
obfuscated(StatementSource theSource, RDFObfuscator theObfuscator)
static long
size(StatementSource theSrc)
Return the size (number of triples) in the StatementSourcestatic java.util.Set<Statement>
toModel(StatementSource theSrc)
Read the contents of a StatementSource into a graph.static StatementSource
usingContext(StatementSource theSrc, Resource theContext)
static StatementSource
virtual(StatementSource theSource)
static StatementSource
withFallbackContext(StatementSource theSrc, Resource theContext)
static long
write(StatementSource theSource, RDFFormat theFormat, java.io.OutputStream theOutputStream, ProgressReporter theReporter)
Write the contents of the StatementSource in the specified format to the output streamstatic long
write(StatementSource theSource, RDFWriter theWriter, ProgressReporter theReporter)
Write the contents of the StatementSource to the Rio writerstatic long
write(StatementSource theSource, java.util.Optional<java.lang.Iterable<Namespace>> theNamespaces, RDFWriter theWriter, ProgressReporter theReporter)
-
-
-
Method Detail
-
closeQuietly
public static void closeQuietly(StatementSource theSource)
Quietly close the statement source, ignoring an exceptions and simply logging them rather than re-throwing.- Parameters:
theSource
- the source to close.
-
empty
public static StatementSource empty()
-
concat
public static StatementSource concat(java.lang.Iterable<StatementSource> theSource)
-
concat
public static StatementSource concat(StatementSource theSource, StatementSource theOther, StatementSource... theRest)
-
copyContext
public static StatementSource copyContext(StatementSource theSrc, Resource theSourceContext, Resource theTargetContext)
-
usingContext
public static StatementSource usingContext(StatementSource theSrc, Resource theContext)
-
withFallbackContext
public static StatementSource withFallbackContext(StatementSource theSrc, Resource theContext)
-
toModel
public static java.util.Set<Statement> toModel(StatementSource theSrc) throws java.io.IOException
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:
java.io.IOException
- if there was an error while reading from the source
-
size
public static long size(StatementSource theSrc) throws java.io.IOException
Return the size (number of triples) in the StatementSource- Parameters:
theSrc
- the source- Returns:
- the size in triples
- Throws:
java.io.IOException
- if there was an error reading from the source
-
write
public static long write(StatementSource theSource, RDFFormat theFormat, java.io.OutputStream theOutputStream, ProgressReporter theReporter) throws java.io.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:
java.io.IOException
- if there was an error getting a statement from the source
-
write
public static long write(StatementSource theSource, RDFWriter theWriter, ProgressReporter theReporter) throws java.io.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:
java.io.IOException
- if there is an error while writing
-
write
public static long write(StatementSource theSource, java.util.Optional<java.lang.Iterable<Namespace>> theNamespaces, RDFWriter theWriter, ProgressReporter theReporter) throws java.io.IOException
- Throws:
java.io.IOException
-
filter
public static StatementSource filter(StatementSource theSource, java.util.function.Predicate<Statement> theFilter)
-
obfuscated
public static StatementSource obfuscated(StatementSource theSource, RDFObfuscator theObfuscator)
-
virtual
public static StatementSource virtual(StatementSource theSource)
-
-