Skip to content

Commit 2af5af8

Browse files
authored
Merge pull request #4 from NASA-AMMOS/dev/plan-search-examples
Examples of finding plans by contents
2 parents a9a8b9d + 26d1587 commit 2af5af8

2 files changed

Lines changed: 93 additions & 2 deletions

File tree

docs/api/examples/plan-search.mdx

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Plan Search
2+
3+
## Query for Plans with a Specific Activity Directive Type
4+
5+
The query below retrieves all plans that contain an activity directive of a specified type (e.g., "GenerateData"):
6+
7+
```graphql
8+
query QueryPlansWithActivityType {
9+
plan(where: { activity_directives: { type: { _eq: "GenerateData" } } }) {
10+
id
11+
name
12+
activity_directives {
13+
type
14+
arguments
15+
}
16+
}
17+
}
18+
```
19+
20+
## Query for Plans with Activity Directives with a Specific Argument Name
21+
22+
The query below retrieves all plans that contain an activity directive with a specific argument name (e.g., "bin"):
23+
24+
```graphql
25+
query QueryPlansWithArgumentName {
26+
plan(where: { activity_directives: { arguments: { _has_key: "bin" } } }) {
27+
id
28+
name
29+
activity_directives {
30+
type
31+
arguments
32+
}
33+
}
34+
}
35+
```
36+
37+
## Query for Plans with Activity Directives with a Specific Argument Value
38+
39+
The query below and the variables that follow retrieves all plans that contain an activity directive with a specific argument value (e.g., "bin" equal to 20):
40+
41+
```graphql
42+
query QueryByArgValue($argPair: jsonb) {
43+
plan(where: { activity_directives: { arguments: { _contains: $argPair } } }) {
44+
id
45+
name
46+
activity_directives {
47+
type
48+
arguments
49+
}
50+
}
51+
}
52+
```
53+
54+
### Variables
55+
56+
```json
57+
{
58+
"argPair": {
59+
"bin": 20
60+
}
61+
}
62+
```
63+
64+
# Activity Directive Search
65+
66+
## Query for Activity Directives with a Specific Activity Type
67+
68+
```graphql
69+
query QueryPlansWithActivityType {
70+
activity_directive(where: { type: { _eq: "GenerateData" } }) {
71+
id
72+
type
73+
plan_id
74+
}
75+
}
76+
```
77+
78+
## Query for Activity Directives with a Specific Argument Value Across All Plans
79+
80+
The query below retrieves all activity directives across all plans that have a specific argument substring present (e.g., "thrust"):
81+
82+
```graphql
83+
query QueryPlansWithParameterSubstring {
84+
activity_directive(where: { arguments: { _cast: { String: { _ilike: "%thrust%" } } } }) {
85+
id
86+
plan_id
87+
arguments
88+
}
89+
}
90+
```

sidebars.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const sidebars = {
2222
items: [
2323
'api/examples/planning/collaboration',
2424
'api/examples/planning/anchors',
25-
'api/examples/planning/snapshots'
25+
'api/examples/planning/snapshots',
2626
],
2727
},
2828
'api/examples/simulation',
@@ -32,6 +32,7 @@ const sidebars = {
3232
'api/examples/advanced-extensions',
3333
'api/examples/tags',
3434
'api/examples/external-events',
35+
'api/examples/plan-search',
3536
],
3637
},
3738
],
@@ -74,7 +75,7 @@ const sidebars = {
7475
'overview/design/software-design-document',
7576
],
7677
},
77-
'overview/aerie-renamed-to-plandev'
78+
'overview/aerie-renamed-to-plandev',
7879
],
7980
},
8081
{

0 commit comments

Comments
 (0)