SemWeb : SemWeb Namespace
RdfXmlReader Class

Reads RDF statements from an RDF/XML file.

public class RdfXmlReader : RdfReader

Remarks

The RdfXmlReader streams the statements to the StatementSink as they are read from the XML stream. The entire XML document will not be loaded into memory.

The following example reads a RDF/XML file from disk:

C# Example
using (RdfReader data = new RdfXmlReader("filename.rdf")) {
    store.Import(data);
}  

It is strongly recommended that you use one of the constructors that takes a Base URI argument, or else set the Base URI of the reader before reading statements from it, so that relative URIs found in the document can be interpreted. If a BaseURI has not been set and a relative URI is encountered, parsing the document will fail.

The stream is begun to be read as soon as the constructor is called. Any namespace declarations found on the document element of the RDF/XML document will be available in the RdfXmlReader.Namespaces property once the constructor returns. 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.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.0, 1.0.6.2

Members

See Also: Inherited members from RdfReader.

Public Constructors

Creates a parser from a stream.
Creates a parser from a TextReader.
Creates a parser for a file.
Creates a parser for an XML document already loaded.
Creates a parser for an XmlReader.
Creates a parser from a stream with the given base URI.
Creates a parser from a TextReader with the given base URI.
Creates a parser from a file with the given base URI.

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

abstract
Select (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.)

Member Details

RdfXmlReader Constructor

Creates a parser from a stream.

public RdfXmlReader (System.IO.Stream document)

Parameters

document
The stream containing the RDF/XML file.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

RdfXmlReader Constructor

Creates a parser from a TextReader.

public RdfXmlReader (System.IO.TextReader document)

Parameters

document
The stream containing the RDF/XML file.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

RdfXmlReader Constructor

Creates a parser for a file.

public RdfXmlReader (string file)

Parameters

file
The path of the file containing RDF/XML, or "-" to read from Console.In.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

RdfXmlReader Constructor

Creates a parser for an XML document already loaded.

public RdfXmlReader (System.Xml.XmlDocument document)

Parameters

document
The RDF/XML document.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

RdfXmlReader Constructor

Creates a parser for an XmlReader.

public RdfXmlReader (System.Xml.XmlReader document)

Parameters

document
A stream containing the RDF/XML file.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

RdfXmlReader Constructor

Creates a parser from a stream with the given base URI.

public RdfXmlReader (System.IO.Stream document, string baseUri)

Parameters

document
The stream containing the RDF/XML file.
baseUri
The URI of the document itself, to be taken as the Base URI for relative URIs encoutered in the document.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

RdfXmlReader Constructor

Creates a parser from a TextReader with the given base URI.

public RdfXmlReader (System.IO.TextReader document, string baseUri)

Parameters

document
A TextReader containing the RDF/XML document.
baseUri
The URI of the document itself, to be taken as the Base URI for relative URIs encoutered in the document.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2

RdfXmlReader Constructor

Creates a parser from a file with the given base URI.

public RdfXmlReader (string file, string baseUri)

Parameters

file
The path of the file containing RDF/XML, or "-" to read from Console.In.
baseUri
The URI of the document itself, to be taken as the Base URI for relative URIs encoutered in the document.

Remarks

None.

Requirements

Namespace: SemWeb
Assembly: SemWeb (in SemWeb.dll)
Assembly Versions: 1.0.6.2