Class GraphPattern
Class for representing Graph Patterns in Sparql Queries.
Inherited Members
Namespace: VDS.RDF.Query.Patterns
Assembly: dotNetRdf.dll
Syntax
public class GraphPattern
Constructors
| Edit this page View SourceGraphPattern()
Creates a new Graph Pattern.
Declaration
public GraphPattern()
Properties
| Edit this page View SourceChildGraphPatterns
Gets the Child Graph Patterns of this Pattern.
Declaration
public List<GraphPattern> ChildGraphPatterns { get; }
Property Value
Type | Description |
---|---|
List<GraphPattern> |
Filter
Gets/Sets the FILTER that applies to this Graph Pattern.
Declaration
public ISparqlFilter Filter { get; }
Property Value
Type | Description |
---|---|
ISparqlFilter |
GraphSpecifier
Gets/Sets the Graph Specifier that applies to this Graph Pattern.
Declaration
public IToken GraphSpecifier { get; }
Property Value
Type | Description |
---|---|
IToken |
Remarks
This property is also used internally for SERVICE specifiers to save adding an additional property unnecessarily.
HasChildGraphPatterns
Checks whether this Pattern has any Child Graph Patterns.
Declaration
public bool HasChildGraphPatterns { get; }
Property Value
Type | Description |
---|---|
bool |
HasInlineData
Gets whether this Graph Pattern contains an Inline Data block (VALUES clause).
Declaration
public bool HasInlineData { get; }
Property Value
Type | Description |
---|---|
bool |
HasModifier
Determines whether the Graph Pattern has any kind of Modifier (GRAPH, MINUS, OPTIONAL etc) applied.
Declaration
public bool HasModifier { get; }
Property Value
Type | Description |
---|---|
bool |
InlineData
Gets the inline data (VALUES block if any).
Declaration
public BindingsPattern InlineData { get; }
Property Value
Type | Description |
---|---|
BindingsPattern |
IsEmpty
Gets whether this is an empty Graph Pattern.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
bool |
IsExists
Gets/Sets whether the Graph Pattern is an EXISTS clause.
Declaration
public bool IsExists { get; }
Property Value
Type | Description |
---|---|
bool |
IsFiltered
Gets/Sets whether the Graph Pattern is Filtered.
Declaration
public bool IsFiltered { get; }
Property Value
Type | Description |
---|---|
bool |
IsGraph
Gets/Sets whether the Graph Pattern operates on a specific Graph.
Declaration
public bool IsGraph { get; }
Property Value
Type | Description |
---|---|
bool |
IsMinus
Gets/Sets whether the Graph Pattern is a MINUS clause.
Declaration
public bool IsMinus { get; }
Property Value
Type | Description |
---|---|
bool |
IsNotExists
Gets/Sets whether the Graph Pattern is a NOT EXISTS clause.
Declaration
public bool IsNotExists { get; }
Property Value
Type | Description |
---|---|
bool |
IsOptimised
Gets whether Optimisation has been applied to this query.
Declaration
public bool IsOptimised { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This only indicates that an Optimiser has been applied to the Pattern. You can always reoptimise by calling the Optimise() method with an optimiser of your choice on the query to which this Pattern belongs.
IsOptional
Gets/Sets whether the Graph Pattern is Optional.
Declaration
public bool IsOptional { get; }
Property Value
Type | Description |
---|---|
bool |
IsService
Gets/Sets whether the Graph Pattern is a SERVICE clause.
Declaration
public bool IsService { get; }
Property Value
Type | Description |
---|---|
bool |
IsSilent
Gets whether Evaluation Errors in this Graph Pattern are suppressed (currently only valid with SERVICE).
Declaration
public bool IsSilent { get; }
Property Value
Type | Description |
---|---|
bool |
IsSubQuery
Gets whether this Graph Pattern is a Sub-query which can be simplified.
Declaration
public bool IsSubQuery { get; }
Property Value
Type | Description |
---|---|
bool |
IsUnion
Gets/Sets whether the Graph Pattern is a Union of its Child Graph Patterns.
Declaration
public bool IsUnion { get; }
Property Value
Type | Description |
---|---|
bool |
TriplePatterns
Gets the Triple Patterns in this Pattern.
Declaration
public List<ITriplePattern> TriplePatterns { get; }
Property Value
Type | Description |
---|---|
List<ITriplePattern> |
UnplacedAssignments
Gets the enumeration of LET assignments that are in this Graph Pattern which will be placed appropriately later.
Declaration
public IEnumerable<IAssignmentPattern> UnplacedAssignments { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IAssignmentPattern> |
UnplacedFilters
Gets the enumeration of Filters that apply to this Graph Pattern which will have yet to be placed within the Graph Pattern.
Declaration
public IEnumerable<ISparqlFilter> UnplacedFilters { get; }
Property Value
Type | Description |
---|---|
IEnumerable<ISparqlFilter> |
UsesDefaultDataset
Gets whether the Graph Pattern uses the Default Dataset.
Declaration
public bool UsesDefaultDataset { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Graph Patterns generally use the Default Dataset unless they are a GRAPH pattern or they contain a Triple Pattern, child Graph Pattern or a FILTER/BIND which does not use the default dataset.
Variables
Gets the Variables used in the Pattern.
Declaration
public IEnumerable<string> Variables { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
Methods
| Edit this page View SourceAddInlineData(BindingsPattern)
Adds inline data to a Graph Pattern respecting any BGP breaks.
Declaration
public void AddInlineData(BindingsPattern data)
Parameters
Type | Name | Description |
---|---|---|
BindingsPattern | data |
AddTriplePattern(ITriplePattern)
Adds a Triple Pattern to the Graph Pattern respecting any BGP breaks.
Declaration
public void AddTriplePattern(ITriplePattern p)
Parameters
Type | Name | Description |
---|---|---|
ITriplePattern | p | Triple Pattern. |
InsertAssignment(IAssignmentPattern, int)
Inserts an Assignment at a given position.
Declaration
public void InsertAssignment(IAssignmentPattern assignment, int i)
Parameters
Type | Name | Description |
---|---|---|
IAssignmentPattern | assignment | Assignment. |
int | i | Position to insert at. |
Remarks
Intended for use by Query Optimisers.
InsertFilter(ISparqlFilter, int)
Inserts a Filter at a given position.
Declaration
public void InsertFilter(ISparqlFilter filter, int i)
Parameters
Type | Name | Description |
---|---|---|
ISparqlFilter | filter | Filter. |
int | i | Position to insert at. |
Remarks
Intended for use by Query Optimisers.
Optimise()
Optimises the Graph Pattern using the default query optimiser.
Declaration
public void Optimise()
Optimise(IQueryOptimiser)
Optimises the Graph Pattern using the given optimiser.
Declaration
public void Optimise(IQueryOptimiser optimiser)
Parameters
Type | Name | Description |
---|---|---|
IQueryOptimiser | optimiser | Query Optimiser. |
Remarks
Important: If a Pattern has already been optimized then calling this again is a no-op.
For finer grained control of what gets optimized you can use QueryOptimisation or QueryOptimisation to disable automatic optimisation and then manually call this method as necessary.
Optimise(IQueryOptimiser, IEnumerable<string>)
Optimises the Graph Pattern using the given optimiser and with the given variables.
Declaration
public void Optimise(IQueryOptimiser optimiser, IEnumerable<string> vars)
Parameters
Type | Name | Description |
---|---|---|
IQueryOptimiser | optimiser | Query Optimiser. |
IEnumerable<string> | vars | Variables. |
Remarks
Important: If a Pattern has already been optimized then calling this again is a no-op.
For finer grained control of what gets optimized you can use QueryOptimisation or QueryOptimisation to disable automatic optimisation and then manually call this method as necessary.
The vars
parameter contains Variables mentioned in the parent Graph Pattern (if any) that can be used to guide optimisation of child graph patterns.
SwapTriplePatterns(int, int)
Swaps the position of the two given Triple Patterns.
Declaration
public void SwapTriplePatterns(int i, int j)
Parameters
Type | Name | Description |
---|---|---|
int | i | First Position. |
int | j | Second Position. |
Remarks
Intended for use by Query Optimisers.
ToAlgebra()
Gets the Algebra representation of the Graph Pattern.
Declaration
public ISparqlAlgebra ToAlgebra()
Returns
Type | Description |
---|---|
ISparqlAlgebra |
ToString()
Gets the String representation of the Graph Pattern.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |