Package com.stardog.stark.io
Class RDFParsers
- java.lang.Object
-
- com.stardog.stark.io.RDFParsers
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<RDFParser>
forFormat(RDFFormat theFormat)
Return theparser
associated with the given formatstatic java.util.Set<Statement>
read(java.io.InputStream theStream, RDFFormat theFormat)
Parse the RDF from theinput
and return the resulting statementsstatic java.util.Set<Statement>
read(java.io.InputStream theStream, RDFFormat theFormat, Options theOptions)
Parse the RDF from theinput
and return the resulting statementsstatic <T> T
read(java.io.InputStream theStream, RDFFormat theFormat, Options theOptions, CollectingRDFHandler<T> theHandler)
Parse the RDF from the specified streamstatic void
read(java.io.InputStream theStream, RDFFormat theFormat, Options theOptions, RDFHandler theHandler)
Parse the RDF from the specified streamstatic java.util.Set<Statement>
read(java.lang.String theInput, RDFFormat theFormat)
Parse the RDF from the given `String` input and return the resulting statements using the default parsing optionsstatic java.util.Set<Statement>
read(java.lang.String theInput, RDFFormat theFormat, Options theOptions)
Parser the RDF from the given `String` input and return the resulting statements.static java.util.Set<Statement>
read(java.nio.file.Path thePath)
Parse the RDF in the specified file and return the resulting statements.static java.util.Set<Statement>
read(java.nio.file.Path thePath, RDFFormat theFormat)
Parse the RDF in the specified file and return the resulting statements.static java.util.Set<Statement>
read(java.nio.file.Path thePath, RDFFormat theFormat, Options theOptions)
Parse the RDF in the specified file and return the resulting statementsstatic <T> T
read(java.nio.file.Path thePath, RDFFormat theFormat, Options theOptions, CollectingRDFHandler<T> theHandler)
Parse the RDF in the specified filestatic void
register(RDFParser theParser)
-
-
-
Method Detail
-
register
public static void register(RDFParser theParser)
-
forFormat
@Nonnull public static java.util.Optional<RDFParser> forFormat(@Nonnull RDFFormat theFormat)
Return theparser
associated with the given format- Parameters:
theFormat
- the format you wish to parse- Returns:
- the parser for the format
-
read
@Nonnull public static java.util.Set<Statement> read(@Nonnull java.io.InputStream theStream, @Nonnull RDFFormat theFormat) throws java.io.IOException
Parse the RDF from theinput
and return the resulting statements- Parameters:
theStream
- the `InputStream` to read fromtheFormat
- the format of the RDF- Returns:
- the parsed RDF
- Throws:
java.io.IOException
- if there was an error while reading from the streamInvalidRDF
- if the RDF syntax was invalid wrt to theformat
java.lang.IllegalArgumentException
- if there is no known parser for the `RDFFormat`
-
read
@Nonnull public static java.util.Set<Statement> read(@Nonnull java.lang.String theInput, @Nonnull RDFFormat theFormat) throws java.io.IOException
Parse the RDF from the given `String` input and return the resulting statements using the default parsing options- Parameters:
theInput
- the RDF inputtheFormat
- the format for the RDF- Returns:
- the parsed statements
- Throws:
java.io.IOException
- if there was an error while reading from the streamInvalidRDF
- if the RDF syntax was invalid wrt to theformat
java.lang.IllegalArgumentException
- if there is no known parser for the `RDFFormat`
-
read
@Nonnull public static java.util.Set<Statement> read(@Nonnull java.lang.String theInput, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions) throws java.io.IOException
Parser the RDF from the given `String` input and return the resulting statements.- Parameters:
theInput
- the RDF inputtheFormat
- the format for the RDFtheOptions
- the parser options- Returns:
- the parsed statements
- Throws:
java.io.IOException
- if there was an error while reading from the streamInvalidRDF
- if the RDF syntax was invalid wrt to theformat
java.lang.IllegalArgumentException
- if there is no known parser for the `RDFFormat`
-
read
@Nonnull public static java.util.Set<Statement> read(@Nonnull java.io.InputStream theStream, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions) throws java.io.IOException
Parse the RDF from theinput
and return the resulting statements- Parameters:
theStream
- the `InputStream` to read fromtheFormat
- the format of the RDFtheOptions
- the parser options- Returns:
- the parsed RDF
- Throws:
java.io.IOException
- if there was an error while reading from the streamInvalidRDF
- if the RDF syntax was invalid wrt to theformat
java.lang.IllegalArgumentException
- if there is no known parser for the `RDFFormat`
-
read
@Nonnull public static java.util.Set<Statement> read(@Nonnull java.nio.file.Path thePath) throws java.io.IOException
Parse the RDF in the specified file and return the resulting statements.- Parameters:
thePath
- the file to read from- Returns:
- the parsed statements
- Throws:
java.io.IOException
- if there is an error opening or reading from the fileInvalidRDF
- if the RDF syntax was invalid wrt to theformat
java.lang.IllegalArgumentException
- if there is no known parser for the `RDFFormat` or the file uses an unknown RDF format
-
read
@Nonnull public static java.util.Set<Statement> read(@Nonnull java.nio.file.Path thePath, @Nonnull RDFFormat theFormat) throws java.io.IOException
Parse the RDF in the specified file and return the resulting statements.- Parameters:
thePath
- the file to read fromtheFormat
- the RDF format- Returns:
- the parsed statements
- Throws:
java.io.IOException
- if there is an error opening or reading from the fileInvalidRDF
- if the RDF syntax was invalid wrt to theformat
java.lang.IllegalArgumentException
- if there is no known parser for the `RDFFormat` or the file uses an unknown RDF format
-
read
@Nonnull public static java.util.Set<Statement> read(@Nonnull java.nio.file.Path thePath, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions) throws java.io.IOException
Parse the RDF in the specified file and return the resulting statements- Parameters:
thePath
- the file to read fromtheFormat
- the RDF formattheOptions
- the parser options- Returns:
- the parsed statements
- Throws:
java.io.IOException
- if there is an error opening or reading from the fileInvalidRDF
- if the RDF syntax was invalid wrt to theformat
java.lang.IllegalArgumentException
- if there is no known parser for the `RDFFormat`
-
read
public static <T> T read(@Nonnull java.nio.file.Path thePath, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions, @Nonnull CollectingRDFHandler<T> theHandler) throws java.io.IOException
Parse the RDF in the specified file- Parameters:
thePath
- the file whose contents should be parsetheFormat
- the RDF format of the filetheOptions
- the parser optionstheHandler
- the handler of the parsed results- Returns:
- the result
- Throws:
java.io.IOException
- if there is an error opening or reading from the fileInvalidRDF
- if the RDF syntax was invalid wrt to theformat
java.lang.IllegalArgumentException
- if there is no known parser for the `RDFFormat`
-
read
public static <T> T read(@Nonnull java.io.InputStream theStream, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions, @Nonnull CollectingRDFHandler<T> theHandler) throws java.io.IOException
Parse the RDF from the specified stream- Parameters:
theStream
- the stream whose contents should be parsedtheFormat
- the RDF format of the filetheOptions
- the parser optionstheHandler
- the handler of the parsed results- Returns:
- the result
- Throws:
java.io.IOException
- if there is an error opening or reading from the fileInvalidRDF
- if the RDF syntax was invalid wrt to theformat
java.lang.IllegalArgumentException
- if there is no known parser for the `RDFFormat`
-
read
public static void read(@Nonnull java.io.InputStream theStream, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions, @Nonnull RDFHandler theHandler) throws java.io.IOException
Parse the RDF from the specified stream- Parameters:
theStream
- the stream whose contents should be parsedtheFormat
- the RDF format of the filetheOptions
- the parser optionstheHandler
- the handler of the parsed results- Throws:
java.io.IOException
- if there is an error opening or reading from the fileInvalidRDF
- if the RDF syntax was invalid wrt to theformat
java.lang.IllegalArgumentException
- if there is no known parser for the `RDFFormat`
-
-