Show / Hide Table of Contents

Class TriGWriter

Class for writing a Triple Store in named Graph TriG syntax to a file/stream.

Inheritance
System.Object
BaseStoreWriter
TriGWriter
Implements
IStoreWriter
IHighSpeedWriter
IPrettyPrintingWriter
ICompressingWriter
IMultiThreadedWriter
Inherited Members
BaseStoreWriter.Save(ITripleStore, string)
BaseStoreWriter.Save(ITripleStore, string, Encoding)
BaseStoreWriter.Save(ITripleStore, TextWriter)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: VDS.RDF.Writing
Assembly: dotNetRdf.dll
Syntax
public class TriGWriter : BaseStoreWriter, IStoreWriter, IHighSpeedWriter, IPrettyPrintingWriter, ICompressingWriter, IMultiThreadedWriter
Remarks

For efficiency the TriG Writer splits it's writing over several threads (currently 4), these threads share a reference to a Context object which gives Global writing context eg. the target System.IO.TextWriter being written to. Each thread generates temporary local writing contexts as it goes along, each of these is scoped to writing a specific Graph. Graphs are written to a StringWriter so the output for each Graph is built completely and then written in one go to the System.IO.TextWriter specified as the target of the writing in the global context.

Properties

| Improve this Doc View Source

CompressionLevel

Gets/Sets the Compression Level for the writer.

Declaration
public int CompressionLevel { get; set; }
Property Value
Type Description
int
Remarks

For efficiency the TriG Writer splits it's writing over several threads (currently 4), these threads share a reference to a Context object which gives Global writing context eg. the target System.IO.TextWriter being written to. Each thread generates temporary local writing contexts as it goes along, each of these is scoped to writing a specific Graph. Graphs are written to a StringWriter so the output for each Graph is built completely and then written in one go to the System.IO.TextWriter specified as the target of the writing in the global context.

| Improve this Doc View Source

HighSpeedModePermitted

Gets/Sets whether High Speed Write Mode is permitted.

Declaration
public bool HighSpeedModePermitted { get; set; }
Property Value
Type Description
System.Boolean
Remarks

For efficiency the TriG Writer splits it's writing over several threads (currently 4), these threads share a reference to a Context object which gives Global writing context eg. the target System.IO.TextWriter being written to. Each thread generates temporary local writing contexts as it goes along, each of these is scoped to writing a specific Graph. Graphs are written to a StringWriter so the output for each Graph is built completely and then written in one go to the System.IO.TextWriter specified as the target of the writing in the global context.

| Improve this Doc View Source

N3CompatibilityMode

Gets/Sets whether N3 Compatibility Mode is used, in this mode an = is written after Graph Names so an N3 parser can read the TriG file correctly.

Declaration
public bool N3CompatibilityMode { get; set; }
Property Value
Type Description
System.Boolean
Remarks

Defaults to false from the 0.4.1 release onwards.

| Improve this Doc View Source

PrettyPrintMode

Gets/Sets whether Pretty Printing is used.

Declaration
public bool PrettyPrintMode { get; set; }
Property Value
Type Description
System.Boolean
Remarks

For efficiency the TriG Writer splits it's writing over several threads (currently 4), these threads share a reference to a Context object which gives Global writing context eg. the target System.IO.TextWriter being written to. Each thread generates temporary local writing contexts as it goes along, each of these is scoped to writing a specific Graph. Graphs are written to a StringWriter so the output for each Graph is built completely and then written in one go to the System.IO.TextWriter specified as the target of the writing in the global context.

| Improve this Doc View Source

Syntax

Get/Sets the syntax mode for the writer.

Declaration
public TriGSyntax Syntax { get; set; }
Property Value
Type Description
TriGSyntax
Remarks

For efficiency the TriG Writer splits it's writing over several threads (currently 4), these threads share a reference to a Context object which gives Global writing context eg. the target System.IO.TextWriter being written to. Each thread generates temporary local writing contexts as it goes along, each of these is scoped to writing a specific Graph. Graphs are written to a StringWriter so the output for each Graph is built completely and then written in one go to the System.IO.TextWriter specified as the target of the writing in the global context.

| Improve this Doc View Source

UseMultiThreadedWriting

Gets/Sets whether multi-threaded writing will be used to generate output faster.

Declaration
public bool UseMultiThreadedWriting { get; set; }
Property Value
Type Description
System.Boolean
Remarks

For efficiency the TriG Writer splits it's writing over several threads (currently 4), these threads share a reference to a Context object which gives Global writing context eg. the target System.IO.TextWriter being written to. Each thread generates temporary local writing contexts as it goes along, each of these is scoped to writing a specific Graph. Graphs are written to a StringWriter so the output for each Graph is built completely and then written in one go to the System.IO.TextWriter specified as the target of the writing in the global context.

Methods

| Improve this Doc View Source

Save(ITripleStore, TextWriter, bool)

Saves a Store in TriG (Turtle with Named Graphs) format.

Declaration
public override void Save(ITripleStore store, TextWriter writer, bool leaveOpen)
Parameters
Type Name Description
ITripleStore store

Store to save.

System.IO.TextWriter writer

Writer to save to.

System.Boolean leaveOpen

Boolean flag indicating if writer should be left open after the store is saved.

Overrides
BaseStoreWriter.Save(ITripleStore, TextWriter, bool)
Remarks

For efficiency the TriG Writer splits it's writing over several threads (currently 4), these threads share a reference to a Context object which gives Global writing context eg. the target System.IO.TextWriter being written to. Each thread generates temporary local writing contexts as it goes along, each of these is scoped to writing a specific Graph. Graphs are written to a StringWriter so the output for each Graph is built completely and then written in one go to the System.IO.TextWriter specified as the target of the writing in the global context.

| Improve this Doc View Source

ToString()

Gets the String representation of the writer which is a description of the syntax it produces.

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
object.ToString()
Remarks

For efficiency the TriG Writer splits it's writing over several threads (currently 4), these threads share a reference to a Context object which gives Global writing context eg. the target System.IO.TextWriter being written to. Each thread generates temporary local writing contexts as it goes along, each of these is scoped to writing a specific Graph. Graphs are written to a StringWriter so the output for each Graph is built completely and then written in one go to the System.IO.TextWriter specified as the target of the writing in the global context.

Events

| Improve this Doc View Source

Warning

Event which writers can raise to indicate possible ambiguities or issues in the syntax they are producing

Declaration
public override event StoreWriterWarning Warning
Event Type
Type Description
StoreWriterWarning
Overrides
BaseStoreWriter.Warning
Remarks

For efficiency the TriG Writer splits it's writing over several threads (currently 4), these threads share a reference to a Context object which gives Global writing context eg. the target System.IO.TextWriter being written to. Each thread generates temporary local writing contexts as it goes along, each of these is scoped to writing a specific Graph. Graphs are written to a StringWriter so the output for each Graph is built completely and then written in one go to the System.IO.TextWriter specified as the target of the writing in the global context.

Implements

IStoreWriter
IHighSpeedWriter
IPrettyPrintingWriter
ICompressingWriter
IMultiThreadedWriter

Extension Methods

Extensions.ToSafeString(object)
Extensions.AsEnumerable<T>(T)
  • Improve this Doc
  • View Source
In This Article
  • Properties
    • CompressionLevel
    • HighSpeedModePermitted
    • N3CompatibilityMode
    • PrettyPrintMode
    • Syntax
    • UseMultiThreadedWriting
  • Methods
    • Save(ITripleStore, TextWriter, bool)
    • ToString()
  • Events
    • Warning
  • Implements
  • Extension Methods
Back to top Generated by DocFX