-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-2630 FederatedStore scripts added.
- Loading branch information
1 parent
6635ba0
commit 0e1b656
Showing
19 changed files
with
184 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
example/real-federated-store/have-a-go-at-operations/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Copyright 2022-2022 Crown Copyright | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
Have A Go Operations | ||
============= | ||
|
||
Your FederatedStore will be empty the first time, so a graph followed by elements will need to be added. Example operations can be found here. | ||
|
||
## JSON | ||
Example json operations can be found at `json-operation-examples`. | ||
Copy & paste the files contents into the Swaggers execute panel. | ||
|
||
## Curl Command | ||
Example curl commands within shell scripts can be found at `curl-opertion-examples`. Execute these shell scripts or copy past the curl command into your terminal. | ||
|
||
```bash | ||
cd curl-operation-examples/ | ||
./curl_getAllGraphIds.sh | ||
``` | ||
|
||
The rest api will be deployed to localhost:8080/rest. |
1 change: 1 addition & 0 deletions
1
...eal-federated-store/have-a-go-at-operations/curl-operation-examples/curl_add1BasicEdge.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d @../json-operation-examples/operation_add1BasicEdge.json 'http://localhost:8080/rest/graph/operations/execute' |
16 changes: 16 additions & 0 deletions
16
...d-store/have-a-go-at-operations/curl-operation-examples/curl_add1BasicEdge_alternative.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ | ||
"class" : "uk.gov.gchq.gaffer.operation.impl.add.AddElements", | ||
"input" : [ { | ||
"group" : "BasicEdge", | ||
"source" : "1", | ||
"destination" : "2", | ||
"directed" : true, | ||
"properties" : { | ||
"count" : 1 | ||
}, | ||
"class" : "uk.gov.gchq.gaffer.data.element.Edge" | ||
} ], | ||
"options": { | ||
"gaffer.federatedstore.operation.graphIds": "mapEdges" | ||
} | ||
}' 'http://localhost:8080/rest/graph/operations/execute' |
1 change: 1 addition & 0 deletions
1
...rated-store/have-a-go-at-operations/curl-operation-examples/curl_addGraphForBasicEdges.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d @../json-operation-examples/operation_addGraphForBasicEdges.json 'http://localhost:8080/rest/graph/operations/execute' |
41 changes: 41 additions & 0 deletions
41
...have-a-go-at-operations/curl-operation-examples/curl_addGraphForBasicEdges_alternative.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ | ||
"class": "AddGraph", | ||
"graphId": "mapEdges", | ||
"storeProperties": { | ||
"gaffer.store.class":"uk.gov.gchq.gaffer.mapstore.MapStore" | ||
}, | ||
"schema": { | ||
"edges": { | ||
"BasicEdge": { | ||
"source": "vertex", | ||
"destination": "vertex", | ||
"directed": "true", | ||
"properties": { | ||
"count": "count" | ||
} | ||
} | ||
}, | ||
"types": { | ||
"vertex": { | ||
"class": "java.lang.String" | ||
}, | ||
"count": { | ||
"class": "java.lang.Integer", | ||
"aggregateFunction": { | ||
"class": "uk.gov.gchq.koryphe.impl.binaryoperator.Sum" | ||
} | ||
}, | ||
"true": { | ||
"description": "A simple boolean that must always be true.", | ||
"class": "java.lang.Boolean", | ||
"validateFunctions": [ | ||
{ | ||
"class": "uk.gov.gchq.koryphe.impl.predicate.IsTrue" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"isPublic": true | ||
}' 'http://localhost:8080/rest/graph/operations/execute' |
2 changes: 2 additions & 0 deletions
2
...al-federated-store/have-a-go-at-operations/curl-operation-examples/curl_getAllElements.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env bash | ||
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d @../json-operation-examples/operation_getAllElements.json 'http://localhost:8080/rest/graph/operations/execute' |
2 changes: 2 additions & 0 deletions
2
...al-federated-store/have-a-go-at-operations/curl-operation-examples/curl_getAllGraphIds.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env bash | ||
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d @../json-operation-examples/operation_getAllGraphIds.json 'http://localhost:8080/rest/graph/operations/execute' |
2 changes: 2 additions & 0 deletions
2
...le/real-federated-store/have-a-go-at-operations/curl-operation-examples/curl_getSchema.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env bash | ||
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d @../json-operation-examples/operation_getSchema.json 'http://localhost:8080/rest/graph/operations/execute' |
5 changes: 5 additions & 0 deletions
5
...rated-store/have-a-go-at-operations/curl-operation-examples/curl_getSchema_alternative.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d ' | ||
{ | ||
"class":"getSchema" | ||
}' 'http://localhost:8080/rest/graph/operations/execute' |
1 change: 1 addition & 0 deletions
1
...erated-store/have-a-go-at-operations/curl-operation-examples/curl_removeBasicEdgeGraph.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d @../json-operation-examples/operation_removeBasicEdgeGraph.json 'http://localhost:8080/rest/graph/operations/execute' |
4 changes: 4 additions & 0 deletions
4
.../have-a-go-at-operations/curl-operation-examples/curl_removeBasicEdgeGraph_alternative.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ | ||
"class": "removeGraph", | ||
"graphId": "mapEdges" | ||
}' 'http://localhost:8080/rest/graph/operations/execute' |
18 changes: 18 additions & 0 deletions
18
...erated-store/have-a-go-at-operations/json-operation-examples/operation_add1BasicEdge.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"class": "uk.gov.gchq.gaffer.operation.impl.add.AddElements", | ||
"input": [ | ||
{ | ||
"group": "BasicEdge", | ||
"source": "1", | ||
"destination": "2", | ||
"directed": true, | ||
"properties": { | ||
"count": 1 | ||
}, | ||
"class": "uk.gov.gchq.gaffer.data.element.Edge" | ||
} | ||
], | ||
"options": { | ||
"gaffer.federatedstore.operation.graphIds": "mapEdges" | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...tore/have-a-go-at-operations/json-operation-examples/operation_addGraphForBasicEdges.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"class": "AddGraph", | ||
"graphId": "mapEdges", | ||
"storeProperties": { | ||
"gaffer.store.class": "uk.gov.gchq.gaffer.mapstore.MapStore" | ||
}, | ||
"schema": { | ||
"edges": { | ||
"BasicEdge": { | ||
"source": "vertex", | ||
"destination": "vertex", | ||
"directed": "true", | ||
"properties": { | ||
"count": "count" | ||
} | ||
} | ||
}, | ||
"types": { | ||
"vertex": { | ||
"class": "java.lang.String" | ||
}, | ||
"count": { | ||
"class": "java.lang.Integer", | ||
"aggregateFunction": { | ||
"class": "uk.gov.gchq.koryphe.impl.binaryoperator.Sum" | ||
} | ||
}, | ||
"true": { | ||
"description": "A simple boolean that must always be true.", | ||
"class": "java.lang.Boolean", | ||
"validateFunctions": [ | ||
{ | ||
"class": "uk.gov.gchq.koryphe.impl.predicate.IsTrue" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"isPublic": true | ||
} |
3 changes: 3 additions & 0 deletions
3
...rated-store/have-a-go-at-operations/json-operation-examples/operation_getAllElements.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"class": "GetAllElements" | ||
} |
3 changes: 3 additions & 0 deletions
3
...rated-store/have-a-go-at-operations/json-operation-examples/operation_getAllGraphIds.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"class": "GetAllGraphIds" | ||
} |
3 changes: 3 additions & 0 deletions
3
...-federated-store/have-a-go-at-operations/json-operation-examples/operation_getSchema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"class": "GetSchema" | ||
} |
4 changes: 4 additions & 0 deletions
4
...store/have-a-go-at-operations/json-operation-examples/operation_removeBasicEdgeGraph.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"class": "removeGraph", | ||
"graphId": "mapEdges" | ||
} |