Couldn't you just retrieve users and use "entity" to get their photos?

On Thu, Sep 18, 2014 at 4:43 PM, Wilker <wilkerlu...@gmail.com> wrote:

> Forgot to mention, I tried the (get-else) but it raises an error about
> cardinality many not supported, so I guessed it doesn't works here...
> ---
> Wilker LĂșcio
> http://about.me/wilkerlucio/bio
> Woboinc Consultant
> +55 81 82556600
> On Thu, Sep 18, 2014 at 7:41 PM, Wilker <wilkerlu...@gmail.com> wrote:
>> Hi
>>
>> I'm trying to figure if I can make some parts of my query results to be
>> optional, for example, given the following query:
>>
>> [:find ?name ?age
>>  :where
>>  [?m :person/name ?name]
>>  [?m :person/age ?age]]
>>
>> This will return all entities that has a :person/name and :person/age. Ok,
>> so, if I want to make the name mandatory and the age optional, I can do:
>>
>> [:find ?name ?age
>>  :in $
>>  :where
>>  [?m :person/name ?name]
>>  [(get-else $ ?m :person/age 0) ?age]]
>>
>> Ok, so, for single values that works great, but what about this:
>>
>> [:find ?m ?name (vec ?url)
>>  :in $
>>  :where
>>  [?m :person/name ?name]
>>  [?m :photos ?p]
>>  [?p :file/url ?url]]
>>
>> On the previous query, it fetch every person that has at least 1 photo,
>> but not those that has no photos.
>>
>> How do I make to the query to return all entities that has name, having
>> photos or not (ideally the value would be a blank list for those without
>> photos)?
>>
>> Best regards.
>> ---
>> Wilker LĂșcio
>> http://about.me/wilkerlucio/bio
>> Woboinc Consultant
>> +55 81 82556600
>>
> -- 
> 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/d/optout.

-- 
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/d/optout.

Reply via email to