Skip to content
This repository was archived by the owner on Feb 16, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions doc/source/api/management/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Basic Service Operations

You can create a service using the following API:

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/admin/createService -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/admin/createService -H 'Content-Type: Application/json' -d '
{
"serviceName": "s2graph",
"cluster": "address for zookeeper",
Expand Down Expand Up @@ -133,9 +133,9 @@ Basic Label Operations
Here is an sample request that creates a label ``user_article_liked`` between column ``user_id`` of service ``s2graph`` and column ``article_id`` of service ``s2graph_news``.
Note that the default indexed property ``_timestamp`` will be created since the ``indexedProps`` field is empty.

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/admin/createLabel -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/admin/createLabel -H 'Content-Type: Application/json' -d '
{
"label": "user_article_liked",
"srcServiceName": "s2graph",
Expand All @@ -156,9 +156,9 @@ This time, edges are managed by both affinity_score and ``_timestamp``.

Friends with higher affinity_scores come first and if affinity_score is a tie, recently added friends comes first.

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/admin/createLabel -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/admin/createLabel -H 'Content-Type: Application/json' -d '
{
"label": "friends",
"srcServiceName": "s2graph",
Expand All @@ -184,9 +184,9 @@ Friends with higher affinity_scores come first and if affinity_score is a tie, r
S2Graph supports **multiple indices** on a label which means you can add separate ordering options for edges.


.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/admin/addIndex -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/admin/addIndex -H 'Content-Type: Application/json' -d '
{
"label": "friends",
"indices": [
Expand All @@ -196,16 +196,16 @@ S2Graph supports **multiple indices** on a label which means you can add separat

In order to get general information on a label, make a GET request to ``/admin/getLabel/{label name}``

.. code:: bash
.. parsed-literal::

curl -XGET localhost:9000/admin/getLabel/friends
curl -XGET |example_base_url|/admin/getLabel/friends


Delete a label with a PUT request to ``/admin/deleteLabel/{label name}``

.. code:: bash
.. parsed-literal::

curl -XPUT localhost:9000/admin/deleteLabel/friends
curl -XPUT |example_base_url|/admin/deleteLabel/friends


Label updates are not supported (except when you are adding an index). Instead, you can delete the label and re-create it.
Expand All @@ -215,9 +215,9 @@ Adding Extra Properties to Labels

To add a new property, use ``/admin/addProp/{label name}``

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/admin/addProp/friend -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/admin/addProp/friend -H 'Content-Type: Application/json' -d '
{
"name": "is_blocked",
"defaultValue": false,
Expand Down Expand Up @@ -343,14 +343,14 @@ Using a vertex-centric index, having millions of edges is fine as long as size K
New indexes can be dynamically added, but will not be applied to pre-existing data (support for this is planned for future versions). Currently, a label can have up to eight indices.
The following is an example of adding index ``play_count`` to a label ``graph_test``.

.. code:: bash
.. parsed-literal::

# add prop first
curl -XPOST localhost:9000/admin/addProp/graph_test -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/admin/addProp/graph_test -H 'Content-Type: Application/json' -d '
{ "name": "play_count", "defaultValue": 0, "dataType": "integer" }'

# then add index
curl -XPOST localhost:9000/admin/addIndex -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/admin/addIndex -H 'Content-Type: Application/json' -d '
{
"label": "graph_test",
"indices": [
Expand Down Expand Up @@ -392,9 +392,9 @@ Basic Service Column Operations
Here are some sample requests for Service Column creation as well as vertex insertion and selection.


.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/admin/createServiceColumn -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/admin/createServiceColumn -H 'Content-Type: Application/json' -d '
{
"serviceName": "s2graph",
"columnName": "user_id",
Expand All @@ -410,35 +410,35 @@ Here are some sample requests for Service Column creation as well as vertex inse

General information on a vertex schema can be retrieved with ``/admin/getServiceColumn/{service name}/{column name}``

.. code:: bash
.. parsed-literal::

curl -XGET localhost:9000/admin/getServiceColumn/s2graph/user_id
curl -XGET |example_base_url|/admin/getServiceColumn/s2graph/user_id

This will give all properties on serviceName ``s2graph`` and columnName ``user_id`` serviceColumn.
Properties can be added to a Service Column with ``/admin/addServiceColumnProps/{service name}/{column name}``

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/admin/addServiceColumnProps/s2graph/user_id -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/admin/addServiceColumnProps/s2graph/user_id -H 'Content-Type: Application/json' -d '
[
{"name": "home_address", "defaultValue": "korea", "dataType": "string"}
]'

Vertices can be inserted to a Service Column using ``/admin/vertices/insert/{service name}/{column name}``

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/mutate/vertex/insert/s2graph/user_id -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/mutate/vertex/insert/s2graph/user_id -H 'Content-Type: Application/json' -d '
[
{"id":1,"props":{"is_active":true}, "timestamp":1417616431},
{"id":2,"props":{},"timestamp":1417616431}
]'

Finally, query your vertex via ``/graphs/getVertices``

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/getVertices -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getVertices -H 'Content-Type: Application/json' -d '
[
{"serviceName": "s2graph", "columnName": "user_id", "ids": [1, 2, 3]}
]'
32 changes: 16 additions & 16 deletions doc/source/api/mutate/mutate_edge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Then insert a same set of edges to each labels and query them as follows.

**strong consistency**

.. code:: bash
.. parsed-literal::

curl -XPOST localhosnt:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/edges/insert -H 'Content-Type: Application/json' -d '
[
{"timestamp": 1, "from": 101, "to": 10, "label": "s2graph_label_test", "props": {"time": 0}},
{"timestamp": 2, "from": 101, "to": 10, "label": "s2graph_label_test", "props": {"time": -10}},
Expand Down Expand Up @@ -94,9 +94,9 @@ Note that only one edge exist between (101, 10, s2graph_label_test, out).

**weak consistency**

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/edges/insert -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/edges/insert -H 'Content-Type: Application/json' -d '
[
{"timestamp": 1, "from": 101, "to": 10, "label": "s2graph_label_test_weak", "props": {"time": 0}},
{"timestamp": 2, "from": 101, "to": 10, "label": "s2graph_label_test_weak", "props": {"time": -10}},
Expand Down Expand Up @@ -188,9 +188,9 @@ Delete - ``POST /mutate/edge/delete``

For edge deletion, again, S2Graph looks for a unique edge with (from, to, label, direction). However, this time it checks the timestamp of the delete request and the existing edge. The timestamp on the delete request ``must be larger than that on the existing edge`` or else the request will be ignored. If everything is well, the edge will be deleted. Also note that no props information is necessary for a delete request on a strongly consistent label since there will be only one edge with edge`s unique id(from, to, label, direction).

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/mutate/edge/delete -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/mutate/edge/delete -H 'Content-Type: Application/json' -d '
[
{"timestamp": 10, "from": 101, "to": 10, "label": "s2graph_label_test"}
]'
Expand All @@ -201,9 +201,9 @@ Update - ``POST /mutate/edge/update``
What an update operation does to a strongly consistent label is identical to an insert.


.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/mutate/edge/update -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/mutate/edge/update -H 'Content-Type: Application/json' -d '
[
{"timestamp": 10, "from": 101, "to": 10, "label": "s2graph_label_test", "props": {"time": 100, "weight": -10}}
]'
Expand All @@ -214,9 +214,9 @@ Increment - ``POST /mutate/edge/increment``

Works like update, other than it returns the incremented value and not the old value.

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/mutate/edge/increment -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/mutate/edge/increment -H 'Content-Type: Application/json' -d '
[
{"timestamp": 10, "from": 101, "to": 10, "label": "s2graph_label_test", "props": {"time": 100, "weight": -10}}
]'
Expand All @@ -226,9 +226,9 @@ Delete All - ``POST /mutate/edge/deleteAll``

Delete all adjacent edges to the source vertex. ``Please note that edges with both in and out directions will be deleted``

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/mutate/edge/deleteAll -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/mutate/edge/deleteAll -H 'Content-Type: Application/json' -d '
[
{"ids" : [101], "label":"s2graph_label_test", "direction": "out", "timestamp":1417616441000}
]'
Expand All @@ -248,9 +248,9 @@ Delete - ``POST /graphs/edges/delete``

For deletion on weakly consistent edges, first, S2Graph fetches existing edges from storage. Then, on each resulting edges, fires the actual delete operations.

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/edges/delete -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/edges/delete -H 'Content-Type: Application/json' -d '
[
{
"cacheRemain": -148,
Expand Down Expand Up @@ -320,9 +320,9 @@ Delete All - ``POST /mutate/edge/deleteAll``

Identical to strong consistency.

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/mutate/edge/deleteAll -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/mutate/edge/deleteAll -H 'Content-Type: Application/json' -d '
[
{"ids" : [101], "label":"s2graph_label_test", "direction": "out", "timestamp":1417616441}
]'
42 changes: 21 additions & 21 deletions doc/source/api/query/query_edge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ return edge for given vertex pair only if edge exist.
This is more ``general`` way to check edge existence between any given vertex pairs comparing using ``_to`` on query parameter


.. code:: bashn
.. parsed-literal::

curl -XPOST localhost:9000/graphs/checkEdges -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/checkEdges -H 'Content-Type: Application/json' -d '
[
{"label": "talk_friend", "direction": "out", "from": 1, "to": 100},
{"label": "talk_friend", "direction": "out", "from": 1, "to": 101}
Expand All @@ -40,9 +40,9 @@ Select edges with query.

Here is a very basic query to fetch all edges that start from source vertex "101".

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getEdges -H 'Content-Type: Application/json' -d '
{

"srcVertices": [
Expand Down Expand Up @@ -404,7 +404,7 @@ You can also run two queries concurrently, and filter the result of one query wi
S2Graph will run two concurrent queries, one in the main step, and another in the filter out clause. Here is more practical example.


.. coce:: bash
.. code:: bash

{
"filterOut": {
Expand Down Expand Up @@ -657,9 +657,9 @@ S2Graph provides step-level aggregation so that users can take the top K items f

**sample Example**

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
"srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", "id":1}],
"steps": [
Expand Down Expand Up @@ -863,10 +863,10 @@ Add more steps for wider traversals. Be gentle on the limit options since the nu

Example 1. From label "graph_test", select the first 100 edges that start from vertex "account_id = 1", with default sorting.

.. code:: bash
.. parsed-literal::


curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
"srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", "id":1}],
"steps": [
Expand All @@ -877,9 +877,9 @@ Example 1. From label "graph_test", select the first 100 edges that start from v

Example 2. Now select between the 50th and 100th edges from the same query.

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
"srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", "id":1}],
"steps": [
Expand All @@ -889,9 +889,9 @@ Example 2. Now select between the 50th and 100th edges from the same query.

Example 3. Now add a time range filter so that you will only get the edges that were inserted between 1416214118000 and 1416300000000.

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
"srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", "id":1}],
"steps": [
Expand All @@ -901,9 +901,9 @@ Example 3. Now add a time range filter so that you will only get the edges that

Example 4. Now add scoring rule to sort the result by indexed properties "time" and "weight", with weights of 1.5 and 10, respectively.

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
"srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", "id":1}],
"steps": [
Expand All @@ -914,9 +914,9 @@ Example 4. Now add scoring rule to sort the result by indexed properties "time"

Example 5. Make a two-step query to fetch friends of friends of a user "account_id = 1". (Limit the first step by 10 friends and the second step by 100.)

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
"srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", "id":1}],
"steps": [
Expand All @@ -928,9 +928,9 @@ Example 5. Make a two-step query to fetch friends of friends of a user "account_

Example 6. Make a two-step query to fetch the music playlist of the friends of user "account_id = 1". Limit the first step by 10 friends and the second step by 100 tracks.)

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
"srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", "id":1}],
"steps": [
Expand All @@ -942,9 +942,9 @@ Example 6. Make a two-step query to fetch the music playlist of the friends of u

Example 7. Query the friends of user "account_id = 1" who played the track "track_id = 200".

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getEdges -H 'Content-Type: Application/json' -d '
{
"srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", "id":1}],
"steps": [
Expand Down
4 changes: 2 additions & 2 deletions doc/source/api/query/query_vertex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ POST - ``/graphs/getVertices``

Selecting all vertices from serviceColumn account_id of a service s2graph.

.. code:: bash
.. parsed-literal::

curl -XPOST localhost:9000/graphs/getVertices -H 'Content-Type: Application/json' -d '
curl -XPOST |example_base_url|/graphs/getVertices -H 'Content-Type: Application/json' -d '
[
{"serviceName": "s2graph", "columnName": "account_id", "ids": [1, 2, 3]},
{"serviceName": "agit", "columnName": "user_id", "ids": [1, 2, 3]}
Expand Down
Loading