Show / Hide Table of Contents

Class BaseFormatter

Abstract Base Class for Formatters.

Inheritance
object
BaseFormatter
CsvFormatter
DeliminatedLineFormatter
NTriplesFormatter
QNameFormatter
Implements
INodeFormatter
ITripleFormatter
IUriFormatter
ICharFormatter
IResultFormatter
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: VDS.RDF.Writing.Formatting
Assembly: dotNetRdf.dll
Syntax
public abstract class BaseFormatter : INodeFormatter, ITripleFormatter, IUriFormatter, ICharFormatter, IResultFormatter

Constructors

| Edit this page View Source

BaseFormatter(string)

Creates a new Formatter.

Declaration
public BaseFormatter(string formatName)
Parameters
Type Name Description
string formatName

Format Name.

Properties

| Edit this page View Source

FormatName

Gets the Format Name.

Declaration
public string FormatName { get; }
Property Value
Type Description
string

Methods

| Edit this page View Source

Escape(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.

List<string[]> escapes

Escapes.

Returns
Type Description
string

Escaped string.

| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

FormatBooleanResult(bool)

Formats a SPARQL Boolean Result for the given format.

Declaration
public virtual string FormatBooleanResult(bool result)
Parameters
Type Name Description
bool result

Boolean Result.

Returns
Type Description
string
| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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
| Edit this page View Source

FormatUri(Uri)

Formats a URI as a String for full Output.

Declaration
public virtual string FormatUri(Uri u)
Parameters
Type Name Description
Uri u

URI.

Returns
Type Description
string
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

ToString()

Gets the Name of the Format this Format uses.

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

Implements

INodeFormatter
ITripleFormatter
IUriFormatter
ICharFormatter
IResultFormatter

Extension Methods

Extensions.ToSafeString(object)
Extensions.AsEnumerable<T>(T)
  • Edit this page
  • View Source
In this article
  • Constructors
    • BaseFormatter(string)
  • Properties
    • FormatName
  • Methods
    • Escape(string, List<string[]>)
    • Format(INode)
    • Format(INode, TripleSegment?)
    • Format(ISparqlResult)
    • Format(Triple)
    • Format(Triple, IRefNode)
    • FormatBlankNode(IBlankNode, TripleSegment?)
    • FormatBooleanResult(bool)
    • FormatChar(char)
    • FormatChar(char[])
    • FormatGraphLiteralNode(IGraphLiteralNode, TripleSegment?)
    • FormatLiteralNode(ILiteralNode, TripleSegment?)
    • FormatTripleNode(ITripleNode, TripleSegment?)
    • FormatUri(string)
    • FormatUri(Uri)
    • FormatUriNode(IUriNode, TripleSegment?)
    • FormatVariableNode(IVariableNode, TripleSegment?)
    • ToString()
  • Implements
  • Extension Methods
Back to top Generated by DocFX