1. A method of performing a graph query issued by a user, comprising: performing on a processor, receiving a user graph query, the user graph query being user generated; creating a new query based on the user graph query and a query policy expressed in a graph query language, the query policy being expressed as a set of one or more views, where each view includes a first query that evaluates whether the query policy applies to the user and a second query that determines graph data that is viewable to the user through the view, wherein the new query comprises a union of conjunctive queries wherein each query in the union is a result of considering one combination from a Cartesian product of creating an optimized query by removing redundant views from the new query, removing any empty views from the new query, and removing any empty sub-query of the new query; and performing the optimized query on graph data to obtain a result, wherein the graph data includes a set of triples, wherein the rewriting further comprises: identifying a plurality of views in the query policy; separating the plurality of views into groups based on a query predicate; considering one view from each of the groups as a rewritten query based on a query predicate; checking a validity of the rewritten query; and generating the new query based on a union of the rewritten queries.