RFHT: Date Range Searching


#1

I think we need a good example of date range searching. To this end, we probably need a dataset we can add that uses our new types.


#2
        // Find a user who has an activation_id matching activationID and who has
        // an activation_created_at within the last day, and return the ID(s)
        Vs, _ := cayley.StartPath(db.QuadStore).
                Has(quad.IRI("is_a"), quad.String("user")).
                Has(quad.IRI("activation_id"), quad.String(activationID)).
                Tag("id").
                Out(quad.IRI("activation_created_at")).
                Filter(iterator.CompareGT, quad.Time(time.Now().AddDate(0, 0, -1))). // <- actual date filter.
                Back("id").
                Iterate(nil).AllValues(nil)

#3

I have a strange feeling I can understand ‘path walking’.
Tell me if I understand the above: you start with all nodes but filter them to only keep those that are users and have specific activation id. Than you walk out and reach all the activation creation date nodes and filter in such a way that you only keep those nodes that are from a specific date. Than you walk back to the previous nodes and print them.

I feel like you might print too many nose and not just the greater than a date since you tagged a bit early buy I probably don’t understand it completely.


#4

You get it mostly. When you go “Back” to a tag, it goes back along the still active paths, so those filtered out are removed, but you got the rest right.


#5

Thanks. btw, what’s RFR? Request for responses? or maybe resources?


#6

It was Request For Recipe – now RFHT.


#7

Is there a GIZMO equivalent of this ?

Thanks


#8