I don't think you're accounting for leading and trailing whitespace. A
field like:

;  GasTurbine2103/01  ;


Will produce a string like:

"  GasTurbine2103/01  "


The only field that doesn't have leading and trailing whitespace is the
timestamp, which works correctly.

There's a standard Clojure function, clojure.string/trim, that will trim
whitespace from a string. All we have to do it apply it in Cascalog:

(?<- (stdout)
     [?timestamp ?assembly ?category]
     (info-tap :> ?timestamp ?assembly ?category)

     (clojure.string/trim ?category :> ?trimmed-category)

     (= ?trimmed-category "Warning"))


See if that works.

- James

On 28 November 2013 20:36, sindhu hosamane <sindh...@gmail.com> wrote:

> Hi James ,
>
>  Thanks a lot for ur excellent reply . It really made me things clearer.
>   But still one small problem  .
>
> Below is my code :
>
> (ns sixthclojureproject.fourthcore
>
>  (:use [cascalog.api]
>
>         [cascalog.more-taps :only (hfs-delimited)])
>
>   (:gen-class))
>
>
> (def info
>
>       (hfs-delimited
>
>           "/Users/Harshabirur/Desktop/Screenshots/messages_new.txt"
>
>           :delimiter ";"
>
>           :outfields ["?timestamp" "?assembly" "?category" "?eventtext"
> "?downtime" "?tag" "?process" "?state"]
>
>           :skip-header? false))
>
>
>
> (def info-tap
>
>   (<- [?timestamp ?assembly ?category ]
>
>       ((select-fields info ["?timestamp" "?assembly" "?category"])?timestamp 
> ?assembly ?category
> )))
>
>
>
> (?<- (stdout)
>
>      [?timestamp ?assembly ?category ]
>
>      (info-tap :> ?timestamp ?assembly ?category )
>
>      (= ?timestamp "12.05.2010 06:03:15"))
>
>
> It produces the correct output like
>
>
> RESULTS
>
> -----------------------
>
> 12.05.2010 06:03:15   GasTurbine2103/01    Start Inhibit
>
>
> But when i have my predicate like (= ?category "Warning")
>
> Also does not work for (= ?assembly "GasTurbine2103/01")
>
>
> RESULTS
>
> -----------------------
>
> -----------------------
>
> I get empty result. But some results are expected , because ?category
> field has some "Warning".
>
> But it seems like only ?timestamp field is processed in = predicate , but
> not other fields like ?category      ?assembly or other .
>
>
> Just Wondering about the strange behaviour of my code . or where is it
> wrong?
>
>
> My data looks like
>
>
> timestamp;  assembly  ;  category  ;  eventtext  ;  downtime  ;  tag  ;
>  process  ;  state
>
> 12.05.2010 00:38:29;  GasTurbine2103/01  ;  Warning ; LUB OIL SUPPLY
> TEMPERATURE HIGH [TC61]  ;03:37:43;  wng 27083  ;FALSCH;  FOHs
>
> 12.05.2010 02:48:18;  GasTurbine2103/01  ;  Status ; INSTRUMENT AIR ASSIST
> PURGE IN PROGRESS  ;03:37:46;  sts 71000  ;FALSCH;  FOHs
>
> 12.05.2010 02:48:18;  GasTurbine2103/01  ;  Status ;LIQUID BURNER FORWARD
> AIR PURGE IN PROGRESS ;03:37:49;  sts 72000 ;FALSCH; FOHs
>
> 12.05.2010 02:52:19;  GasTurbine2103/01  ;  Start Inhibit  ;  Emergency
> Stop Loop Test In Progress  ;;  sti 6032  ;FALSCH;  FOHs
>
> 12.05.2010 02:52:23;  GasTurbine2103/01  ;  Start Inhibit  ;  Emergency
> Stop Loop Test In Progress  ;;  sti 6032  ;FALSCH;  FOHs
>
>
> (Attached is my datasource for reference )
> sorry for my long post . Please help me to find where is it going wrong .
>
> -Sindhu
>
>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to