{
  "context": [
    {
      "type": "contextDef",
      "subType": "prefix",
      "key": "",
      "value": {
        "type": "term",
        "subType": "namedNode",
        "value": "http://books.example/",
        "loc": {
          "sourceLocationType": "source",
          "start": 9,
          "end": 32
        }
      },
      "loc": {
        "sourceLocationType": "source",
        "start": 0,
        "end": 32
      }
    }
  ],
  "subType": "select",
  "where": {
    "type": "pattern",
    "subType": "group",
    "patterns": [
      {
        "type": "pattern",
        "subType": "bgp",
        "triples": [
          {
            "type": "triple",
            "subject": {
              "type": "term",
              "subType": "variable",
              "value": "org",
              "loc": {
                "sourceLocationType": "source",
                "start": 80,
                "end": 84
              }
            },
            "predicate": {
              "type": "term",
              "subType": "namedNode",
              "value": "affiliates",
              "loc": {
                "sourceLocationType": "source",
                "start": 85,
                "end": 96
              },
              "prefix": ""
            },
            "object": {
              "type": "term",
              "subType": "variable",
              "value": "auth",
              "loc": {
                "sourceLocationType": "source",
                "start": 97,
                "end": 102
              }
            },
            "loc": {
              "sourceLocationType": "source",
              "start": 80,
              "end": 102
            }
          },
          {
            "type": "triple",
            "subject": {
              "type": "term",
              "subType": "variable",
              "value": "auth",
              "loc": {
                "sourceLocationType": "source",
                "start": 107,
                "end": 112
              }
            },
            "predicate": {
              "type": "term",
              "subType": "namedNode",
              "value": "writesBook",
              "loc": {
                "sourceLocationType": "source",
                "start": 113,
                "end": 124
              },
              "prefix": ""
            },
            "object": {
              "type": "term",
              "subType": "variable",
              "value": "book",
              "loc": {
                "sourceLocationType": "source",
                "start": 125,
                "end": 130
              }
            },
            "loc": {
              "sourceLocationType": "source",
              "start": 107,
              "end": 130
            }
          },
          {
            "type": "triple",
            "subject": {
              "type": "term",
              "subType": "variable",
              "value": "book",
              "loc": {
                "sourceLocationType": "source",
                "start": 135,
                "end": 140
              }
            },
            "predicate": {
              "type": "term",
              "subType": "namedNode",
              "value": "price",
              "loc": {
                "sourceLocationType": "source",
                "start": 141,
                "end": 147
              },
              "prefix": ""
            },
            "object": {
              "type": "term",
              "subType": "variable",
              "value": "lprice",
              "loc": {
                "sourceLocationType": "source",
                "start": 148,
                "end": 155
              }
            },
            "loc": {
              "sourceLocationType": "source",
              "start": 135,
              "end": 155
            }
          }
        ],
        "loc": {
          "sourceLocationType": "source",
          "start": 80,
          "end": 157
        }
      }
    ],
    "loc": {
      "sourceLocationType": "source",
      "start": 76,
      "end": 159
    }
  },
  "solutionModifiers": {
    "group": {
      "type": "solutionModifier",
      "subType": "group",
      "groupings": [
        {
          "type": "term",
          "subType": "variable",
          "value": "org",
          "loc": {
            "sourceLocationType": "source",
            "start": 169,
            "end": 173
          }
        }
      ],
      "loc": {
        "sourceLocationType": "source",
        "start": 160,
        "end": 173
      }
    },
    "having": {
      "type": "solutionModifier",
      "subType": "having",
      "having": [
        {
          "type": "expression",
          "subType": "operation",
          "operator": ">",
          "args": [
            {
              "type": "expression",
              "subType": "aggregate",
              "aggregation": "sum",
              "distinct": false,
              "loc": {
                "sourceLocationType": "source",
                "start": 182,
                "end": 194
              },
              "expression": [
                {
                  "type": "term",
                  "subType": "variable",
                  "value": "lprice",
                  "loc": {
                    "sourceLocationType": "source",
                    "start": 186,
                    "end": 193
                  }
                }
              ]
            },
            {
              "type": "term",
              "subType": "literal",
              "value": "10",
              "langOrIri": {
                "type": "term",
                "subType": "namedNode",
                "value": "http://www.w3.org/2001/XMLSchema#integer",
                "loc": {
                  "sourceLocationType": "noMaterialize"
                }
              },
              "loc": {
                "sourceLocationType": "source",
                "start": 197,
                "end": 199
              }
            }
          ],
          "loc": {
            "sourceLocationType": "source",
            "start": 181,
            "end": 200
          }
        }
      ],
      "loc": {
        "sourceLocationType": "source",
        "start": 174,
        "end": 200
      }
    },
    "order": {
      "type": "solutionModifier",
      "subType": "order",
      "orderDefs": [
        {
          "expression": {
            "type": "term",
            "subType": "variable",
            "value": "totalPrice",
            "loc": {
              "sourceLocationType": "source",
              "start": 210,
              "end": 221
            }
          },
          "descending": false,
          "loc": {
            "sourceLocationType": "source",
            "start": 210,
            "end": 221
          }
        }
      ],
      "loc": {
        "sourceLocationType": "source",
        "start": 201,
        "end": 221
      }
    }
  },
  "datasets": {
    "type": "datasetClauses",
    "clauses": [],
    "loc": {
      "sourceLocationType": "noMaterialize"
    }
  },
  "variables": [
    {
      "type": "pattern",
      "subType": "bind",
      "expression": {
        "type": "expression",
        "subType": "aggregate",
        "aggregation": "sum",
        "distinct": false,
        "loc": {
          "sourceLocationType": "source",
          "start": 41,
          "end": 53
        },
        "expression": [
          {
            "type": "term",
            "subType": "variable",
            "value": "lprice",
            "loc": {
              "sourceLocationType": "source",
              "start": 45,
              "end": 52
            }
          }
        ]
      },
      "variable": {
        "type": "term",
        "subType": "variable",
        "value": "totalPrice",
        "loc": {
          "sourceLocationType": "source",
          "start": 57,
          "end": 68
        }
      },
      "loc": {
        "sourceLocationType": "source",
        "start": 40,
        "end": 69
      }
    }
  ],
  "loc": {
    "sourceLocationType": "inlinedSource",
    "newSource": "PREFIX : <http://books.example/>\nSELECT (SUM(?lprice) AS ?totalPrice)\nWHERE {\n  ?org :affiliates ?auth .\n  ?auth :writesBook ?book .\n  ?book :price ?lprice .\n}\nGROUP BY ?org\nHAVING (SUM(?lprice) > 10)\nORDER BY ?totalPrice\nVALUES (?book) { \n     (:book2)\n   }\n",
    "start": 0,
    "end": 9007199254740991,
    "loc": {
      "sourceLocationType": "source",
      "start": 0,
      "end": 258
    },
    "startOnNew": 0,
    "endOnNew": 258
  },
  "type": "query",
  "values": {
    "type": "pattern",
    "subType": "values",
    "variables": [
      {
        "type": "term",
        "subType": "variable",
        "value": "book",
        "loc": {
          "sourceLocationType": "source",
          "start": 230,
          "end": 235
        }
      }
    ],
    "values": [
      {
        "book": {
          "type": "term",
          "subType": "namedNode",
          "value": "book2",
          "loc": {
            "sourceLocationType": "source",
            "start": 246,
            "end": 252
          },
          "prefix": ""
        }
      }
    ],
    "loc": {
      "sourceLocationType": "source",
      "start": 222,
      "end": 258
    }
  }
}
