Reads RDF statements from a Notation 3 (N3, Turtle, or NTriples) stream.
|
Most of the N3 specification is supported, including everything in NTriples and Turtle. Statements are streamed as soon as they are read from the stream.
N3 formula notation with { and } is supported in the following way. For every formula, an anonymous entity is created to represent that graph. Every statement in the formula is imported with the SemWeb.Statement.Meta property set to the anonymous entity (unless it is recursively embedded in another formula, in which case it uses the innermost formula's anonymous entity).
The following example reads a N-Triples, Turtle, or N3 file from disk:
C# Example |
using (RdfReader data = new N3Reader("filename.n3")) { store.Import(data); } |
Once the document is fully read, all namespace declarations in the document are available in the SemWeb.RdfReader.Namespaces property and can be copied into the namespace manager of a SemWeb.RdfWriter using the SemWeb.NamespaceManager.AddFrom(SemWeb.NamespaceManager) method.
See Also: Inherited members from RdfReader.
Creates a new N3 parser for a stream. |
Creates a new N3 parser for the given file. |
BaseUri
|
string . The base URI for resolving relative URIs found in the stream. If a base URI is provided within the stream, this property may be updated to indicate the base URI found. (Inherited from RdfReader.) |
Meta
|
Entity . An entity to assign as the meta entity for statements loaded by this reader. (Inherited from RdfReader.) |
Namespaces [read-only] | NamespaceManager . Gets the NamespaceManager that contains all of the namespace-prefix mappings used in the input stream. (Inherited from RdfReader.) |
ReuseEntities
|
bool . Determines whether the reader must reuse Entity objects that it creates. (Inherited from RdfReader.) |
Variables [read-only] | System.Collections.Generic.ICollection<SemWeb.Variable> . A list of SemWeb.Variables found in the stream. (Inherited from RdfReader.) |
Warnings [read-only] | System.Collections.Generic.ICollection<System.String> . Gets a list of warnings generated while parsing the input stream. (Inherited from RdfReader.) |
Dispose
() Disposes the reader. (Inherited from RdfReader.) |
|
abstract |
Select
(StatementSink) Reads the stream into the statement sink. (Inherited from RdfReader.) |
Creates a new N3 parser for a stream.
Creates a new N3 parser for the given file.