protected object GetPropertyExpression(TranslationContext context, ASTNode node, string path)
		{
			var result = new SQLModel.PropertyExpression();
			result.Path = path;

			if (node.Children.Count > 0)
			{
				result.Item = context.TranslateNode(node.Children[0]);
			}

			return result;
		}
Beispiel #2
0
        protected object GetPropertyExpression(TranslationContext context, ASTNode node, string path)
        {
            var result = new SQLModel.PropertyExpression();

            result.Path = path;

            if (node.Children.Count > 0)
            {
                result.Item = context.TranslateNode(node.Children[0]);
            }

            return(result);
        }
Beispiel #3
0
        private object GetRelatedClinicalStatement(TranslationContext context, ASTNode node, string idPropertyName, SQLModel.PatientQueryType type)
        {
            var propertyNode = GetRelatedClinicalStatementPropertyNode(node);

            if (propertyNode == null)
            {
                throw new InvalidOperationException("Could not resolve related clinical statement property access node.");
            }

            var id     = new SQLModel.PropertyExpression();
            var source = propertyNode.Children.FirstOrDefault();

            if (source != null)
            {
                id.Item = context.TranslateNode(source);
            }
            id.Path = idPropertyName;

            var request = new SQLModel.RequestExpression();

            request.Cardinality          = SQLModel.RequestCardinality.Multiple;
            request.CardinalitySpecified = true;

            request.Type          = type;
            request.TypeSpecified = true;

            var filter = new SQLModel.FilterExpression();

            filter.Items.Add(request);

            var condition = new SQLModel.BinaryExpression();

            condition.Operator          = SQLModel.BinaryOperator.opEqual;
            condition.OperatorSpecified = true;

            var idReference = new SQLModel.PropertyExpression();

            idReference.Path = "ID";
            condition.Items.Add(idReference);
            condition.Items.Add(id);

            filter.Items.Add(condition);

            var first = new SQLModel.UnaryExpression();

            first.Item              = filter;
            first.Operator          = SQLModel.UnaryOperator.opFirst;
            first.OperatorSpecified = true;

            return(first);
        }
        private object GetRelatedClinicalStatement(TranslationContext context, ASTNode node, string idPropertyName, SQLModel.PatientQueryType type)
        {
            var propertyNode = GetRelatedClinicalStatementPropertyNode(node);
            if (propertyNode == null)
            {
                throw new InvalidOperationException("Could not resolve related clinical statement property access node.");
            }

            var id = new SQLModel.PropertyExpression();
            var source = propertyNode.Children.FirstOrDefault();
            if (source != null)
            {
                id.Item = context.TranslateNode(source);
            }
            id.Path = idPropertyName;

            var request = new SQLModel.RequestExpression();
            request.Cardinality = SQLModel.RequestCardinality.Multiple;
            request.CardinalitySpecified = true;

            request.Type = type;
            request.TypeSpecified = true;

            var filter = new SQLModel.FilterExpression();
            filter.Items.Add(request);
                    
            var condition = new SQLModel.BinaryExpression();
            condition.Operator = SQLModel.BinaryOperator.opEqual;
            condition.OperatorSpecified = true;

            var idReference = new SQLModel.PropertyExpression();
            idReference.Path = "ID";
            condition.Items.Add(idReference);
            condition.Items.Add(id);

            filter.Items.Add(condition);

            var first = new SQLModel.UnaryExpression();
            first.Item = filter;
            first.Operator = SQLModel.UnaryOperator.opFirst;
            first.OperatorSpecified = true;

            return first;
        }