Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ComplementPattern.cs
2using System.Threading.Tasks;
5
7{
12 {
19 : base(Left, Right)
20 {
21 }
22
31 public override async Task<IEnumerable<Possibility>> Search(ISemanticCube Cube, Variables Variables,
32 IEnumerable<Possibility> ExistingMatches, SparqlQuery Query)
33 {
34 ExistingMatches = await this.Left.Search(Cube, Variables, ExistingMatches, Query);
35 if (ExistingMatches is null)
36 return null;
37
38 ChunkedList<Possibility> Result = null;
39
40 foreach (Possibility P in ExistingMatches)
41 {
42 IEnumerable<Possibility> NewMatches = await this.Right.Search(Cube, Variables,
43 new Possibility[] { P }, Query);
44 bool Empty = NewMatches is null;
45
46 if (!Empty)
47 {
48 using (IEnumerator<Possibility> e = NewMatches.GetEnumerator())
49 {
50 if (!e.MoveNext())
51 Empty = true;
52 }
53 }
54
55 if (Empty)
56 {
57 if (Result is null)
58 Result = new ChunkedList<Possibility>();
59
60 Result.Add(P);
61 }
62 }
63
64 return Result;
65 }
66
67 }
68}
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
Complement of a pattern (right) in another (left).
override async Task< IEnumerable< Possibility > > Search(ISemanticCube Cube, Variables Variables, IEnumerable< Possibility > ExistingMatches, SparqlQuery Query)
Searches for the pattern on information in a semantic cube.
ComplementPattern(ISparqlPattern Left, ISparqlPattern Right)
Complement of a pattern (right) in another (left).
Represents a possible solution during SPARQL evaluation.
Definition: Possibility.cs:13
Collection of variables.
Definition: Variables.cs:25
Interface for semantic cubes.
Task< IEnumerable< Possibility > > Search(ISemanticCube Cube, Variables Variables, IEnumerable< Possibility > ExistingMatches, SparqlQuery Query)
Searches for the pattern on information in a semantic cube.