Closed jshughes closed 4 years ago
@msbentley it is in the plan for Build 11.0 (October 2020). We can also try to get a point build out if you need it for a previous version of the IM
Thanks @jordanpadams and @jshughes! Indeed whether we can use it immediately depends on if the next version(s) of LDDTool will support dictionaries built against other IMs. If not, we may have to wait until next year when some of the PSA missions probably update their IM versions (currently we're all on 1B00).
@msbentley we are also going to work that into this next delivery as well, so hopefully we will be able to work that out.
Fantastic! I'm stuck on 0.2.1.5b plus a workaround script, so it will be great to upgrade and "cleanly" generate dictionaries!
@jshughes can you provide a status on this?
Next in queue to be addressed.
June schedule status: delayed due to other bug fix taking precedent. still on schedule for delivery by end of build cycle.
July schedule status: delayed due to other IM and DDWG work pulling staff away from task. Slack built into schedule should allow for this to be completed in this build.
August schedule status: delayed due to other IM and DDWG work pulling staff away from task. Slack built into schedule should allow for this to be completed in this build.
After further review of the request, it seems that the request can be accommodated under the current implementation. A test case and the results follow.
This resolution of this issue will now be further tested under SI&T
Well, that's even easier - thanks @jshughes I'll give it a test also on my current version of lddtool!
Hi @jshughes I tested this and it indeed works, but my Ingest file no longer validates:
The prefix "sch" for element "sch:value-of" is not bound.
I guess I would have to define the sch prefix in my Ingest file?
@jshughes the nested XML is kind of a cludge here. should we use XML entity escaping here instead?
e.g.
<sch:rule context="msn:mission_phase_name">
<sch:let name="num_colons" value="string-length(.) - string-length(translate(., ':', ''))"/>
<sch:let name="required_colons" value="4"/>
<sch:assert test="$num_colons eq $required_colons">
In Product_Collection, the number of colons found: (<sch:value-of select="$num_colons"/>) is inconsistent with the number expected: (<sch:value-of select="$required_colons"/>).</sch:assert>
</sch:rule>
</sch:pattern>
Note: <sch:value-of select="$required_colons"/>
instead of <sch:value-of select="$required_colons"/>
LDDTool can then just recognize that and "convert" in the output to schematron
Sorry, I should have cleared that up. When entering the rule into DD_Rule, the escape sequence "\<" must be used for "<" and likewise "\>" for ">". Otherwise, the Ingest_LDD XML document will not validate correctly. LDDTool then converts as necessary.
Ahh, that did the trick - fantastic, many thanks - time to go and add more descriptive messages to my dictionaries using this trick!
@jshughes before we close this out, can we briefly document this somewhere either in the LDDTool docs or on the SBN wiki just so we don't forget about it when we put some more effort into refining the documentation for LDDTool.
@jshughes @msbentley this has been documented here: https://pds-data-dictionaries.github.io/development/ldd-how-to.html#using-schematron-value-of-functionality
@msbentley @jshughes Can you provide a test file for me to finish verifying the latest release build? Thx,
I can send an LDD ingest file if you need it, but an example snippet from my current development PSA dictionary is:
<DD_Rule>
<local_identifier>logical_identifier_filename</local_identifier>
<rule_context>pds:Product_Observational/pds:Identification_Area</rule_context>
<rule_assign>name="file-name" value="replace(tokenize(document-uri(/), '/')[last()],'\.[^.]+$','')"</rule_assign>
<rule_assign>name="lid" value="tokenize(pds:logical_identifier, ':')[last()]"</rule_assign>
<DD_Rule_Statement>
<rule_type>Assert</rule_type>
<rule_test>
lower-case($file-name) = $lid
</rule_test>
<rule_message>
Label filename (<sch:value-of select="$file-name"/>) and last component of the LID (product ID) (<sch:value-of select="$lid"/>) must match for observational products
</rule_message>
<rule_description>Filename (minus extension) and the product ID (last part of the LID) must match for observational products (case can be different)</rule_description>
</DD_Rule_Statement>
</DD_Rule>
On Jan 18, 2019, at 7:59 AM, Mark Bentley (HE SPACE OPERATIONS BV)
using sch:value-of to display a variable in validate/Schematron validation looks really useful, and I see the PDS4 master schema (but no discipline dictionaries) use this extensively.
Currently I don't think anything like that can be included in the DD_Rule class in LDDTool to generate such output. Is this possible, or might it be included in the future? It would be nice both for debugging and to help the end user to have more rich output.