public virtual JoinImpl CreateJoin() { JoinImpl join = new JoinImpl(_processDefinition); this._join = join; this.AddNode(join); return join; }
public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext) { // the fork and join are created in the parent block but we'll add them // also as referencable objects to this block's scope a few lines below _parentBlock = creationContext.ProcessBlock; this._join = new JoinImpl(); this._fork = new ForkImpl(); creationContext.ProcessBlock = this; base.ReadProcessData(xmlElement, creationContext); XmlElement joinElement = xmlElement.GetChildElement("join"); creationContext.Check((joinElement != null), "element join is missing"); XmlElement forkElement = xmlElement.GetChildElement("fork"); creationContext.Check((joinElement != null), "element fork is missing"); ((JoinImpl) this._join).ReadProcessData(joinElement, creationContext); ((ForkImpl) this._fork).ReadProcessData(forkElement, creationContext); creationContext.ProcessBlock = _parentBlock; this._nodes.Add(_join); this._nodes.Add(_fork); // add the fork and join as referencable objects in the proper scope creationContext.AddReferencableObject(_fork.Name, _parentBlock, typeof (INode), _fork); creationContext.AddReferencableObject(_join.Name, this, typeof (INode), _join); }
public void JoinType_Subquery_Alias_With_Alias_Name() { IAlias person = sql.Alias("person", "per"); IJoin join = sql.Left.Join(sql.RawQuery("Subquery"), person); QueryResult result = engine.Compile(join); Assert.Equal("LEFT JOIN (Subquery) AS \"per\"", result.Sql); }
public void Join_Subquery_Alias() { IAlias person = sql.Alias("person"); IJoin join = sql.Join(sql.RawQuery("Subquery"), person); QueryResult result = engine.Compile(join); Assert.Equal("INNER JOIN (Subquery) AS \"person\"", result.Sql); }
public void JoinType_Expression() { Person person = null; IJoin join = sql.Left.Join(() => person); QueryResult result = engine.Compile(join); Assert.Equal("LEFT JOIN \"Person\" AS \"person\"", result.Sql); }
public void Join_Typed_Alias() { IAlias <Person> person = sql.Alias <Person>(); IJoin join = sql.Join(person); QueryResult result = engine.Compile(join); Assert.Equal("INNER JOIN \"Person\" AS \"person\"", result.Sql); }
public void Join_Alias_With_Alias_Name_With_JoinType() { IAlias person = sql.Alias("person", "per"); IJoin join = sql.Join(person, JoinType.Left); QueryResult result = engine.Compile(join); Assert.Equal("LEFT JOIN \"person\" AS \"per\"", result.Sql); }
public void Join_Expression() { Person2 person = null; IJoin join = sql.Join(() => person); QueryResult result = engine.Compile(join); Assert.Equal("INNER JOIN \"dbo\".\"Person\" AS \"person\"", result.Sql); }
public void Join_Typed_Alias_With_Alias_Name() { IAlias <Person2> person = sql.Alias <Person2>("per"); IJoin join = sql.Join(person); QueryResult result = engine.Compile(join); Assert.Equal("INNER JOIN \"dbo\".\"Person\" AS \"per\"", result.Sql); }
public void Join_Subquery_Expression_With_Type() { IAlias person = sql.Alias("per"); IJoin join = sql.Join(sql.RawQuery("Subquery"), () => person, JoinType.Left); QueryResult result = engine.Compile(join); Assert.Equal("LEFT JOIN (Subquery) AS \"person\"", result.Sql); }
public void Join_TypedAlias_With_Type() { IAlias <Person> person = sql.Alias <Person>(); IJoin join = sql.Join(person, JoinType.Left); QueryResult result = engine.Compile(join); Assert.Equal("LEFT JOIN \"Person\" AS \"person\"", result.Sql); }
public void Join_Type_StringAlias_With_Alias() { IAlias person = sql.Alias("person", "per"); IJoin join = sql.Left.Join(person); QueryResult result = engine.Compile(join); Assert.Equal("LEFT JOIN \"person\" AS \"per\"", result.Sql); }
public void JoinType_Subquery_Expression() { Person person = null; IJoin join = sql.Left.Join(sql.RawQuery("Subquery"), () => person); QueryResult result = engine.Compile(join); Assert.Equal("LEFT JOIN (Subquery) AS \"person\"", result.Sql); }
internal IAlias BindFromPath() { if (_from == null) { _from = new Join(TableName, GetFromAliasName(TableName)); } return(_from); }
public void JoinType_Typed_Alias_With_Alias_Name() { IAlias <Person> person = sql.Alias <Person>("per"); IJoin join = sql.Left.Join(person); QueryResult result = engine.Compile(join); Assert.Equal("LEFT JOIN \"Person\" AS \"per\"", result.Sql); }
public void Join_Alias() { IAlias person = sql.Alias("person"); IJoin join = sql.Join(person); QueryResult result = engine.Compile(join); Assert.Equal("INNER JOIN \"person\"", result.Sql); }
public void Join_On_Expression() { Person person = null; Department dept = null; IJoin join = sql.Join(() => dept).On(() => dept.Id == person.Department.Id); QueryResult result = engine.Compile(join); Assert.Equal("INNER JOIN \"Dept\" AS \"dept\" ON \"dept\".\"Id\" = \"person\".\"DepartmentId\"", result.Sql); }
public From <TColumns> Join(IJoin join) { if (this.JoinNodes == null) { this.JoinNodes = new List <IJoin>(); } QueryNodeHelper.SwitchParent(join, this); this.JoinNodes.Add(join); return(this); }
internal IAlias BindItemVersionCriteria(string type = "") { _from = _from ?? new Join(typeof(ContentItemVersionRecord).FullName, "civ", type); if (_from.Type.Length < type.Length) { _from.Type = type; } return(_from); }
public void Join_On() { IAlias person = sql.Alias("person"); IAlias dept = sql.Alias("dept"); IJoin join = sql.Join(dept).On(dept["Id"].Eq(person["DepartmentId"])); QueryResult result = engine.Compile(join); Assert.Equal("INNER JOIN \"dept\" ON \"dept\".\"Id\" = \"person\".\"DepartmentId\"", result.Sql); }
public void Join_Cte_String() { IAlias person = sql.Alias("person"); ICte cte = sql.Cte("cte").As(sql.Query.Select(person.All).From(person)); IJoin join = sql.Join(cte, "personCte"); QueryResult result = engine.Compile(join); Assert.Equal("INNER JOIN \"cte\" AS \"personCte\"", result.Sql); }
public void Full_Join_Not_Supported() { engine.Options.FullJoinSupported = false; IAlias person = sql.Alias("person"); IJoin join = sql.Full.Join(person); Exception ex = Assert.Throws <ClauseNotSupportedException>(() => engine.Compile(join)); Assert.Equal("Full join is not supported in this engine.", ex.Message); }
public void Join_Cte_Expression() { Person person = null; Person personCte = null; ICte cte = sql.Cte("cte").As(sql.Query.Select(() => person).From(() => person)); IJoin join = sql.Join(cte, () => personCte); QueryResult result = engine.Compile(join); Assert.Equal("INNER JOIN \"cte\" AS \"personCte\"", result.Sql); }
public void Join_Without_As() { engine.Options.TableAs = false; IAlias person = sql.Alias("person", "per"); IJoin join = sql.Join(person, JoinType.Left); QueryResult result = engine.Compile(join); Assert.Equal("LEFT JOIN \"person\" \"per\"", result.Sql); }
/// <summary> /// Initializes a new instance of the <see cref="JoinConstrainableContext"/> class. /// Each <see cref="IColumnValueCollectionPair"/> in <paramref name="constraintList"/> describes a list of values in a column. /// A row is a match if all columns contain at least one of the listed values. /// </summary> /// <parameters> /// <param name="join">The join describing how tables are connected in the request.</param> /// <param name="constraintList">The constraints specifying the subset of values this request must match.</param> /// </parameters> /// <exception cref="ArgumentNullException"> /// <paramref name="join"/> is null. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="constraintList"/> is null. /// </exception> public JoinConstrainableContext(IJoin join, IEnumerable <IColumnValueCollectionPair> constraintList) : base(join) { if (constraintList == null) { throw new ArgumentNullException(nameof(constraintList)); } else { InitConstraints(constraintList); } }
protected virtual void BuildTreeFromGraph(TreeNodeViewModel <INode> parentNode, IEnumerable <INode> nodes) { foreach (var node in nodes) { if (node is IFork) { IJoin matchingJoin = FindMatchingJoin(node); if (matchingJoin == null) { throw new Exception(Resources.DefaultWorkflowViewModelBuilder_ErrorNoMatchingForkOrJoin); } matchingJoin.ParentObject = parentNode; } if (node is IDecision) { IMerge matchingMerge = FindMatchingMerge(node); if (matchingMerge == null) { throw new Exception(Resources.DefaultWorkflowViewModelBuilder_NoMatchingMerge); } matchingMerge.ParentObject = parentNode; } if (node is IJoin) { if (node.ParentObject == null) { throw new Exception(Resources.DefaultWorkflowViewModelBuilder_ErrorOrphanJoin); } this.BuildTreeFromGraph((TreeNodeViewModel <INode>)node.ParentObject, node.Successors); } else if (node is IMerge) { if (node.ParentObject == null) { throw new Exception(Resources.DefaultWorkflowViewModelBuilder_ErrorOrphanMerge); } this.BuildTreeFromGraph((TreeNodeViewModel <INode>)node.ParentObject, node.Successors); } else if (!(node is IFinal)) { var childViewModel = this.GetNodeViewModel(node); childViewModel.ParentNode = parentNode.ParentNode != null && !(parentNode.Model is IFork) && !(parentNode.Model is IDecision) ? parentNode.ParentNode : parentNode; this.BuildTreeFromGraph(childViewModel, node.Successors); } } }
public void Options() { Person person = null; Department dept = null; IJoin join = sql.Join(() => dept) .On(() => dept.Id == person.Department.Id) .Options(sql.Raw("USE INDEX (myIndex)")); QueryResult result = engine.Compile(join); Assert.Equal("INNER JOIN \"Dept\" AS \"dept\" USE INDEX (myIndex) " + "ON \"dept\".\"Id\" = \"person\".\"DepartmentId\"", result.Sql); }
public void RightJoin() { ICriteriaBuilder cb = EJBContainer.Instance.EntityManager.GetCriteriaBuilder(); ICriteriaQuery cc = cb.CreateQuery(); IRoot r = cc.From("Students"); IJoin facultiesJoin = r.Join("Faculties", JoinType.Right, "Faculty_Id", "Id"); cc.Select(r.Get("Firstname"), facultiesJoin.Get("Name")); Assert.AreEqual("SELECT Students.Firstname, Faculties.Name FROM Students RIGHT JOIN Faculties ON Students.Faculty_Id = Faculties.Id", cc.ExpressionValue); }
/// <summary> /// Optimises an Algebra to a form that uses <see cref="LazyBgp">LazyBgp</see> where possible. /// </summary> /// <param name="algebra">Algebra.</param> /// <param name="depth">Depth.</param> /// <returns></returns> /// <remarks> /// <para> /// By transforming a query to use <see cref="LazyBgp">LazyBgp</see> we can achieve much more efficient processing of some forms of queries. /// </para> /// </remarks> protected override ISparqlAlgebra OptimiseInternal(ISparqlAlgebra algebra, int depth) { try { ISparqlAlgebra temp; // Note this first test is specifically for the default BGP implementation since other optimisers // may run before us and replace with other BGP implementations which we don't want to replace hence // why we don't check for IBgp here if (algebra is Bgp) { temp = new LazyBgp(((Bgp)algebra).TriplePatterns); } else if (algebra is IUnion) { IUnion join = (IUnion)algebra; temp = new LazyUnion(OptimiseInternal(join.Lhs, depth + 1), OptimiseInternal(join.Rhs, depth + 1)); } else if (algebra is IJoin) { IJoin join = (IJoin)algebra; if (join.Lhs.Variables.IsDisjoint(join.Rhs.Variables)) { // If the sides of the Join are disjoint then can fully transform the join since we only need to find the requisite number of // solutions on either side to guarantee a product which meets/exceeds the required results temp = join.Transform(this); } else { // If the sides are not disjoint then the LHS must be fully evaluated but the RHS need only produce enough // solutions that match temp = join.TransformRhs(this); } } else if (algebra is Algebra.Graph || algebra is Select || algebra is Slice || algebra is OrderBy) { IUnaryOperator op = (IUnaryOperator)algebra; temp = op.Transform(this); } else { temp = algebra; } return(temp); } catch { // If the Optimise fails return the current algebra return(algebra); } }
public HqlProjection(Type type, string projectionName, string projectionAlias) { _rootEntityName = type.Name; _projectionName = projectionName; _projectionAlias = projectionAlias; if (_projectionName.Contains(".")) { _projectionNameSplits = _projectionName.Split('.'); } _reuquiredJoin = new HqlJoin(_rootEntityName, _projectionName); _requiredGroupBy = new HqlGroupBy(GetProjectionName(), false); }
/// <summary> /// Optimises the Algebra to use implict joins where applicable /// </summary> /// <param name="algebra">Algebra</param> /// <returns></returns> public ISparqlAlgebra Optimise(ISparqlAlgebra algebra) { try { if (algebra is Filter) { Filter f = (Filter)algebra; // See if the Filtered Product style optimization applies instead int splitPoint = -1; if (f.SparqlFilter.Expression.CanParallelise && IsDisjointOperation(f.InnerAlgebra, f.SparqlFilter.Expression.Variables.ToList(), out splitPoint)) { if (splitPoint > -1) { // Means the inner algebra is a BGP we can split into two parts IBgp bgp = (IBgp)f.InnerAlgebra; return(new FilteredProduct(new Bgp(bgp.TriplePatterns.Take(splitPoint)), new Bgp(bgp.TriplePatterns.Skip(splitPoint)), f.SparqlFilter.Expression)); } else { // Means that the inner algebra is a Join where the sides are disjoint IJoin join = (IJoin)f.InnerAlgebra; return(new FilteredProduct(join.Lhs, join.Rhs, f.SparqlFilter.Expression)); } } else { return(f.Transform(this)); } } else if (algebra is IAbstractJoin) { return(((IAbstractJoin)algebra).Transform(this)); } else if (algebra is IUnaryOperator) { return(((IUnaryOperator)algebra).Transform(this)); } else { return(algebra); } } catch { return(algebra); } }
void IThematicController.JoinedRender() { _joinView = (IJoinView)_view; _join = new GJoin(); _joinController = new GJoinController(_join, _joinView); _joinController.Perform(); _thematic.Layer = _joinView.FeatureLayer; _thematic.BreakCount = _view.BreakCount; _thematic.FieldName = _view.FieldName; _thematic.IndexLayer = _view.IndexLayer; _thematic.MaxValue = _view.MaxValue; _thematic.MinValue = _view.MinValue; _thematic.JoinRender(); }
public void SparqlGraphPatternToAlgebra6() { GraphPattern gp = new GraphPattern(); gp.IsService = true; gp.GraphSpecifier = new VariableToken("g", 0, 0, 1); gp.AddInlineData(new BindingsPattern()); ISparqlAlgebra algebra = gp.ToAlgebra(); Assert.IsAssignableFrom <IJoin>(algebra); IJoin join = (IJoin)algebra; Assert.IsType <Service>(join.Lhs); Assert.IsType <Bindings>(join.Rhs); }
protected virtual IJoin VisitJoin(IJoin node) { this.Visit(node.Left); this.Visit(node.Right); this.Visit(node.Condition); return node; }
public GJoinController(IJoin join, IJoinView view) { _join = join; _view = view; }