-
Notifications
You must be signed in to change notification settings - Fork 15
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
has-oscal-namespace()
function in Metapath
#195
Comments
FWIW, the I believe For The latest changes in the Metapath grammar now allow a QName to be used for functions. I am working to add support for this in metaschema-java. Once done, we will have a full implementation of this approach to test with. This work is tied to metaschema-java. IMHO, other than discussing a general implementation approach, I don't think there is any work to do in Metaschema at the moment. Once we have an implementation approach, we should document this in the Metapath specification, which is still very nascent. |
I actually encouraged @wendellpiez to open this issue based on a conversation, so we can say I helped co-authored the issue. That said, I did very little homework before the casual discussion, which I should have done before recommending we open this issue in this repo.
Ironically, I had not checked this and was unaware of it. I presume the answer to Wendell's question is: yes, Metaschema users can extend the core Metapath function set if they have the capability to do so, and for OSCAL this approach has been take with
Good point, that makes a good deal of sense to me.
Completely agree and I was the one who didn't do the homework when this was originally discussed. @david-waltermire-nist. EDIT: I have the ability to transfer the issue myself given my perms, I will do so. No need on your end, Dave. |
Excellent, thank you. In my implementation I will continue on working with the assumption that I can make any solution work as interim, while we balance the concerns. Also happy to help with any rewiring in repositories or indeed in helping with XPath/Metapath in any metaschema, real or mockup. 🚀
|
User Story:
Because straight-up XPath seems a little cumbersome and to reflect its special semantics, we proposed wrapping the test for the oscal namespace (@ns flag) in a function
has-oscal-namespace()
which is indeed called in OSCAL.https://github.com/usnistgov/OSCAL/blob/534b12dca5da4223615b72677159528022aa344a/src/metaschema/oscal_catalog_metaschema.xml#L52C77-L52C108
Couple of problems with this:
has-oscal-namespace('some-other-namespace
)` should returnCan we consider rolling this back or improving it?
The question is not urgent except it poses a planning problem for metaschema-xslt or indeed any processor that wants to implement constraints testing -- see below under Goals.
Alternatives:
OSCAL could use pure XPath:
not(@ns != 'http://csrc.nist.gov/ns/oscal')
- no @ns is present not equal to the valueempty(@ns) or (@ns = 'http://csrc.nist.gov/ns/oscal')
- cumbersome but explicitor rely on the processor supporting an extended XPath/Metapath:
oscal:has-namespace()
orm:has-namespace()
$oscal:has-namespace()
or$m:has-namespace()
or continue with a homemade function (presumed Metapath-native, so no namespace is given on the function name) but cleaned up semantics
has-namespace($ns)
instead ofhas-oscal-namespace($ns)
- although this is reallydoesn't-have-another-namespace()
🤔possibly other choices I have not thought of.
These are given in order of ease of implementation for the constraints checking, assuming XPath support. (The last option more or less requires implementing Metapath, if not to interpret it, at least to parse its syntax.)
Goals:
More clarity on plans for this function in particular and extensions to XPath in general.
One outcome could be an Issue in the OSCAL repository for making a change to its metaschemas where they use this construct.
Another outcome could be a decision to support or revise the function, with a PR or a spin-off Issue for necessary docs edits.
Irrespective of whether this feature of Metapath can be changed, the metaschema-xslt dev plan for constraints checking will be to build full Metapath support so as not to have this issue again -- with this feature or any other. Shorter term, however, if this feature can be pulled back, something much easier than Metapath can be contemplated for an implementation of Metaschema-based constraints checking.
This is especially true if we could go with a pure XPath approach, and continue to stick better to the rule "All XPath For Now".
Dependencies:
None known. This developer is seeking guidance that bears on implementation strategy.
However, the OSCAL team needs to be consulted. Indeed, they might prefer to use all XPath against a custom function in any case.
(cc @aj-stein-nist @nikitawootten-nist - please circulate as necessary)
Acceptance Criteria
The text was updated successfully, but these errors were encountered: