Author: steamshon
Date: Thu Mar 28 11:04:32 2019
New Revision: 1856470

URL: http://svn.apache.org/viewvc?rev=1856470&view=rev
Log:
add docs

Added:
    incubator/s2graph/site/docs/
    incubator/s2graph/site/docs/_sources/
    incubator/s2graph/site/docs/_sources/api/
    incubator/s2graph/site/docs/_sources/api/index.rst.txt
    incubator/s2graph/site/docs/_sources/api/management/
    incubator/s2graph/site/docs/_sources/api/management/index.rst.txt
    incubator/s2graph/site/docs/_sources/api/mutate/
    incubator/s2graph/site/docs/_sources/api/mutate/index.rst.txt
    incubator/s2graph/site/docs/_sources/api/mutate/mutate_edge.rst.txt
    incubator/s2graph/site/docs/_sources/api/mutate/mutate_vertex.rst.txt
    incubator/s2graph/site/docs/_sources/api/query/
    incubator/s2graph/site/docs/_sources/api/query/index.rst.txt
    incubator/s2graph/site/docs/_sources/api/query/query_edge.rst.txt
    incubator/s2graph/site/docs/_sources/api/query/query_options.rst.txt
    incubator/s2graph/site/docs/_sources/api/query/query_vertex.rst.txt
    incubator/s2graph/site/docs/_sources/getting_started/
    incubator/s2graph/site/docs/_sources/getting_started/index.rst.txt
    
incubator/s2graph/site/docs/_sources/getting_started/your_first_graph.rst.txt
    incubator/s2graph/site/docs/_sources/index.rst.txt
    incubator/s2graph/site/docs/_static/
    incubator/s2graph/site/docs/_static/ajax-loader.gif   (with props)
    incubator/s2graph/site/docs/_static/basic.css
    incubator/s2graph/site/docs/_static/comment-bright.png   (with props)
    incubator/s2graph/site/docs/_static/comment-close.png   (with props)
    incubator/s2graph/site/docs/_static/comment.png   (with props)
    incubator/s2graph/site/docs/_static/css/
    incubator/s2graph/site/docs/_static/css/badge_only.css
    incubator/s2graph/site/docs/_static/css/s2graph_style.css
    incubator/s2graph/site/docs/_static/css/theme.css
    incubator/s2graph/site/docs/_static/doctools.js
    incubator/s2graph/site/docs/_static/documentation_options.js
    incubator/s2graph/site/docs/_static/down-pressed.png   (with props)
    incubator/s2graph/site/docs/_static/down.png   (with props)
    incubator/s2graph/site/docs/_static/file.png   (with props)
    incubator/s2graph/site/docs/_static/fonts/
    incubator/s2graph/site/docs/_static/fonts/Inconsolata-Bold.ttf   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Inconsolata-Regular.ttf   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Inconsolata.ttf   (with props)
    incubator/s2graph/site/docs/_static/fonts/Lato/
    incubator/s2graph/site/docs/_static/fonts/Lato-Bold.ttf   (with props)
    incubator/s2graph/site/docs/_static/fonts/Lato-Regular.ttf   (with props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-bold.eot   (with props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-bold.ttf   (with props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-bold.woff   (with props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-bold.woff2   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-bolditalic.eot   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-bolditalic.ttf   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-bolditalic.woff   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-bolditalic.woff2   
(with props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-italic.eot   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-italic.ttf   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-italic.woff   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-italic.woff2   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-regular.eot   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-regular.ttf   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-regular.woff   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/Lato/lato-regular.woff2   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/RobotoSlab/
    incubator/s2graph/site/docs/_static/fonts/RobotoSlab-Bold.ttf   (with props)
    incubator/s2graph/site/docs/_static/fonts/RobotoSlab-Regular.ttf   (with 
props)
    
incubator/s2graph/site/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot   
(with props)
    
incubator/s2graph/site/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf   
(with props)
    
incubator/s2graph/site/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff   
(with props)
    
incubator/s2graph/site/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2  
 (with props)
    
incubator/s2graph/site/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot 
  (with props)
    
incubator/s2graph/site/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf 
  (with props)
    
incubator/s2graph/site/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff
   (with props)
    
incubator/s2graph/site/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2
   (with props)
    incubator/s2graph/site/docs/_static/fonts/fontawesome-webfont.eot   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/fontawesome-webfont.svg
    incubator/s2graph/site/docs/_static/fonts/fontawesome-webfont.ttf   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/fontawesome-webfont.woff   (with 
props)
    incubator/s2graph/site/docs/_static/fonts/fontawesome-webfont.woff2   (with 
props)
    incubator/s2graph/site/docs/_static/jquery-3.2.1.js
    incubator/s2graph/site/docs/_static/jquery.js
    incubator/s2graph/site/docs/_static/js/
    incubator/s2graph/site/docs/_static/js/modernizr.min.js
    incubator/s2graph/site/docs/_static/js/theme.js
    incubator/s2graph/site/docs/_static/language_data.js
    incubator/s2graph/site/docs/_static/minus.png   (with props)
    incubator/s2graph/site/docs/_static/plus.png   (with props)
    incubator/s2graph/site/docs/_static/pygments.css
    incubator/s2graph/site/docs/_static/searchtools.js
    incubator/s2graph/site/docs/_static/underscore-1.3.1.js
    incubator/s2graph/site/docs/_static/underscore.js
    incubator/s2graph/site/docs/_static/up-pressed.png   (with props)
    incubator/s2graph/site/docs/_static/up.png   (with props)
    incubator/s2graph/site/docs/_static/websupport.js
    incubator/s2graph/site/docs/api/
    incubator/s2graph/site/docs/api/index.html
    incubator/s2graph/site/docs/api/management/
    incubator/s2graph/site/docs/api/management/index.html
    incubator/s2graph/site/docs/api/mutate/
    incubator/s2graph/site/docs/api/mutate/index.html
    incubator/s2graph/site/docs/api/mutate/mutate_edge.html
    incubator/s2graph/site/docs/api/mutate/mutate_vertex.html
    incubator/s2graph/site/docs/api/query/
    incubator/s2graph/site/docs/api/query/index.html
    incubator/s2graph/site/docs/api/query/query_edge.html
    incubator/s2graph/site/docs/api/query/query_options.html
    incubator/s2graph/site/docs/api/query/query_vertex.html
    incubator/s2graph/site/docs/genindex.html
    incubator/s2graph/site/docs/getting_started/
    incubator/s2graph/site/docs/getting_started/index.html
    incubator/s2graph/site/docs/getting_started/your_first_graph.html
    incubator/s2graph/site/docs/index.html
    incubator/s2graph/site/docs/objects.inv   (with props)
    incubator/s2graph/site/docs/search.html
    incubator/s2graph/site/docs/searchindex.js
Modified:
    incubator/s2graph/site/index.html

Added: incubator/s2graph/site/docs/_sources/api/index.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/api/index.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/api/index.rst.txt (added)
+++ incubator/s2graph/site/docs/_sources/api/index.rst.txt Thu Mar 28 11:04:32 
2019
@@ -0,0 +1,13 @@
+HTTP API Glossary
+==============================================
+
+The following is a non-exhaustive list of commonly used S2Graph APIs and their 
examples
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   management/index
+   mutate/index
+   query/index

Added: incubator/s2graph/site/docs/_sources/api/management/index.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/api/management/index.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/api/management/index.rst.txt (added)
+++ incubator/s2graph/site/docs/_sources/api/management/index.rst.txt Thu Mar 
28 11:04:32 2019
@@ -0,0 +1,444 @@
+Management APIs
+==================
+Admin Apis for Management Service, Label, Index ..
+
+****************
+Create a Service
+****************
+
+``Service`` is the top level abstraction in S2Graph which could be considered 
as a database in MySQL.
+
+.. code:: bash
+
+  POST /admin/createService
+
+Service Fields
+---------------
+
+In order to create a Service, the following fields should be specified in the 
request.
+
+.. csv-table:: Option
+   :header: "Field Name", "Definition", "Data Type", "Example", "Note"
+   :widths: 15, 30, 30, 30, 30
+
+   "serviceName",      "User defined namespace",       "String",       
"talk_friendship", "Required"
+   "cluster",  "Zookeeper quorum address",     "String",       
"abc.com:2181,abd.com:2181", "Optional"
+   "hTableName",       "HBase table name",     "String",       "test", 
"Optional"
+   "hTableTTL",        "Time to live setting for data","Integer", "86000", 
"Optional"
+   "preSplitSize",     "Factor for the table pre-split size", "Integer", "1", 
"Optional"
+
+.. list
+   - By default, S2Graph looks for "hbase.zookeeper.quorum" in your 
application.conf. If "hbase.zookeeper.quorum" is undefined, this value is set 
as "localhost".
+
+
+Basic Service Operations
+--------------------------
+
+You can create a service using the following API:
+
+.. code:: bash
+
+  curl -XPOST localhost:9000/admin/createService -H 'Content-Type: 
Application/json' -d '
+  {
+     "serviceName": "s2graph",
+     "cluster": "address for zookeeper",
+     "hTableName": "hbase table name",
+     "hTableTTL": 86000,
+     "preSplitSize": 2
+  }'
+
+
+****************
+Create a Label
+****************
+
+A ``Label`` represents a relation between two serviceColumns. Labels are to 
S2Graph what tables are to RDBMS since they contain the schema information, 
i.e. descriptive information of the data being managed or indices used for 
efficient retrieval.
+In most scenarios, defining an edge schema (in other words, label) requires a 
little more care compared to a vertex schema (which is pretty straightforward).
+First, think about the kind of queries you will be using, then, model user 
actions or relations into ``edges`` and design a label accordingly.
+
+.. code:: bash
+
+  POST /admin/createLabel
+
+Label Fields
+---------------
+
+A Label creation request includes the following information.
+
+.. csv-table:: Option
+   :header: "Field Name", "Definition", "Data Type", "Example", "Note"
+   :widths: 15, 30, 30, 30, 30
+
+   "label",    "Name of the relation", "String",       "talk_friendship", 
"Required"
+   "srcServiceName", "Source column's service",        "String",       
"kakaotalk", "Required"
+   "srcColumnName", "Source column's name",    "String",       "user_id", 
"Required"
+   "srcColumnType", "Source column's data type","Long/Integer/String", 
"string", "Required"
+   "tgtServiceName", "Target column's service",        "String",       
"kakaotalk/kakaomusic", "Optional"
+   "tgtColumnName", "Target column's name",    "String",       "item_id", 
"Required"
+   "tgtColumnType", "Target column's data type", "Long/Integer/String",        
"string", "Required"
+   "isDirected", "Wether the label is directed or undirected", "True/False",   
"true/false", "Optional. default is true"
+   "serviceName", "Which service the label belongs to",        "String",       
"kakaotalk", "Optional. tgtServiceName is used by default"
+   "hTableName", "A dedicated HBase table to your Label",      "String",       
"s2graph-batch", "Optional. Service hTableName is used by default"
+   "hTableTTL", "Data time to live setting",   "Integer", "86000", "Optional. 
Service hTableTTL is used by default"
+   "consistencyLevel", "If set to 'strong', only one edge is alowed between a 
pair of source/ target vertices. Set to 'weak', and multiple-edge is 
supported", "String", "strong/weak", "Optional. default is 'weak'"
+
+
+Props & Indices
+----------------
+
+A couple of key elements of a Label are its Properties (props) and indices.
+Supplementary information of a Vertex or Edge can be stored as props. A single 
property can be defined in a simple key-value JSON as follows:
+
+.. code:: json
+
+   {
+     "name": "name of property",
+     "dataType": "data type of property value",
+     "defaultValue": "default value in string"
+   }
+
+In a scenario where user - video playback history is stored in a Label, a 
typical example for props would look like this:
+
+.. code:: json
+
+   [
+     {"name": "play_count", "defaultValue": 0, "dataType": "integer"},
+     {"name": "is_hidden","defaultValue": false,"dataType": "boolean"},
+     {"name": "category","defaultValue": "jazz","dataType": "string"},
+     {"name": "score","defaultValue": 0,"dataType": "float"}
+   ]
+
+Props can have data types of ``numeric`` (byte/ short/ integer/ float/ 
double), ``boolean`` or ``string``.
+In order to achieve efficient data retrieval, a Label can be indexed using the 
"indices" option.
+Default value for indices is ``_timestamp``, a hidden label property.
+
+All labels have ``_timestamp`` in their props under the hood
+
+The first index in indices array will be the primary index ``(Think of PRIMARY 
INDEX idx_xxx(p1, p2) in MySQL)``
+S2Graph will automatically store edges according to the primary index.
+Trailing indices are used for multiple ordering on edges. ``(Think of ALTER 
TABLE ADD INDEX idx_xxx(p2, p1) in MySQL)``
+
+props define meta datas that will not be affect the order of edges.
+Please avoid using S2Graph-reserved property names:
+
+
+- ``_timestamp`` is reserved for system wise timestamp. this can be 
interpreted as last_modified_at
+- ``_from`` is reserved for label's start vertex.
+- ``_to`` is reserved for label's target vertex.
+
+
+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
+
+   curl -XPOST localhost:9000/admin/createLabel -H 'Content-Type: 
Application/json' -d '
+   {
+     "label": "user_article_liked",
+     "srcServiceName": "s2graph",
+     "srcColumnName": "user_id",
+     "srcColumnType": "long",
+     "tgtServiceName": "s2graph_news",
+     "tgtColumnName": "article_id",
+     "tgtColumnType": "string",
+     "indices": [], // _timestamp will be used as default
+     "props": [],
+     "serviceName": "s2graph_news"
+   }'
+
+
+The created label ``user_article_liked`` will manage edges in a 
timestamp-descending order (which seems to be the common requirement for most 
services).
+Here is another example that creates a label ``friends``, which represents the 
friend relation between ``users`` in service ``s2graph``.
+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
+
+   curl -XPOST localhost:9000/admin/createLabel -H 'Content-Type: 
Application/json' -d '
+   {
+     "label": "friends",
+     "srcServiceName": "s2graph",
+     "srcColumnName": "user_id",
+     "srcColumnType": "long",
+     "tgtServiceName": "s2graph",
+     "tgtColumnName": "user_id",
+     "tgtColumnType": "long",
+     "indices": [
+       {"name": "idx_affinity_timestamp", "propNames": ["affinity_score", 
"_timestamp"]}
+     ],
+     "props": [
+       {"name": "affinity_score", "dataType": "float", "defaultValue": 0.0},
+       {"name": "_timestamp", "dataType": "long", "defaultValue": 0},
+       {"name": "is_hidden", "dataType": "boolean", "defaultValue": false},
+       {"name": "is_blocked", "dataType": "boolean", "defaultValue": true},
+       {"name": "error_code", "dataType": "integer", "defaultValue": 500}
+     ],
+     "serviceName": "s2graph",
+     "consistencyLevel": "strong"
+     }'
+
+S2Graph supports **multiple indices** on a label which means you can add 
separate ordering options for edges.
+
+
+.. code:: bash
+
+    curl -XPOST localhost:9000/admin/addIndex -H 'Content-Type: 
Application/json' -d '
+    {
+      "label": "friends",
+      "indices": [
+        {"name": "idx_3rd", "propNames": ["is_blocked", "_timestamp"]}
+      ]
+    }'
+
+In order to get general information on a label, make a GET request to 
``/admin/getLabel/{label name}``
+
+.. code:: bash
+
+   curl -XGET localhost:9000/admin/getLabel/friends
+
+
+Delete a label with a PUT request to ``/admin/deleteLabel/{label name}``
+
+.. code:: bash
+
+   curl -XPUT localhost:9000/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.
+
+Adding Extra Properties to Labels
+----------------------------------
+
+To add a new property, use ``/admin/addProp/{label name}``
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/admin/addProp/friend -H 'Content-Type: 
Application/json' -d '
+   {
+     "name": "is_blocked",
+     "defaultValue": false,
+     "dataType": "boolean"
+   }'
+
+
+Consistency Level
+------------------
+
+Simply put, the consistency level of your label will determine how the edges 
are stored at storage level.
+First, note that S2Graph identifies a unique edge by combining its from, 
label, to values as a key.
+
+Now, let's consider inserting the following two edges that have same keys (1, 
graph_test, 101) and different timestamps (1418950524721 and 1418950524723).
+
+.. code:: bash
+
+   1418950524721    insert  e 1 101    graph_test    {"weight": 10} = (1, 
graph_test, 101)
+   1418950524723    insert  e 1 101    graph_test    {"weight": 20} = (1, 
graph_test, 101)
+
+
+**Each consistency levels handle the case differently.**
+
+- strong
+
+  - The strong option makes sure that there is only one edge record stored in 
the HBase table for edge key (1, graph_test, 101). With strong consistency 
level, the later insertion will overwrite the previous one.
+
+- weak
+
+  - The weak option will allow two different edges stored in the table with 
different timestamps and weight values.
+
+
+For a better understanding, let's simplify the notation for an edge that 
connects two vertices u - v at time t as u -> (t, v), and assume that we are 
inserting these four edges into two different labels with each consistency 
configuration (both indexed by timestamp only).
+
+.. code:: bash
+
+   u1 -> (t1, v1)
+   u1 -> (t2, v2)
+   u1 -> (t3, v2)
+   u1 -> (t4, v1)
+
+With a strong consistencyLevel, your Label contents will be:
+
+.. code:: bash
+
+   u1 -> (t4, v1)
+   u1 -> (t3, v2)
+
+Note that edges with same vertices and earlier timestamp (u1 -> (t1, v1) and 
u1 -> (t2, v2)) were overwritten and do not exist.
+On the other hand, with consistencyLevel weak.
+
+.. code:: bash
+
+   u1 -> (t1, v1)
+   u1 -> (t2, v2)
+   u1 -> (t3, v2)
+   u1 -> (t4, v1)
+
+**It is recommended to set consistencyLevel to weak unless you are expecting 
concurrent updates on same edge.**
+
+In real world systems, it is not guaranteed that operation requests arrive at 
S2Graph in the order of their timestamp. Depending on the environment (network 
conditions, client making asynchronous calls, use of a message que, and so on) 
request that were made earlier can arrive later. Consistency level also 
determines how S2Graph handles these cases.
+Strong consistencyLevel promises a final result consistent to the timestamp.
+For example, consider a set of operation requests on edge (1, graph_test, 101) 
were made in the following order;
+
+
+.. code:: bash
+
+   1418950524721    insert    e    1    101    graph_test    {"is_blocked": 
false}
+   1418950524722    delete    e    1    101    graph_test
+   1418950524723    insert    e    1    101    graph_test    {"is_hidden": 
false, "weight": 10}
+   1418950524724    update    e    1    101    graph_test    {"time": 1, 
"weight": -10}
+   1418950524726    update    e    1    101    graph_test    {"is_blocked": 
true}
+
+
+and actually arrived in a shuffled order due to complications
+
+
+.. code:: bash
+
+   1418950524726    update    e    1    101    graph_test    {"is_blocked": 
true}
+   1418950524723    insert    e    1    101    graph_test    {"is_hidden": 
false, "weight": 10}
+   1418950524722    delete    e    1    101    graph_test
+   1418950524721    insert    e    1    101    graph_test    {"is_blocked": 
false}
+   1418950524724    update    e    1    101    graph_test    {"time": 1, 
"weight": -10}
+
+Strong consistency still makes sure that you get the same eventual state on 
(1, graph_test, 101).
+Here is pseudocode of what S2Graph does to provide a strong consistency level.
+
+.. code:: bash
+
+   complexity = O(one read) + O(one delete) + O(2 put)
+
+   fetchedEdge = fetch edge with (1, graph_test, 101) from lookup table.
+
+   if fetchedEdge is not exist:
+          create new edge same as current insert operation
+          update lookup table as current insert operation
+   else:
+          valid = compare fetchedEdge vs current insert operation.
+          if valid:
+          delete fetchedEdge
+          create new edge after comparing fetchedEdge and current insert.
+          update lookup table
+
+Limitations Since S2Graph makes asynchronous writes to HBase via Asynchbase, 
there is no consistency guaranteed on same edge within its flushInterval (1 
second).
+
+Adding Extra Indices (Optional)
+---------------------------------
+
+.. code:: bash
+
+   POST /admin/addIndex
+
+A label can have multiple properties set as indexes. When edges are queried, 
the ordering will determined according to indexes, therefore, deciding which 
edges will be included in the top-K results.
+
+**Edge retrieval queries in S2Graph by default returns top-K edges. Clients 
must issue another query to fetch the next K edges, i.e., top-K ~ 2 x top-K**
+
+Edges sorted according to the indices in order to limit the number of edges 
being fetched by a query. If no ordering property is given, S2Graph will use 
the timestamp as an index, thus resulting in the most recent data.
+
+**It would be extremely difficult to fetch millions of edges and sort them at 
request time and return a top-K in a reasonable amount of time. Instead, 
S2Graph uses vertex-centric indexes to avoid this.
+Using a vertex-centric index, having millions of edges is fine as long as size 
K of the top-K values is reasonable (under 1K) Note that indexes must be 
created prior to inserting any data on the label (which is the same case with 
the conventional RDBMS).**
+
+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
+
+   # add prop first
+   curl -XPOST localhost:9000/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 '
+   {
+     "label": "graph_test",
+      "indices": [
+        { name: "idx_play_count", propNames: ["play-count"] }
+      ]
+   }'
+
+
+**********************************
+Create a ServiceColumn (Optional)
+**********************************
+
+.. code:: bash
+
+   POST /admin/createServiceColumn
+
+If your use case requires props assigned to vertices instead of edges, what 
you need is a Service Column
+
+**Remark: If it is only the vertex id that you need and not additional props, 
there's no need to create a Service Column explicitly. At label creation, by 
default, S2Graph creates column space with empty properties according to the 
label schema.**
+
+
+Service Column Fields
+----------------------
+
+
+.. csv-table:: Option
+   :header: "Field Name", "Definition", "Data Type", "Example", "Note"
+   :widths: 15, 30, 30, 30, 30
+
+   "Field Name",       "Definition",   "Data Type",    "Example",      
"Remarks"
+   "serviceName", "Which service the Service Column belongs to", "String", 
"kakaotalk", "Required"
+   "columnName", "Service Column`s name", "String", "talk_user_id", "Required"
+   "props", "Optional properties of Service Column",   "JSON (array 
dictionaries)", "Please refer to the examples", "Optional"
+
+
+Basic Service Column Operations
+-------------------------------
+
+Here are some sample requests for Service Column creation as well as vertex 
insertion and selection.
+
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/admin/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}
+     ]
+   }'
+
+General information on a vertex schema can be retrieved with 
``/admin/getServiceColumn/{service name}/{column name}``
+
+.. code:: bash
+
+   curl -XGET localhost:9000/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
+
+   curl -XPOST localhost:9000/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
+
+   curl -XPOST localhost:9000/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
+
+   curl -XPOST localhost:9000/graphs/getVertices -H 'Content-Type: 
Application/json' -d '
+   [
+     {"serviceName": "s2graph", "columnName": "user_id", "ids": [1, 2, 3]}
+   ]'

Added: incubator/s2graph/site/docs/_sources/api/mutate/index.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/api/mutate/index.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/api/mutate/index.rst.txt (added)
+++ incubator/s2graph/site/docs/_sources/api/mutate/index.rst.txt Thu Mar 28 
11:04:32 2019
@@ -0,0 +1,10 @@
+Mutate APIs
+==============================================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   mutate_edge
+   mutate_vertex

Added: incubator/s2graph/site/docs/_sources/api/mutate/mutate_edge.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/api/mutate/mutate_edge.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/api/mutate/mutate_edge.rst.txt (added)
+++ incubator/s2graph/site/docs/_sources/api/mutate/mutate_edge.rst.txt Thu Mar 
28 11:04:32 2019
@@ -0,0 +1,328 @@
+****************
+Manage Edges
+****************
+
+An ``Edge`` represents a relation between two vertices, with properties 
according to the schema defined in its label.
+
+Edge Fields
+---------------
+
+The following fields need to be specified when inserting an edge, and are 
returned when queried on edges.
+
+.. csv-table:: Option
+   :header: "Field Name", "Definition", "Data Type", "Example", "Note"
+   :widths: 15, 30, 30, 30, 30
+
+   "**timestamp**",    "Issue time of request", "Long", "1430116731156", 
"Required. Unix Epoch time in milliseconds. S2Graph TTL and timestamp unit is 
**milliseconds**"
+   "operation", "One of insert, delete, update, or increment", "String", "'i', 
'insert'", "Required only for bulk operations. Aliases are also available: i 
(insert), d (delete), u (update), in (increment). Default is insert"
+   "from", "Id of source vertex", "Long/String",       "1", "Required. Use 
long if possible. **Maximum string byte-size is 249**"
+   "to", "Id of target vertex", "Long/String", "101", "Required. Use long if 
possible. **Maximum string byte-size is 249**"
+   "label",    "Label name",   "String",       "graph_test", "Required"
+   "direction",        "Direction of the edge. Should be one of **out/ in/ 
undirected**", "String", "out", "Required. Alias are also available: o (out), i 
(in), u (undirected)"
+   "props",    "Additional properties of the edge", "JSON (dictionary)",       
"{""timestamp"": 1417616431, ""affinity_score"":10, ""is_hidden"": false, 
""is_valid"": true}", "Required. **If in indexed properties isn't given, 
default values will be added**"
+
+
+Basic Edge Operations
+--------------------------
+
+In S2Graph, an Edge supports five different operations.
+
+- ``insert``: Create new edge.
+- ``delete``: Delete existing edge.
+- ``update``: Update existing edge`s state.
+- ``increment``: Increment existing edge`s state.
+- ``deleteAll``: Delete all adjacent edges from certain source vertex. 
(Available for strong consistency only)
+
+Edge operations work differently depending on the target label`s consistency 
level.
+
+For a better understanding, please take a look at the following test cases.
+
+Create 2 different labels, one of each consistencyLevels.
+
+- s2graph_label_test (strong)
+- s2graph_label_test_weak (weak)
+
+Then insert a same set of edges to each labels and query them as follows.
+
+**strong consistency**
+
+.. code:: bash
+
+  curl -XPOST localhosnt:9000/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}},
+    {"timestamp": 3, "from": 101, "to": 10, "label": "s2graph_label_test", 
"props": {"time": -30}}
+  ]'
+
+
+Note that only one edge exist between (101, 10, s2graph_label_test, out).
+
+.. code:: json
+
+   {
+     "size": 1,
+     "degrees": [
+       {
+         "from": 101,
+          "label": "s2graph_label_test",
+          "direction": "out",
+          "_degree": 1
+       }
+     ],
+     "results": [
+       {
+         "cacheRemain": -20,
+         "from": 101,
+          "to": 10,
+          "label": "s2graph_label_test",
+          "direction": "out",
+          "_timestamp": 3,
+          "timestamp": 3,
+          "score": 1,
+          "props": {
+            "_timestamp": 3,
+            "time": -30,
+            "weight": 0,
+            "is_hidden": false,
+            "is_blocked": false
+          }
+        }
+     ],
+     "impressionId": -1650835965
+   }
+
+**weak consistency**
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/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}},
+     {"timestamp": 3, "from": 101, "to": 10, "label": 
"s2graph_label_test_weak", "props": {"time": -30}}
+   ]'
+
+This time there are ``three edges`` between (101, 10, s2graph_label_test_weak, 
out).
+
+.. code:: json
+
+   {
+     "size": 3,
+     "degrees": [
+        {
+            "from": 101,
+            "label": "s2graph_label_test_weak",
+            "direction": "out",
+            "_degree": 3
+        }
+     ],
+     "results": [
+       {
+         "cacheRemain": -148,
+         "from": 101,
+         "to": "10",
+         "label": "s2graph_label_test_weak",
+         "direction": "out",
+         "_timestamp": 3,
+         "timestamp": 3,
+         "score": 1,
+         "props": {
+           "_timestamp": 3,
+           "time": -30,
+           "weight": 0,
+           "is_hidden": false,
+           "is_blocked": false
+         }
+       },
+       {
+         "cacheRemain": -148,
+         "from": 101,
+         "to": "10",
+         "label": "s2graph_label_test_weak",
+         "direction": "out",
+         "_timestamp": 2,
+         "timestamp": 2,
+         "score": 1,
+         "props": {
+           "_timestamp": 2,
+           "time": -10,
+           "weight": 0,
+           "is_hidden": false,
+           "is_blocked": false
+         }
+       },
+       {
+         "cacheRemain": -148,
+         "from": 101,
+         "to": "10",
+         "label": "s2graph_label_test_weak",
+         "direction": "out",
+         "_timestamp": 1,
+         "timestamp": 1,
+         "score": 1,
+         "props": {
+           "_timestamp": 1,
+           "time": 0,
+           "weight": 0,
+           "is_hidden": false,
+           "is_blocked": false
+         }
+       }
+     ],
+      "impressionId": 1972178414
+    }
+
+
+Strong Consistency
+---------------------
+
+Insert - ``POST /mutate/edge/insert``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+A unique edge is identified by a combination of (from, to, label, direction). 
For insert operations, S2Graph first checks if an edge with same (from, to, 
label, direction) information exists. If there is an existing edge, then insert 
will work as ``update``. See above example.
+
+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
+
+   curl -XPOST localhost:9000/mutate/edge/delete -H 'Content-Type: 
Application/json' -d '
+   [
+     {"timestamp": 10, "from": 101, "to": 10, "label": "s2graph_label_test"}
+   ]'
+
+Update - ``POST /mutate/edge/update``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+What an update operation does to a strongly consistent label is identical to 
an insert.
+
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/mutate/edge/update -H 'Content-Type: 
Application/json' -d '
+   [
+     {"timestamp": 10, "from": 101, "to": 10, "label": "s2graph_label_test", 
"props": {"time": 100, "weight": -10}}
+   ]'
+
+
+Increment - ``POST /mutate/edge/increment``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Works like update, other than it returns the incremented value and not the old 
value.
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/mutate/edge/increment -H 'Content-Type: 
Application/json' -d '
+   [
+     {"timestamp": 10, "from": 101, "to": 10, "label": "s2graph_label_test", 
"props": {"time": 100, "weight": -10}}
+   ]'
+
+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
+
+   curl -XPOST localhost:9000/mutate/edge/deleteAll -H 'Content-Type: 
Application/json' -d '
+   [
+     {"ids" : [101], "label":"s2graph_label_test", "direction": "out", 
"timestamp":1417616441000}
+   ]'
+
+
+Weak Consistency
+-----------------
+
+
+Insert ``POST /mutate/edge/insert``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+S2Graph ``does not look`` for a unique edge defined by (from, to, label, 
direction). It simply stores a new edge according to the request. No read, no 
consistency check. Note that this difference allows multiple edges with same 
(from, to, label, direction) id.
+
+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
+
+   curl -XPOST localhost:9000/graphs/edges/delete -H 'Content-Type: 
Application/json' -d '
+   [
+     {
+       "cacheRemain": -148,
+       "from": 101,
+       "to": "10",
+       "label": "s2graph_label_test_weak",
+       "direction": "out",
+       "_timestamp": 3,
+       "timestamp": 3,
+       "score": 1,
+       "props": {
+         "_timestamp": 3,
+         "time": -30,
+         "weight": 0,
+         "is_hidden": false,
+         "is_blocked": false
+       }
+     },
+     {
+       "cacheRemain": -148,
+       "from": 101,
+       "to": "10",
+       "label": "s2graph_label_test_weak",
+       "direction": "out",
+       "_timestamp": 2,
+       "timestamp": 2,
+       "score": 1,
+       "props": {
+         "_timestamp": 2,
+         "time": -10,
+         "weight": 0,
+         "is_hidden": false,
+         "is_blocked": false
+       }
+     },
+     {
+       "cacheRemain": -148,
+       "from": 101,
+       "to": "10",
+       "label": "s2graph_label_test_weak",
+       "direction": "out",
+       "_timestamp": 1,
+       "timestamp": 1,
+       "score": 1,
+       "props": {
+         "_timestamp": 1,
+         "time": 0,
+         "weight": 0,
+         "is_hidden": false,
+         "is_blocked": false
+       }
+     }
+   ]'
+
+Update - ``POST /mutate/edge/update``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Like insert, S2Graph ``does not check`` for uniqueness. Update requires a 
pre-fetch of existing edges, similar to delete. Props of the resulting edges 
will be updated.
+
+Increment - ``POST /mutate/edge/increment``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+For increment, S2Graph also ``does not check`` for uniqueness. Update requires 
a pre-fetch of existing edges, similar to delete. Props of the resulting edges 
will be incremented.
+
+Delete All - ``POST /mutate/edge/deleteAll``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Identical to strong consistency.
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/mutate/edge/deleteAll -H 'Content-Type: 
Application/json' -d '
+   [
+     {"ids" : [101], "label":"s2graph_label_test", "direction": "out", 
"timestamp":1417616441}
+   ]'

Added: incubator/s2graph/site/docs/_sources/api/mutate/mutate_vertex.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/api/mutate/mutate_vertex.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/api/mutate/mutate_vertex.rst.txt 
(added)
+++ incubator/s2graph/site/docs/_sources/api/mutate/mutate_vertex.rst.txt Thu 
Mar 28 11:04:32 2019
@@ -0,0 +1,139 @@
+****************************
+Manage Vertices (Optional)
+****************************
+
+Vertices are the two end points of an edge, and logically stored in columns of 
a service. If your use case requires storing metadata corresponding to vertices 
rather than edges, there are operations available on vertices as well.
+
+
+Vertex Fields
+----------------
+
+Unlike edges and their labels, properties of a vertex are not indexed nor 
require a predefined schema. The following fields are used when operating on 
vertices.
+
+
+.. csv-table:: Option
+   :header: "Field Name", "Definition", "Data Type", "Example", "Note"
+   :widths: 15, 30, 30, 30, 30
+
+   "timestamp",        "Issue time of request", "Long", "1430116731156", 
"Required. Unix Epoch time in **milliseconds**"
+   "operation",        "One of insert, delete, update, increment", "String", 
"i, insert", "Required only for bulk operations. Alias are also available: i 
(insert), d (delete), u (update), in (increment). Default is insert."
+   "**serviceName**", "Corresponding service name", "String", 
"kakaotalk/kakaogroup", "Required"
+   "**columnName**", "Corresponding column name", "String", "user_id", 
"Required"
+   "id", "Unique identifier of vertex", "Long/String", "101", "Required. Use 
Long if possible"
+   "**props**", "Additional properties of vertex", "JSON (dictionary)", 
"{""is_active_user"": true, ""age"":10, ""gender"": ""F"", ""country_iso"": 
""kr""}", "Required"
+
+
+
+
+Basic Vertex Operations
+--------------------------
+
+Insert - ``POST /mutate/vertex/insert/:serviceName/:columnName``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/mutate/vertex/insert/s2graph/account_id -H 
'Content-Type: Application/json' -d '
+   [
+     {"id":1,"props":{"is_active":true, 
"talk_user_id":10},"timestamp":1417616431000},
+     {"id":2,"props":{"is_active":true, 
"talk_user_id":12},"timestamp":1417616431000},
+     {"id":3,"props":{"is_active":false, 
"talk_user_id":13},"timestamp":1417616431000},
+     {"id":4,"props":{"is_active":true, 
"talk_user_id":14},"timestamp":1417616431000},
+     {"id":5,"props":{"is_active":true, 
"talk_user_id":15},"timestamp":1417616431000}
+   ]'
+
+
+Delete - ``POST /mutate/vertex/delete/:serviceName/:columnName``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/mutate/vertex/delete/s2graph/account_id -H 
'Content-Type: Application/json' -d '
+   [
+     {"id":1,"timestamp":1417616431001},
+     {"id":2,"timestamp":1417616431002}
+   ]'
+
+
+This operation will delete only the vertex data of a specified column and will 
not delete any edges connected to those vertices.
+Also important thing is timestamp. vertex will be deleted only if delete 
requests ``timestamp is larger than all of vertexs`` property`s timestamp.
+
+following example shows the difference.
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/mutate/vertex/insert/s2graph_test/account_id -H 
'Content-Type: Application/json' -d '
+   [
+     {"id":1,"props":{"is_active":true, 
"talk_user_id":10},"timestamp":1417616431000},
+     {"id":1,"props":{"talk_user_id":20},"timestamp":1417616431002}
+   ]'
+
+if user request delete(ts) on vertex like below then vertex would not be 
deleted, but only properties on this vertex that is updated before ts will be 
deleted.
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/mutate/vertex/delete/s2graph_test/account_id -H 
'Content-Type: Application/json' -d '
+   [
+     {"id":1,"timestamp":1417616431001}
+   ]'
+
+
+then result still have vertex with property that is updated with larger 
timestamp.
+
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/graphs/getVertices -H 'Content-Type: 
Application/json' -d '
+   [
+      {"serviceName": "s2graph_test", "columnName": "account_id", "ids": [1]}
+   ]'
+
+
+   # result
+   {
+     "serviceName": "s2graph_test",
+     "columnName": "account_id",
+     "id": 1,
+     "props": {
+       "talk_user_id": 20
+     },
+     "timestamp": 1417616431002
+   }
+
+
+**Important notes**
+
+.. note::
+   This means that edges returned by a query can contain deleted vertices. 
Clients are responsible for checking validity of the vertices.
+
+Delete All - ``POST /mutate/vertex/deleteAll/:serviceName/:columnName``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This is a **very expensive** operation. If you're interested in what goes on 
under the hood, please refer to the following pseudocode:
+
+.. code:: python
+
+   vertices = vertex list to delete
+     for vertex in vertices
+         labels = fetch all labels that this vertex is included.
+         for label in labels
+             for index in label.indices
+                 edges = G.read with limit 50K
+                 for edge in edges
+                     edge.delete
+
+
+
+The total complexity is O(L L.I) reads + O(L L.I 50K) writes, worst case. **If 
the vertex you're trying to delete has more than 50K edges, the deletion will 
not be consistent**.
+
+
+Update - POST /mutate/vertex/insert/:serviceName/:columnName
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Basically update on Vertex is same with insert overwrite so use insert for 
update.
+
+Increment
+~~~~~~~~~~~
+
+Not yet implemented; stay tuned.

Added: incubator/s2graph/site/docs/_sources/api/query/index.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/api/query/index.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/api/query/index.rst.txt (added)
+++ incubator/s2graph/site/docs/_sources/api/query/index.rst.txt Thu Mar 28 
11:04:32 2019
@@ -0,0 +1,15 @@
+Query APIs
+==============================================
+
+Once you have your graph data uploaded to S2Graph, you can traverse your graph 
using our query APIs.
+S2Graph query DSL define ``breadth first search(BFS)`` and various options for 
``ranking`` subgraph that BFS return.
+Query DSL has many options for ranking and filtering.
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   query_options
+   query_edge
+   query_vertex

Added: incubator/s2graph/site/docs/_sources/api/query/query_edge.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/api/query/query_edge.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/api/query/query_edge.rst.txt (added)
+++ incubator/s2graph/site/docs/_sources/api/query/query_edge.rst.txt Thu Mar 
28 11:04:32 2019
@@ -0,0 +1,954 @@
+****************
+Edge Queries
+****************
+
+S2Graph provides a query DSL which has been reported to have a pretty steep 
learning curve.
+One tip is to try to understand each features by projecting it to that of a 
RDBMS such MySQL.
+This doesn't work all the time, but there are many similarities between 
S2Graph and a conventional RDBMS.
+For example, S2Graphs "getEdges" is used to fetch data and traverse multiple 
steps. This is very similar to the "SELECT" query in MySQL.
+
+Traversing each step is similar to ``join`` operation in RDBMS. One thing to 
note here is that users must start their traverse from smaller set to terminate 
BFS early as soon as possible.
+Another tip is to not be shy to ask! Ask any questions on our `mailing list`_. 
list or open an issue at our `github`_ with the problems that you're having 
with S2Graph.
+
+.. _mailing list: https://groups.google.com/forum/#!forum/s2graph
+
+.. _github: https://github.com/apache/incubator-s2graph
+
+
+checkEdges - ``POST /graphs/checkEdges``
+------------------------------------------
+
+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
+
+   curl -XPOST localhost:9000/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}
+   ]'
+
+
+getEdges - ``POST /graphs/getEdges``
+-----------------------------------------
+
+Select edges with query.
+
+**Duplicate Policy**
+
+Here is a very basic query to fetch all edges that start from source vertex 
"101".
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: 
Application/json' -d '
+   {
+
+       "srcVertices": [
+           {
+               "serviceName": "s2graph",
+               "columnName": "user_id_test",
+               "id": 101
+           }
+       ],
+       "steps": [
+           {
+               "step": [
+                   {
+                       "label": "s2graph_label_test_weak",
+                       "direction": "out",
+                       "offset": 0,
+                       "limit": 10,
+                       "duplicate": "raw"
+                   }
+               ]
+           }
+       ]
+   }'
+
+
+``Notice the "duplicate" field``. If a target label's consistency level is 
``weak`` and multiple edges exist with the same (from, to, label, direction) 
id, then the query is expect to have a policy for handling edge duplicates. 
S2Graph provides four duplicate policies on edges.
+
+
+.. note::
+   - raw: Allow duplicates and return all edges.
+   - first: Return only the first edge if multiple edges exist. This is 
default.
+   - countSum: Return only one edge, and return how many duplicates exist.
+   - sum: Return only one edge, and return sum of the scores.
+
+
+With duplicate "raw", there are actually three edges with the same (from, to, 
label, direction) id.
+
+.. code:: bash
+
+   {
+     "size": 3,
+     "degrees": [
+         {
+             "from": 101,
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_degree": 3
+         }
+     ],
+     "results": [
+         {
+             "cacheRemain": -29,
+             "from": 101,
+             "to": "10",
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_timestamp": 6,
+             "timestamp": 6,
+             "score": 1,
+             "props": {
+                 "_timestamp": 6,
+                 "time": -30,
+                 "weight": 0,
+                 "is_hidden": false,
+                 "is_blocked": false
+             }
+         },
+         {
+             "cacheRemain": -29,
+             "from": 101,
+             "to": "10",
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_timestamp": 5,
+             "timestamp": 5,
+             "score": 1,
+             "props": {
+                 "_timestamp": 5,
+                 "time": -10,
+                 "weight": 0,
+                 "is_hidden": false,
+                 "is_blocked": false
+             }
+         },
+         {
+             "cacheRemain": -29,
+             "from": 101,
+             "to": "10",
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_timestamp": 4,
+             "timestamp": 4,
+             "score": 1,
+             "props": {
+                 "_timestamp": 4,
+                 "time": 0,
+                 "weight": 0,
+                 "is_hidden": false,
+                 "is_blocked": false
+             }
+         }
+     ],
+     "impressionId": 1972178414
+   }
+
+Duplicate "countSum" returns only one edge with the score sum of 3.
+
+.. code:: bash
+
+   {
+     "size": 1,
+     "degrees": [
+         {
+             "from": 101,
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_degree": 3
+         }
+     ],
+     "results": [
+         {
+             "cacheRemain": -135,
+             "from": 101,
+             "to": "10",
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_timestamp": 4,
+             "timestamp": 4,
+             "score": 3,
+             "props": {
+                 "_timestamp": 4,
+                 "time": 0,
+                 "weight": 0,
+                 "is_hidden": false,
+                 "is_blocked": false
+             }
+         }
+     ],
+     "impressionId": 1972178414
+  }
+
+
+**Select Option Example**
+
+In case you want to control the fields shown in the result edges, use the 
"select" option.
+
+.. code:: bash
+
+   {
+     "select": ["from", "to", "label"],
+     "srcVertices": [
+         {
+             "serviceName": "s2graph",
+             "columnName": "user_id_test",
+             "id": 101
+         }
+     ],
+     "steps": [
+         {
+             "step": [
+                 {
+                     "label": "s2graph_label_test_weak",
+                     "direction": "out",
+                     "offset": 0,
+                     "limit": 10,
+                     "duplicate": "raw"
+                 }
+             ]
+         }
+     ]
+   }
+
+S2Graph will return only those fields in the result.
+
+.. code:: bash
+
+   {
+     "size": 3,
+     "degrees": [
+         {
+             "from": 101,
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_degree": 3
+         }
+     ],
+     "results": [
+         {
+             "from": 101,
+             "to": "10",
+             "label": "s2graph_label_test_weak"
+         },
+         {
+             "from": 101,
+             "to": "10",
+             "label": "s2graph_label_test_weak"
+         },
+         {
+             "from": 101,
+             "to": "10",
+             "label": "s2graph_label_test_weak"
+         }
+     ],
+     "impressionId": 1972178414
+   }
+
+Default value of the "select" option is an empty array which means that all 
edge fields are returned.
+
+
+**groupBy Option Example**
+
+
+Result edges can be grouped by a given field.
+
+.. code:: bash
+
+   {
+      "select": ["from", "to", "label", "direction", "timestamp", "score", 
"time", "weight", "is_hidden", "is_blocked"],
+      "groupBy": ["from", "to", "label"],
+      "srcVertices": [
+          {
+              "serviceName": "s2graph",
+              "columnName": "user_id_test",
+              "id": 101
+          }
+      ],
+      "steps": [
+          {
+              "step": [
+                  {
+                      "label": "s2graph_label_test_weak",
+                      "direction": "out",
+                      "offset": 0,
+                      "limit": 10,
+                      "duplicate": "raw"
+                  }
+              ]
+          }
+      ]
+   }
+
+
+You can see the result edges are grouped by their "from", "to", and "label" 
fields.
+
+
+.. code:: bash
+
+   {
+     "size": 1,
+     "results": [
+         {
+             "groupBy": {
+                 "from": 101,
+                 "to": "10",
+                 "label": "s2graph_label_test_weak"
+             },
+             "agg": [
+                 {
+                     "from": 101,
+                     "to": "10",
+                     "label": "s2graph_label_test_weak",
+                     "direction": "out",
+                     "timestamp": 6,
+                     "score": 1,
+                     "props": {
+                         "time": -30,
+                         "weight": 0,
+                         "is_hidden": false,
+                         "is_blocked": false
+                     }
+                 },
+                 {
+                     "from": 101,
+                     "to": "10",
+                     "label": "s2graph_label_test_weak",
+                     "direction": "out",
+                     "timestamp": 5,
+                     "score": 1,
+                     "props": {
+                         "time": -10,
+                         "weight": 0,
+                         "is_hidden": false,
+                         "is_blocked": false
+                     }
+                 },
+                 {
+                     "from": 101,
+                     "to": "10",
+                     "label": "s2graph_label_test_weak",
+                     "direction": "out",
+                     "timestamp": 4,
+                     "score": 1,
+                     "props": {
+                         "time": 0,
+                         "weight": 0,
+                         "is_hidden": false,
+                         "is_blocked": false
+                     }
+                 }
+             ]
+         }
+     ],
+     "impressionId": 1972178414
+   }
+
+
+**filterOut option example**
+
+You can also run two queries concurrently, and filter the result of one query 
with the result of the other.
+
+.. code:: bash
+
+   {
+     "filterOutFields": ["_to"],
+     "filterOut": {
+         "srcVertices": [
+             {
+                 "serviceName": "s2graph",
+                 "columnName": "user_id_test",
+                 "id": 100
+             }
+         ],
+         "steps": [
+             {
+                 "step": [
+                     {
+                         "label": "s2graph_label_test_weak",
+                         "direction": "out",
+                         "offset": 0,
+                         "limit": 10,
+                         "duplicate": "raw"
+                     }
+                 ]
+             }
+         ]
+     },
+     "srcVertices": [
+         {
+             "serviceName": "s2graph",
+             "columnName": "user_id_test",
+             "id": 101
+         }
+     ],
+     "steps": [
+         {
+             "step": [
+                 {
+                     "label": "s2graph_label_test_weak",
+                     "direction": "out",
+                     "offset": 0,
+                     "limit": 10,
+                     "duplicate": "raw"
+                 }
+             ]
+         }
+     ]
+   }
+
+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
+
+   {
+     "filterOut": {
+       "srcVertices": [
+         {
+           "columnName": "uuid",
+           "id": "Alec",
+           "serviceName": "daumnews"
+         }
+       ],
+       "steps": [
+         {
+           "step": [
+             {
+               "direction": "out",
+               "label": "daumnews_user_view_news",
+               "limit": 100,
+               "offset": 0
+             }
+           ]
+         }
+       ]
+     },
+     "srcVertices": [
+       {
+         "columnName": "uuid",
+         "id": "Alec",
+         "serviceName": "daumnews"
+       }
+     ],
+     "steps": [
+       {
+         "nextStepLimit": 10,
+         "step": [
+           {
+             "direction": "out",
+             "duplicate": "scoreSum",
+             "label": "daumnews_user_view_news",
+             "limit": 100,
+             "offset": 0,
+             "timeDecay": {
+               "decayRate": 0.1,
+               "initial": 1,
+               "timeUnit": 86000000
+             }
+           }
+         ]
+       },
+       {
+         "nextStepLimit": 10,
+         "step": [
+           {
+             "label": "daumnews_news_belongto_category",
+             "limit": 1
+           }
+         ]
+       },
+       {
+         "step": [
+           {
+             "direction": "in",
+             "label": "daumnews_news_belongto_category",
+             "limit": 10
+           }
+         ]
+       }
+     ]
+   }
+
+
+
+The main query from the above will traverse a graph of users and news articles 
as follows:
+
+1. Fetch the list of news articles that user Alec read.
+2. Get the categories of the result edges of step one.
+3. Fetch other articles that were published in same category.
+
+
+Meanwhile, Alec does not want to get articles that he already read. This can 
be taken care of with the following query in the filterOut option:
+Articles that Alec has already read.
+
+
+.. code:: bash
+
+   {
+     "size": 5,
+     "degrees": [
+         {
+             "from": "Alec",
+             "label": "daumnews_user_view_news",
+             "direction": "out",
+             "_degree": 6
+         }
+     ],
+     "results": [
+         {
+             "cacheRemain": -19,
+             "from": "Alec",
+             "to": 20150803143507760,
+             "label": "daumnews_user_view_news",
+             "direction": "out",
+             "_timestamp": 1438591888454,
+             "timestamp": 1438591888454,
+             "score": 0.9342237306639056,
+             "props": {
+                 "_timestamp": 1438591888454
+             }
+         },
+         {
+             "cacheRemain": -19,
+             "from": "Alec",
+             "to": 20150803150406010,
+             "label": "daumnews_user_view_news",
+             "direction": "out",
+             "_timestamp": 1438591143640,
+             "timestamp": 1438591143640,
+             "score": 0.9333716513280771,
+             "props": {
+                 "_timestamp": 1438591143640
+             }
+         },
+         {
+             "cacheRemain": -19,
+             "from": "Alec",
+             "to": 20150803144908340,
+             "label": "daumnews_user_view_news",
+             "direction": "out",
+             "_timestamp": 1438581933262,
+             "timestamp": 1438581933262,
+             "score": 0.922898833570944,
+             "props": {
+                 "_timestamp": 1438581933262
+             }
+         },
+         {
+             "cacheRemain": -19,
+             "from": "Alec",
+             "to": 20150803124627492,
+             "label": "daumnews_user_view_news",
+             "direction": "out",
+             "_timestamp": 1438581485765,
+             "timestamp": 1438581485765,
+             "score": 0.9223930035297659,
+             "props": {
+                 "_timestamp": 1438581485765
+             }
+         },
+         {
+             "cacheRemain": -19,
+             "from": "Alec",
+             "to": 20150803113311090,
+             "label": "daumnews_user_view_news",
+             "direction": "out",
+             "_timestamp": 1438580536376,
+             "timestamp": 1438580536376,
+             "score": 0.9213207756669546,
+             "props": {
+                 "_timestamp": 1438580536376
+             }
+         }
+     ],
+     "impressionId": 354266627
+   }
+
+
+Without "filterOut"
+
+.. code:: bash
+
+  {
+    "size": 2,
+    "degrees": [
+        {
+            "from": 1028,
+            "label": "daumnews_news_belongto_category",
+            "direction": "in",
+            "_degree": 2
+        }
+    ],
+    "results": [
+        {
+            "cacheRemain": -33,
+            "from": 1028,
+            "to": 20150803105805092,
+            "label": "daumnews_news_belongto_category",
+            "direction": "in",
+            "_timestamp": 1438590169146,
+            "timestamp": 1438590169146,
+            "score": 0.9342777143725886,
+            "props": {
+                "updateTime": 20150803172249144,
+                "_timestamp": 1438590169146
+            }
+        },
+        {
+            "cacheRemain": -33,
+            "from": 1028,
+            "to": 20150803143507760,
+            "label": "daumnews_news_belongto_category",
+            "direction": "in",
+            "_timestamp": 1438581548486,
+            "timestamp": 1438581548486,
+            "score": 0.9342777143725886,
+            "props": {
+                "updateTime": 20150803145908490,
+                "_timestamp": 1438581548486
+            }
+        }
+    ],
+    "impressionId": -14034523
+  }
+
+
+with "filterOut"
+
+
+.. code:: bash
+
+   {
+     "size": 1,
+     "degrees": [],
+     "results": [
+         {
+             "cacheRemain": 85957406,
+             "from": 1028,
+             "to": 20150803105805092,
+             "label": "daumnews_news_belongto_category",
+             "direction": "in",
+             "_timestamp": 1438590169146,
+             "timestamp": 1438590169146,
+             "score": 0.9343106784173475,
+             "props": {
+                 "updateTime": 20150803172249144,
+                 "_timestamp": 1438590169146
+             }
+         }
+     ],
+     "impressionId": -14034523
+   }
+
+
+Note that article ``20150803143507760`` has been filtered out.
+
+
+**nextStepLimit Example**
+
+S2Graph provides step-level aggregation so that users can take the top K items 
from the aggregated results.
+
+**nextStepThreshold Example**
+
+**sample Example**
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: 
Application/json' -d '
+   {
+     "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", 
"id":1}],
+     "steps": [
+       {"sample":2,"step": [{"label": "graph_test", "direction": "out", 
"offset": 0, "limit": 10, "scoring": {"time": 1, "weight": 1}}]}
+     ]
+   }
+
+
+**transform Example**
+
+With typical two-step query, S2Graph will start the second step from the "_to" 
(vertex id) values of the first steps' result. With the "transform" option, you 
can actually use any single field from the result edges' properties of step one.
+
+Add a "transform" option to the query from example 1.
+
+.. code:: bash
+
+   {
+     "select": [],
+     "srcVertices": [
+         {
+             "serviceName": "s2graph",
+             "columnName": "user_id_test",
+             "id": 101
+         }
+     ],
+     "steps": [
+         {
+             "step": [
+                 {
+                     "label": "s2graph_label_test_weak",
+                     "direction": "out",
+                     "offset": 0,
+                     "limit": 10,
+                     "duplicate": "raw",
+                     "transform": [
+                         ["_to"],
+                         ["time.$", "time"]
+                     ]
+                 }
+             ]
+         }
+     ]
+   }
+
+Note that we have six resulting edges. We have two transform rules, the first 
one simply fetches edges with their target vertex IDs (such as "to": "10"), and 
the second rule will fetch the same edges but with the "time" values replacing 
vertex IDs (such as "to": "to": "time.-30").
+
+.. code:: bash
+
+   {
+     "size": 6,
+     "degrees": [
+         {
+             "from": 101,
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_degree": 3
+         },
+         {
+             "from": 101,
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_degree": 3
+         }
+     ],
+     "results": [
+         {
+             "cacheRemain": -8,
+             "from": 101,
+             "to": "10",
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_timestamp": 6,
+             "timestamp": 6,
+             "score": 1,
+             "props": {
+                 "_timestamp": 6,
+                 "time": -30,
+                 "weight": 0,
+                 "is_hidden": false,
+                 "is_blocked": false
+             }
+         },
+         {
+             "cacheRemain": -8,
+             "from": 101,
+             "to": "time.-30",
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_timestamp": 6,
+             "timestamp": 6,
+             "score": 1,
+             "props": {
+                 "_timestamp": 6,
+                 "time": -30,
+                 "weight": 0,
+                 "is_hidden": false,
+                 "is_blocked": false
+             }
+         },
+         {
+             "cacheRemain": -8,
+             "from": 101,
+             "to": "10",
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_timestamp": 5,
+             "timestamp": 5,
+             "score": 1,
+             "props": {
+                 "_timestamp": 5,
+                 "time": -10,
+                 "weight": 0,
+                 "is_hidden": false,
+                 "is_blocked": false
+             }
+         },
+         {
+             "cacheRemain": -8,
+             "from": 101,
+             "to": "time.-10",
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_timestamp": 5,
+             "timestamp": 5,
+             "score": 1,
+             "props": {
+                 "_timestamp": 5,
+                 "time": -10,
+                 "weight": 0,
+                 "is_hidden": false,
+                 "is_blocked": false
+             }
+         },
+         {
+             "cacheRemain": -8,
+             "from": 101,
+             "to": "10",
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_timestamp": 4,
+             "timestamp": 4,
+             "score": 1,
+             "props": {
+                 "_timestamp": 4,
+                 "time": 0,
+                 "weight": 0,
+                 "is_hidden": false,
+                 "is_blocked": false
+             }
+         },
+         {
+             "cacheRemain": -8,
+             "from": 101,
+             "to": "time.0",
+             "label": "s2graph_label_test_weak",
+             "direction": "out",
+             "_timestamp": 4,
+             "timestamp": 4,
+             "score": 1,
+             "props": {
+                 "_timestamp": 4,
+                 "time": 0,
+                 "weight": 0,
+                 "is_hidden": false,
+                 "is_blocked": false
+             }
+         }
+     ],
+     "impressionId": 1972178414
+   }
+
+
+**Two-Step Traversal Example**
+
+The following query will fetch a user's (id 1) friends of friends by chaining 
multiple steps:
+
+
+.. code:: bash
+
+   {
+     "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", 
"id":1}],
+     "steps": [
+       {
+           "step": [
+             {"label": "friends", "direction": "out", "limit": 100}
+           ]
+       },
+       {
+           "step": [
+             {"label": "friends", "direction": "out", "limit": 10}
+           ]
+       }
+     ]
+   }'
+
+**Three-Step Traversal Example**
+
+Add more steps for wider traversals. Be gentle on the limit options since the 
number of visited edges will increase exponentially and become very heavy on 
the system.
+
+**More examples**
+
+Example 1. From label "graph_test", select the first 100 edges that start from 
vertex "account_id = 1", with default sorting.
+
+.. code:: bash
+
+
+   curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: 
Application/json' -d '
+   {
+       "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", 
"id":1}],
+       "steps": [
+         [{"label": "graph_test", "direction": "out", "offset": 0, "limit": 100
+         }]
+       ]
+   }'
+
+Example 2. Now select between the 50th and 100th edges from the same query.
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: 
Application/json' -d '
+   {
+       "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", 
"id":1}],
+       "steps": [
+         [{"label": "graph_test", "direction": "in", "offset": 50, "limit": 
50}]
+       ]
+   }'
+
+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
+
+   curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: 
Application/json' -d '
+   {
+       "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", 
"id":1}],
+       "steps": [
+         [{"label": "graph_test", "direction": "in", "offset": 50, "limit": 
50, "duration": {"from": 1416214118000, "to": 1416300000000}]
+       ]
+   }'
+
+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
+
+   curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: 
Application/json' -d '
+   {
+       "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", 
"id":1}],
+       "steps": [
+         [{"label": "graph_test", "direction": "in", "offset": 50, "limit": 
50, "duration": {"from": 1416214118000, "to": 1416214218000}, "scoring": 
{"time": 1.5, "weight": 10}]
+       ]
+   }'
+
+
+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
+
+   curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: 
Application/json' -d '
+   {
+       "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", 
"id":1}],
+       "steps": [
+         [{"label": "friends", "direction": "out", "limit": 100}],
+         [{"label": "friends", "direction": "out", "limit": 10}]
+       ]
+   }'
+
+
+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
+
+   curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: 
Application/json' -d '
+   {
+       "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", 
"id":1}],
+       "steps": [
+         [{"label": "talk_friend", "direction": "out", "limit": 100}],
+         [{"label": "play_music", "direction": "out", "limit": 10}]
+       ]
+   }'
+
+
+Example 7. Query the friends of user "account_id = 1" who played the track 
"track_id = 200".
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/graphs/getEdges -H 'Content-Type: 
Application/json' -d '
+   {
+       "srcVertices": [{"serviceName": "s2graph", "columnName": "account_id", 
"id":1}],
+       "steps": [
+         [{"label": "talk_friend", "direction": "out", "limit": 100}],
+         [{"label": "play_music", "direction": "out", "_to": 200}]
+       ]
+   }'

Added: incubator/s2graph/site/docs/_sources/api/query/query_options.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/api/query/query_options.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/api/query/query_options.rst.txt (added)
+++ incubator/s2graph/site/docs/_sources/api/query/query_options.rst.txt Thu 
Mar 28 11:04:32 2019
@@ -0,0 +1,27 @@
+****************
+Query Options
+****************
+
+Query Level Options
+-----------------------
+
+A typical query contains the source vertex as a starting point, a list of 
labels to traverse, and optional filters or weights for unwanted results and 
sorting respectively. Query requests are structured as follows
+
+
+QUERY LEVEL TABLE HERE
+
+**Step**
+
+Each step tells S2Graph which labels to traverse in the graph and how to 
traverse them. Labels in the very first step should be directly connected to 
the source vertices, labels in the second step should be directly connected to 
the result vertices of the first step traversal, and so on. A step is specified 
with a list of ``query params`` which we will cover in detail below.
+
+
+Step Level Option
+-------------------------
+
+STEP LEVEL TABLE HERE
+
+
+Query Param Level Option
+-----------------------------
+
+Query PARAM LEVEL TABLE HERE

Added: incubator/s2graph/site/docs/_sources/api/query/query_vertex.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/api/query/query_vertex.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/api/query/query_vertex.rst.txt (added)
+++ incubator/s2graph/site/docs/_sources/api/query/query_vertex.rst.txt Thu Mar 
28 11:04:32 2019
@@ -0,0 +1,17 @@
+****************
+Query Vertices
+****************
+
+
+POST - ``/graphs/getVertices``
+--------------------------------
+
+Selecting all vertices from serviceColumn account_id of a service s2graph.
+
+.. code:: bash
+
+    curl -XPOST localhost:9000/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]}
+    ]'

Added: incubator/s2graph/site/docs/_sources/getting_started/index.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/getting_started/index.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/getting_started/index.rst.txt (added)
+++ incubator/s2graph/site/docs/_sources/getting_started/index.rst.txt Thu Mar 
28 11:04:32 2019
@@ -0,0 +1,43 @@
+Getting Started
+===============
+
+********************
+The Directory Layout
+********************
+
+Once extracted the downloaded binary release of S2Graph or built from the 
source as described below, the following files and directories should be found 
in the directory.
+
+.. code::
+
+  DISCLAIMER
+  LICENCE               # the Apache License 2.0
+  NOTICE
+  bin                   # scripts to manage the lifecycle of S2Graph
+  conf                  # configuration files
+  lib                   # contains the binary
+  logs                  # application logs
+  var                   # application data
+
+*****************
+Launching S2Graph
+*****************
+
+The following will launch S2Graph, using HBase in the standalone mode for data 
storage and H2 as the metadata storage.
+
+.. code::
+
+  sh bin/start-s2graph.sh
+
+To connect to a remote HBase cluster or use MySQL as the metastore, refer to 
the instructions in ``conf/application.conf``
+
+************************
+Building from the Source
+************************
+
+We use SBT to build the project, which can be installed using Homebrew on 
MacOS (brew install sbt). For other operating systems, refer to the SBT 
Tutorial. Once SBT is installed, running the following command on the source 
root will build the project from the source:
+
+.. code:: bash
+
+  sbt package
+
+Depending on the internet connection, the initial run might take a while 
downloading the required dependencies. Once the build is complete, the same 
directory layout as in the top of this document can be found at 
``target/apache-s2graph-$version-bin``, where ``$version`` is the current 
version of the project, e.g. ``0.1.0-incubating``

Added: 
incubator/s2graph/site/docs/_sources/getting_started/your_first_graph.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/getting_started/your_first_graph.rst.txt?rev=1856470&view=auto
==============================================================================
--- 
incubator/s2graph/site/docs/_sources/getting_started/your_first_graph.rst.txt 
(added)
+++ 
incubator/s2graph/site/docs/_sources/getting_started/your_first_graph.rst.txt 
Thu Mar 28 11:04:32 2019
@@ -0,0 +1,178 @@
+Your First S2Graph
+==================
+
+Once the S2Graph server has been set up, you can now start to send HTTP 
queries to the server to create a graph and pour data in it. This tutorial goes 
over a simple toy problem to get a sense of how S2Graph's API looks like. For 
the exact definitions of the terminology used here, refer to The Data Model 
document.
+The toy problem is to create a timeline feature for a simple social media, 
like a simplified version of Facebook's timeline. Using simple S2Graph queries 
it is possible to keep track of each user's friends and their posts.
+
+First, we need a name for the new service.
+---------------------------------------------
+
+The following POST query will create a service named ``KakaoFavorites``
+
+.. code:: bash
+
+  curl -XPOST localhost:9000/admin/createService -H 'Content-Type: 
Application/json' -d '
+  {
+    "serviceName": "KakaoFavorites",
+    "compressionAlgorithm" : "gz"
+  }'
+
+To make sure the service is created correctly, check out the following
+
+.. code:: bash
+
+  curl -XGET localhost:9000/admin/getService/KakaoFavorites
+
+Next, we will need some friends.
+---------------------------------------------
+In S2Graph, relationships are organized as labels. Create a ``friends`` label 
with the following ``createLabel`` API call:
+
+.. code:: bash
+
+  curl -XPOST localhost:9000/admin/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 if the label has been created correctly:
+
+.. code:: bash
+
+   curl -XGET localhost:9000/admin/getLabel/friends
+
+Now that the label ``friends`` is ready, we can store the friendship data. 
Entries of a label are called edges, and you can add edges with 
``edges/insert`` API:
+
+.. code:: bash
+
+   curl -XPOST localhost:9000/mutate/edge/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}
+   ]'
+
+Query friends of Elmo with ``getEdges`` API:
+
+.. code:: bash
+
+  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}]}
+    ]
+  }'
+
+Now query friends of Cookie Monster:
+
+.. code:: bash
+
+  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}]}
+    ]
+  }'
+
+Users of Kakao Favorites will be able to ``post`` URLs of their favorite 
websites.
+----------------------------------------------------------------------------------
+
+We will need a new label ``post`` for this data:
+
+.. code:: bash
+
+  curl -XPOST localhost:9000/admin/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 the users:
+
+.. code:: bash
+
+  curl -XPOST localhost:9000/mutate/edge/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:
+
+.. code:: bash
+
+  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}]}
+    ]
+  }'
+
+
+So far, we have designed a label schema for the labels ``friends`` and 
``post``, and stored some edges to them.
+---------------------------------------------------------------------------------------------------------------
+
+This should be enough for creating the timeline feature! The following 
two-step query will return the URLs for Elmo's timeline, which are the posts of 
Elmo's friends:
+
+
+.. code:: bash
+
+  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:
+
+.. code:: bash
+
+  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}]}
+    ]
+  }'
+
+
+The example above is by no means a full blown social network timeline, but it 
gives you an idea of how to represent, store and query graph data with S2Graph.
+
+We also provide a simple script under ``script/test.sh`` so that you can see 
if everything is setup correctly.
+
+.. code:: bash
+
+  sh script/test.sh

Added: incubator/s2graph/site/docs/_sources/index.rst.txt
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_sources/index.rst.txt?rev=1856470&view=auto
==============================================================================
--- incubator/s2graph/site/docs/_sources/index.rst.txt (added)
+++ incubator/s2graph/site/docs/_sources/index.rst.txt Thu Mar 28 11:04:32 2019
@@ -0,0 +1,27 @@
+Introduction
+===================================
+
+S2Graph is a graph database designed to handle transactional graph processing 
at scale. Its REST API allows you to store, manage and query relational 
information using edge and vertex representations in a fully asynchronous and 
non-blocking manner. This document covers the basic concepts and terminology of 
S2Graph to help you get a feel for the S2Graph API.
+
+Mailing Lists
+Everyone interested in using and developing S2Graph is welcome to join our 
mailing lists!
+
[email protected] is for usage questions and announcements.
[email protected] is for people who want to contribute to 
S2Graph.
+
+.. toctree::
+   :caption: S2Graph Documentation
+   :maxdepth: 3
+
+   getting_started/index
+   getting_started/your_first_graph
+   design/data_model
+   api/index
+
+..
+   Indices and tables
+   ==================
+
+   * :ref:`genindex`
+   * :ref:`modindex`
+   * :ref:`search`

Added: incubator/s2graph/site/docs/_static/ajax-loader.gif
URL: 
http://svn.apache.org/viewvc/incubator/s2graph/site/docs/_static/ajax-loader.gif?rev=1856470&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/s2graph/site/docs/_static/ajax-loader.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream


Reply via email to