From 1b24751a0358dee43241a5a262081f47a9967def Mon Sep 17 00:00:00 2001 From: DO YUNG YOON Date: Tue, 6 Sep 2016 23:44:20 +0900 Subject: [PATCH 1/3] merge test.sh into bin/example.sh --- bin/example.sh | 216 +++++++++++++++++++++++++++++++++++++++++++++++++ script/test.sh | 177 ---------------------------------------- test.sh | 58 ------------- 3 files changed, 216 insertions(+), 235 deletions(-) create mode 100644 bin/example.sh delete mode 100644 script/test.sh delete mode 100644 test.sh diff --git a/bin/example.sh b/bin/example.sh new file mode 100644 index 00000000..c33cacbc --- /dev/null +++ b/bin/example.sh @@ -0,0 +1,216 @@ +#!/usr/bin/env bash + + +printf "First, we need a name for the new service. \n Why don't we call it Kakao Favorites? \n" +read -r -p 'Step 1: Creating Service >>> ' var + +curl -XPOST localhost:9000/graphs/createService -H 'Content-Type: Application/json' -d ' +{"serviceName": "KakaoFavorites", "compressionAlgorithm" : "gz"} +' + +printf "\n\n" + +read -r -p 'Make Sure the service is created correctly. >>> ' var + +curl -XGET localhost:9000/graphs/getService/KakaoFavorites + +# 2. Next, we will need some friends. +# In S2Graph, relationships are defined as Labels. +# Create a friends label with the following createLabel API call: +printf "\n\n\nNext, we will need some friends. \nIn S2Graph, relationships are defined as Labels.\nCreate a friends label with the following createLabel API call:\n" +read -r -p 'Step 2: Create Label >>> ' var + +payload=' +{ + "label": "friends", + "srcServiceName": "KakaoFavorites", + "srcColumnName": "userName", + "srcColumnType": "string", + "tgtServiceName": "KakaoFavorites", + "tgtColumnName": "userName", + "tgtColumnType": "string", + "isDirected": "false", + "indices": [], + "props": [], + "consistencyLevel": "strong" +} +' +printf "\n$payload\n" +curl -XPOST localhost:9000/graphs/createLabel -H 'Content-Type: Application/json' -d ' +{ + "label": "friends", + "srcServiceName": "KakaoFavorites", + "srcColumnName": "userName", + "srcColumnType": "string", + "tgtServiceName": "KakaoFavorites", + "tgtColumnName": "userName", + "tgtColumnType": "string", + "isDirected": "false", + "indices": [], + "props": [], + "consistencyLevel": "strong" +} +' + +# Check the label: +printf "\n\n" +read -r -p 'Make Sure Label has been created correctly >>> ' var + +curl -XGET localhost:9000/graphs/getLabel/friends + +# Now that the label friends is ready, we can store friend entries. +# Entries of a label are called edges, and you can add edges with the edges/insert API: +printf "\n\nNow that the label friends is ready, we can store friend entries.\nEntries of a label are called edges, and you can add edges with the edges/insert API:\n" +read -r -p 'Step 3: Insert Edges >>> ' var +payload=' +[ + {"from":"Elmo","to":"Big Bird","label":"friends","props":{},"timestamp":1444360152477}, + {"from":"Elmo","to":"Ernie","label":"friends","props":{},"timestamp":1444360152478}, + {"from":"Elmo","to":"Bert","label":"friends","props":{},"timestamp":1444360152479}, + + {"from":"Cookie Monster","to":"Grover","label":"friends","props":{},"timestamp":1444360152480}, + {"from":"Cookie Monster","to":"Kermit","label":"friends","props":{},"timestamp":1444360152481}, + {"from":"Cookie Monster","to":"Oscar","label":"friends","props":{},"timestamp":1444360152482} +] +' +printf "\n$payload\n" +curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d ' +[ + {"from":"Elmo","to":"Big Bird","label":"friends","props":{},"timestamp":1444360152477}, + {"from":"Elmo","to":"Ernie","label":"friends","props":{},"timestamp":1444360152478}, + {"from":"Elmo","to":"Bert","label":"friends","props":{},"timestamp":1444360152479}, + + {"from":"Cookie Monster","to":"Grover","label":"friends","props":{},"timestamp":1444360152480}, + {"from":"Cookie Monster","to":"Kermit","label":"friends","props":{},"timestamp":1444360152481}, + {"from":"Cookie Monster","to":"Oscar","label":"friends","props":{},"timestamp":1444360152482} +] +' +printf "\n\n" +read -r -p 'Step 4: Query friends of Elmo with getEdges API: >>> ' var + +# Query friends of Elmo with getEdges API: +curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' +{ + "srcVertices": [{"serviceName": "KakaoFavorites", "columnName": "userName", "id":"Elmo"}], + "steps": [ + {"step": [{"label": "friends", "direction": "out", "offset": 0, "limit": 10}]} + ] +} +' +printf "\n\n" +read -r -p 'Step 5: Now query friends of Cookie Monster: >>> ' var +# Now query friends of Cookie Monster: +curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' +{ + "srcVertices": [{"serviceName": "KakaoFavorites", "columnName": "userName", "id":"Cookie Monster"}], + "steps": [ + {"step": [{"label": "friends", "direction": "out", "offset": 0, "limit": 10}]} + ] +} +' + + +# 3. Users of Kakao Favorites will be able to post URLs of their favorite websites. +# We will need a new label post for this data: +printf "\n\nUsers of Kakao Favorites will be able to post URLs of their favorite websites.\nWe will need a new label post for this data\n" +read -r -p 'Step 6: Create Label for Users of Kakao Favorites will be able to post URLs of their favorite websites. >>> ' var +payload=' +{ + "label": "post", + "srcServiceName": "KakaoFavorites", + "srcColumnName": "userName", + "srcColumnType": "string", + "tgtServiceName": "KakaoFavorites", + "tgtColumnName": "url", + "tgtColumnType": "string", + "isDirected": "true", + "indices": [], + "props": [], + "consistencyLevel": "strong" +} +' +printf "\n$payload\n" +curl -XPOST localhost:9000/graphs/createLabel -H 'Content-Type: Application/json' -d ' +{ + "label": "post", + "srcServiceName": "KakaoFavorites", + "srcColumnName": "userName", + "srcColumnType": "string", + "tgtServiceName": "KakaoFavorites", + "tgtColumnName": "url", + "tgtColumnType": "string", + "isDirected": "true", + "indices": [], + "props": [], + "consistencyLevel": "strong" +} +' + +# Now, insert some posts of our users: + +payload=' +[ + {"from":"Big Bird","to":"www.kakaocorp.com/en/main","label":"post","props":{},"timestamp":1444360152477}, + {"from":"Big Bird","to":"github.com/kakao/s2graph","label":"post","props":{},"timestamp":1444360152478}, + {"from":"Ernie","to":"groups.google.com/forum/#!forum/s2graph","label":"post","props":{},"timestamp":1444360152479}, + {"from":"Grover","to":"hbase.apache.org/forum/#!forum/s2graph","label":"post","props":{},"timestamp":1444360152480}, + {"from":"Kermit","to":"www.playframework.com","label":"post","props":{},"timestamp":1444360152481}, + {"from":"Oscar","to":"www.scala-lang.org","label":"post","props":{},"timestamp":1444360152482} +] +' +printf "\n\n" +read -r -p 'Step 7: Now, insert some posts of our users. >>> ' var +printf "\n$payload\n" +curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d ' +[ + {"from":"Big Bird","to":"www.kakaocorp.com/en/main","label":"post","props":{},"timestamp":1444360152477}, + {"from":"Big Bird","to":"github.com/kakao/s2graph","label":"post","props":{},"timestamp":1444360152478}, + {"from":"Ernie","to":"groups.google.com/forum/#!forum/s2graph","label":"post","props":{},"timestamp":1444360152479}, + {"from":"Grover","to":"hbase.apache.org/forum/#!forum/s2graph","label":"post","props":{},"timestamp":1444360152480}, + {"from":"Kermit","to":"www.playframework.com","label":"post","props":{},"timestamp":1444360152481}, + {"from":"Oscar","to":"www.scala-lang.org","label":"post","props":{},"timestamp":1444360152482} +] +' + +# Query posts of Big Bird: +printf "\n\n" +read -r -p 'Step 8: Query posts of Big Bird. >>> ' var +curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' +{ + "srcVertices": [{"serviceName": "KakaoFavorites", "columnName": "userName", "id":"Big Bird"}], + "steps": [ + {"step": [{"label": "post", "direction": "out", "offset": 0, "limit": 10}]} + ] +} +' + + +# 4. So far, we designed a label schema for your user relation data friends and post as well as stored some sample edges. +# While doing so, we have also prepared ourselves for our timeline query! +# The following two-step query will return URLs for Elmo's timeline, which are posts of Elmo's friends: +printf "\n\n" +read -r -p 'Step 9: Elmo`s Timeline. >>> ' var +curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' +{ + "srcVertices": [{"serviceName": "KakaoFavorites", "columnName": "userName", "id":"Elmo"}], + "steps": [ + {"step": [{"label": "friends", "direction": "out", "offset": 0, "limit": 10}]}, + {"step": [{"label": "post", "direction": "out", "offset": 0, "limit": 10}]} + ] +} +' + +# Also try Cookie Monster's timeline: +printf "\n\n" +read -r -p 'Step 10: Also try Cookie Monsters timeline: >>> ' var +curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' +{ + "srcVertices": [{"serviceName": "KakaoFavorites", "columnName": "userName", "id":"Cookie Monster"}], + "steps": [ + {"step": [{"label": "friends", "direction": "out", "offset": 0, "limit": 10}]}, + {"step": [{"label": "post", "direction": "out", "offset": 0, "limit": 10}]} + ] +} +' + +printf "\n\n" \ No newline at end of file diff --git a/script/test.sh b/script/test.sh deleted file mode 100644 index eba39345..00000000 --- a/script/test.sh +++ /dev/null @@ -1,177 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# create service. -curl -XPOST localhost:9000/graphs/createService -H 'Content-Type: Application/json' -d ' -{"serviceName": "s2graph", "compressionAlgorithm" : "gz"} -' -# check service. -curl -XGET localhost:9000/graphs/getService/s2graph - -# create label. -curl -XPUT localhost:9000/graphs/deleteLabel/graph_test -curl -XPOST localhost:9000/graphs/createLabel -H 'Content-Type: Application/json' -d ' -{ - "label": "graph_test", - "srcServiceName": "s2graph", - "srcColumnName": "account_id", - "srcColumnType": "long", - "tgtServiceName": "s2graph", - "tgtColumnName": "item_id", - "tgtColumnType": "string", - "indices": [ { "name": "idx_time_weight", "propNames": ["time", "weight"]} ], - "props": [ - {"name": "time", "dataType": "integer", "defaultValue": 0}, - {"name": "weight","dataType": "float","defaultValue": 0.0}, - {"name": "is_hidden","dataType": "boolean","defaultValue": false}, - {"name": "is_blocked","dataType": "boolean","defaultValue": false} - ], - "consistencyLevel": "strong" -} -' -curl -XPUT localhost:9000/graphs/deleteLabel/graph_test_2 -curl -XPOST localhost:9000/graphs/createLabel -H 'Content-Type: Application/json' -d ' -{ - "label": "graph_test_2", - "srcServiceName": "s2graph", - "srcColumnName": "account_id", - "srcColumnType": "long", - "tgtServiceName": "s2graph", - "tgtColumnName": "item_id", - "tgtColumnType": "string", - "indices": [ { "name": "idx_time_weight", "propNames": ["time", "weight"]} ], - "props": [ - {"name": "time", "dataType": "integer", "defaultValue": 0}, - {"name": "weight","dataType": "float","defaultValue": 0.0}, - {"name": "is_hidden","dataType": "boolean","defaultValue": false}, - {"name": "is_blocked","dataType": "boolean","defaultValue": false} - ], - "consistencyLevel": "strong" -} -' - -# check labels -curl -XGET localhost:9000/graphs/getLabel/graph_test -curl -XGET localhost:9000/graphs/getLabel/graph_test_2 - -# app props -curl -XPOST localhost:9000/graphs/addProp/graph_test -H 'Content-Type: Application/json' -d ' -{"name": "rel_type", "defaultValue": 0, "dataType": "integer"} -' - -curl -XPOST localhost:9000/graphs/addProp/graph_test -H 'Content-Type: Application/json' -d ' -{"name": "play_count", "defaultValue": 0, "dataType": "integer"} -' - -curl -XPOST localhost:9000/graphs/addProp/graph_test -H 'Content-Type: Application/json' -d ' -{"name": "pay_amount", "defaultValue": 0, "dataType": "integer"} -' - -# check if props is added correctly -curl -XGET localhost:9000/graphs/getLabel/graph_test - -# add extra index -curl -XPOST localhost:9000/graphs/addIndex -H 'Content-Type: Application/json' -d ' -{ - "label": "graph_test", - "indices": [ {"name": "idx_play_count_pay_amount", "propNames": ["play_count", "pay_amount"]} ] -} -' - -# check if new index is added correcly -curl -XGET localhost:9000/graphs/getLabel/graph_test - - -# add edges -curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d ' -[ - {"from":1,"to":"ab","label":"graph_test","props":{"time":-1, "weight":0.98},"timestamp":1442502000000}, - {"from":1,"to":"123456","label":"graph_test","props":{"time":0, "weight":0.81},"timestamp":1442502000010}, - {"from":1,"to":"zdfdk2384","label":"graph_test","props":{"time":1, "weight":1.0},"timestamp":1442502000020}, - {"from":1,"to":"dfjkdjfdk1234","label":"graph_test","props":{"time":-2, "weight":0.71},"timestamp":1442502000030}, - {"from":1,"to":"ab","label":"graph_test_2","props":{"time":-1, "weight":0.98},"timestamp":1442502000040}, - {"from":1,"to":"123456","label":"graph_test_2","props":{"time":0, "weight":0.81},"timestamp":1442502000050}, - {"from":1,"to":"zdfdk2384","label":"graph_test_2","props":{"time":1, "weight":1.0},"timestamp":1442502000060}, - {"from":1,"to":"dfjkdjfdk1234","label":"graph_test_2","props":{"time":-2, "weight":0.71},"timestamp":1442502000070} -] -' - -sleep 2 - -# select edges -curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' -{ - "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", "id":1}], - "steps": [ - {"step": [{"label": "graph_test", "direction": "out", "offset": 0, "limit": 10, "scoring": {"time": 1, "weight": 1}}]} - ] -} -' -## check for contentions - -curl -XPOST localhost:9000/graphs/edges/bulk -H 'Content-Type: text/plain' -d ' -1442502000000 insert edge 2 ab graph_test {"time": -1, "weight": 0.98} -1442502000001 delete edge 2 ab graph_test {} -1442502000002 insert edge 2 ab graph_test {"time": -10, "weight": -0.1} -' - -curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' -{ - "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", "id":2}], - "steps": [ - {"step": [{"label": "graph_test", "direction": "out", "offset": 0, "limit": 10, "scoring": {"time": 1, "weight": 1}}]} - ] -} -' - -## Vertex -curl -XPOST localhost:9000/graphs/createServiceColumn -H 'Content-Type: Application/json' -d ' -{ - "serviceName": "s2graph", - "columnName": "user_id", - "columnType": "long", - "props": [ - {"name": "is_active", "dataType": "boolean", "defaultValue": true}, - {"name": "phone_number", "dataType": "string", "defaultValue": "-"}, - {"name": "nickname", "dataType": "string", "defaultValue": ".."}, - {"name": "activity_score", "dataType": "float", "defaultValue": 0.0}, - {"name": "age", "dataType": "integer", "defaultValue": 0} - ] -} -' -# add props on Vertex -curl -XPOST localhost:9000/graphs/addServiceColumnProps/s2graph/user_id -H 'Content-Type: Application/json' -d ' -[ - {"name": "home_address", "defaultValue": "korea", "dataType": "string"} -] -' - -# insert vertex data -curl -XPOST localhost:9000/graphs/vertices/insert/s2graph/user_id -H 'Content-Type: Application/json' -d ' -[ - {"id":1,"props":{"is_active":true}, "timestamp":1417616431000}, - {"id":2,"props":{},"timestamp":1417616431000} -] -' - - -# select vertices -curl -XPOST localhost:9000/graphs/getVertices -H 'Content-Type: Application/json' -d ' -[ - {"serviceName": "s2graph", "columnName": "user_id", "ids": [1, 2]} -] -' diff --git a/test.sh b/test.sh deleted file mode 100644 index eb3a798b..00000000 --- a/test.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d ' -[ -{"timestamp": 1447493110829, "from": 7007, "to": "700710007abc", "label": "s2graph_label_test_2", "props": {"time": 10}} -] -' -sleep 2 -curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d ' -[ -{"timestamp": 1447493110831, "from": 7007, "to": "700710007abc", "label": "s2graph_label_test_2", "props": {"time": -10, "weight": 20}} -] -' -sleep 2 -curl -XPOST localhost:9000/graphs/edges/delete -H 'Content-Type: Application/json' -d ' -[ -{"timestamp": 1447493110830, "from": 7007, "to": "700710007abc", "label": "s2graph_label_test_2"} -] -' -sleep 2 -curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' -{ - "srcVertices": [ - { - "serviceName": "s2graph", - "columnName": "user_id_test", - "id": 7007 - } - ], - "steps": [ - [ - { - "label": "s2graph_label_test_2", - "direction": "out", - "offset": 0, - "limit": -1, - "duplicate": "raw" - } - ] - ] -} -' - From 7c2f143fe1a7609a7008fa635615d577b26252c7 Mon Sep 17 00:00:00 2001 From: DO YUNG YOON Date: Wed, 7 Sep 2016 00:07:55 +0900 Subject: [PATCH 2/3] update bin/example.sh. --- CHANGES | 2 ++ README.md | 2 ++ bin/example.sh | 11 ++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) mode change 100644 => 100755 bin/example.sh diff --git a/CHANGES b/CHANGES index 353b7167..659b091b 100644 --- a/CHANGES +++ b/CHANGES @@ -180,6 +180,8 @@ Release 0.12.1 - unreleased S2GRAPH-84: Test-case compilation error on `s2counter_loader` project (Committed by Jaesang Kim). S2GRAPH-104: force scalaz-stream, netty-http-pipelining dependencies version which is available on maven central (Committed by DOYUNG YOON). + + S2GRAPH-109: Merge duplicate test.sh into one same as `Your First Graph` on README.md (Committed by DOYUNG YOON). TEST diff --git a/README.md b/README.md index 73a683f3..aecc65d1 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ The first three projects are for OLTP-style workloads, currently the main target Your First Graph ================ +Once S2Graph server is up, let's try out small toy example. `bin/example.sh` can be used to go through following example. + As a toy problem, let's try to create the backend for a simple timeline of a new social network service. (Think of a simplified version of Facebook's Timeline. :stuck_out_tongue_winking_eye:) You will be able to manage "friends" and "posts" of a user with simple S2Graph queries. diff --git a/bin/example.sh b/bin/example.sh old mode 100644 new mode 100755 index c33cacbc..9d8def29 --- a/bin/example.sh +++ b/bin/example.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +printf "\n\n" +printf "As a toy problem, let's try to create the backend for a simple timeline of a new social network service.\n" +printf "(Think of a simplified version of Facebook's Timeline.)\n" +printf "You will be able to manage 'friends' and 'posts' of a user with simple S2Graph queries.\n\n" printf "First, we need a name for the new service. \n Why don't we call it Kakao Favorites? \n" read -r -p 'Step 1: Creating Service >>> ' var @@ -91,6 +95,7 @@ read -r -p 'Step 4: Query friends of Elmo with getEdges API: >>> ' var # Query friends of Elmo with getEdges API: curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' { + "select": ["to"], "srcVertices": [{"serviceName": "KakaoFavorites", "columnName": "userName", "id":"Elmo"}], "steps": [ {"step": [{"label": "friends", "direction": "out", "offset": 0, "limit": 10}]} @@ -102,6 +107,7 @@ read -r -p 'Step 5: Now query friends of Cookie Monster: >>> ' var # Now query friends of Cookie Monster: curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' { + "select": ["to"], "srcVertices": [{"serviceName": "KakaoFavorites", "columnName": "userName", "id":"Cookie Monster"}], "steps": [ {"step": [{"label": "friends", "direction": "out", "offset": 0, "limit": 10}]} @@ -177,6 +183,7 @@ printf "\n\n" read -r -p 'Step 8: Query posts of Big Bird. >>> ' var curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' { + "select": ["to"], "srcVertices": [{"serviceName": "KakaoFavorites", "columnName": "userName", "id":"Big Bird"}], "steps": [ {"step": [{"label": "post", "direction": "out", "offset": 0, "limit": 10}]} @@ -192,6 +199,7 @@ printf "\n\n" read -r -p 'Step 9: Elmo`s Timeline. >>> ' var curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' { + "select": ["from", "to"], "srcVertices": [{"serviceName": "KakaoFavorites", "columnName": "userName", "id":"Elmo"}], "steps": [ {"step": [{"label": "friends", "direction": "out", "offset": 0, "limit": 10}]}, @@ -205,6 +213,7 @@ printf "\n\n" read -r -p 'Step 10: Also try Cookie Monsters timeline: >>> ' var curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d ' { + "select": ["from", "to"], "srcVertices": [{"serviceName": "KakaoFavorites", "columnName": "userName", "id":"Cookie Monster"}], "steps": [ {"step": [{"label": "friends", "direction": "out", "offset": 0, "limit": 10}]}, @@ -213,4 +222,4 @@ curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' - } ' -printf "\n\n" \ No newline at end of file +printf "\n\nThe above example is by no means a full-blown social network timeline, but it gives you an idea on how to represent, store and query relations with S2Graph.\n\n" \ No newline at end of file From be2dbf4ac2203ff6e4c1cc28db66bf208005e749 Mon Sep 17 00:00:00 2001 From: DO YUNG YOON Date: Wed, 7 Sep 2016 22:32:00 +0900 Subject: [PATCH 3/3] change route from insert to insertWithWait. --- bin/example.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/example.sh b/bin/example.sh index 9d8def29..9a1e354b 100755 --- a/bin/example.sh +++ b/bin/example.sh @@ -63,8 +63,8 @@ read -r -p 'Make Sure Label has been created correctly >>> ' var curl -XGET localhost:9000/graphs/getLabel/friends # Now that the label friends is ready, we can store friend entries. -# Entries of a label are called edges, and you can add edges with the edges/insert API: -printf "\n\nNow that the label friends is ready, we can store friend entries.\nEntries of a label are called edges, and you can add edges with the edges/insert API:\n" +# Entries of a label are called edges, and you can add edges with the edges/insertWithWait API: +printf "\n\nNow that the label friends is ready, we can store friend entries.\nEntries of a label are called edges, and you can add edges with the edges/insertWithWait API:\n" read -r -p 'Step 3: Insert Edges >>> ' var payload=' [ @@ -78,7 +78,7 @@ payload=' ] ' printf "\n$payload\n" -curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d ' +curl -XPOST localhost:9000/graphs/edges/insertWithWait -H 'Content-Type: Application/json' -d ' [ {"from":"Elmo","to":"Big Bird","label":"friends","props":{},"timestamp":1444360152477}, {"from":"Elmo","to":"Ernie","label":"friends","props":{},"timestamp":1444360152478}, @@ -167,7 +167,7 @@ payload=' printf "\n\n" read -r -p 'Step 7: Now, insert some posts of our users. >>> ' var printf "\n$payload\n" -curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d ' +curl -XPOST localhost:9000/graphs/edges/insertWithWait -H 'Content-Type: Application/json' -d ' [ {"from":"Big Bird","to":"www.kakaocorp.com/en/main","label":"post","props":{},"timestamp":1444360152477}, {"from":"Big Bird","to":"github.com/kakao/s2graph","label":"post","props":{},"timestamp":1444360152478},