stevedlawrence commented on a change in pull request #748:
URL: https://github.com/apache/daffodil/pull/748#discussion_r801985256
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaComponent.scala
##########
@@ -141,6 +141,17 @@ trait SchemaComponent
res.distinct
}
+ /**
+ * The lexically enclosing term, if one exists
+ */
+ final lazy val optEnclosingLexicalTerm: Option[Term] = {
+ optLexicalParent match {
+ case Some(t: Term) => Some(t)
+ case Some(sc: SchemaComponent) => sc.optEnclosingLexicalTerm
+ case _ => None
Review comment:
Schemas are represented in memory by the DSOM, which has what I believe
is a pretty up to date UML diagram:
https://cwiki.apache.org/confluence/display/DAFFODIL/DFDL+Schema+Object+Model+%28DSOM%29+with+UML
It's not super easy to follow, but if you follow the lines enough you can
see the relationships. It's definitely helpful to see what is a Term and what
isn't.
For example, a local `<xs:complex>` is modeled by a `LocalComplexTypeDef`.
This is not a `Term`, but has a lexical parent that could be, depending if the
parent is a `LocalElementDecl` (a `Term) or a `GlobalElementDecl` (not a
`Term`).
Another example, a local `<xs:sequence>` is modeled by a `LocalSequence` (a
Term), which may have a lexical parent that is a `LocalComplexTypeDef` (not a
`Term`), which may have a lexical parent that is a `LocalElementDef` (a
`Term`), etc.
So this `optEnclsoingLexicalTerm` essentially skips over lexical parents
like `LocalComplexTypeDef` since they really don't provide any information--you
can't put any DFDL properties on them. `Term`s are usually the more interesting
things, and what the alignment stuff cares about.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]