1using System.Collections.Generic;
2using System.Threading.Tasks;
18 private bool graphIsVariableRef;
19 private string graphVariableRef;
29 this.pattern = Pattern;
31 this.CheckGraphVariableReference();
34 private void CheckGraphVariableReference()
38 this.graphIsVariableRef =
true;
39 this.graphVariableRef = Ref.VariableName;
43 this.graphIsVariableRef =
false;
44 this.graphVariableRef =
null;
67 if (ExistingMatches is
null)
69 if (this.graphIsVariableRef &&
72 LinkedList<Possibility> Result =
new LinkedList<Possibility>();
76 Cube = await Query.GetNamedGraph(GraphName,
Variables);
85 ObjectProperties.Object = P;
87 IEnumerable<Possibility> PartResult = await this.pattern.Search(
90 if (!(PartResult is
null))
104 return await this.pattern.Search(Cube,
Variables, ExistingMatches, Query);
109 LinkedList<Possibility> Result =
new LinkedList<Possibility>();
116 ObjectProperties.Object = P;
118 if (!this.graphIsVariableRef ||
126 IEnumerable<Possibility> PartResult = await this.pattern.Search(
129 if (!(PartResult is
null))
140 Cube = await Query.GetNamedGraph(GraphName,
Variables);
144 IEnumerable<Possibility> PartResult = await this.pattern.Search(
147 new Possibility(this.graphVariableRef, GraphName, P)
150 if (!(PartResult is
null))
171 this.pattern.SetParent(Parent);
186 this.pattern.ForAllChildNodes(Callback, State, Order);
189 this.
ForAll(Callback, State, Order);
194 this.pattern.ForAllChildNodes(Callback, State, Order);
209 if (!Callback(this.graph, out
ScriptNode NewNode, State))
212 if (!(NewNode is
null))
214 this.graph = NewNode;
215 this.CheckGraphVariableReference();
218 if (!this.pattern.ForAll(Callback, State, Order))
228 this.graph.
Equals(Typed.graph) &&
229 this.pattern.Equals(Typed.pattern);
237 Result ^= Result << 5 ^ this.pattern.GetHashCode();
Base class for all nodes in a parsed script tree.
bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, bool DepthFirst)
Calls the callback method for all child nodes.
override bool Equals(object obj)
void SetParent(ScriptNode Parent)
Sets the parent node. Can only be used when expression is being parsed.
override int GetHashCode()
virtual Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection. This method should be ...
Represents a variable reference.
A pattern referencing a named source.
void SetParent(ScriptNode Parent)
Sets the parent node. Can only be used when expression is being parsed.
bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, SearchMethod Order)
Calls the callback method for all child nodes.
override bool Equals(object obj)
GraphPattern(ScriptNode Graph, ISparqlPattern Pattern)
A pattern referencing a named source.
override int GetHashCode()
bool ForAll(ScriptNodeEventHandler Callback, object State, SearchMethod Order)
Calls the callback method for all child nodes.
bool IsEmpty
If pattern is empty.
async Task< IEnumerable< Possibility > > Search(ISemanticCube Cube, Variables Variables, IEnumerable< Possibility > ExistingMatches, SparqlQuery Query)
Searches for the pattern on information in a semantic cube.
Represents a possible solution during SPARQL evaluation.
UriNode[] NamedGraphNames
Names of named graphs, may be null.
override bool ContainsVariable(string Name)
If the collection contains a variable with a given name.
virtual bool ContainsVariable(string Name)
If the collection contains a variable with a given name.
Interface for semantic cubes.
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
Interface for SPARQL patterns.
delegate bool ScriptNodeEventHandler(ScriptNode Node, out ScriptNode NewNode, object State)
Delegate for ScriptNode callback methods.
SearchMethod
Method to traverse the expression structure