Skip to content

Commit

Permalink
gh-2630 FederatedStore scripts added.
Browse files Browse the repository at this point in the history
  • Loading branch information
GCHQDev404 committed Apr 19, 2022
1 parent 6635ba0 commit 48ff219
Show file tree
Hide file tree
Showing 19 changed files with 182 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ curl -X POST --header 'Content-Type: application/json' --header 'Accept: applica
}
]
}
}
}
},
"isPublic": true
Expand Down
4 changes: 4 additions & 0 deletions example/real-federated-store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ cd Gaffer/example/real-federated-store/
```

The rest api will be deployed to localhost:8080/rest.


## Example Operations
Examples can be found at `have-a-go-at-operations`.
32 changes: 32 additions & 0 deletions example/real-federated-store/have-a-go-at-operations/README.md
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.
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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"
}
}
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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"class": "GetAllElements"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"class": "GetAllGraphIds"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"class": "GetSchema"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"class": "removeGraph",
"graphId": "mapEdges"
}

0 comments on commit 48ff219

Please sign in to comment.