コード例 #1
0
        /// <summary>Visit an entity type constrain.</summary>
        /// <param name="entityTypeConstrain">Entity type constrain to be visited.</param>
        protected override void VisitEntityTypeConstrain(EntityTypeConstrain entityTypeConstrain)
        {
            if (entityTypeConstrain.InheritedTypes.Any())
            {
                if (_entityAccessorToExpand != null)
                {
                    VisitComponent(_entityAccessorToExpand.About);
                    _commandText.AppendFormat(" <{0}> ?{1}_type . ", Rdf.type, (_variableNameOverride.ContainsKey(_entityAccessorToExpand.About) ? _variableNameOverride[_entityAccessorToExpand.About] : _entityAccessorToExpand.About.Name));
                }

                _commandText.Append("FILTER ( EXISTS { ");
                _commandText.AppendFormat("?{0} ", _currentEntityAccessor.Peek().About.Name);
                VisitComponent(entityTypeConstrain.Predicate);
                _commandText.Append(" ");
                VisitComponent(entityTypeConstrain.Value);
                _commandText.Append(" . } ");
                foreach (Literal inheritedType in entityTypeConstrain.InheritedTypes)
                {
                    _commandText.Append("|| EXISTS { ");
                    _commandText.AppendFormat("?{0} ", _currentEntityAccessor.Peek().About.Name);
                    VisitComponent(entityTypeConstrain.Predicate);
                    _commandText.Append(" ");
                    VisitComponent(inheritedType);
                    _commandText.Append(" . } ");
                }

                _commandText.Append(") ");
            }
            else
            {
                VisitEntityConstrain(entityTypeConstrain);
            }
        }
コード例 #2
0
 /// <summary>Visit an entity type constrain.</summary>
 /// <param name="entityTypeConstrain">Entity type constrain to be visited.</param>
 protected abstract void VisitEntityTypeConstrain(EntityTypeConstrain entityTypeConstrain);