Class AstSignature


  • @PublicApi
    public class AstSignature
    extends java.lang.Object
    This will produce signature and privacy safe query documents that can be used for query categorisation and logging.
    • Constructor Summary

      Constructors 
      Constructor Description
      AstSignature()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Document privacySafeQuery​(Document document, java.lang.String operationName)
      This can produce a "privacy safe" AST that some what conforms to the algorithm as outlined here which removes excess operations, removes any field aliases, hides some literal values and sorts the result.
      Document signatureQuery​(Document document, java.lang.String operationName)
      This can produce a "signature" canonical AST that conforms to the algorithm as outlined here which removes excess operations, removes any field aliases, hides literal values and sorts the result into a canonical query.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AstSignature

        public AstSignature()
    • Method Detail

      • signatureQuery

        public Document signatureQuery​(Document document,
                                       java.lang.String operationName)
        This can produce a "signature" canonical AST that conforms to the algorithm as outlined here which removes excess operations, removes any field aliases, hides literal values and sorts the result into a canonical query. A signature says two queries with the same signature can be thought of as the same query. For example a tracing system will want a canonical signature for queries to group them.
        Parameters:
        document - the document to make a signature query from
        operationName - the name of the operation to do it for (since only one query can be run at a time)
        Returns:
        the signature query in document form
      • privacySafeQuery

        public Document privacySafeQuery​(Document document,
                                         java.lang.String operationName)
        This can produce a "privacy safe" AST that some what conforms to the algorithm as outlined here which removes excess operations, removes any field aliases, hides some literal values and sorts the result. This is not a signature. For example object literal structures are retained like `{ a : "", b : 0}` which means you can infer what was asked for but not what the values are. This differs from signatureQuery(Document, String) which collapses literals to create more canonical signatures. A privacy safe Query is useful for logging say to show what shapes was asked for without revealing what data was provided
        Parameters:
        document - the document to make a privacy safe query from
        operationName - the name of the operation to do it for (since only one query can be run at a time)
        Returns:
        the privacy safe query in document form