terminusdb icon indicating copy to clipboard operation
terminusdb copied to clipboard

Problem with cost function

Open hoijnet opened this issue 1 year ago • 0 comments

Describe the bug I ran a WOQL query to select inbound documents (either direct link or as a path query to fragments) and got the following result:

Below is a WOQL query for inbound documents. Works in one simple data product, but not in a more advanced one.

          WOQL.select(
            "v:doc",
            WOQL.and(
              WOQL.triple("v:linkedFragment", "v:prop", "v:target"),
              WOQL.eq("v:target", docId),
              WOQL.or(
                WOQL.and(
                  WOQL.triple("v:linkedFragment", "rdf:type", "v:linkDocType"),
                  WOQL.not(WOQL.quad("v:linkDocType", "sys:subdocument", "v:own", "schema")),
                  WOQL.eq("v:doc", "v:linkedFragment")
                ),
                WOQL.and(
                  WOQL.not(WOQL.quad("v:baseDocType", "sys:subdocument", "v:own", "schema")),
                  WOQL.triple("v:baseDoc", "rdf:type", "v:baseDocType"),
                  WOQL.path("v:baseDoc", ".+>", "v:linkedFragment"),
                  WOQL.eq("v:doc", "v:baseDoc")
                )
              )
            )
          )
{
  "@type": "api:WoqlErrorResponse",
  "api:error": {
    "@type": "api:ExistenceError",
    "api:value": "'query/definition':cost_(path(mv(baseDoc),plus(p),mv(linkedFragment)),_38412,pos)"
  },
  "api:message": "The program: 'query/definition:cost_(path(mv(baseDoc),plus(p),mv(linkedFragment)),_38412,pos)' used a predicate with unhandled arguments",
  "api:status": "api:failure"
}

To Reproduce Steps to reproduce the behavior:

  1. Run query on a data product with a document structure with many levels of subdocuments
  2. See error

Expected behavior The same query works with smaller data products

Screenshots N/A

Info (please complete the following information):

  • Via DFRNT, 11.1.11

hoijnet avatar Jan 26 '24 12:01 hoijnet