Class SparqlFormatter
Formatter for formatting Nodes for use in SPARQL and for formatting SPARQL Queries.
Implements
Inherited Members
Namespace: VDS.RDF.Writing.Formatting
Assembly: dotNetRdf.dll
Syntax
public class SparqlFormatter : TurtleFormatter, ITripleFormatter, ICharFormatter, INamespaceFormatter, IBaseUriFormatter, IQueryFormatter, INodeFormatter, IUriFormatter, IResultFormatter
Constructors
| Edit this page View SourceSparqlFormatter()
Creates a new SPARQL Formatter.
Declaration
public SparqlFormatter()
SparqlFormatter(IGraph)
Creates a new SPARQL Formatter using the given Graph.
Declaration
public SparqlFormatter(IGraph g)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | Graph. |
SparqlFormatter(INamespaceMapper)
Creates a new SPARQL Formatter using the given Namespace Map.
Declaration
public SparqlFormatter(INamespaceMapper nsmap)
Parameters
Type | Name | Description |
---|---|---|
INamespaceMapper | nsmap | Namespace Map. |
SparqlFormatter(INamespaceMapper, IUriFactory)
Creates a new SPARQL Formatter using the given Namespace Map.
Declaration
public SparqlFormatter(INamespaceMapper nsmap, IUriFactory uriFactory)
Parameters
Type | Name | Description |
---|---|---|
INamespaceMapper | nsmap | Namespace Map. |
IUriFactory | uriFactory | The factory to use when creating new Uri instances. |
SparqlFormatter(IUriFactory)
Creates a new SPARQL Formatter.
Declaration
public SparqlFormatter(IUriFactory uriFactory)
Parameters
Type | Name | Description |
---|---|---|
IUriFactory | uriFactory | The factory to use when creating new Uri instances. |
Methods
| Edit this page View SourceFormat(ISparqlResult)
Formats a SPARQL Result using this Formatter to format the Node values for each Variable.
Declaration
public override string Format(ISparqlResult result)
Parameters
Type | Name | Description |
---|---|---|
ISparqlResult | result | SPARQL Result. |
Returns
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceFormat(GraphPattern)
Formats a Graph Pattern in nicely formatted SPARQL syntax.
Declaration
public virtual string Format(GraphPattern gp)
Parameters
Type | Name | Description |
---|---|---|
GraphPattern | gp | Graph Pattern. |
Returns
Type | Description |
---|---|
string |
Format(ITriplePattern)
Formats a Triple Pattern in nicely formatted SPARQL syntax.
Declaration
public virtual string Format(ITriplePattern tp)
Parameters
Type | Name | Description |
---|---|---|
ITriplePattern | tp | Triple Pattern. |
Returns
Type | Description |
---|---|
string |
Format(PatternItem, TripleSegment?)
Formats a Pattern Item in nicely formatted SPARQL syntax.
Declaration
public virtual string Format(PatternItem item, TripleSegment? segment)
Parameters
Type | Name | Description |
---|---|---|
PatternItem | item | Pattern Item. |
TripleSegment? | segment | Triple Pattern Segment. |
Returns
Type | Description |
---|---|
string |
Format(SparqlQuery)
Formats a Query in nicely formatted SPARQL syntax.
Declaration
public virtual string Format(SparqlQuery query)
Parameters
Type | Name | Description |
---|---|---|
SparqlQuery | query | SPARQL Query. |
Returns
Type | Description |
---|---|
string |
FormatAggregate(ISparqlAggregate)
Formats a SPARQL Aggregate.
Declaration
protected virtual string FormatAggregate(ISparqlAggregate agg)
Parameters
Type | Name | Description |
---|---|---|
ISparqlAggregate | agg | SPARQL Aggregate. |
Returns
Type | Description |
---|---|
string |
FormatBaseUri(Uri)
Formats a Base URI Declaration.
Declaration
public override string FormatBaseUri(Uri u)
Parameters
Type | Name | Description |
---|---|---|
Uri | u | Base URI. |
Returns
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceFormatBooleanResult(bool)
Formats a Boolean Result.
Declaration
public override string FormatBooleanResult(bool result)
Parameters
Type | Name | Description |
---|---|---|
bool | result | Boolean Result. |
Returns
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceFormatDescribeVariablesList(SparqlQuery)
Formats the Variable/QName/URI for a SPARQL DESCRIBE Query.
Declaration
protected virtual string FormatDescribeVariablesList(SparqlQuery q)
Parameters
Type | Name | Description |
---|---|---|
SparqlQuery | q | SPARQL Query. |
Returns
Type | Description |
---|---|
string |
FormatExpression(ISparqlExpression)
Formats a SPARQL Expression.
Declaration
protected virtual string FormatExpression(ISparqlExpression expr)
Parameters
Type | Name | Description |
---|---|---|
ISparqlExpression | expr | SPARQL Expression. |
Returns
Type | Description |
---|---|
string |
FormatGroupBy(ISparqlGroupBy)
Formats a SPARQL GROUP BY Clause.
Declaration
protected virtual string FormatGroupBy(ISparqlGroupBy groupBy)
Parameters
Type | Name | Description |
---|---|---|
ISparqlGroupBy | groupBy | GROUP BY Clause. |
Returns
Type | Description |
---|---|
string |
FormatInlineData(BindingsPattern)
Formats the Inline Data portion of a Query.
Declaration
protected virtual string FormatInlineData(BindingsPattern data)
Parameters
Type | Name | Description |
---|---|---|
BindingsPattern | data | Inline Data. |
Returns
Type | Description |
---|---|
string |
FormatNamespace(string, Uri)
Formats a Namespace Declaration.
Declaration
public override string FormatNamespace(string prefix, Uri namespaceUri)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Namespace Prefix. |
Uri | namespaceUri | Namespace URI. |
Returns
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceFormatOrderBy(ISparqlOrderBy)
Formats a SPARQL ORDER BY Clause.
Declaration
protected virtual string FormatOrderBy(ISparqlOrderBy orderBy)
Parameters
Type | Name | Description |
---|---|---|
ISparqlOrderBy | orderBy | ORDER BY Clause. |
Returns
Type | Description |
---|---|
string |
FormatPath(ISparqlPath)
Formats a SPARQL Property Path.
Declaration
protected virtual string FormatPath(ISparqlPath path)
Parameters
Type | Name | Description |
---|---|---|
ISparqlPath | path | SPARQL Property Path. |
Returns
Type | Description |
---|---|
string |
FormatTripleNode(ITripleNode, TripleSegment?)
Formats a triple node a a string for the given format.
Declaration
protected override string FormatTripleNode(ITripleNode t, TripleSegment? segment)
Parameters
Type | Name | Description |
---|---|---|
ITripleNode | t | Triple node. |
TripleSegment? | segment | Triple segment being written. |
Returns
Type | Description |
---|---|
string |
Overrides
Remarks
This method should be overridden in formatters that support serializing ITripleNodes.
FormatVariableNode(IVariableNode, TripleSegment?)
Formats a Variable Node in SPARQL Syntax.
Declaration
protected override string FormatVariableNode(IVariableNode v, TripleSegment? segment)
Parameters
Type | Name | Description |
---|---|---|
IVariableNode | v | Variable Node. |
TripleSegment? | segment | Triple Segment. |
Returns
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceFormatVariablesList(IEnumerable<SparqlVariable>)
Formats the Variable List for a SPARQL Query.
Declaration
protected virtual string FormatVariablesList(IEnumerable<SparqlVariable> vars)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SparqlVariable> | vars | Variables. |
Returns
Type | Description |
---|---|
string |
IsValidQName(string)
Determines whether a QName is valid.
Declaration
protected override bool IsValidQName(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value | Value. |
Returns
Type | Description |
---|---|
bool |