Package org.apache.jena.riot
Class RDFDataMgr
- java.lang.Object
-
- org.apache.jena.riot.RDFDataMgr
-
public class RDFDataMgr extends java.lang.Object
General purpose reader framework for RDF (triples and quads) syntaxes.
- HTTP Content negotiation
- File type hint by the extension
- Application language hint
It also provides a way to lookup names in different locations and to remap URIs to other URIs.
Extensible - a new syntax can be added to the framework.
Operations fall into the following categories:
read
-- Read data from a location into a Model, Dataset, etc. The methods in this class treat all types of Model in the same way. For behavior specific to a subtype of Model, use the methods of that specific class.loadXXX
-- Read data and return an in-memory object holding the data.parse
-- Read data and send to anStreamRDF
open
-- Open a typed input stream to the location, using any alternative locationswrite
-- Write Model/Dataset etccreate
-- Create a reader or writer explicitly
RDFDataMgr
provides single functions for many of the common application patterns. It is built on top ofRDFParser
for reading andRDFWriter
for output. Each of these classes has an associated builder that provides complete control over the parsing process. For example, to translate language tags to lower case on input:RDFParser.create() .source("myData.ttl") .langTagLowerCase() .parse(graph);
or to have Turtle written withBASE
andPREFIX
rather than@base
and@prefix
(both are legal Turtle):RDFWriter.create() .set(RIOT.symTurtleDirectiveStyle, "rdf11") .source(model) .output(System.out);
-
-
Constructor Summary
Constructors Constructor Description RDFDataMgr()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.util.Iterator<Quad>
createIteratorQuads(java.io.InputStream input, Lang lang, java.lang.String baseIRI)
Deprecated.static java.util.Iterator<Triple>
createIteratorTriples(java.io.InputStream input, Lang lang, java.lang.String baseIRI)
static Lang
determineLang(java.lang.String target, java.lang.String ctStr, Lang hintLang)
Determine the Lang, given the URI target, any content type header string and a hintstatic Dataset
loadDataset(java.lang.String uri)
Create a memory Dataset and read in some datastatic Dataset
loadDataset(java.lang.String uri, Lang lang)
Create a memory Dataset and read in some datastatic DatasetGraph
loadDatasetGraph(java.lang.String uri)
Create a memory DatasetGraph and read in some datastatic DatasetGraph
loadDatasetGraph(java.lang.String uri, Lang lang)
Create a memory DatasetGraph and read in some datastatic Graph
loadGraph(java.lang.String uri)
Create a memory Graph and read in some datastatic Graph
loadGraph(java.lang.String uri, Lang lang)
Create a memory Graph and read in some datastatic Model
loadModel(java.lang.String uri)
Create a memory Model and read in some datastatic Model
loadModel(java.lang.String uri, Lang lang)
Create a memory Model and read in some datastatic TypedInputStream
open(java.lang.String filenameOrURI)
Open a stream to the destination (URI or filename) Performs content negotiation, including looking at file extension.static TypedInputStream
open(java.lang.String filenameOrURI, StreamManager streamManager)
Open a stream to the destination (URI or filename) Performs content negotiation, including looking at file extension.static void
parse(StreamRDF sink, java.io.InputStream in, java.lang.String base, Lang hintLang)
Deprecated.To be removed.static void
parse(StreamRDF sink, java.io.InputStream in, Lang lang)
Deprecated.To be removed.static void
parse(StreamRDF sink, java.io.StringReader in, java.lang.String base, Lang hintLang)
Deprecated.To be removed.static void
parse(StreamRDF sink, java.io.StringReader in, Lang lang)
Deprecated.To be removed.static void
parse(StreamRDF dest, java.lang.String uri)
Read RDF data.static void
parse(StreamRDF sink, java.lang.String uri, java.lang.String base, Lang hintLang)
Deprecated.UseRDFParser.source(uri).base(base).lang(hintLang).parse(sink)
static void
parse(StreamRDF sink, java.lang.String uri, Lang lang)
Deprecated.UseRDFParser.source(uri).lang(hintLang).parse(sink)
static void
parse(StreamRDF sink, TypedInputStream in)
Deprecated.To be removed.static void
parse(StreamRDF sink, TypedInputStream in, java.lang.String base)
Deprecated.To be removed.static void
read(Graph graph, java.io.InputStream in, java.lang.String base, Lang lang)
Read triples into a Model with bytes from an InputStream.static void
read(Graph graph, java.io.InputStream in, Lang lang)
Read triples into a Model with bytes from an InputStream.static void
read(Graph graph, java.io.Reader in, java.lang.String base, Lang lang)
Deprecated.Use an InputStream or StringReader.static void
read(Graph graph, java.io.StringReader in, java.lang.String base, Lang lang)
Read triples into a model with chars from a StringReader.static void
read(Graph graph, java.lang.String uri)
Read triples into a Model from the given location.static void
read(Graph graph, java.lang.String uri, java.lang.String base, Lang hintLang)
Read triples into a Model from the given location, with a hint of language.static void
read(Graph graph, java.lang.String uri, Lang hintLang)
Read triples into a Model from the given location, with a hint of the language (MIME type or short name)static void
read(Dataset dataset, java.io.InputStream in, java.lang.String base, Lang lang)
Read quads or triples into a dataset with bytes from an input stream.static void
read(Dataset dataset, java.io.InputStream in, Lang lang)
Read quads or triples into a dataset with bytes from an input stream.static void
read(Dataset dataset, java.io.Reader in, java.lang.String base, Lang lang)
Deprecated.use an InputStream or a StringReader.static void
read(Dataset dataset, java.io.StringReader in, java.lang.String base, Lang lang)
Read quads into a dataset with chars from a StringReader.static void
read(Dataset dataset, java.lang.String uri)
Read quads or triples into a Dataset from the given location, with a hint of the language.static void
read(Dataset dataset, java.lang.String uri, java.lang.String base, Lang hintLang)
Read quads or triples into a Dataset from the given location, with a hint of the language.static void
read(Dataset dataset, java.lang.String uri, Lang hintLang)
Read quads or triples into a Dataset from the given location, with a hint of the language.static void
read(Model model, java.io.InputStream in, java.lang.String base, Lang lang)
Read triples into a Model with bytes from an InputStream.static void
read(Model model, java.io.InputStream in, Lang lang)
Read triples into a Model with bytes from an InputStream.static void
read(Model model, java.io.Reader in, java.lang.String base, Lang lang)
Deprecated.Use an InputStream or StringReader.static void
read(Model model, java.io.StringReader in, java.lang.String base, Lang lang)
Read triples into a model with chars from a StringReader.static void
read(Model model, java.lang.String uri)
Read triples into a Model from the given location.static void
read(Model model, java.lang.String uri, java.lang.String base, Lang hintLang)
Read triples into a Model from the given location, with a hint of language.static void
read(Model model, java.lang.String uri, Lang hintLang)
Read triples into a Model from the given location, with a hint of the language (MIME type)static void
read(DatasetGraph dataset, java.io.InputStream in, java.lang.String base, Lang lang)
Read quads or triples into a dataset with bytes from an input stream.static void
read(DatasetGraph dataset, java.io.InputStream in, Lang lang)
Read quads or triples into a dataset with bytes from an input stream.static void
read(DatasetGraph dataset, java.io.Reader in, java.lang.String base, Lang lang)
Deprecated.use an InputStream or a StringReader.static void
read(DatasetGraph dataset, java.io.StringReader in, java.lang.String base, Lang lang)
Read quads into a dataset with chars from a StringReader.static void
read(DatasetGraph dataset, java.lang.String uri)
Read quads or triples into a Dataset from the given location, with a hint of the language.static void
read(DatasetGraph dataset, java.lang.String uri, java.lang.String base, Lang hintLang)
Read quads or triples into a Dataset from the given location, with a hint of the language.static void
read(DatasetGraph dataset, java.lang.String uri, Lang hintLang)
Read quads or triples into a Dataset from the given location, with a hint of the language.static void
write(java.io.OutputStream out, Graph graph, Lang lang)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.OutputStream out, Graph graph, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.OutputStream out, Dataset dataset, Lang lang)
Write the Dataset to the output stream in the default serialization for the language.static void
write(java.io.OutputStream out, Dataset dataset, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.OutputStream out, Model model, Lang lang)
Write the model to the output stream in the default serialization for the language.static void
write(java.io.OutputStream out, Model model, RDFFormat serialization)
Write the model to the output stream in the default serialization for the language.static void
write(java.io.OutputStream out, DatasetGraph dataset, Lang lang)
Write the DatasetGraph to the output stream in the default serialization for the language.static void
write(java.io.OutputStream out, DatasetGraph dataset, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.StringWriter out, Graph graph, Lang lang)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.StringWriter out, Graph graph, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.StringWriter out, Dataset dataset, Lang lang)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.StringWriter out, Dataset dataset, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.StringWriter out, Model model, Lang lang)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.StringWriter out, Model model, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.StringWriter out, DatasetGraph dataset, Lang lang)
Write the DatasetGraph to the output stream in the default serialization for the language.static void
write(java.io.StringWriter out, DatasetGraph dataset, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.static void
write(java.io.Writer out, Graph graph, Lang lang)
Deprecated.Use of writers is deprecated - use anOutputStream
static void
write(java.io.Writer out, Graph graph, RDFFormat serialization)
Deprecated.Use of writers is deprecated - use anOutputStream
static void
write(java.io.Writer out, Dataset dataset, RDFFormat serialization)
Deprecated.Use of writers is deprecated - use anOutputStream
static void
write(java.io.Writer out, Model model, Lang lang)
Deprecated.Use of writers is deprecated - use anOutputStream
static void
write(java.io.Writer out, Model model, RDFFormat serialization)
Deprecated.Use of writers is deprecated - use anOutputStream
static void
write(java.io.Writer out, DatasetGraph dataset, RDFFormat serialization)
Deprecated.Use of writers is deprecated - use anOutputStream
static void
writeQuads(java.io.OutputStream out, java.util.Iterator<Quad> iterator)
Write an iterator of quads (in N-Quads)static void
writeTriples(java.io.OutputStream out, java.util.Iterator<Triple> iterator)
Write an iterator of triples (in N-Triples)
-
-
-
Method Detail
-
read
public static void read(Model model, java.lang.String uri)
Read triples into a Model from the given location. The syntax is determined from input source URI (content negotiation or file extension).- Parameters:
model
- Destination for the RDF read.uri
- URI to read from (includes file: and a plain file name).- Throws:
RiotNotFoundException
- if the location is not found - the model is unchanged.
-
read
public static void read(Graph graph, java.lang.String uri)
Read triples into a Model from the given location. The syntax is determined from input source URI (content negotiation or file extension).- Parameters:
graph
- Destination for the RDF read.uri
- URI to read from (includes file: and a plain file name).- Throws:
RiotNotFoundException
- if the location is not found - the graph is unchanged.
-
read
public static void read(Model model, java.lang.String uri, Lang hintLang)
Read triples into a Model from the given location, with a hint of the language (MIME type)- Parameters:
model
- Destination for the RDF read.uri
- URI to read from (includes file: and a plain file name).hintLang
- Hint for the syntax.- Throws:
RiotNotFoundException
- if the location is not found - the model is unchanged.
-
read
public static void read(Graph graph, java.lang.String uri, Lang hintLang)
Read triples into a Model from the given location, with a hint of the language (MIME type or short name)- Parameters:
graph
- Destination for the RDF read.uri
- URI to read from (includes file: and a plain file name).hintLang
- Hint for the syntax.- Throws:
RiotNotFoundException
- if the location is not found - the graph is unchanged.
-
read
public static void read(Model model, java.lang.String uri, java.lang.String base, Lang hintLang)
Read triples into a Model from the given location, with a hint of language. Throws parse errors depending on the language and reader; the model may be partially updated.- Parameters:
model
- Destination for the RDF read.uri
- URI to read from (includes file: and a plain file name).base
- Base URI (defaults to uri).hintLang
- Hint for the syntax- Throws:
RiotNotFoundException
- if the location is not found - the model is unchanged.
-
read
public static void read(Graph graph, java.lang.String uri, java.lang.String base, Lang hintLang)
Read triples into a Model from the given location, with a hint of language. Throws parse errors depending on the language and reader; the model may be partially updated.- Parameters:
graph
- Destination for the RDF read.uri
- URI to read from (includes file: and a plain file name).base
- Base URI (defaults to uri).hintLang
- Hint for the syntax- Throws:
RiotNotFoundException
- if the location is not found - the graph is unchanged.
-
read
public static void read(Model model, java.io.InputStream in, Lang lang)
Read triples into a Model with bytes from an InputStream. A base URI and a syntax can be provided. The base URI defaults to "no base" in which case the data should have no relative URIs. The lang gives the syntax of the stream.- Parameters:
model
- Destination for the RDF read.in
- InputStreamlang
- Language syntax
-
read
public static void read(Graph graph, java.io.InputStream in, Lang lang)
Read triples into a Model with bytes from an InputStream. A base URI and a syntax can be provided. The base URI defaults to "no base" in which case the data should have no relative URIs. The lang gives the syntax of the stream.- Parameters:
graph
- Destination for the RDF read.in
- InputStreamlang
- Language syntax
-
read
public static void read(Model model, java.io.InputStream in, java.lang.String base, Lang lang)
Read triples into a Model with bytes from an InputStream. A base URI and a syntax can be provided. The base URI defaults to "no base" in which case the data should have no relative URIs. The lang gives the syntax of the stream.- Parameters:
model
- Destination for the RDF read.in
- InputStreambase
- Base URIlang
- Language syntax
-
read
public static void read(Graph graph, java.io.InputStream in, java.lang.String base, Lang lang)
Read triples into a Model with bytes from an InputStream. A base URI and a syntax can be provided. The base URI defaults to "no base" in which case the data should have no relative URIs. The lang gives the syntax of the stream.- Parameters:
graph
- Destination for the RDF read.in
- InputStreambase
- Base URIlang
- Language syntax
-
read
@Deprecated public static void read(Model model, java.io.Reader in, java.lang.String base, Lang lang)
Deprecated.Use an InputStream or StringReader.Read triples into a model with chars from an Reader. Use of java.io.Readers is not encouraged - use with a StringReader is the primary use case. For files, open aFileInputStream
, not aReader
to ensure correct character set handling.- Parameters:
model
- Destination for the RDF read.in
- Readerbase
- Base URIlang
- Language syntax
-
read
@Deprecated public static void read(Graph graph, java.io.Reader in, java.lang.String base, Lang lang)
Deprecated.Use an InputStream or StringReader.Read triples into a model with chars from an Reader. Use of java.io.Readers is not encouraged - use with a StringReader is the primary use case. For files, open aFileInputStream
, not aReader
to ensure correct character set handling.- Parameters:
graph
- Destination for the RDF read.in
- Readerbase
- Base URIlang
- Language syntax
-
read
public static void read(Model model, java.io.StringReader in, java.lang.String base, Lang lang)
Read triples into a model with chars from a StringReader.- Parameters:
model
- Destination for the RDF read.in
- InputStreambase
- Base URIlang
- Language syntax
-
read
public static void read(Graph graph, java.io.StringReader in, java.lang.String base, Lang lang)
Read triples into a model with chars from a StringReader.- Parameters:
graph
- Destination for the RDF read.in
- InputStreambase
- Base URIlang
- Language syntax
-
loadModel
public static Model loadModel(java.lang.String uri)
Create a memory Model and read in some data- See Also:
read(Model,String)
-
loadModel
public static Model loadModel(java.lang.String uri, Lang lang)
Create a memory Model and read in some data- See Also:
read(Model,String,Lang)
-
loadGraph
public static Graph loadGraph(java.lang.String uri)
Create a memory Graph and read in some data- See Also:
read(Graph,String)
-
loadGraph
public static Graph loadGraph(java.lang.String uri, Lang lang)
Create a memory Graph and read in some data- See Also:
read(Graph,String,Lang)
-
loadDataset
public static Dataset loadDataset(java.lang.String uri)
Create a memory Dataset and read in some data- See Also:
read(Dataset,String,Lang)
-
loadDataset
public static Dataset loadDataset(java.lang.String uri, Lang lang)
Create a memory Dataset and read in some data- See Also:
read(Dataset,String,Lang)
-
loadDatasetGraph
public static DatasetGraph loadDatasetGraph(java.lang.String uri)
Create a memory DatasetGraph and read in some data- See Also:
read(DatasetGraph,String)
-
loadDatasetGraph
public static DatasetGraph loadDatasetGraph(java.lang.String uri, Lang lang)
Create a memory DatasetGraph and read in some data- See Also:
read(DatasetGraph,String,Lang)
-
read
public static void read(Dataset dataset, java.lang.String uri)
Read quads or triples into a Dataset from the given location, with a hint of the language.- Parameters:
dataset
- Destinationuri
- URI to read from (includes file: and a plain file name).
-
read
public static void read(DatasetGraph dataset, java.lang.String uri)
Read quads or triples into a Dataset from the given location, with a hint of the language.- Parameters:
dataset
- Destinationuri
- URI to read from (includes file: and a plain file name).
-
read
public static void read(Dataset dataset, java.lang.String uri, Lang hintLang)
Read quads or triples into a Dataset from the given location, with a hint of the language.- Parameters:
dataset
- Destinationuri
- URI to read from (includes file: and a plain file name).hintLang
- Language syntax
-
read
public static void read(DatasetGraph dataset, java.lang.String uri, Lang hintLang)
Read quads or triples into a Dataset from the given location, with a hint of the language.- Parameters:
dataset
- Destinationuri
- URI to read from (includes file: and a plain file name).hintLang
- Language syntax
-
read
public static void read(Dataset dataset, java.lang.String uri, java.lang.String base, Lang hintLang)
Read quads or triples into a Dataset from the given location, with a hint of the language.- Parameters:
dataset
- Destinationuri
- URI to read from (includes file: and a plain file name).base
- Base URI (defaults to uri).hintLang
- Language syntax
-
read
public static void read(DatasetGraph dataset, java.lang.String uri, java.lang.String base, Lang hintLang)
Read quads or triples into a Dataset from the given location, with a hint of the language.- Parameters:
dataset
- Destinationuri
- URI to read from (includes file: and a plain file name).base
- Base URI (defaults to uri).hintLang
- Language syntax
-
read
public static void read(Dataset dataset, java.io.InputStream in, Lang lang)
Read quads or triples into a dataset with bytes from an input stream.- Parameters:
dataset
- Destinationin
- InputStreamlang
- Language syntax
-
read
public static void read(DatasetGraph dataset, java.io.InputStream in, Lang lang)
Read quads or triples into a dataset with bytes from an input stream.- Parameters:
dataset
- Destinationin
- InputStreamlang
- Language syntax
-
read
public static void read(Dataset dataset, java.io.InputStream in, java.lang.String base, Lang lang)
Read quads or triples into a dataset with bytes from an input stream.- Parameters:
dataset
- Destinationin
- InputStreambase
- Base URIlang
- Language syntax
-
read
public static void read(DatasetGraph dataset, java.io.InputStream in, java.lang.String base, Lang lang)
Read quads or triples into a dataset with bytes from an input stream.- Parameters:
dataset
- Destinationin
- InputStreambase
- Base URIlang
- Language syntax
-
read
@Deprecated public static void read(Dataset dataset, java.io.Reader in, java.lang.String base, Lang lang)
Deprecated.use an InputStream or a StringReader.Read quads into a dataset with chars from an Reader. Use java.io.Readers is not encouraged - use with a StringReader is the primary use case. For files, open aFileInputStream
to ensure correct character set handling.- Parameters:
dataset
- Destinationin
- InputStreambase
- Base URIlang
- Language syntax
-
read
@Deprecated public static void read(DatasetGraph dataset, java.io.Reader in, java.lang.String base, Lang lang)
Deprecated.use an InputStream or a StringReader.Read quads into a dataset with chars from an Reader. Use java.io.Readers is not encouraged - use with a StringReader is the primary use case. For files, open aFileInputStream
to ensure correct character set handling.- Parameters:
dataset
- Destinationin
- InputStreambase
- Base URIlang
- Language syntax
-
read
public static void read(Dataset dataset, java.io.StringReader in, java.lang.String base, Lang lang)
Read quads into a dataset with chars from a StringReader. Use java.io.Readers is not encouraged - use with a StringReader is the primary use case. For files, open aFileInputStream
to ensure correct character set handling.- Parameters:
dataset
- Destinationin
- InputStreambase
- Base URIlang
- Language syntax
-
read
public static void read(DatasetGraph dataset, java.io.StringReader in, java.lang.String base, Lang lang)
Read quads into a dataset with chars from a StringReader. Use java.io.Readers is not encouraged - use with a StringReader is the primary use case. For files, open aFileInputStream
to ensure correct character set handling.- Parameters:
dataset
- Destinationin
- InputStreambase
- Base URIlang
- Language syntax
-
parse
public static void parse(StreamRDF dest, java.lang.String uri)
Read RDF data. Short forRDFParser.source(uri).parse(dest)
- Parameters:
dest
- Destination for the RDF read.uri
- URI to read from (includes file: and a plain file name).
-
parse
@Deprecated public static void parse(StreamRDF sink, java.lang.String uri, Lang lang)
Deprecated.UseRDFParser.source(uri).lang(hintLang).parse(sink)
Read RDF data.- Parameters:
sink
- Destination for the RDF read.uri
- URI to read from (includes file: and a plain file name).lang
- Hint for the syntax
-
parse
@Deprecated public static void parse(StreamRDF sink, java.lang.String uri, java.lang.String base, Lang hintLang)
Deprecated.UseRDFParser.source(uri).base(base).lang(hintLang).parse(sink)
Read RDF data.- Parameters:
sink
- Destination for the RDF read.uri
- URI to read from (includes file: and a plain file name).base
- Base URI (defaults to uri).hintLang
- Hint for the syntax
-
parse
@Deprecated public static void parse(StreamRDF sink, java.io.InputStream in, Lang lang)
Deprecated.To be removed. UseRDFParser.source(in).lang(lang).parse(sink)
Read RDF data.- Parameters:
sink
- Destination for the RDF read.in
- Bytes to read.lang
- Syntax for the stream.
-
parse
@Deprecated public static void parse(StreamRDF sink, java.io.InputStream in, java.lang.String base, Lang hintLang)
Deprecated.To be removed. UseRDFParser.source(in).lang(lang).base(base).parse(sink)
Read RDF data.- Parameters:
sink
- Destination for the RDF read.in
- Bytes to read.base
- Base URI (defaults to uri).hintLang
- Hint for the syntax
-
parse
@Deprecated public static void parse(StreamRDF sink, java.io.StringReader in, Lang lang)
Deprecated.To be removed. UseRDFParser.create().source(in).lang(hintLang)...
Read RDF data.- Parameters:
sink
- Destination for the RDF read.in
- StringReaderlang
- Syntax for the stream.
-
parse
@Deprecated public static void parse(StreamRDF sink, java.io.StringReader in, java.lang.String base, Lang hintLang)
Deprecated.To be removed. UseRDFParser.create().source(in).base(base).lang(hintLang).parse(sink)
Read RDF data.- Parameters:
sink
- Destination for the RDF read.in
- Readerbase
- Base URI (defaults to uri).hintLang
- Hint for the syntax
-
parse
@Deprecated public static void parse(StreamRDF sink, TypedInputStream in)
Deprecated.To be removed. Use anInputStream
andRDFParser.source(in).lang(hintLang).parse(sink)
Read RDF data.- Parameters:
sink
- Destination for the RDF read.in
- Bytes to read. This must include the content type.
-
parse
@Deprecated public static void parse(StreamRDF sink, TypedInputStream in, java.lang.String base)
Deprecated.To be removed. Use anInputStream
andRDFParser.source(in).base(base).lang(lang).parse(sink)
Read RDF data.- Parameters:
sink
- Destination for the RDF read.in
- Bytes to read.base
- Base URI
-
open
public static TypedInputStream open(java.lang.String filenameOrURI)
Open a stream to the destination (URI or filename) Performs content negotiation, including looking at file extension.- Parameters:
filenameOrURI
-- Returns:
- TypedInputStream
-
open
public static TypedInputStream open(java.lang.String filenameOrURI, StreamManager streamManager)
Open a stream to the destination (URI or filename) Performs content negotiation, including looking at file extension.- Parameters:
filenameOrURI
-streamManager
-- Returns:
- TypedInputStream
-
determineLang
public static Lang determineLang(java.lang.String target, java.lang.String ctStr, Lang hintLang)
Determine the Lang, given the URI target, any content type header string and a hint
-
write
public static void write(java.io.OutputStream out, Model model, Lang lang)
Write the model to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreammodel
- Graph to writelang
- Language for the serialization.
-
write
public static void write(java.io.OutputStream out, Model model, RDFFormat serialization)
Write the model to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreammodel
- Model to writeserialization
- Serialization format
-
write
public static void write(java.io.StringWriter out, Model model, Lang lang)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- StringWritermodel
- Model to writelang
- Serialization format
-
write
@Deprecated public static void write(java.io.Writer out, Model model, Lang lang)
Deprecated.Use of writers is deprecated - use anOutputStream
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- Writermodel
- Model to writelang
- Serialization format
-
write
public static void write(java.io.StringWriter out, Model model, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- StringWritermodel
- Model to writeserialization
- Serialization format
-
write
@Deprecated public static void write(java.io.Writer out, Model model, RDFFormat serialization)
Deprecated.Use of writers is deprecated - use anOutputStream
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreammodel
- Model to writeserialization
- Serialization format
-
write
public static void write(java.io.OutputStream out, Graph graph, Lang lang)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreamgraph
- Graph to writelang
- Language for the serialization.
-
write
public static void write(java.io.OutputStream out, Graph graph, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreamgraph
- Graph to writeserialization
- Serialization format
-
write
public static void write(java.io.StringWriter out, Graph graph, Lang lang)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- StringWritergraph
- Graph to writelang
- Serialization format
-
write
@Deprecated public static void write(java.io.Writer out, Graph graph, Lang lang)
Deprecated.Use of writers is deprecated - use anOutputStream
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- Writergraph
- Graph to writelang
- Serialization format
-
write
public static void write(java.io.StringWriter out, Graph graph, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreamgraph
- Graph to writeserialization
- Serialization format
-
write
@Deprecated public static void write(java.io.Writer out, Graph graph, RDFFormat serialization)
Deprecated.Use of writers is deprecated - use anOutputStream
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreamgraph
- Graph to writeserialization
- Serialization format
-
write
public static void write(java.io.OutputStream out, Dataset dataset, Lang lang)
Write the Dataset to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreamdataset
- Dataset to writelang
- Language for the serialization.
-
write
public static void write(java.io.OutputStream out, Dataset dataset, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreamdataset
- Dataset to writeserialization
- Serialization format
-
write
public static void write(java.io.StringWriter out, Dataset dataset, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- Writerdataset
- Dataset to writeserialization
- Serialization format
-
write
public static void write(java.io.StringWriter out, Dataset dataset, Lang lang)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- StringWriterdataset
- Dataset to writelang
- Language for the serialization.
-
write
@Deprecated public static void write(java.io.Writer out, Dataset dataset, RDFFormat serialization)
Deprecated.Use of writers is deprecated - use anOutputStream
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- Writerdataset
- Dataset to writeserialization
- Serialization format
-
write
public static void write(java.io.OutputStream out, DatasetGraph dataset, Lang lang)
Write the DatasetGraph to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreamdataset
- DatasetGraph to writelang
- Language for the serialization.
-
write
public static void write(java.io.OutputStream out, DatasetGraph dataset, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- OutputStreamdataset
- DatasetGraph to writeserialization
- Serialization format
-
write
public static void write(java.io.StringWriter out, DatasetGraph dataset, Lang lang)
Write the DatasetGraph to the output stream in the default serialization for the language.- Parameters:
out
- StringWriterdataset
- DatasetGraph to writelang
- Language for the serialization.
-
write
public static void write(java.io.StringWriter out, DatasetGraph dataset, RDFFormat serialization)
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- StringWriterdataset
- DatasetGraph to writeserialization
- Serialization format
-
write
@Deprecated public static void write(java.io.Writer out, DatasetGraph dataset, RDFFormat serialization)
Deprecated.Use of writers is deprecated - use anOutputStream
Write the graph to the output stream in the default serialization for the language.- Parameters:
out
- Writerdataset
- DatasetGraph to writeserialization
- Serialization format
-
writeTriples
public static void writeTriples(java.io.OutputStream out, java.util.Iterator<Triple> iterator)
Write an iterator of triples (in N-Triples)- Parameters:
out
-iterator
-
-
writeQuads
public static void writeQuads(java.io.OutputStream out, java.util.Iterator<Quad> iterator)
Write an iterator of quads (in N-Quads)- Parameters:
out
-iterator
-
-
createIteratorTriples
@Deprecated public static java.util.Iterator<Triple> createIteratorTriples(java.io.InputStream input, Lang lang, java.lang.String baseIRI)
Deprecated.Create an iterator over parsing of triples. This function creates a thread unless the Lang is N-Triples.- Parameters:
input
- Input Streamlang
- LanguagebaseIRI
- Base IRI- Returns:
- Iterator over the triples
-
createIteratorQuads
@Deprecated public static java.util.Iterator<Quad> createIteratorQuads(java.io.InputStream input, Lang lang, java.lang.String baseIRI)
Deprecated.Creates an iterator over parsing of quads. This function creates a thread unless the Lang is N-Quads.- Parameters:
input
- Input Streamlang
- LanguagebaseIRI
- Base IRI- Returns:
- Iterator over the quads
-
-