File size: 8,690 Bytes
9b44a02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284


# AGDB Time Series Graphs and Query Structure

Active Graph Databases (AGDBs) are an innovative framework designed for efficiently managing and querying time-series data. By leveraging **Active Graph Theory (AGT)** and **Active Graph Networks (AGN)**, AGDBs enable the creation of structured and synthetic relationships that can scale across various domains while maintaining efficiency in both small and large datasets.

## Overview of AGDB Architecture

AGDB utilizes a hierarchical time-based structure combined with synthetic relationships to enable efficient querying and scalable handling of complex data. This design facilitates cross-domain contextual relationships, supporting advanced data interactions, rule-based querying, and scalable, efficient processing.

### Architecture Diagram

```mermaid
graph TB
  subgraph AGDB
    AGT[Active Graph Theory]
    AGN[Active Graph Network]
    AGDBMain[(AGDB Main Database)]
    SyntheticRel[Synthetic Relationships]
    TimeHierarchy[Time Hierarchy Nodes]
    DataNodes[Data Nodes]

    AGT --> AGN
    AGN --> AGDBMain
    AGDBMain --> SyntheticRel
    AGDBMain --> TimeHierarchy
    TimeHierarchy --> DataNodes
  end

  AGDB -->|Integrates| AGT
  AGDB -->|Utilizes| AGN
  AGT -->|Provides Structure| SyntheticRel
  AGN -->|Facilitates Querying| DataNodes
```

---

## Structure of AGDB Time Series Graphs

AGDB structures time-series data through hierarchical **Time Nodes** and **Data Nodes**. Synthetic relationships within the database enable efficient traversal and retrieval of specific time points or patterns, allowing AGDB to act as a powerful framework for scalable time-series querying.

### AGDB Structure Diagram

```mermaid
graph TD
  TimeHierarchy[Time Hierarchy]
  Year[Year]
  Month[Month]
  Day[Day]
  Hour[Hour]
  Minute[Minute]
  Checkpoints[Predefined Checkpoints]
  Data[Data Nodes]

  TimeHierarchy --> Year
  Year --> Month
  Month --> Day
  Day --> Hour
  Hour --> Minute
  Minute --> Data
  TimeHierarchy --> Checkpoints
  Checkpoints --> Minute
  Checkpoints -->|Synthetically link| Hour
```

- **Hierarchical Structure**: Organized from Year down to Minute, each node level enables efficient time-based navigation.
- **Checkpoints**: Serve as reference points within the hierarchy, allowing quicker access to relevant data via synthetic pathing.
- **Data Nodes**: Store attributes for each time interval, making each data point easily accessible.

---

## Query Structure for AGDB

The query structure for AGDBs supports flexible access to data across predefined and synthetic relationships. Using a path-based syntax, AGDB queries are intuitive and efficient for time-series and context-rich data.

### Example Query Structure

```mermaid
graph LR
  Year2024[2024]
  Month11[November]
  Day04[4th]
  Hour10[10:00 AM]
  Minute45[10:45 AM]
  DataNode[Data Node]

  Year2024 --> Month11
  Month11 --> Day04
  Day04 --> Hour10
  Hour10 --> Minute45
  Minute45 --> DataNode
  Checkpoint1040[Checkpoint 10:40 AM]
  Checkpoint1040 -->|+5 Minutes| Minute45
```

- **Direct Navigation**: Queries traverse through the year, month, day, hour, and minute levels until reaching the target node.
- **Synthetic Pathing**: Checkpoints at predefined intervals enable rapid traversal, allowing queries to skip to approximate points and increment from there.

---

## Definitions and Components

### AGT (Active Graph Theory)

AGT provides the foundational logic for defining and managing relationships within AGDB, modeling data as interconnected nodes with contextual relationships.

```mermaid
graph LR
  AGT[Active Graph Theory]
  Nodes[Data Nodes]
  Relationships[Relationships]
  ContextualInference[Contextual Inference]

  AGT --> Nodes
  AGT --> Relationships
  Relationships --> ContextualInference
```

- **Nodes**: Represent data entries or entities.
- **Relationships**: Define connections between nodes.
- **Contextual Inference**: Adds depth to data by inferring relationships based on contextual cues.

### AGN (Active Graph Networks)

AGN utilizes AGT’s principles to support querying and interaction within AGDB. Through rules and policies, AGN automates and simplifies navigation through AGDB.

```mermaid
graph TD
  AGN[Active Graph Network]
  QueryEngine[Query Engine]
  TraversalRules[Traversal Rules]
  SyntheticPathing[Synthetic Pathing]
  Checkpoints[Checkpoints]

  AGN --> QueryEngine
  QueryEngine --> TraversalRules
  TraversalRules --> SyntheticPathing
  SyntheticPathing --> Checkpoints
```

- **Query Engine**: Processes requests by applying AGN’s traversal rules.
- **Traversal Rules**: Define how nodes are accessed based on AGDB structure.
- **Synthetic Pathing**: Creates shortcuts between nodes, improving query efficiency.

---

## Example JSON Structure for AGDB

This structure organizes AGDB data, relationships, and policies into a flexible format that allows for easy traversal and analysis.

```json
{
    "metadata": {
        "title": "BTC-USD Time Series Data",
        "source": "AGT Platform",
        "description": "Time-series AGDB for BTC-USD trading data with predefined checkpoints",
        "created_at": "2024-11-04",
        "timezone": "UTC"
    },
    "schema": {
        "entity": "BTC_USD_Data",
        "type": "TimeSeriesNode",
        "domain": "TradingData",
        "attributes": ["Time", "Node_ID", "Open", "High", "Low", "Close", "Volume"]
    },
    "data": [
        ["2024-10-14 07:30:00", "node_0001", 50, 52, 48, 51, 5000],
        ["2024-10-14 07:31:00", "node_0002", 51, 55, 43, 55, 3000]
    ],
    "relationships": [
        {
            "type": "temporal_sequence",
            "from": "node_0001",
            "to": "node_0002",
            "relationship": "next"
        }
    ],
    "policies": {
        "AGN": {
            "trading_inference": {
                "rules": {
                    "time_series_trend": {
                        "relationship": "temporal_sequence",
                        "weight_threshold": 0.5
                    },
                    "volatility_correlation": {
                        "attributes": ["High", "Low"],
                        "relationship": "correlates_with",
                        "weight_threshold": 0.3
                    }
                }
            }
        }
    }
}
```

---

## Sample Queries and Structure

### Basic Queries

1. **Get Specific Time Node**: Retrieve data at a particular time.

   ```plaintext
   get-node-type ts-path {domain}/2024/11/04/10/45
   ```

2. **Use Checkpoint for Efficiency**:

   ```plaintext
   get-node-type ts-path {domain}/2024/11/04/10/40 +5
   ```

### Rule-Based Strategy Example

1. **Apply Trading Strategy**:

   ```plaintext
   get-node-type ts-path TRADING/2024/11/04/11/45
   ```

   This query fetches data at `11:45 AM` for trading strategies.

---

## Unified Command Structure

### Core Commands and Syntax Structure

1. **Graph Creation and Initialization**
   - `create-graph -name "financial_time_series" -type "AGDB"`

2. **Node and Relationship Management**
   - `create-node -id "node_001" -type "TimeSeriesNode" -attributes {...}`
   - `create-relationship -from "node_001" -to "node_002" -type "next"`

3. **Setting Edges, Attributes, and Domains**
   - `set-edge -from "node_001" -to "node_002" -weight 0.8`
   - `set-attribute -node "node_001" -attributes {...}`
   - `set-domain -graph "financial_time_series" -name "Trading"`

4. **Retrieving Nodes, Relationships, and Domains**
   - `get-node.attribute -name "node_001"`
   - `get-relationship -node "node_001"`
   - `get-domain -node "node_001"`

5. **AGN/AGDB Specific Commands**
   - `get-AGN -policy "trading_inference"`
   - `set-AGN -policy "trading_inference" -rules {...}`

---

## Example JSON Query Logic

To optimize queries, AGDB uses a hierarchical time-based navigation structure with checkpoints for faster traversal.

1. **Query Example for Time Range**:

   ```json
   {
       "command": "get-node",
       "start": "2024-10-14 08:00:00",
       "end": "2024-10-14 08:30:00"
   }
   ```

2. **Relationship-Based Query for Correlation**:

   ```json
   {
       "command": "get-relationship",
       "type": "correlates_with",
       "attributes": ["High", "Low"]
   }
   ```

---

### Conclusion

This README provides a high-level overview of AGDB architecture, query structure, and example usage. By integrating **AGT** and **AGN**, AGDB offers a powerful, scalable framework for time-series and complex data management, making it ideal for various fields, including finance and healthcare. The unified query structure allows users to access and manipulate data efficiently, making AGDB a versatile and user-friendly database solution.