@yottagraph-app/elemental-api-skill 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/README.md +61 -0
- package/index.js +29 -0
- package/package.json +25 -0
- package/skill/SKILL.md +37 -0
- package/skill/articles.md +386 -0
- package/skill/entities.md +360 -0
- package/skill/events.md +145 -0
- package/skill/find.md +279 -0
- package/skill/graph.md +239 -0
- package/skill/llm.md +18 -0
- package/skill/overview.md +51 -0
- package/skill/relationships.md +308 -0
- package/skill/schema.md +351 -0
- package/skill/sentiment.md +93 -0
- package/skill/server.md +186 -0
package/skill/find.md
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# Find (Expression Language)
|
|
2
|
+
|
|
3
|
+
The `/elemental/find` endpoint searches for entities using a JSON expression language. Expressions can filter by entity type, compare property values, traverse relationships, and combine conditions with logical operators.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- You need to search for entities matching specific criteria (type, property values, relationships)
|
|
8
|
+
- You need to combine multiple filters (e.g., "ships with name containing PACIFIC")
|
|
9
|
+
- You need to find entities connected to a given entity via the knowledge graph
|
|
10
|
+
|
|
11
|
+
## Expression Structure
|
|
12
|
+
|
|
13
|
+
Every expression is a JSON object with a `type` field that determines which other fields are required:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{"type": "<expression_type>", "<expression_type>": { ... }}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Expressions are passed as URL-encoded form data in the `expression` parameter (NOT as a JSON request body).
|
|
20
|
+
|
|
21
|
+
## Expression Types
|
|
22
|
+
|
|
23
|
+
| Type | Description | Key Fields | Status |
|
|
24
|
+
|------|-------------|------------|--------|
|
|
25
|
+
| `is_type` | Filter entities by type (flavor) | `is_type.fid` (integer) | Implemented |
|
|
26
|
+
| `comparison` | Compare a property value | `comparison.operator`, `comparison.pid`, `comparison.value` | Partial -- see operator table below |
|
|
27
|
+
| `linked` | Find entities linked via relationships | `linked.distance`, `linked.to_entity`, `linked.pids` | Implemented |
|
|
28
|
+
| `and` | All sub-expressions must match | `and` (array of expressions) | Implemented |
|
|
29
|
+
| `or` | At least one sub-expression must match | `or` (array of expressions) | Implemented |
|
|
30
|
+
| `not` | Negate an expression | `not` (single expression) | Implemented |
|
|
31
|
+
|
|
32
|
+
### `is_type` -- Filter by Entity Type
|
|
33
|
+
|
|
34
|
+
Returns all entities of a given flavor (type). Look up FIDs via `GET /elemental/metadata/schema` (see schema.md).
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{"type": "is_type", "is_type": {"fid": 1}}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### `comparison` -- Compare Property Values
|
|
41
|
+
|
|
42
|
+
Compares a property (identified by PID) against a value. Look up PIDs via the schema endpoints (see schema.md).
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{"type": "comparison", "comparison": {"operator": "string_like", "pid": 8, "value": "PACIFIC"}}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Fields:**
|
|
49
|
+
|
|
50
|
+
| Field | Type | Required | Description |
|
|
51
|
+
|-------|------|----------|-------------|
|
|
52
|
+
| operator | string | yes | One of: `string_like`, `eq`, `lt`, `gt`, `regex`, `has_value` |
|
|
53
|
+
| pid | integer | yes | Property ID to compare (must be non-zero) |
|
|
54
|
+
| value | any | depends | Value to compare against (not required for `has_value`) |
|
|
55
|
+
| accept_imputed | boolean | no | Include imputed (inferred) values in the comparison (default: false). Parsed but not yet used by any operator. |
|
|
56
|
+
|
|
57
|
+
**Operators:**
|
|
58
|
+
|
|
59
|
+
| Operator | Description | Value Type | Status |
|
|
60
|
+
|----------|-------------|------------|--------|
|
|
61
|
+
| `string_like` | Case-insensitive substring match | string | Implemented (name property only) |
|
|
62
|
+
| `has_value` | Property has any value (value field not needed) | n/a | Implemented |
|
|
63
|
+
| `eq` | Equal to | string, number, or boolean | Implemented (type-aware) |
|
|
64
|
+
| `lt` | Less than | number | Implemented (numeric properties only) |
|
|
65
|
+
| `gt` | Greater than | number | Implemented (numeric properties only) |
|
|
66
|
+
| `regex` | Regular expression match | string (regex pattern) | Not yet implemented |
|
|
67
|
+
|
|
68
|
+
### `linked` -- Relationship Traversal
|
|
69
|
+
|
|
70
|
+
Finds entities linked to a target entity through the knowledge graph. See relationships.md for more on entity relationships.
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{"type": "linked", "linked": {"to_entity": "00416400910670863867", "distance": 1}}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Fields:**
|
|
77
|
+
|
|
78
|
+
| Field | Type | Required | Description |
|
|
79
|
+
|-------|------|----------|-------------|
|
|
80
|
+
| distance | integer | yes | Maximum relationship distance to traverse (minimum 1) |
|
|
81
|
+
| to_entity | string | no | Target entity ID (20-character zero-padded) |
|
|
82
|
+
| pids | integer[] | no | Property IDs defining which relationship types to follow |
|
|
83
|
+
| direction | string | no | Direction of traversal: `"outgoing"` (default) follows subject->value edges, `"incoming"` follows reverse (value->subject) edges, `"both"` unions both directions |
|
|
84
|
+
|
|
85
|
+
### `and` / `or` / `not` -- Logical Operators
|
|
86
|
+
|
|
87
|
+
Combine expressions with standard boolean logic. `and` and `or` take arrays of sub-expressions; `not` takes a single sub-expression.
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{"type": "and", "and": [
|
|
91
|
+
{"type": "is_type", "is_type": {"fid": 1}},
|
|
92
|
+
{"type": "comparison", "comparison": {"operator": "string_like", "pid": 8, "value": "PACIFIC"}}
|
|
93
|
+
]}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{"type": "or", "or": [
|
|
98
|
+
{"type": "is_type", "is_type": {"fid": 1}},
|
|
99
|
+
{"type": "is_type", "is_type": {"fid": 2}}
|
|
100
|
+
]}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{"type": "not", "not": {"type": "is_type", "is_type": {"fid": 1}}}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
### Find all organizations
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
POST /elemental/find
|
|
113
|
+
Content-Type: application/x-www-form-urlencoded
|
|
114
|
+
|
|
115
|
+
expression={"type":"is_type","is_type":{"fid":10}}&limit=100
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Find entities with "Apple" in the name
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
POST /elemental/find
|
|
122
|
+
Content-Type: application/x-www-form-urlencoded
|
|
123
|
+
|
|
124
|
+
expression={"type":"comparison","comparison":{"operator":"string_like","pid":8,"value":"Apple"}}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Find ships with "PACIFIC" in the name (combined AND)
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
POST /elemental/find
|
|
131
|
+
Content-Type: application/x-www-form-urlencoded
|
|
132
|
+
|
|
133
|
+
expression={"type":"and","and":[{"type":"is_type","is_type":{"fid":1}},{"type":"comparison","comparison":{"operator":"string_like","pid":8,"value":"PACIFIC"}}]}&limit=50
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Find entities linked to a specific entity
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
POST /elemental/find
|
|
140
|
+
Content-Type: application/x-www-form-urlencoded
|
|
141
|
+
|
|
142
|
+
expression={"type":"linked","linked":{"to_entity":"00416400910670863867","distance":1}}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Exclude a type from results (NOT)
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
POST /elemental/find
|
|
149
|
+
Content-Type: application/x-www-form-urlencoded
|
|
150
|
+
|
|
151
|
+
expression={"type":"and","and":[{"type":"comparison","comparison":{"operator":"string_like","pid":8,"value":"Apple"}},{"type":"not","not":{"type":"is_type","is_type":{"fid":1}}}]}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Tips
|
|
155
|
+
|
|
156
|
+
- Always look up FIDs and PIDs from the schema first (see schema.md) rather than hardcoding values
|
|
157
|
+
- Use `limit` to control result size; the response sets `follow_up: true` if more results are available
|
|
158
|
+
- Expressions can be deeply nested -- combine `and`, `or`, and `not` freely
|
|
159
|
+
- The `string_like` operator currently only works on the "name" property
|
|
160
|
+
- The `lt` and `gt` operators work on numeric properties (`data_int`, `data_float`) only; using them on non-numeric properties will return an error
|
|
161
|
+
- The `regex` comparison operator is defined in the schema but not yet implemented; using it will return an error
|
|
162
|
+
- The `accept_imputed` field is accepted on comparison expressions but has no effect yet
|
|
163
|
+
|
|
164
|
+
<!-- BEGIN GENERATED CONTENT -->
|
|
165
|
+
|
|
166
|
+
## Endpoints
|
|
167
|
+
|
|
168
|
+
### Find entities by expression
|
|
169
|
+
|
|
170
|
+
`POST /elemental/find`
|
|
171
|
+
|
|
172
|
+
Search for entities using a powerful expression language. The expression parameter supports complex nested queries with logical operators, geographic constraints, property comparisons, and more.
|
|
173
|
+
|
|
174
|
+
#### Guidance
|
|
175
|
+
|
|
176
|
+
CRITICAL: This endpoint REQUIRES Content-Type: application/x-www-form-urlencoded. Sending a JSON body will fail with 400 error. The expression parameter must be URL-encoded form data, not a JSON request body. For the full expression language reference including all expression types, comparison operators, and examples, see find.md.
|
|
177
|
+
|
|
178
|
+
#### Request Body
|
|
179
|
+
|
|
180
|
+
**Content-Type:** `application/x-www-form-urlencoded`
|
|
181
|
+
|
|
182
|
+
| Name | Type | Required | Description |
|
|
183
|
+
|------|------|----------|-------------|
|
|
184
|
+
| expression | string | yes | JSON-encoded expression object defining the search criteria |
|
|
185
|
+
| deadline | any | no | Response deadline in milliseconds or duration format |
|
|
186
|
+
| limit | integer | no | Maximum number of entity IDs to return in first response |
|
|
187
|
+
|
|
188
|
+
#### Responses
|
|
189
|
+
|
|
190
|
+
| Status | Description |
|
|
191
|
+
|--------|-------------|
|
|
192
|
+
| 200 | Find operation successful (`FindResponse`) |
|
|
193
|
+
| 400 | Bad request - invalid parameters or malformed expression (`Error`) |
|
|
194
|
+
| 500 | Internal server error (`Error`) |
|
|
195
|
+
| 501 | Elemental API capability not enabled (`Error`) |
|
|
196
|
+
|
|
197
|
+
#### Example
|
|
198
|
+
|
|
199
|
+
**Request:**
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
POST /elemental/find
|
|
203
|
+
Content-Type: application/x-www-form-urlencoded
|
|
204
|
+
|
|
205
|
+
expression={"type":"is_type","is_type":{"fid":10}}&limit=5
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Response:**
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
{"op_id": "98cc54e9-0108-4361-9c96-18ea97cda7a2", "follow_up": true, "eids": ["01601807036815568643", "08115040994665529432", "02045070050429461063"]}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Types
|
|
215
|
+
|
|
216
|
+
### FindResponse
|
|
217
|
+
|
|
218
|
+
| Field | Type | Description |
|
|
219
|
+
|-------|------|-------------|
|
|
220
|
+
| find | `FindData` | |
|
|
221
|
+
|
|
222
|
+
### FindData
|
|
223
|
+
|
|
224
|
+
| Field | Type | Description |
|
|
225
|
+
|-------|------|-------------|
|
|
226
|
+
| **eids** | string[] | Array of 20-character entity IDs matching the search expression |
|
|
227
|
+
|
|
228
|
+
### Expression
|
|
229
|
+
|
|
230
|
+
| Field | Type | Description |
|
|
231
|
+
|-------|------|-------------|
|
|
232
|
+
| **type** | string | Type of expression. One of: is_type (filter by entity type), comparison (compare property values), linked (relationship traversal), and (logical AND), or (logical OR), not (logical NOT) |
|
|
233
|
+
|
|
234
|
+
### AndExpression
|
|
235
|
+
|
|
236
|
+
| Field | Type | Description |
|
|
237
|
+
|-------|------|-------------|
|
|
238
|
+
| **and** | `Expression`[] | Array of expressions that must all be true |
|
|
239
|
+
|
|
240
|
+
### OrExpression
|
|
241
|
+
|
|
242
|
+
| Field | Type | Description |
|
|
243
|
+
|-------|------|-------------|
|
|
244
|
+
| **or** | `Expression`[] | Array of expressions where at least one must be true |
|
|
245
|
+
|
|
246
|
+
### NotExpression
|
|
247
|
+
|
|
248
|
+
| Field | Type | Description |
|
|
249
|
+
|-------|------|-------------|
|
|
250
|
+
| **not** | `Expression` | Expression to negate |
|
|
251
|
+
|
|
252
|
+
### ComparisonExpression
|
|
253
|
+
|
|
254
|
+
| Field | Type | Description |
|
|
255
|
+
|-------|------|-------------|
|
|
256
|
+
| **comparison** | `Comparison` | |
|
|
257
|
+
|
|
258
|
+
### IsTypeExpression
|
|
259
|
+
|
|
260
|
+
| Field | Type | Description |
|
|
261
|
+
|-------|------|-------------|
|
|
262
|
+
| **is_type** | `IsType` | |
|
|
263
|
+
|
|
264
|
+
### Comparison
|
|
265
|
+
|
|
266
|
+
| Field | Type | Description |
|
|
267
|
+
|-------|------|-------------|
|
|
268
|
+
| **operator** | string | Comparison operator. One of: string_like (case-insensitive substring match), eq (equal to), lt (less than), gt (greater than), regex (regular expression match), has_value (property has any value, no value field needed) |
|
|
269
|
+
| **pid** | integer | Property identifier (PID) to compare against |
|
|
270
|
+
| value | any | Value to compare with (not required for has_value operator) |
|
|
271
|
+
| accept_imputed | boolean | Whether to include imputed property values in comparison |
|
|
272
|
+
|
|
273
|
+
### IsType
|
|
274
|
+
|
|
275
|
+
| Field | Type | Description |
|
|
276
|
+
|-------|------|-------------|
|
|
277
|
+
| **fid** | integer | Flavor identifier (FID) representing entity type |
|
|
278
|
+
|
|
279
|
+
<!-- END GENERATED CONTENT -->
|
package/skill/graph.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Graph
|
|
2
|
+
|
|
3
|
+
The graph endpoints are focused on "graph analysis", providing insights into relationships between different entities. This includes, but is not limited to, visual rendering of a graph.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- You want to explore the entities that are most directly related to a given center entity (the "neighborhood" of entities)
|
|
8
|
+
- You want to understand the relationships between entities and their neighbors
|
|
9
|
+
- You need to create a visual representation of entity relationships
|
|
10
|
+
- You need layout coordinates for rendering a graph
|
|
11
|
+
|
|
12
|
+
## Key Concepts
|
|
13
|
+
|
|
14
|
+
- **Graph Layout**: Computed positions for nodes (entities) and edges (relationships)
|
|
15
|
+
- **Neighborhood**: The set of entities directly connected to a focal entity
|
|
16
|
+
- **Neighborhood History**: How the neighborhood has changed over time
|
|
17
|
+
|
|
18
|
+
## Tips
|
|
19
|
+
|
|
20
|
+
- Start with a single focal entity (center NEID) to get its immediate neighborhood
|
|
21
|
+
- Graph endpoints return relationships between entities as well as layout data optimized for visualization
|
|
22
|
+
|
|
23
|
+
<!-- BEGIN GENERATED CONTENT -->
|
|
24
|
+
|
|
25
|
+
## Endpoints
|
|
26
|
+
|
|
27
|
+
### Get graph layout
|
|
28
|
+
|
|
29
|
+
`GET /graph/{center_neid}/layout`
|
|
30
|
+
|
|
31
|
+
Get nodes and edges layout data for visualizing a relationship graph. Response is cached for 5 minutes.
|
|
32
|
+
|
|
33
|
+
#### Guidance
|
|
34
|
+
|
|
35
|
+
Only use this endpoint if you care about graph-specific properties. Otherwise it is faster to use /entities/{source_neid}/links/{target_neid}. This should always be called with a non-empty list of neids. A typical pattern is to call /graph/{center_neid}/neighborhood and then use the returned NEIDs to call this endpoint.
|
|
36
|
+
|
|
37
|
+
#### Parameters
|
|
38
|
+
|
|
39
|
+
| Name | Type | Required | Description |
|
|
40
|
+
|------|------|----------|-------------|
|
|
41
|
+
| center_neid | string | yes | Center entity NEID |
|
|
42
|
+
| neid | string[] | no | Additional entity NEIDs to include in layout |
|
|
43
|
+
| borderMinX | number | no | Minimum X border for layout |
|
|
44
|
+
| borderMinY | number | no | Minimum Y border for layout |
|
|
45
|
+
| borderMaxX | number | no | Maximum X border for layout |
|
|
46
|
+
| borderMaxY | number | no | Maximum Y border for layout |
|
|
47
|
+
|
|
48
|
+
#### Responses
|
|
49
|
+
|
|
50
|
+
| Status | Description |
|
|
51
|
+
|--------|-------------|
|
|
52
|
+
| 200 | Graph layout with nodes and edges (`GraphLayoutResponse`) |
|
|
53
|
+
| 400 | Invalid parameters (`Error`) |
|
|
54
|
+
| 500 | Internal server error (`Error`) |
|
|
55
|
+
|
|
56
|
+
#### Example
|
|
57
|
+
|
|
58
|
+
**Request:**
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
GET /graph/00416400910670863867/layout?neid=04358848009837283240
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Response:**
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{"nodes": [{"neid": "00416400910670863867", "label": "organization|Apple|nationality: us...", "isCentralNode": true, "x": -333.33, "y": -200, "width": 666.67, "height": 266.67}], "edges": [{"source": "00416400910670863867", "target": "04358848009837283240", "label": "competes_with", "path": [{"X": 0, "Y": 0}, {"X": 0, "Y": 66.67}], "article_ids": ["02861951941133789623"], "snippets": ["Apple and Google are mentioned as companies..."], "weight": 0.0267}]}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### Get graph neighborhood
|
|
73
|
+
|
|
74
|
+
`GET /graph/{center_neid}/neighborhood`
|
|
75
|
+
|
|
76
|
+
Get list of neighboring entities in the relationship graph, optionally filtered by entity type. Response is cached for 5 minutes.
|
|
77
|
+
|
|
78
|
+
#### Guidance
|
|
79
|
+
|
|
80
|
+
Only use this endpoint if you care about graph-specific properties. Otherwise it is faster to use /entities/{source_neid}/linked. Response includes the center entity itself in the results with a weight of 1.0. The 'neighbors' and 'weights' arrays are parallel (same indices correspond).
|
|
81
|
+
|
|
82
|
+
#### Parameters
|
|
83
|
+
|
|
84
|
+
| Name | Type | Required | Description |
|
|
85
|
+
|------|------|----------|-------------|
|
|
86
|
+
| center_neid | string | yes | Center entity NEID |
|
|
87
|
+
| size | integer | no | Maximum number of neighbors to return |
|
|
88
|
+
| type | string[] | no | Filter by entity type(s) |
|
|
89
|
+
|
|
90
|
+
#### Responses
|
|
91
|
+
|
|
92
|
+
| Status | Description |
|
|
93
|
+
|--------|-------------|
|
|
94
|
+
| 200 | Neighbors and their weights (`GraphNeighborhoodResponse`) |
|
|
95
|
+
| 400 | Invalid parameters (`Error`) |
|
|
96
|
+
| 404 | Center entity not found (`Error`) |
|
|
97
|
+
| 500 | Internal server error (`Error`) |
|
|
98
|
+
|
|
99
|
+
#### Example
|
|
100
|
+
|
|
101
|
+
**Request:**
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
GET /graph/00416400910670863867/neighborhood?size=5
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Response:**
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{"neighbors": ["00416400910670863867", "04358848009837283240", "00315863961550087877"], "weights": [1, 0.0267, 0.0167]}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### Get neighborhood history
|
|
116
|
+
|
|
117
|
+
`GET /graph/{center_neid}/neighborhood/history`
|
|
118
|
+
|
|
119
|
+
Get historical data about influential neighbors for an entity over time. Response is cached for 5 minutes.
|
|
120
|
+
|
|
121
|
+
#### Guidance
|
|
122
|
+
|
|
123
|
+
Response includes the center entity itself in each day's results with an influence of 1.0.
|
|
124
|
+
|
|
125
|
+
#### Parameters
|
|
126
|
+
|
|
127
|
+
| Name | Type | Required | Description |
|
|
128
|
+
|------|------|----------|-------------|
|
|
129
|
+
| center_neid | string | yes | Center entity NEID |
|
|
130
|
+
| size | integer | no | Maximum number of neighbors per day to return |
|
|
131
|
+
| type | string[] | no | Filter by entity type(s) |
|
|
132
|
+
|
|
133
|
+
#### Responses
|
|
134
|
+
|
|
135
|
+
| Status | Description |
|
|
136
|
+
|--------|-------------|
|
|
137
|
+
| 200 | Historical neighborhood data (`GraphNeighborhoodHistoryResponse`) |
|
|
138
|
+
| 400 | Invalid parameters (`Error`) |
|
|
139
|
+
| 404 | Center entity not found (`Error`) |
|
|
140
|
+
| 500 | Internal server error (`Error`) |
|
|
141
|
+
|
|
142
|
+
#### Example
|
|
143
|
+
|
|
144
|
+
**Request:**
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
GET /graph/00416400910670863867/neighborhood/history?size=3
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Response:**
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{"history": [{"date": "2025-12-30T00:00:00Z", "neighbors": [{"neid": "00416400910670863867", "influence": 1}, {"neid": "04015955446548481006", "influence": 0.072}]}]}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Types
|
|
157
|
+
|
|
158
|
+
### GraphEdge
|
|
159
|
+
|
|
160
|
+
An edge between two nodes in the graph
|
|
161
|
+
|
|
162
|
+
| Field | Type | Description |
|
|
163
|
+
|-------|------|-------------|
|
|
164
|
+
| article_ids | string[] | Article IDs associated with this edge |
|
|
165
|
+
| label | string | Display label for the edge |
|
|
166
|
+
| path | `GraphVector`[] | Path points for rendering the edge |
|
|
167
|
+
| snippets | string[] | Text snippets describing the relationship |
|
|
168
|
+
| source | string | Source node NEID |
|
|
169
|
+
| target | string | Target node NEID |
|
|
170
|
+
| weight | number | Weight/strength of the edge |
|
|
171
|
+
|
|
172
|
+
### GraphLayoutResponse
|
|
173
|
+
|
|
174
|
+
Response containing graph layout for visualization
|
|
175
|
+
|
|
176
|
+
| Field | Type | Description |
|
|
177
|
+
|-------|------|-------------|
|
|
178
|
+
| edges | `GraphEdge`[] | List of graph edges |
|
|
179
|
+
| nodes | `GraphNode`[] | List of graph nodes |
|
|
180
|
+
|
|
181
|
+
### GraphNeighborhoodHistoryResponse
|
|
182
|
+
|
|
183
|
+
Response containing historical influential neighbor data over time
|
|
184
|
+
|
|
185
|
+
| Field | Type | Description |
|
|
186
|
+
|-------|------|-------------|
|
|
187
|
+
| history | `NeighborhoodHistoryEntry`[] | List of historical neighborhood entries |
|
|
188
|
+
|
|
189
|
+
### GraphNeighborhoodResponse
|
|
190
|
+
|
|
191
|
+
Response containing neighbors of an entity in the relationship graph
|
|
192
|
+
|
|
193
|
+
| Field | Type | Description |
|
|
194
|
+
|-------|------|-------------|
|
|
195
|
+
| neighbors | string[] | List of neighbor NEIDs |
|
|
196
|
+
| weights | number[] | Weights corresponding to each neighbor (same order as neighbors) |
|
|
197
|
+
|
|
198
|
+
### GraphNode
|
|
199
|
+
|
|
200
|
+
A node in the graph layout
|
|
201
|
+
|
|
202
|
+
| Field | Type | Description |
|
|
203
|
+
|-------|------|-------------|
|
|
204
|
+
| height | number | Height of the node for rendering |
|
|
205
|
+
| isCentralNode | boolean | Whether this is the central/focus node |
|
|
206
|
+
| label | string | Display label for the node |
|
|
207
|
+
| neid | string | Named Entity ID |
|
|
208
|
+
| width | number | Width of the node for rendering |
|
|
209
|
+
| x | number | X coordinate in the layout |
|
|
210
|
+
| y | number | Y coordinate in the layout |
|
|
211
|
+
|
|
212
|
+
### GraphVector
|
|
213
|
+
|
|
214
|
+
A 2D point in the graph layout
|
|
215
|
+
|
|
216
|
+
| Field | Type | Description |
|
|
217
|
+
|-------|------|-------------|
|
|
218
|
+
| X | number | X coordinate |
|
|
219
|
+
| Y | number | Y coordinate |
|
|
220
|
+
|
|
221
|
+
### InfluenceEntry
|
|
222
|
+
|
|
223
|
+
A neighbor and their influence score
|
|
224
|
+
|
|
225
|
+
| Field | Type | Description |
|
|
226
|
+
|-------|------|-------------|
|
|
227
|
+
| influence | number | Influence score |
|
|
228
|
+
| neid | string | Named Entity ID |
|
|
229
|
+
|
|
230
|
+
### NeighborhoodHistoryEntry
|
|
231
|
+
|
|
232
|
+
Influential neighbors for a specific date
|
|
233
|
+
|
|
234
|
+
| Field | Type | Description |
|
|
235
|
+
|-------|------|-------------|
|
|
236
|
+
| date | string | Date of the history entry @Format date-time |
|
|
237
|
+
| neighbors | `InfluenceEntry`[] | List of influential neighbors on this date |
|
|
238
|
+
|
|
239
|
+
<!-- END GENERATED CONTENT -->
|
package/skill/llm.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# LLM (Ada)
|
|
2
|
+
|
|
3
|
+
Ada is the AI assistant integrated into the Query Server, capable of answering natural language questions about the Knowledge Graph.
|
|
4
|
+
|
|
5
|
+
## Status: Not Currently Available
|
|
6
|
+
|
|
7
|
+
⚠️ The LLM/Ada endpoints are currently **excluded** from this skill because they are not functional in the current deployment. This documentation is a placeholder for when the feature becomes available.
|
|
8
|
+
|
|
9
|
+
## Intended Use Cases (Future)
|
|
10
|
+
|
|
11
|
+
- Natural language queries about entities ("Tell me about Apple's recent news")
|
|
12
|
+
- Conversational exploration of the Knowledge Graph
|
|
13
|
+
- AI-assisted analysis and summarization
|
|
14
|
+
|
|
15
|
+
<!-- BEGIN GENERATED CONTENT -->
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<!-- END GENERATED CONTENT -->
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Elemental API Overview
|
|
2
|
+
|
|
3
|
+
The Elemental API provides access to the Lovelace Knowledge Graph through the Query Server. This document explains core concepts and guides you to the right endpoint documentation.
|
|
4
|
+
|
|
5
|
+
## Core Concepts
|
|
6
|
+
|
|
7
|
+
### Named Entity ID (NEID)
|
|
8
|
+
Every entity in the system has a unique identifier called a NEID. Most API calls require a NEID, so your first step is usually looking up an entity by name to get its NEID.
|
|
9
|
+
|
|
10
|
+
**Format**: 20-character numeric string with zero-padding. Example: `00416400910670863867`
|
|
11
|
+
|
|
12
|
+
When normalizing NEIDs, always pad with leading zeros to exactly 20 characters.
|
|
13
|
+
|
|
14
|
+
**Note**: The terms "eid" and "neid" are interchangeable throughout the API. Some endpoints use `neid` and others use `eid`, but they refer to the same entity identifier.
|
|
15
|
+
|
|
16
|
+
### Mention Code (MCODE)
|
|
17
|
+
A mention is a specific reference to an entity in an article. Each mention has a unique MCODE that links the entity, article, and context together.
|
|
18
|
+
|
|
19
|
+
**Format**: `{neid}:{artid}` with colon separator. Example: `00416400910670863867:05433395856363393596`
|
|
20
|
+
|
|
21
|
+
### Time Ranges
|
|
22
|
+
Most endpoints accept `start` and `end` parameters for filtering by date.
|
|
23
|
+
|
|
24
|
+
**Required format**: Full ISO 8601 with timezone.
|
|
25
|
+
- Correct: `2026-01-28T00:00:00Z`
|
|
26
|
+
- Incorrect: `2026-01-28` (missing time and timezone)
|
|
27
|
+
|
|
28
|
+
## Endpoint Categories
|
|
29
|
+
|
|
30
|
+
| File | Use When You Need To... |
|
|
31
|
+
|------|------------------------|
|
|
32
|
+
| [entities.md](entities.md) | Look up entities by name, get details and properties |
|
|
33
|
+
| [find.md](find.md) | Search for entities by type, property values, or relationships using the expression language |
|
|
34
|
+
| [sentiment.md](sentiment.md) | Get sentiment scores and trends for an entity |
|
|
35
|
+
| [articles.md](articles.md) | Get articles that mention an entity, article content, titles, summaries |
|
|
36
|
+
| [events.md](events.md) | Find events involving an entity (mergers, lawsuits, etc.) |
|
|
37
|
+
| [relationships.md](relationships.md) | Find connections between entities |
|
|
38
|
+
| [graph.md](graph.md) | Generate visual network graphs |
|
|
39
|
+
| [server.md](server.md) | Check server status and capabilities, as well as schema info including flavors and properties. |
|
|
40
|
+
| [llm.md](llm.md) | (Not currently available) AI-assisted queries |
|
|
41
|
+
|
|
42
|
+
## Common Workflows
|
|
43
|
+
|
|
44
|
+
### "What's the sentiment for Apple?"
|
|
45
|
+
1. `entities.md` → Look up "Apple" to get NEID
|
|
46
|
+
2. `sentiment.md` → Query sentiment with the NEID
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### "How are Microsoft and OpenAI connected?"
|
|
50
|
+
1. `entities.md` → Look up both companies to get NEIDs
|
|
51
|
+
2. `relationships.md` → Query links between the two NEIDs
|