Class BaseFormatter
Abstract Base Class for Formatters.
Inheritance
Inherited Members
Namespace: VDS.RDF.Writing.Formatting
Assembly: dotNetRdf.dll
Syntax
public abstract class BaseFormatter : INodeFormatter, ITripleFormatter, IUriFormatter, ICharFormatter, IResultFormatter
Constructors
| Improve this Doc View SourceBaseFormatter(string)
Creates a new Formatter.
Declaration
public BaseFormatter(string formatName)
Parameters
Type | Name | Description |
---|---|---|
string | formatName | Format Name. |
Properties
| Improve this Doc View SourceFormatName
Gets the Format Name.
Declaration
public string FormatName { get; }
Property Value
Type | Description |
---|---|
string |
Methods
| Improve this Doc View SourceEscape(string, List<string[]>)
Applies escapes to the given value.
Declaration
protected string Escape(string value, List<string[]> escapes)
Parameters
Type | Name | Description |
---|---|---|
string | value | Value. |
System.Collections.Generic.List<T><string[]> | escapes | Escapes. |
Returns
Type | Description |
---|---|
string | Escaped string. |
Format(INode, TripleSegment?)
Formats a Node as a String.
Declaration
public virtual string Format(INode n, TripleSegment? segment)
Parameters
Type | Name | Description |
---|---|---|
INode | n | Node. |
TripleSegment? | segment | Triple Segment. |
Returns
Type | Description |
---|---|
string |
Format(INode)
Formats a Node as a String.
Declaration
public virtual string Format(INode n)
Parameters
Type | Name | Description |
---|---|---|
INode | n | Node. |
Returns
Type | Description |
---|---|
string |
Format(ISparqlResult)
Formats a SPARQL Result for the given format.
Declaration
public virtual string Format(ISparqlResult result)
Parameters
Type | Name | Description |
---|---|---|
ISparqlResult | result | SPARQL Result. |
Returns
Type | Description |
---|---|
string |
Format(Triple, IRefNode)
Formats a triple in the context of a graph as a string.
Declaration
public virtual string Format(Triple t, IRefNode graph)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | The triple. |
IRefNode | graph | The graph containing the triple. |
Returns
Type | Description |
---|---|
string |
Format(Triple)
Formats a Triple as a String.
Declaration
public virtual string Format(Triple t)
Parameters
Type | Name | Description |
---|---|---|
Triple | t | Triple. |
Returns
Type | Description |
---|---|
string |
FormatBlankNode(IBlankNode, TripleSegment?)
Formats a Blank Node as a String for the given Format.
Declaration
protected virtual string FormatBlankNode(IBlankNode b, TripleSegment? segment)
Parameters
Type | Name | Description |
---|---|---|
IBlankNode | b | Blank Node. |
TripleSegment? | segment | Triple Segment. |
Returns
Type | Description |
---|---|
string |
FormatBooleanResult(bool)
Formats a SPARQL Boolean Result for the given format.
Declaration
public virtual string FormatBooleanResult(bool result)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | result | Boolean Result. |
Returns
Type | Description |
---|---|
string |
FormatChar(char)
Formats a Character for the given Format.
Declaration
[Obsolete("This form of the FormatChar() method is considered obsolete as it is inefficient", true)]
public virtual string FormatChar(char c)
Parameters
Type | Name | Description |
---|---|---|
char | c | Character. |
Returns
Type | Description |
---|---|
string |
FormatChar(char[])
Formats a sequence of characters as a String.
Declaration
public virtual string FormatChar(char[] cs)
Parameters
Type | Name | Description |
---|---|---|
char[] | cs | Characters. |
Returns
Type | Description |
---|---|
string | String. |
FormatGraphLiteralNode(IGraphLiteralNode, TripleSegment?)
Formats a Graph Literal Node as a String for the given Format.
Declaration
protected virtual string FormatGraphLiteralNode(IGraphLiteralNode glit, TripleSegment? segment)
Parameters
Type | Name | Description |
---|---|---|
IGraphLiteralNode | glit | Graph Literal. |
TripleSegment? | segment | Triple Segment. |
Returns
Type | Description |
---|---|
string |
FormatLiteralNode(ILiteralNode, TripleSegment?)
Formats a Literal Node as a String for the given Format.
Declaration
protected abstract string FormatLiteralNode(ILiteralNode l, TripleSegment? segment)
Parameters
Type | Name | Description |
---|---|---|
ILiteralNode | l | Literal Node. |
TripleSegment? | segment | Triple Segment. |
Returns
Type | Description |
---|---|
string |
FormatTripleNode(ITripleNode, TripleSegment?)
Formats a triple node a a string for the given format.
Declaration
protected virtual string FormatTripleNode(ITripleNode t, TripleSegment? segment)
Parameters
Type | Name | Description |
---|---|---|
ITripleNode | t | Triple node. |
TripleSegment? | segment | Triple segment being written. |
Returns
Type | Description |
---|---|
string |
Remarks
This method should be overridden in formatters that support serializing ITripleNodes.
FormatUri(string)
Formats a URI as a String for full Output.
Declaration
public virtual string FormatUri(string u)
Parameters
Type | Name | Description |
---|---|---|
string | u | URI. |
Returns
Type | Description |
---|---|
string |
FormatUri(Uri)
Formats a URI as a String for full Output.
Declaration
public virtual string FormatUri(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | URI. |
Returns
Type | Description |
---|---|
string |
FormatUriNode(IUriNode, TripleSegment?)
Formats a URI Node as a String for the given Format.
Declaration
protected abstract string FormatUriNode(IUriNode u, TripleSegment? segment)
Parameters
Type | Name | Description |
---|---|---|
IUriNode | u | URI Node. |
TripleSegment? | segment | Triple Segment. |
Returns
Type | Description |
---|---|
string |
FormatVariableNode(IVariableNode, TripleSegment?)
Formats a Variable Node as a String for the given Format.
Declaration
protected virtual string FormatVariableNode(IVariableNode v, TripleSegment? segment)
Parameters
Type | Name | Description |
---|---|---|
IVariableNode | v | Variable Name. |
TripleSegment? | segment | Triple Segment. |
Returns
Type | Description |
---|---|
string |
ToString()
Gets the Name of the Format this Format uses.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |