agent-docs 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/plans/OPTIMISE.md +379 -0
- package/.cursor/plans/VERSIONING.md +207 -0
- package/.cursor/rules/IMPORTANT.mdc +97 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +13 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- package/.github/dependabot.yml +38 -0
- package/.github/pull_request_template.md +10 -0
- package/.github/workflows/format.yml +35 -0
- package/CODE_OF_CONDUCT.md +64 -0
- package/CONTRIBUTING.md +52 -0
- package/LICENSE.md +20 -0
- package/PLAN.md +707 -0
- package/README.md +133 -0
- package/SECURITY.md +21 -0
- package/docs/APEXANNOTATIONS.md +472 -0
- package/docs/APEXDOC.md +198 -0
- package/docs/CML.md +877 -0
- package/docs/CODEANALYZER.md +435 -0
- package/docs/CONTEXTDEFINITIONS.md +617 -0
- package/docs/ESLINT.md +827 -0
- package/docs/ESLINTJSDOC.md +520 -0
- package/docs/FIELDSERVICE.md +4452 -0
- package/docs/GRAPHBINARY.md +208 -0
- package/docs/GRAPHENGINE.md +616 -0
- package/docs/GRAPHML.md +337 -0
- package/docs/GRAPHSON.md +302 -0
- package/docs/GREMLIN.md +490 -0
- package/docs/GRYO.md +232 -0
- package/docs/HUSKY.md +106 -0
- package/docs/JEST.md +387 -0
- package/docs/JORJE.md +537 -0
- package/docs/JSDOC.md +621 -0
- package/docs/PMD.md +910 -0
- package/docs/PNPM.md +409 -0
- package/docs/PRETTIER.md +716 -0
- package/docs/PRETTIERAPEX.md +874 -0
- package/docs/REVENUETRANSACTIONMANAGEMENT.md +887 -0
- package/docs/TINKERPOP.md +252 -0
- package/docs/VITEST.md +706 -0
- package/docs/VSCODE.md +231 -0
- package/docs/XPATH31.md +213 -0
- package/package.json +32 -0
- package/postinstall.mjs +51 -0
- package/prettier.config.js +18 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# Apache TinkerPop Reference
|
|
2
|
+
|
|
3
|
+
> **Version**: 1.0.0
|
|
4
|
+
|
|
5
|
+
Graph computing framework for OLTP (real-time) and OLAP (batch) operations.
|
|
6
|
+
Vendor-agnostic, language-agnostic, extensible.
|
|
7
|
+
|
|
8
|
+
**Related:** [GREMLIN.md](GREMLIN.md), [GRAPHML.md](GRAPHML.md),
|
|
9
|
+
[GRAPHSON.md](GRAPHSON.md), [GRYO.md](GRYO.md), [GRAPHBINARY.md](GRAPHBINARY.md)
|
|
10
|
+
|
|
11
|
+
## Framework Components
|
|
12
|
+
|
|
13
|
+
### TinkerGraph
|
|
14
|
+
|
|
15
|
+
In-memory property graph reference implementation. Lightweight, fast for
|
|
16
|
+
small-medium graphs. Supports all serialization formats.
|
|
17
|
+
|
|
18
|
+
```groovy
|
|
19
|
+
graph = TinkerGraph.open()
|
|
20
|
+
g = graph.traversal()
|
|
21
|
+
graph.io(graphml()).readGraph("path/to/file.graphml")
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Config:** `gremlin.tinkergraph.vertexIdManager`, `edgeIdManager`,
|
|
25
|
+
`vertexPropertyIdManager`, `defaultVertexPropertyCardinality` **ID Types:**
|
|
26
|
+
`LONG`, `INTEGER`, `STRING`, `UUID` (auto-generates if not provided)
|
|
27
|
+
|
|
28
|
+
**TinkerFactory Toy Graphs:**
|
|
29
|
+
|
|
30
|
+
- `createClassic()` - TinkerPop 2.x toy graph
|
|
31
|
+
- `createModern()` - TinkerPop 3.x version, 6 vertices/6 edges, used in docs
|
|
32
|
+
- `createTheCrew()` - Demonstrates meta-properties, multi-properties
|
|
33
|
+
- `createGratefulDead()` - 808 vertices/8049 edges, larger testing
|
|
34
|
+
|
|
35
|
+
```groovy
|
|
36
|
+
graph = TinkerFactory.createModern()
|
|
37
|
+
g = traversal().with(graph)
|
|
38
|
+
// or: g = graph.traversal()
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Gremlin Server
|
|
42
|
+
|
|
43
|
+
Remote Gremlin execution server. Supports sessions, auth, SSL/TLS.
|
|
44
|
+
|
|
45
|
+
**Formats:** GraphSON (primary), GraphBinary (optimized) **Config (YAML):**
|
|
46
|
+
host/port, graph config, serializers, thread pool, auth, SSL, script engines,
|
|
47
|
+
metrics
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bin/gremlin-server.sh conf/gremlin-server.yaml
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Sessions:** Stateless (default), Session (maintains state), configurable
|
|
54
|
+
timeout **Security:** Auth, SSL/TLS, authorization (provider-specific),
|
|
55
|
+
traversal restrictions
|
|
56
|
+
|
|
57
|
+
### Gremlin Console
|
|
58
|
+
|
|
59
|
+
Interactive CLI for Gremlin queries. Groovy-based with autocompletion, syntax
|
|
60
|
+
highlighting.
|
|
61
|
+
|
|
62
|
+
**Commands:** `:help`/`:h`, `:exit`/`:x`/`:quit`/`:q`, `:import`/`:i`,
|
|
63
|
+
`:clear`/`:c`, `:show`/`:S`, `:load`, `:install`, `:plugin`
|
|
64
|
+
|
|
65
|
+
```groovy
|
|
66
|
+
// Load graph
|
|
67
|
+
graph = TinkerGraph.open()
|
|
68
|
+
graph.io(graphml()).readGraph('data/air-routes.graphml')
|
|
69
|
+
g = graph.traversal()
|
|
70
|
+
|
|
71
|
+
// Remote connection
|
|
72
|
+
:remote connect tinkerpop.server conf/remote.yaml
|
|
73
|
+
:remote console
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**`:install`** - Maven dependency installation (requires Grape config):
|
|
77
|
+
|
|
78
|
+
```groovy
|
|
79
|
+
:install com.datastax.cassandra cassandra-driver-core 2.1.9
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Static Imports:**
|
|
83
|
+
|
|
84
|
+
```groovy
|
|
85
|
+
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*
|
|
86
|
+
import static org.apache.tinkerpop.gremlin.process.traversal.P.*
|
|
87
|
+
import static org.apache.tinkerpop.gremlin.structure.T.*
|
|
88
|
+
import static org.apache.tinkerpop.gremlin.process.traversal.Order.*
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Result Iteration:**
|
|
92
|
+
|
|
93
|
+
```groovy
|
|
94
|
+
g.V().hasLabel('person').forEachRemaining { vertex ->
|
|
95
|
+
println(vertex.value('name'))
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**`def` Keyword:** Use inside closures for scoping. Don't use at console prompt
|
|
100
|
+
(causes error).
|
|
101
|
+
|
|
102
|
+
**Init Script:** `bin/gremlin.sh -i init.groovy`
|
|
103
|
+
|
|
104
|
+
## Property Graph Model
|
|
105
|
+
|
|
106
|
+
**Components:** Vertices (nodes), Edges (relationships), Properties (key-value),
|
|
107
|
+
Labels (categorization) **Tokens:** `T.id`, `T.label`
|
|
108
|
+
|
|
109
|
+
```java
|
|
110
|
+
Graph graph = TinkerGraph.open();
|
|
111
|
+
Vertex gremlin = graph.addVertex(T.label, "software", "name", "gremlin");
|
|
112
|
+
gremlin.property("created", 2009);
|
|
113
|
+
gremlin.addEdge("dependsOn", blueprints);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Traversal Strategies
|
|
117
|
+
|
|
118
|
+
Auto-applied optimizations. Use `withStrategies()` for manual application.
|
|
119
|
+
|
|
120
|
+
**Common:** `SubgraphStrategy`, `ReadOnlyStrategy`, `PartitionStrategy`,
|
|
121
|
+
`VertexProgramStrategy`, `OptionsStrategy`, `ProductiveStrategy`,
|
|
122
|
+
`LazyBarrierStrategy`, `IncidentToAdjacentStrategy`, `FilterRankingStrategy`,
|
|
123
|
+
`CountStrategy`, `PathRetractionStrategy`, `MatchAlgorithmStrategy`,
|
|
124
|
+
`OrderLimitStrategy`, `RangeByIsCountStrategy`, `RepeatUnrollStrategy`,
|
|
125
|
+
`EarlyTerminationStrategy`
|
|
126
|
+
|
|
127
|
+
```java
|
|
128
|
+
g = graph.traversal().withStrategies(
|
|
129
|
+
SubgraphStrategy.build().vertices(hasLabel("Person")).create(),
|
|
130
|
+
ReadOnlyStrategy.instance()
|
|
131
|
+
);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## GraphComputer API (OLAP)
|
|
135
|
+
|
|
136
|
+
Distributed graph computation for batch processing.
|
|
137
|
+
|
|
138
|
+
**Concepts:** GraphComputer (interface), VertexProgram (per-vertex execution),
|
|
139
|
+
MapReduce (aggregation), Messaging (vertex communication), Memory (shared),
|
|
140
|
+
ComputerResult
|
|
141
|
+
|
|
142
|
+
**GraphComputer Methods:** `compute()`, `workers()`, `persist()`, `result()`,
|
|
143
|
+
`vertices()`, `edges()`, `memory()`, `program()`, `mapReduce()`, `submit()`
|
|
144
|
+
**VertexProgram Methods:** `setup()`, `execute()`, `terminate()`,
|
|
145
|
+
`getMemoryComputeKeys()`, `getVertexComputeKeys()`, `clone()` **MapReduce
|
|
146
|
+
Methods:** `map()`, `combine()`, `reduce()`, `execute()`, `getMemoryKey()`
|
|
147
|
+
|
|
148
|
+
**Execution:** Partition graph → Execute VertexProgram in parallel → Message
|
|
149
|
+
passing → Check termination → MapReduce aggregation → Store results
|
|
150
|
+
|
|
151
|
+
## Graph I/O
|
|
152
|
+
|
|
153
|
+
**Interfaces:** `GraphReader`, `GraphWriter` **Formats:** GraphML, GraphSON,
|
|
154
|
+
Gryo, GraphBinary (see dedicated docs) **Methods:** `readGraph()`,
|
|
155
|
+
`writeGraph()`
|
|
156
|
+
|
|
157
|
+
### Loading Data
|
|
158
|
+
|
|
159
|
+
**Get or Create Pattern:**
|
|
160
|
+
|
|
161
|
+
```groovy
|
|
162
|
+
getOrCreate = { id ->
|
|
163
|
+
g.V().has('user', 'userId', id).
|
|
164
|
+
fold().
|
|
165
|
+
coalesce(unfold(),
|
|
166
|
+
addV('user').property('userId', id)).next()
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Complete Example:**
|
|
171
|
+
|
|
172
|
+
```groovy
|
|
173
|
+
graph = TinkerGraph.open()
|
|
174
|
+
graph.createIndex('userId', Vertex.class)
|
|
175
|
+
g = traversal().with(graph)
|
|
176
|
+
|
|
177
|
+
getOrCreate = { id ->
|
|
178
|
+
g.V().has('user', 'userId', id).
|
|
179
|
+
fold().
|
|
180
|
+
coalesce(unfold(),
|
|
181
|
+
addV('user').property('userId', id)).next()
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
new File('wiki-Vote.txt').eachLine {
|
|
185
|
+
if (!it.startsWith("#")) {
|
|
186
|
+
(fromVertex, toVertex) = it.split('\t').collect(getOrCreate)
|
|
187
|
+
g.addE('votesFor').from(fromVertex).to(toVertex).iterate()
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
For larger datasets: `CloneVertexProgram` or native bulk loading.
|
|
193
|
+
|
|
194
|
+
### Format Comparison
|
|
195
|
+
|
|
196
|
+
| Format | Type | Use Case | Pros | Cons |
|
|
197
|
+
| ----------- | ------ | ------------------------- | -------------------------- | ------------------------------ |
|
|
198
|
+
| GraphML | XML | Human-readable, debugging | Standard, widely supported | Verbose, slow |
|
|
199
|
+
| GraphSON | JSON | Network, Gremlin Server | Compact JSON | Less expressive |
|
|
200
|
+
| Gryo | Binary | Performance, large graphs | Fastest, smallest | Not readable, version-specific |
|
|
201
|
+
| GraphBinary | Binary | Network, Gremlin Server | Efficient, flexible typing | Not readable |
|
|
202
|
+
|
|
203
|
+
**Size (approx):** Gryo < GraphBinary < GraphSON (2-3x) < GraphML (3-5x)
|
|
204
|
+
**Speed:** Gryo > GraphBinary > GraphSON > GraphML
|
|
205
|
+
|
|
206
|
+
**Selection:** Human-readable? → GraphML/GraphSON. Gremlin Server? →
|
|
207
|
+
GraphSON/GraphBinary. Performance-critical? → Gryo. Network-optimized? →
|
|
208
|
+
GraphBinary.
|
|
209
|
+
|
|
210
|
+
## Provider Integration
|
|
211
|
+
|
|
212
|
+
**Provider Types:** Graph System (DB/Processor), Driver, Language, Plugin
|
|
213
|
+
|
|
214
|
+
**Requirements:** Implement core API, pass `gremlin-test` suite, support
|
|
215
|
+
property graph model **OLTP:** `Graph`, `GraphTraversalSource` interfaces
|
|
216
|
+
**OLAP:** `GraphComputer` interface **IO:** `GraphReader`, `GraphWriter`
|
|
217
|
+
interfaces
|
|
218
|
+
|
|
219
|
+
**Validation:** JVM test suite, Gherkin BDD tests
|
|
220
|
+
|
|
221
|
+
## Core API Reference
|
|
222
|
+
|
|
223
|
+
**Graph:** `TinkerGraph.open()`, `TinkerGraph.open(Configuration)`
|
|
224
|
+
|
|
225
|
+
**Traversal<S,E>:** `hasNext()`, `next()`, `tryNext()`, `toList()`, `toSet()`,
|
|
226
|
+
`iterate()`, `explain()`, `profile()`, `as()`, `by()`, `cap()`, `option()`,
|
|
227
|
+
`union()`, `coalesce()`, `optional()`
|
|
228
|
+
|
|
229
|
+
**GraphTraversal<S,E>:** Extends Traversal with graph steps (V, E, out, in, has,
|
|
230
|
+
etc.)
|
|
231
|
+
|
|
232
|
+
**Step Types:** `Step`, `MapStep` (1:1), `FilterStep` (1:0/1:1), `FlatMapStep`
|
|
233
|
+
(1:N), `BarrierStep`, `SideEffectStep`, `CollectingBarrierStep`
|
|
234
|
+
|
|
235
|
+
## Version 3.5/3.6 Features
|
|
236
|
+
|
|
237
|
+
**New Steps:** `mergeV()` (upsert vertex), `mergeE()` (upsert edge),
|
|
238
|
+
`elementMap()` **Deprecations:** `Order.incr`/`Order.decr` →
|
|
239
|
+
`Order.asc`/`Order.desc`
|
|
240
|
+
|
|
241
|
+
```groovy
|
|
242
|
+
g.mergeV().has('airport', 'code', 'XYZ')
|
|
243
|
+
.option(Merge.onCreate, __.property('name', 'New'))
|
|
244
|
+
.option(Merge.onMatch, __.property('name', 'Updated'))
|
|
245
|
+
.next()
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Air-Routes Dataset
|
|
249
|
+
|
|
250
|
+
Airline route network: airports, countries, continents as vertices; routes as
|
|
251
|
+
edges. Load from `air-routes.graphml`. Thousands of airports, tens of thousands
|
|
252
|
+
of routes.
|