Skip to content

Queries with recursive predicates do not parse #339

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

Open
mpoffald opened this issue Jan 17, 2023 · 4 comments
Open

Queries with recursive predicates do not parse #339

mpoffald opened this issue Jan 17, 2023 · 4 comments
Labels
bug Something isn't working as expected
Milestone

Comments

@mpoffald
Copy link
Contributor

mpoffald commented Jan 17, 2023

Our expand fn is throwing an exception when we attempt to parse queries with recursive predicates.

Exception is being thrown at this step: https://github.com/fluree/db/blob/main/src/fluree/db/query/fql/parse.cljc#L144

Stack trace:

  contains? not supported on type: clojure.lang.Keyword

                   RT.java:  853  clojure.lang.RT/contains
                  core.clj: 1506  clojure.core/contains?
                  core.clj: 1498  clojure.core/contains?
               expand.cljc:  319  fluree.json_ld.impl.expand$node/invokeStatic
               expand.cljc:  305  fluree.json_ld.impl.expand$node/invoke
               expand.cljc:  311  fluree.json_ld.impl.expand$node/invokeStatic
               expand.cljc:  305  fluree.json_ld.impl.expand$node/invoke
              json_ld.cljc:   96  fluree.json_ld$expand/invokeStatic
              json_ld.cljc:   88  fluree.json_ld$expand/invoke
                parse.cljc:  145  fluree.db.query.fql.parse$recursion_predicate/invokeStatic
                parse.cljc:  134  fluree.db.query.fql.parse$recursion_predicate/invoke
                parse.cljc:  210  fluree.db.query.fql.parse$parse_recursion_predicate/invokeStatic
                parse.cljc:  208  fluree.db.query.fql.parse$parse_recursion_predicate/invoke
                parse.cljc:  235  fluree.db.query.fql.parse$parse_predicate_pattern/invokeStatic
                parse.cljc:  230  fluree.db.query.fql.parse$parse_predicate_pattern/invoke
                parse.cljc:  293  fluree.db.query.fql.parse$parse_triple/invokeStatic
                parse.cljc:  290  fluree.db.query.fql.parse$parse_triple/invoke
                parse.cljc:  307  fluree.db.query.fql.parse$eval30336$fn__30337/invoke
              MultiFn.java:  244  clojure.lang.MultiFn/invoke
                parse.cljc:  284  fluree.db.query.fql.parse$parse_where_clause$fn__30328/invoke
                  core.clj: 6979  clojure.core/mapv/fn
           ArrayChunk.java:   58  clojure.lang.ArrayChunk/reduce
             protocols.clj:  136  clojure.core.protocols/fn
             protocols.clj:  124  clojure.core.protocols/fn
             protocols.clj:   19  clojure.core.protocols/fn/G
             protocols.clj:   31  clojure.core.protocols/seq-reduce
             protocols.clj:   75  clojure.core.protocols/fn
             protocols.clj:   75  clojure.core.protocols/fn
             protocols.clj:   13  clojure.core.protocols/fn/G
                  core.clj: 6886  clojure.core/reduce
                  core.clj: 6970  clojure.core/mapv
                  core.clj: 6970  clojure.core/mapv
                parse.cljc:  283  fluree.db.query.fql.parse$parse_where_clause/invokeStatic
                parse.cljc:  279  fluree.db.query.fql.parse$parse_where_clause/invoke
                parse.cljc:  327  fluree.db.query.fql.parse$parse_where/invokeStatic
                parse.cljc:  324  fluree.db.query.fql.parse$parse_where/invoke
                parse.cljc:  394  fluree.db.query.fql.parse$parse_analytical_query/invokeStatic
                parse.cljc:  389  fluree.db.query.fql.parse$parse_analytical_query/invoke
subject_crawl_reparse_test.clj:   97  fluree.db.query.subject-crawl-reparse-test/fn
subject_crawl_reparse_test.clj:    9  fluree.db.query.subject-crawl-reparse-test/fn
                  test.clj:  242  cider.nrepl.middleware.test/test-var/fn
                  test.clj:  242  cider.nrepl.middleware.test/test-var
                  test.clj:  234  cider.nrepl.middleware.test/test-var
                  test.clj:  257  cider.nrepl.middleware.test/test-vars/fn/fn
                  test.clj:  687  clojure.test/default-fixture
                  test.clj:  683  clojure.test/default-fixture
                  test.clj:  257  cider.nrepl.middleware.test/test-vars/fn
                  test.clj:  687  clojure.test/default-fixture
                  test.clj:  683  clojure.test/default-fixture
                  test.clj:  254  cider.nrepl.middleware.test/test-vars
                  test.clj:  248  cider.nrepl.middleware.test/test-vars
                  test.clj:  270  cider.nrepl.middleware.test/test-ns
                  test.clj:  261  cider.nrepl.middleware.test/test-ns
                  test.clj:  281  cider.nrepl.middleware.test/test-var-query
                  test.clj:  274  cider.nrepl.middleware.test/test-var-query
                  test.clj:  319  cider.nrepl.middleware.test/handle-test-var-query-op/fn/fn
                  AFn.java:  152  clojure.lang.AFn/applyToHelper
                  AFn.java:  144  clojure.lang.AFn/applyTo
                  core.clj:  667  clojure.core/apply
                  core.clj: 1990  clojure.core/with-bindings*
                  core.clj: 1990  clojure.core/with-bindings*
               RestFn.java:  425  clojure.lang.RestFn/invoke
                  test.clj:  311  cider.nrepl.middleware.test/handle-test-var-query-op/fn
                  AFn.java:   22  clojure.lang.AFn/run
               session.clj:  218  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  217  nrepl.middleware.session/session-exec/main-loop
                  AFn.java:   22  clojure.lang.AFn/run
               Thread.java:  833  java.lang.Thread/run

@mpoffald mpoffald added the bug Something isn't working as expected label Jan 17, 2023
@bplatz
Copy link
Contributor

bplatz commented Feb 6, 2023

Here is a property path description from SPARQL which ultimately we want to support all of - so we should use similar syntax (JSON-ified):
https://en.wikibooks.org/wiki/SPARQL/Property_paths

dpetran added a commit that referenced this issue Feb 7, 2023
@mpoffald mpoffald reopened this Feb 16, 2023
@dpetran
Copy link
Contributor

dpetran commented May 30, 2023

Possibly related: db #322

@mpoffald
Copy link
Contributor Author

mpoffald commented Jun 8, 2023

This still does need some spec work to see what syntax we can use that won't break anything, but that will be part of the implementation work.

@mpoffald mpoffald self-assigned this Jun 8, 2023
@mpoffald mpoffald added this to the 3.0.0-beta1 milestone Jun 12, 2023
@mpoffald
Copy link
Contributor Author

Some work was done on this, but the approach needs to be rethought and this isn't high-priority enough to keep working on right now.

The fix for the parsing error itself is straightforward, just need to use expand-iri where we were using expand, and accommodate strings vs keywords appropriately: d943ba2

But the bigger lift is getting the recursive queries to actually execute, and we have chosen to come back to that later.

@mpoffald mpoffald removed their assignment Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants