public object Translate(TranslationContext context, ASTNode node) { var result = new CREFModel.ValueSetExpression(); // TODO: Handle Value Set Mapping result.ValueSetID = node.GetAttribute <string>("id"); var version = node.GetAttribute <string>("version"); if (!String.IsNullOrEmpty(version)) { result.Version = Int32.Parse(version); result.VersionSpecified = true; } // TODO: Value Set Authority return(result); }
public object Translate(TranslationContext context, ASTNode node) { // Ideally, this would be expressed as an InValueSet expression within CREF, but in the absence of such an operator, the translation // Can be supporting using: Exists(Filter(ValueSet(ValueSetId), Condition(Current = Operand))) var valueSetId = node.GetAttribute <string>("id"); var valueSetVersion = node.GetAttribute <string>("version"); var valueSetAuthority = node.GetAttribute <string>("authority"); // TODO: Authority resolution? var operand = node.Children.FirstOrDefault(c => c.Name == "operand"); var valueSetExpression = new CREFModel.ValueSetExpression(); valueSetExpression.ValueSetID = valueSetId; if (!String.IsNullOrEmpty(valueSetVersion)) { valueSetExpression.Version = Convert.ToInt32(valueSetVersion); valueSetExpression.VersionSpecified = true; } var filter = new CREFModel.FilterExpression(); filter.Items.Add(valueSetExpression); var condition = new CREFModel.BinaryExpression(); condition.Operator = CREFModel.BinaryOperator.opEqual; condition.OperatorSpecified = true; // Assumption: A property expression with no path specified is equivalent to a "current" reference var property = new CREFModel.PropertyExpression(); condition.Items.Add(property); condition.Items.Add(context.TranslateNode(operand)); var exists = new CREFModel.UnaryExpression(); exists.Operator = CREFModel.UnaryOperator.opExists; exists.OperatorSpecified = true; exists.Item = filter; return(exists); }
public object Translate(TranslationContext context, ASTNode node) { // Ideally, this would be expressed as an InValueSet expression within CREF, but in the absence of such an operator, the translation // Can be supporting using: Exists(Filter(ValueSet(ValueSetId), Condition(Current = Operand))) var valueSetId = node.GetAttribute<string>("id"); var valueSetVersion = node.GetAttribute<string>("version"); var valueSetAuthority = node.GetAttribute<string>("authority"); // TODO: Authority resolution? var operand = node.Children.FirstOrDefault(c => c.Name == "operand"); var valueSetExpression = new CREFModel.ValueSetExpression(); valueSetExpression.ValueSetID = valueSetId; if (!String.IsNullOrEmpty(valueSetVersion)) { valueSetExpression.Version = Convert.ToInt32(valueSetVersion); valueSetExpression.VersionSpecified = true; } var filter = new CREFModel.FilterExpression(); filter.Items.Add(valueSetExpression); var condition = new CREFModel.BinaryExpression(); condition.Operator = CREFModel.BinaryOperator.opEqual; condition.OperatorSpecified = true; // Assumption: A property expression with no path specified is equivalent to a "current" reference var property = new CREFModel.PropertyExpression(); condition.Items.Add(property); condition.Items.Add(context.TranslateNode(operand)); var exists = new CREFModel.UnaryExpression(); exists.Operator = CREFModel.UnaryOperator.opExists; exists.OperatorSpecified = true; exists.Item = filter; return exists; }
public object Translate(TranslationContext context, ASTNode node) { var result = new CREFModel.ValueSetExpression(); // TODO: Handle Value Set Mapping result.ValueSetID = node.GetAttribute<string>("id"); var version = node.GetAttribute<string>("version"); if (!String.IsNullOrEmpty(version)) { result.Version = Int32.Parse(version); result.VersionSpecified = true; } // TODO: Value Set Authority return result; }