pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
yenda 2020-08-22T13:30:42.005Z

is such query invalid?

[{[:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"]
  [:video/placeholder-url]}
 {[:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"] [:creator/id]}]

yenda 2020-08-22T13:31:09.005600Z

shouldn't the parser merge the outputs instead of overwriting them (which I assume it does since it responds with one or the other)?

souenzzo 2020-08-22T15:09:36.006600Z

@yenda it's not a invalid query But both results end up in the same ident. It will not merge

[{([:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"] {:pathom/as :a})
  [:video/placeholder-url]}
 {([:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"] {:pathom/as :b})
  [:creator/id]}]

souenzzo 2020-08-22T15:10:43.006700Z

Or using placeholders

[{:>/a [{[:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"]
         [:video/placeholder-url]}]}
 {:>/b [{[:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"]
         [:creator/id]}]}]

yenda 2020-08-22T18:05:24.007200Z

I have the following attributes:

[:comment/created-on
                :video/id
                :user/id
                :comment/id
                :comment/text
                :comment/deleted?
                :comment/mentioned-id]

yenda 2020-08-22T18:06:02.008Z

both user/id and comment/mentioned-id are user-ids but I don't see how I can get more info about the mentioned-id with one query

yenda 2020-08-22T18:06:31.008300Z

[{[:comment/id "b214304f"] 
                                                             [{:>/mentioned-user [:comment/mentioned-id :user/username]} :comment/created-on 
                                                              {:>/user [:user/id :user/username]}]}]

yenda 2020-08-22T18:06:52.008700Z

this doesn't work and picks the username of user/id in both placeholders

yenda 2020-08-22T18:10:45.009Z

I have an alias for mentioned-id (pc/alias-resolver2 :user/id :comment/mentioned-id))

wilkerlucio 2020-08-22T20:02:49.010700Z

@yenda that's a modeling issue, because you have multiple paths with different input values, so which path it chooses is unpredictable (not a problem when paths are consistent, but its not this case), a way out is to instead of making those alias, make that a relationship, in this way:

wilkerlucio 2020-08-22T20:03:50.010900Z

(pc/defresolver comment-mentioned [_ {:keys [comment/mentioned-id]}]
  {::pc/input #{:comment/mentioned-id}
   ::pc/output [{:comment/mentioned [:user/id]}]}
  {:comment/mentioned {:user/id mentioned-id}})

wilkerlucio 2020-08-22T20:04:27.011200Z

then, you can query:

[{[:comment/id "b214304f"]
  [{:comment/mentioned [:user/username]}
   :comment/created-on
   {:>/user [:user/id :user/username]}]}]

wilkerlucio 2020-08-22T20:05:21.011800Z

the idea is created a separated context for the specific (mentioned) entry, this way it doesn't conflict with the user in the parent

yenda 2020-08-22T20:06:28.012100Z

nice thanks