kakao / s2graph

This code base is retained for historical interest only, please visit Apache Incubator Repo for latest one
https://github.com/apache/incubator-s2graph
Other
250 stars 32 forks source link

Feature/add random sampling #97

Closed HyunsungJo closed 8 years ago

HyunsungJo commented 9 years ago
curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
    "srcVertices": [{"serviceName": "s2graph", "columnName": "a_id", "id":"1"}],
    "steps": [
      {"step": [{"label": "sampling_test_label", "direction": "out", "offset": 0, "limit": 10}], "sample": 2},  //  <== This will randomly draw two edges from step 1 and continue to step 2 with only those two cases.
      {"step": [{"label": "sampling_test_label", "direction": "out", "offset": 0, "limit": 10}]}
    ]
}'

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
    "srcVertices": [{"serviceName": "s2graph", "columnName": "a_id", "id":"1"}],
    "steps": [
      {"step": [{"label": "sampling_test_label", "direction": "out", "offset": 0, "limit": 10}]},
      {"step": [{"label": "sampling_test_label", "direction": "out", "offset": 0, "limit": 10}], "sample": 2}  //  <== This will randomly draw two edges from each result sets of step 2 and return them as a final result.
    ]
}'
HyunsungJo commented 9 years ago
curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
    "srcVertices": [{"serviceName": "s2graph", "columnName": "a_id", "id":"1"}],
    "steps": [
      {"step": [{"label": "sampling_test_label", "direction": "out", "offset": 0, "limit": 10, "sample": 2}]},  //  <== This will randomly draw two edges from step 1 and continue to step 2 with only those two cases.
      {"step": [{"label": "sampling_test_label", "direction": "out", "offset": 0, "limit": 10}]}
    ]
}'

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
    "srcVertices": [{"serviceName": "s2graph", "columnName": "a_id", "id":"1"}],
    "steps": [
      {"step": [{"label": "sampling_test_label", "direction": "out", "offset": 0, "limit": 10}]},
      {"step": [{"label": "sampling_test_label", "direction": "out", "offset": 0, "limit": 10, "sample": 2}]}  //  <== This will randomly draw two edges from each result sets of step 2 and return them as a final result.
    ]
}'

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
    "srcVertices": [{"serviceName": "s2graph", "columnName": "a_id", "id":"1"}],
    "steps": [
      {"step": [
          {"label": "sampling_test_label1", "direction": "out", "offset": 0, "limit": 10, "sample": 2}, 
          {"label": "sampling_test_label2", "direction": "out", "offset": 0, "limit": 10}
      ]}, //  <== Sampling only occurs for "sampling_test_label1"!
      {"step": [{"label": "sampling_test_label", "direction": "out", "offset": 0, "limit": 10}]}
    ]
}'
HyunsungJo commented 8 years ago

continuing on #190..