Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector argument expected in q/out #6

Open
basdek opened this issue Apr 14, 2015 · 4 comments
Open

Vector argument expected in q/out #6

basdek opened this issue Apr 14, 2015 · 4 comments

Comments

@basdek
Copy link

basdek commented Apr 14, 2015

This issue is reported with the assumption of the https://raw.githubusercontent.com/tinkerpop/blueprints/master/doc/images/graph-example-1.jpg graph in mind. Furthermore, this issue is a duplicate of clojurewerkz/ogre#68, I am (as described) not sure if this is a problem in the docs or in the actual code, I suspect the docs, hence me reporting it here too.

The documentation describes in the chapter "Traversals" that to query for the things Josh created we should do:

(q/query (g/find-by-id 4)
         (q/--> :created)
         q/into-vec!)

This throws an error:

java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
RT.java:505 clojure.lang.RT.seqFrom
RT.java:486 clojure.lang.RT.seq
core.clj:133 clojure.core/seq
core.clj:2595 clojure.core/filter[fn]
LazySeq.java:40 clojure.lang.LazySeq.sval
LazySeq.java:49 clojure.lang.LazySeq.seq
RT.java:484 clojure.lang.RT.seq
core.clj:133 clojure.core/seq
core.clj:2551 clojure.core/map[fn]
LazySeq.java:40 clojure.lang.LazySeq.sval
LazySeq.java:49 clojure.lang.LazySeq.seq
RT.java:484 clojure.lang.RT.seq
core.clj:133 clojure.core/seq
core.clj:3165 clojure.core/into-array
util.clj:35 clojurewerkz.ogre.util/str-array
util.clj:39 clojurewerkz.ogre.util/keywords-to-strings
core.clj:119 clojurewerkz.ogre.core/out[fn]
util.clj:58 clojurewerkz.ogre.util/compile-query[fn]
ArrayChunk.java:58 clojure.lang.ArrayChunk.reduce
protocols.clj:98 clojure.core.protocols/fn
protocols.clj:19 clojure.core.protocols/fn[fn]
protocols.clj:31 clojure.core.protocols/seq-reduce
protocols.clj:48 clojure.core.protocols/fn
protocols.clj:13 clojure.core.protocols/fn[fn]
core.clj:6289 clojure.core/reduce
util.clj:58 clojurewerkz.ogre.util/compile-query
pipe.clj:26 clojurewerkz.ogre.pipe/into-vec!
(...)

After investigation into the test suite of the library I came across the following lines:

The first argument for clojurewerkz.ogre.core/out is expected to be a vector, instead of a keyword. The following code worked:

(q/query (g/find-by-id 4)
         (q/--> [:created])
         q/into-vec!)

Somewhere there is something wrong: either with the docs describing expect behaviour (but the behaviour is not in line with the code), or the docs describing behaviour not congruent with the code as proven by the results and test suite.

@michaelklishin
Copy link
Member

@basdek please submit a PR that corrects the docs.

@basdek
Copy link
Author

basdek commented Apr 14, 2015

@michaelklishin You have concluded that the docs are wrong in this regard? Cause in that case, if you confirm it, I will make such a PR for the docs.

@basdek
Copy link
Author

basdek commented Apr 14, 2015

@spmallette @michaelklishin @vsu

I forked the repo and there the code examples are correct, which is different from what is currently publicly visible on the website. Maybe someone forgot to do an update?

Btw, the q/--E> also got renamed to q/-E>, not in the published docs, but in the master branch of the doc repo it is correct.

@michaelklishin
Copy link
Member

@basdek please submit a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants