/// <summary> /// Adds the given column of bindings to the SPARQL values /// </summary> public RDFValues AddColumn(RDFVariable variable, List <RDFPatternMember> bindings) { if (variable != null) { //Initialize bindings of the given variable if (!this.Bindings.ContainsKey(variable.ToString())) { this.Bindings.Add(variable.ToString(), new List <RDFPatternMember>()); } //Populate bindings of the given variable //(null indicates the special UNDEF binding) if (bindings?.Any() ?? false) { bindings.ForEach(b => this.Bindings[variable.ToString()].Add((b is RDFResource || b is RDFLiteral) ? b : null)); } else { this.Bindings[variable.ToString()].Add(null); } //Mark the SPARQL values as evaluable this.IsEvaluable = true; } return(this); }
/// <summary> /// Adds the given variable to the results of the query /// </summary> public RDFSelectQuery AddProjectionVariable(RDFVariable projectionVariable) { if (projectionVariable != null) { if (!this.ProjectionVars.Any(pv => pv.Key.ToString().Equals(projectionVariable.ToString(), StringComparison.OrdinalIgnoreCase))) { this.ProjectionVars.Add(projectionVariable, this.ProjectionVars.Count); } } return(this); }
/// <summary> /// Adds the given variable to the results of the query /// </summary> public RDFSelectQuery AddProjectionVariable(RDFVariable projectionVariable) { if (projectionVariable != null) { if (!this.ProjectionVars.Any(pv => pv.Key.ToString().Equals(projectionVariable.ToString(), StringComparison.OrdinalIgnoreCase))) { this.ProjectionVars.Add(projectionVariable, this.ProjectionVars.Count); } } return this; }