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 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 RdfReader.Namespaces property and can be copied into the namespace manager of a SemWeb.RdfWriter using the NamespaceManager.AddFrom(NamespaceManager) method.
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.0, 1.0.6.2
See Also: Inherited members from RdfReader.
⊟ Public Constructors
Creates a new N3 parser for a stream. Creates a new N3 parser for the given file. ⊟ Public Properties
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.) [read-only] Namespaces 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.) ValidateLiterals bool . Gets or sets whether literal values should be validated. If set, warnings are issued for invalid literal values. (Inherited from RdfReader.) [read-only] Variables ICollection<Variable> . A list of SemWeb.Variables found in the stream. (Inherited from RdfReader.) [read-only] Warnings ICollection<string> . Gets a list of warnings generated while parsing the input stream. (Inherited from RdfReader.) ⊟ Public Methods
abstractSelect (StatementSink) Reads the stream into the statement sink. (Inherited from RdfReader.)⊟ Protected Methods
AddVariable (Variable) Adds a Variable to the Variables collection. (Inherited from RdfReader.)Dispose () Disposes the reader. (Inherited from RdfReader.)OnWarning (string) Implementors of RdfReader may call this method to indicate a parsing warning. (Inherited from RdfReader.)ValidateLiteral (Literal) If ValidateLiterals is true, checks that the literal's value is in the value space of the literal's datatype, if recognized, and issues a warning if not. (Inherited from RdfReader.)⊟ Explicitly Implemented Interface Members
IDisposable.Dispose Documentation for this section has not yet been entered. (Inherited from RdfReader.) [read-only] SemWeb.StatementSource.Distinct bool . Documentation for this section has not yet been entered. (Inherited from RdfReader.)
⊟ N3Reader Constructor
Creates a new N3 parser for a stream.
public N3Reader (System.IO.TextReader source)⊟ Parameters
- source
- The N3 stream to read.
⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2
⊟ N3Reader Constructor
Creates a new N3 parser for the given file.
public N3Reader (string sourcefile)⊟ Parameters
- sourcefile
- The name of a file, or "-" to read from Console.In.
⊟ Remarks
None.⊟ Requirements
Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2