code: public static void configure(DatabaseClient client) throws IOException {
      // create a manager for configuring rules
      RuleManager ruleMgr = client.newRuleManager();
  
  
      // specify a rule in raw XML (raw JSON is also supported
      // as well as a POJO rule definition)
      String rawRule =
        "<rapi:rule xmlns:rapi='http://marklogic.com/rest-api'>"+
          "<rapi:name>"+RULE_NAME+"</rapi:name>"+
          "<rapi:description>industry of Real Estate</rapi:description>"+
          "<search:search "+
          "xmlns:search='http://marklogic.com/appservices/search'>"+
          "<search:query>"+
          "<search:value-constraint-query>"+
          "<search:constraint-name>industry</search:constraint-name>"+
          "<search:text>Real Estate</search:text>"+
          "</search:value-constraint-query>"+
          "</search:query>"+
          "<search:options>"+
          "<search:constraint name='industry'>"+
          "<search:value>"+
          "<search:element name='industry' ns=''/>"+
          "</search:value>"+
          "</search:constraint>"+
          "</search:options>"+
          "</search:search>"+
          "<rapi:rule-metadata>"+
          "<correlate-with>/demographic-statistics?zipcode=</correlate-with>"+
          "</rapi:rule-metadata>"+
          "</rapi:rule>";
  
      // create a handle for writing the rule
      StringHandle writeHandle = new StringHandle(rawRule);
  
      // write the rule to the database
      ruleMgr.writeRule(RULE_NAME, writeHandle);
    }
docs: set up alert rules