Index: libabac/abac_pl_yy.c
===================================================================
--- libabac/abac_pl_yy.c	(revision c586a3c974eed872c4a41b9c2f5f7db8484b0eef)
+++ libabac/abac_pl_yy.c	(revision d5bbd3e92c5d4a706596e828432a61fb4549423d)
@@ -14,5 +14,5 @@
 
 /* from abac_pl_gen.c */
-extern char *generate_pl_range_constraint_clause(char *,char *,char *,char *);
+extern char *generate_pl_range_constraint(char *,char *,char *,char *);
 extern char *generate_pl_oset_constraint_clause(abac_oset_t *, char *);
 extern abac_list_t *generate_pl_role_clauses(abac_role_t *, abac_role_t *);
@@ -55,5 +55,5 @@
 
 /* to track role/oset constraint clauses used within a rule clause,
-   collect them up in one place */
+   collect them up in one place, these are for conjunction clauses */
 typedef struct _abac_yy_constraint_t {
     char *clause;
@@ -316,5 +316,4 @@
     abac_list_foreach(ptr, cur,
         type=cur->type;
-        val=cur->val; 
         switch (type) {
             case e_yy_RANGE_MIN:
@@ -459,4 +458,20 @@
     int type=abac_term_verify_term_type(typestr);
     ptr->type=type;
+}
+
+int is_yy_term_data_type_numeric(abac_yy_term_data_t *ptr)
+{
+    if(ptr->type==abac_term_verify_term_type("integer") ||
+          ptr->type==abac_term_verify_term_type("float"))
+        return 1;
+    return 0;
+}
+
+int is_yy_term_data_type_alpha(abac_yy_term_data_t *ptr)
+{
+    if(ptr->type==abac_term_verify_term_type("string") ||
+          ptr->type==abac_term_verify_term_type("urn"))
+        return 1;
+    return 0;
 }
 
@@ -1308,15 +1323,15 @@
    return NULL;
 } 
+
 /****************************************************************/
 /* add the range condition to constraint list */
-
-void make_yy_range_constraint(abac_yy_term_data_t *ptr, char *var)
-{
-   /* XXXX this only works for integer and float */
+/* this is for integer and float only */
+void make_yy_range_numeric_constraint(abac_yy_term_data_t *ptr, char *var)
+{
    char *typestr=abac_term_type(ptr->type);
    abac_list_t *rlist=get_yy_term_data_cond_range(ptr);
    char *tmplist=NULL;
    char *tmp=NULL;
-   int is_range=1; /* either , or | */
+   int as_range=1; /* either , or ; */
    if(rlist) {
        char *rstring=_string_yy_cond_range(rlist);
@@ -1324,4 +1339,5 @@
        abac_yy_range_t *cur;
      
+       /* a list of values -- in chars */
        abac_list_foreach(rlist, cur,
            int type=cur->type;
@@ -1329,16 +1345,17 @@
            switch(type) {
              case e_yy_RANGE_MIN:
-               tmp=generate_pl_range_constraint_clause(typestr,var,val,">");
+               tmp=generate_pl_range_constraint(typestr,var,val,">");
                break;
              case e_yy_RANGE_MAX:
-               tmp=generate_pl_range_constraint_clause(typestr,var,val,"<");
+               tmp=generate_pl_range_constraint(typestr,var,val,"<");
                break;
              case e_yy_RANGE_TARGET:
-               tmp=generate_pl_range_constraint_clause(typestr,var,val,"=");
-               int is_range=0;
+               tmp=generate_pl_range_constraint(NULL,var,val,"=");
+               as_range=0;
                break;
            }
+           /* ; is prolog's disjunction built in predicate */
            if(tmplist) {
-               if(is_range)
+               if(as_range)
                    asprintf(&tmplist,"%s,%s",tmplist,tmp);
                    else
@@ -1352,4 +1369,60 @@
        abac_yy_add_yy_constraints(tmplist);
    }
+}
+
+/****************************************************************/
+/* this is for string and urn only */
+void make_yy_range_string_constraint(abac_yy_term_data_t *ptr, char *var)
+{
+   char *typestr=abac_term_type(ptr->type);
+   abac_list_t *rlist=get_yy_term_data_cond_range(ptr);
+   char *tmplist=NULL;
+   char *tmp=NULL;
+   if(rlist) {
+       char *rstring=_string_yy_cond_range(rlist);
+       set_yy_term_data_cond_str(ptr,rstring);
+       abac_yy_range_t *cur;
+     
+       /* a list of values -- in chars */
+       abac_list_foreach(rlist, cur,
+           int type=cur->type;
+           char *val=cur->val; 
+           switch(type) {
+             case e_yy_RANGE_MIN:
+               panic("make_yy_range_string_constraint, invalid range type - min"); 
+               break;
+             case e_yy_RANGE_MAX:
+               /* invalid range type */
+               panic("make_yy_range_string_constraint, invalid range type - max"); 
+               break;
+             case e_yy_RANGE_TARGET:
+               tmp=generate_pl_range_constraint(NULL,var,val,"=");
+               break;
+           }
+           /* ; is prolog's disjunction built in predicate */
+           if(tmplist)
+               asprintf(&tmplist,"%s;%s",tmplist,tmp);
+               else tmplist=tmp;
+           tmp=NULL;
+       );
+       asprintf(&tmplist,"(%s)",tmplist);
+       /* generate a clause with above and add into db */
+       tmp=abac_pl_add_string_range_constraint_clause(var,tmplist);
+       abac_yy_add_yy_constraints(tmp);
+   }
+}
+
+void make_yy_range_constraint(abac_yy_term_data_t *ptr, char *var)
+{
+    if(is_yy_term_data_type_numeric(ptr)) {
+        make_yy_range_numeric_constraint(ptr, var);
+        } else if (is_yy_term_data_type_alpha(ptr)) {
+            make_yy_range_string_constraint(ptr, var);
+    }
+/*
+        } else if (is_yy_term_data_type_time(ptr)) {
+            make_yy_range_time_constraint(ptr, var);
+    }
+*/
 }
 
