|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IO
IO interface for reading RDF data from various input sources.
This interface is usually used in conjunction with Adder or Remover
to specify the RDF to be added/removed from the parent Connection
The IO object is stateful in that once you set the
context(org.openrdf.model.Resource) context} and/or
format(org.openrdf.rio.RDFFormat) format, you can repeatedly use the object
to read in RDF from a file or stream
using the same context/format.
Usage
Connection aConn = // obtain connection
aConn.add().io().format(RDFFormat.TURTLE).file(new File("mydata.ttl"));
// reuse the object
URI aContext = Values.uri("urn:context");
IO aIO = aConn.add().io();
aIO.format(RDFFormat.TURTLE)
.context(aCxt);
Collection aFiles = // get file list
for (File aFile : aFiles) {
// this will parse the file using the Turtle parser & put the resulting RDF
// into the previously specified context.
aIO.file(aFile);
}
Adder,
Remover| Method Summary | |
|---|---|
IO |
context(Resource theContext)
Set the context that will be applied to all statements created when the RDF is read in from the specified IO source. |
IO |
file(File theFile)
Load RDF data from this file. |
IO |
format(RDFFormat theFormat)
Specify that subsequent IO operations with this class will be parsed using this RDF format. |
IO |
stream(InputStream theStream)
Read RDF data from the provided InputStream. |
| Method Detail |
|---|
IO format(RDFFormat theFormat)
throws StardogException
theFormat - the RDF format to use
StardogException - if there is an error
IO stream(InputStream theStream)
throws StardogException
Read RDF data from the provided InputStream. You must have specified a
format(org.openrdf.rio.RDFFormat) before reading the RDF data.
The stream is closed after the content is parsed.
theStream - the stream
StardogException - if there is an errorformat(org.openrdf.rio.RDFFormat)
IO file(File theFile)
throws StardogException
Load RDF data from this file. You must have specified a
format(org.openrdf.rio.RDFFormat) format} before reading the RDF data.
theFile - the file to load from
StardogException - if there was an errorformat(org.openrdf.rio.RDFFormat)
IO context(Resource theContext)
throws StardogException
Set the context that will be applied to all statements created when the RDF is read in from the specified IO source. If you are using an RDF format which specifies a context, such as Trig or NQuads, the context on the parsed statements will override any specified context value.
theContext - the context for the statements
StardogException - if there was an error setting the context
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||