Yes I could, but I'm trying to stick on the philosophy of "define your data
at query time", so I would like to move all "query stuff" to Datomic, also,
even if I don't use, I still would like to know if that's possible, I'm
still very noob to Datomic and so trying stuff around. But considering all
kinds of complex stuff that Datomic support, I would be surprise if that
wasn't possible to do at query time...

So, what I do in my queries is just fetch all fields and name then by
position, it's very flexible as long as I'm able to "shape" my data at
query time, so, if there is a way to do it, I would love to know.

Thanks.

---
Wilker Lúcio
http://about.me/wilkerlucio/bio
Woboinc Consultant
+55 81 82556600

On Thu, Sep 18, 2014 at 7:48 PM, Ashton Kemerling <ashtonkemerl...@gmail.com
> wrote:

> 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
> "Datomic" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to datomic+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