0

Using MarkLogic DHF, I am trying to invoke a json validation function from my harmonization flow. All works well in the rest of the flow except the validation function does not find the schema. The *-FINAL DB where the harmonized files end up has my *-SCHEMAS db associated, and my schema file is stored in that *-SCHEMAS db under a simple URI. How can I determine where the DHF harmonize flow is looking for the schema?

UPDATE: Through trial and error, I determined that after loading my json schema into my server's base "Schemas" DB, the harmonize flow was able to find it for the jsonValidate() function. But I don't understand why it does not find it in the final schemas DBs, which is where the schema is loaded by the build.

UPDATE 2.0: Using @grtjn's suggestion below, I determined the current database for the harmonize flow is not the final db but rather the staging db. So when I manually loaded the schema in the staging schemas db (with proper permissions), the flow finds it. So now I just need to figure out how to get the gradle deploy to put the schema in the staging schemas db instead of the final schemas db.

Paulwms
  • 95
  • 8
  • Schemas db is normally determined by the content database (it is one of its properties). Confirm if your code is indeed running against the expected content db (something like `xdmp.log(xdmp.databaseName())`), and then verify if that content db is properly configured to use the schemas db you expect. – grtjn Jan 11 '19 at 18:17

1 Answers1

0

In DHF 4.1.0 or later, you should be able to just place the schema in the ml-gradle declared spots: https://github.com/marklogic-community/ml-gradle/wiki/Loading-schemas

In this case, you likely want to place it in your ml-config/databases directory under your staging schemas database name.

While it does make some logical sense that you're writing data to your final DB, the operation has to take place reading the staging data. Additionally schemas you define for your final DB (such as validation of final entities or TDEs to expose data as row/column) you likely want separate from your raw/staging data.

Please log an issue on our github (https://github.com/marklogic/marklogic-data-hub/issues) if you feel we need better documentation around this, or if you have another proposal to make it a bit easier for you to use.