Show / Hide Table of Contents

Class SparqlQueryParser

Class for parsing SPARQL Queries into SparqlQuery objects that can be used to query a Graph or Triple Store.

Inheritance
System.Object
SparqlQueryParser
Implements
ITraceableTokeniser
IObjectParser<SparqlQuery>
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: VDS.RDF.Parsing
Assembly: dotNetRdf.dll
Syntax
public class SparqlQueryParser : ITraceableTokeniser, IObjectParser<SparqlQuery>

Constructors

| Improve this Doc View Source

SparqlQueryParser()

Creates a new instance of the SPARQL Query Parser.

Declaration
public SparqlQueryParser()
| Improve this Doc View Source

SparqlQueryParser(IUriFactory)

Creates a new instance of the SPARQL query parser.

Declaration
public SparqlQueryParser(IUriFactory uriFactory)
Parameters
Type Name Description
IUriFactory uriFactory

The URI factory to use.

| Improve this Doc View Source

SparqlQueryParser(SparqlQuerySyntax)

Creates a new instance of the SPARQL Query Parser which supports the given SPARQL Syntax.

Declaration
public SparqlQueryParser(SparqlQuerySyntax syntax)
Parameters
Type Name Description
SparqlQuerySyntax syntax

SPARQL Syntax.

| Improve this Doc View Source

SparqlQueryParser(TokenQueueMode, SparqlQuerySyntax, IUriFactory)

Creates a new instance of the SPARQL query parser.

Declaration
public SparqlQueryParser(TokenQueueMode queueMode, SparqlQuerySyntax syntax, IUriFactory uriFactory)
Parameters
Type Name Description
TokenQueueMode queueMode

Token queue mode.

SparqlQuerySyntax syntax

SPARQL syntax to parse.

IUriFactory uriFactory

URI factory to use during the parse.

| Improve this Doc View Source

SparqlQueryParser(TokenQueueMode, SparqlQuerySyntax)

Creates a new instance of the SPARQL Query Parser using the given Tokeniser which supports the given SPARQL Syntax.

Declaration
public SparqlQueryParser(TokenQueueMode queueMode, SparqlQuerySyntax syntax)
Parameters
Type Name Description
TokenQueueMode queueMode

Token Queue Mode.

SparqlQuerySyntax syntax

SPARQL Syntax.

| Improve this Doc View Source

SparqlQueryParser(TokenQueueMode)

Creates a new instance of the SPARQL Query Parser using the given Tokeniser Queue Mode.

Declaration
public SparqlQueryParser(TokenQueueMode queueMode)
Parameters
Type Name Description
TokenQueueMode queueMode

Token Queue Mode.

Properties

| Improve this Doc View Source

AllowUnknownFunctions

Gets/Sets whether functions that can't be parsed into Expressions should be represented by the UnknownFunction.

Declaration
public bool AllowUnknownFunctions { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

DefaultBaseUri

Gets/Sets the Default Base URI for Queries parsed by this Parser instance.

Declaration
public Uri DefaultBaseUri { get; set; }
Property Value
Type Description
System.Uri
| Improve this Doc View Source

ExpressionFactories

Gets/Sets the locally scoped custom expression factories.

Declaration
public IEnumerable<ISparqlCustomExpressionFactory> ExpressionFactories { get; set; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<T><ISparqlCustomExpressionFactory>
| Improve this Doc View Source

QueryOptimisation

Get/set whether query optimization should be used.

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

Defaults to true.

| Improve this Doc View Source

QueryOptimiser

Gets/Sets the locally scoped Query Optimiser applied to queries at the end of the parsing process.

Declaration
public IQueryOptimiser QueryOptimiser { get; set; }
Property Value
Type Description
IQueryOptimiser
Remarks

May be null if no locally scoped optimiser is set in which case the globally scoped optimiser will be used.

| Improve this Doc View Source

SyntaxMode

Gets/Sets the Syntax that should be supported.

Declaration
public SparqlQuerySyntax SyntaxMode { get; set; }
Property Value
Type Description
SparqlQuerySyntax
| Improve this Doc View Source

TraceTokeniser

Gets/Sets whether Tokeniser progress is Traced to the Console.

Declaration
public bool TraceTokeniser { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

UriFactory

Gets/Sets the factory to use for creating URIs.

Declaration
public IUriFactory UriFactory { get; set; }
Property Value
Type Description
IUriFactory

Methods

| Improve this Doc View Source

ExcessTokensString(SparqlQueryParserContext, int)

Constructs an error message that informs the user about unexpected excess tokens in a SPARQL qery.

Declaration
public string ExcessTokensString(SparqlQueryParserContext context, int expectedCount)
Parameters
Type Name Description
SparqlQueryParserContext context

Current parser context.

int expectedCount

The expected number of tokens.

Returns
Type Description
string
| Improve this Doc View Source

Parse(StreamReader)

Parses a SPARQL Query from an arbitrary Input Stream.

Declaration
public SparqlQuery Parse(StreamReader input)
Parameters
Type Name Description
System.IO.StreamReader input

Input Stream.

Returns
Type Description
SparqlQuery
| Improve this Doc View Source

Parse(TextReader)

Parses a SPARQL Query from an arbitrary Input.

Declaration
public SparqlQuery Parse(TextReader input)
Parameters
Type Name Description
System.IO.TextReader input

Input.

Returns
Type Description
SparqlQuery
| Improve this Doc View Source

ParseFromFile(string)

Parses a SPARQL Query from a File.

Declaration
public SparqlQuery ParseFromFile(string queryFile)
Parameters
Type Name Description
string queryFile

File containing the Query.

Returns
Type Description
SparqlQuery
| Improve this Doc View Source

ParseFromString(string)

Parses a SPARQL Query from a String.

Declaration
public SparqlQuery ParseFromString(string queryString)
Parameters
Type Name Description
string queryString

A SPARQL Query.

Returns
Type Description
SparqlQuery
| Improve this Doc View Source

ParseFromString(SparqlParameterizedString)

Parses a SPARQL Query from a SPARQL Parameterized String.

Declaration
public SparqlQuery ParseFromString(SparqlParameterizedString queryString)
Parameters
Type Name Description
SparqlParameterizedString queryString

A SPARQL Parameterized String.

Returns
Type Description
SparqlQuery
Remarks

The SparqlParameterizedString class allows you to use parameters in a String in a manner similar to SQL Commands in the ADO.Net model. See the documentation for SparqlParameterizedString for details of this.

| Improve this Doc View Source

TryParseGraphPattern(SparqlQueryParserContext, bool)

Tries to parse a Graph Pattern from the given Parser Context.

Declaration
protected GraphPattern TryParseGraphPattern(SparqlQueryParserContext context, bool requireOpeningLeftBracket)
Parameters
Type Name Description
SparqlQueryParserContext context

Parser Context.

System.Boolean requireOpeningLeftBracket

Whether the opening Left Curly Bracket is required.

Returns
Type Description
GraphPattern

Events

| Improve this Doc View Source

Warning

Event raised when a non-fatal issue with the SPARQL Query being parsed is detected

Declaration
public event SparqlWarning Warning
Event Type
Type Description
SparqlWarning

Implements

ITraceableTokeniser
IObjectParser<T>

Extension Methods

Extensions.ToSafeString(object)
Extensions.AsEnumerable<T>(T)
  • Improve this Doc
  • View Source
In This Article
  • Constructors
    • SparqlQueryParser()
    • SparqlQueryParser(IUriFactory)
    • SparqlQueryParser(SparqlQuerySyntax)
    • SparqlQueryParser(TokenQueueMode, SparqlQuerySyntax, IUriFactory)
    • SparqlQueryParser(TokenQueueMode, SparqlQuerySyntax)
    • SparqlQueryParser(TokenQueueMode)
  • Properties
    • AllowUnknownFunctions
    • DefaultBaseUri
    • ExpressionFactories
    • QueryOptimisation
    • QueryOptimiser
    • SyntaxMode
    • TraceTokeniser
    • UriFactory
  • Methods
    • ExcessTokensString(SparqlQueryParserContext, int)
    • Parse(StreamReader)
    • Parse(TextReader)
    • ParseFromFile(string)
    • ParseFromString(string)
    • ParseFromString(SparqlParameterizedString)
    • TryParseGraphPattern(SparqlQueryParserContext, bool)
  • Events
    • Warning
  • Implements
  • Extension Methods
Back to top Generated by DocFX