Skip to content

Skip Logic

Rebecca Madsen edited this page Apr 23, 2018 · 9 revisions

Purpose

Skip logic provides interfaces an API to use a Network Query to define whether an interface should be skipped or shown.

Skip Logic API

Property Possible Values Purpose
action
Required
'SHOW' or 'SKIP' This string dictates whether an interface should be skipped or shown if the query against the network matches.
operator
Required
'ANY', 'NONE', 'EXACTLY', 'NOT', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL' This string is evaulated on the number of nodes returned from the filter.
value
Default: undefined
A positive integer This number is used in conjunction with the operator to consider the number of nodes returned from the filter. It is required for any operator except 'ANY' or 'NONE'.
filter
Required
A string that can be functionized to create a query, or an object describing the query. This filter is used to construct the query against the network.
filter.join
Optional
Default: 'AND'
'OR' or 'AND' This describes how to combine the rules in the filter. It defaults to 'AND'.
filter.rules
Optional
Default: []
An array of objects, which are subquery rules. These rules are evaluated against the network.
filter.rules.type
Required
'alter', 'ego', or 'edge' The type of network object to match against.
filter.rules.id
Optional
A unique identifier. Identifier for a rule.
filter.rules.options
Required
An object describing the subquery. This describes the subquery
filter.rules.options.type
Required
A string describing which type to use from the network, e.g. 'person' or 'friend' Describes which type of node or edge to include in the query.
filter.rules.options.attribute
Required
A string denoting an edge or node attribute. Describes which attribute value to match against.
filter.rules.options.operator
Required
'EXISTS', 'NOT_EXISTS', 'EXACTLY', 'NOT', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL' These rules are evaluated against the network.
filter.rules.options.value A string, number, etc Used in the subquery comparison to match against node/edge attribute's values.

Example usage using a filter object

      "skipLogic": {
        "action": "SHOW",
        "operator": "EXACTLY",
        "value": "3",
        "filter": {
          "join": "OR",
          "rules": [
            {
              "type": "alter",
              "id": "15218241538622",
              "options": {
                "type": "person",
                "attribute": "name",
                "operator": "EXACTLY",
                "value": "Dee"
              }
            },
            {
              "type": "ego",
              "id": "15218241553253",
              "options": {
                "attribute": "name",
                "operator": "EXACTLY",
                "value": "Bob"
              }
            },
            {
              "type": "edge",
              "id": "15218241565624",
              "options": {
                "type": "friends",
                "operator": "EXISTS"
              }
            }
          ]
        }
      }

Example usage using a filter string

      "skipLogic": {
        "action": "SHOW",
        "operator": "EXACTLY",
        "value": "3",
        "filter": "return query.and([query.edgeRule({ type: 'friend' }), query.alterRule({ type: 'person', attribute: 'age', operator: 'GREATER_THAN', value: 29 }),]);"
      }
Clone this wiki locally