本文整理汇总了C#中ISparqlExpression类的典型用法代码示例。如果您正苦于以下问题:C# ISparqlExpression类的具体用法?C# ISparqlExpression怎么用?C# ISparqlExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISparqlExpression类属于命名空间,在下文中一共展示了ISparqlExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CartesianFunction
/// <summary>
/// Creates a new 2D Cartesian Function
/// </summary>
/// <param name="x1">Expression for X Coordinate of 1st point</param>
/// <param name="y1">Expression for Y Coordinate of 1st point</param>
/// <param name="x2">Expression for X Coordinate of 2nd point</param>
/// <param name="y2">Expression for Y Coordinate of 2nd point</param>
public CartesianFunction(ISparqlExpression x1, ISparqlExpression y1, ISparqlExpression x2, ISparqlExpression y2)
{
this._x1 = x1;
this._y1 = y1;
this._x2 = x2;
this._y2 = y2;
}
示例2: LeftJoin
/// <summary>
/// Left Joins the Multiset to another Multiset
/// </summary>
/// <param name="other">Other Multiset</param>
/// <param name="expr">Expression which the Join is predicated on</param>
/// <returns>The other Multiset</returns>
public override BaseMultiset LeftJoin(BaseMultiset other, ISparqlExpression expr)
{
//If Other is Null/Empty then the Join still results in Identity
if (other is NullMultiset) return this;
if (other.IsEmpty) return this;
return other;
}
示例3: BaseBinaryStringFunction
/// <summary>
/// Creates a new XPath Binary String function
/// </summary>
/// <param name="stringExpr">Expression</param>
/// <param name="argExpr">Argument</param>
/// <param name="allowNullArgument">Whether the argument may be null</param>
/// <param name="argumentTypeValidator">Type validator for the argument</param>
public BaseBinaryStringFunction(ISparqlExpression stringExpr, ISparqlExpression argExpr, bool allowNullArgument, Func<Uri, bool> argumentTypeValidator)
{
this._expr = stringExpr;
this._arg = argExpr;
this._allowNullArgument = allowNullArgument;
if (this._arg == null && !this._allowNullArgument) throw new RdfParseException("Cannot create a XPath String Function which takes a String and a single argument since the expression for the argument is null");
this._argumentTypeValidator = argumentTypeValidator;
}
示例4: LeviathanCartesianFunction
/// <summary>
/// Creates a new 3D Cartesian Function
/// </summary>
/// <param name="x1">Expression for X Coordinate of 1st point</param>
/// <param name="y1">Expression for Y Coordinate of 1st point</param>
/// <param name="z1">Expression for Z Coordiante of 1st point</param>
/// <param name="x2">Expression for X Coordinate of 2nd point</param>
/// <param name="y2">Expression for Y Coordinate of 2nd point</param>
/// <param name="z2">Expression for Z Coordinate of 2nd point</param>
public LeviathanCartesianFunction(ISparqlExpression x1, ISparqlExpression y1, ISparqlExpression z1, ISparqlExpression x2, ISparqlExpression y2, ISparqlExpression z2)
{
this._x1 = x1;
this._y1 = y1;
this._z1 = z1;
this._x2 = x2;
this._y2 = y2;
this._z2 = z2;
this._3d = true;
}
示例5: Extend
/// <summary>
/// Creates a new Extend operator
/// </summary>
/// <param name="pattern">Pattern</param>
/// <param name="expr">Expression</param>
/// <param name="var">Variable to bind to</param>
public Extend(ISparqlAlgebra pattern, ISparqlExpression expr, String var)
{
this._inner = pattern;
this._expr = expr;
this._var = var;
if (this._inner.Variables.Contains(this._var))
{
throw new RdfQueryException("Cannot create an Extend() operator which extends the results of the inner algebra with a variable that is already used in the inner algebra");
}
}
示例6: Transform
/// <summary>
/// Transforms an expression into a form where primary expressions may be substituted
/// </summary>
/// <param name="expr">Expression</param>
/// <returns></returns>
public ISparqlExpression Transform(ISparqlExpression expr)
{
if (expr.Type == SparqlExpressionType.Primary)
{
return this.SubstitutePrimaryExpression(expr);
}
else
{
return expr.Transform(this);
}
}
示例7: TryCreateExpression
public bool TryCreateExpression(Uri u, List<ISparqlExpression> args, Dictionary<string, ISparqlExpression> scalarArguments, out ISparqlExpression expr)
{
//TODO: Add support for FullTextMatchFunction and FullTextSearchFunction
//switch (u.ToString())
//{
//}
expr = null;
return false;
}
示例8: MaxAggregate
/// <summary>
/// Creates a new MAX Aggregate
/// </summary>
/// <param name="distinct">Distinct Modifier</param>
/// <param name="expr">Expression</param>
public MaxAggregate(ISparqlExpression distinct, ISparqlExpression expr)
: base(expr)
{
if (distinct is DistinctModifier)
{
this._distinct = true;
}
else
{
throw new RdfQueryException("The first argument to the MaxAggregate constructor must be of type DistinctModifierExpression");
}
}
示例9: ReplaceFunction
/// <summary>
/// Creates a new SPARQL Replace function
/// </summary>
/// <param name="text">Text Expression</param>
/// <param name="find">Search Expression</param>
/// <param name="replace">Replace Expression</param>
/// <param name="options">Options Expression</param>
public ReplaceFunction(ISparqlExpression text, ISparqlExpression find, ISparqlExpression replace, ISparqlExpression options)
{
this._textExpr = text;
//Get the Pattern
if (find is ConstantTerm)
{
//If the Pattern is a Node Expression Term then it is a fixed Pattern
IValuedNode n = find.Evaluate(null, 0);
if (n.NodeType == NodeType.Literal)
{
//Try to parse as a Regular Expression
try
{
string p = n.AsString();
Regex temp = new Regex(p);
//It's a Valid Pattern
this._fixedPattern = true;
this._find = p;
}
catch
{
//No catch actions
}
}
}
this._findExpr = find;
//Get the Replace
if (replace is ConstantTerm)
{
//If the Replace is a Node Expresison Term then it is a fixed Pattern
IValuedNode n = replace.Evaluate(null, 0);
if (n.NodeType == NodeType.Literal)
{
this._replace = n.AsString();
this._fixedReplace = true;
}
}
this._replaceExpr = replace;
//Get the Options
if (options != null)
{
if (options is ConstantTerm)
{
this.ConfigureOptions(options.Evaluate(null, 0), false);
}
this._optionExpr = options;
}
}
示例10: SecantFunction
/// <summary>
/// Creates a new Leviathan Secant Function
/// </summary>
/// <param name="expr">Expression</param>
/// <param name="inverse">Whether this should be the inverse function</param>
public SecantFunction(ISparqlExpression expr, bool inverse)
: base(expr)
{
this._inverse = inverse;
if (this._inverse)
{
this._func = _arcsecant;
}
else
{
this._func = _secant;
}
}
示例11: TangentFunction
/// <summary>
/// Creates a new Leviathan Tangent Function
/// </summary>
/// <param name="expr">Expression</param>
/// <param name="inverse">Whether this should be the inverse function</param>
public TangentFunction(ISparqlExpression expr, bool inverse)
: base(expr)
{
this._inverse = inverse;
if (this._inverse)
{
this._func = Math.Atan;
}
else
{
this._func = Math.Tan;
}
}
示例12: CotangentFunction
/// <summary>
/// Creates a new Leviathan Cotangent Function
/// </summary>
/// <param name="expr">Expression</param>
/// <param name="inverse">Whether this should be the inverse function</param>
public CotangentFunction(ISparqlExpression expr, bool inverse)
: base(expr)
{
this._inverse = inverse;
if (this._inverse)
{
this._func = _arccotangent;
}
else
{
this._func = _cotangent;
}
}
示例13: SineFunction
/// <summary>
/// Creates a new Leviathan Sine Function
/// </summary>
/// <param name="expr">Expression</param>
/// <param name="inverse">Whether this should be the inverse function</param>
public SineFunction(ISparqlExpression expr, bool inverse)
: base(expr)
{
this._inverse = inverse;
if (this._inverse)
{
this._func = Math.Asin;
}
else
{
this._func = Math.Sin;
}
}
示例14: RegexFunction
/// <summary>
/// Creates a new Regex() function expression
/// </summary>
/// <param name="text">Text to apply the Regular Expression to</param>
/// <param name="pattern">Regular Expression Pattern</param>
/// <param name="options">Regular Expression Options</param>
public RegexFunction(ISparqlExpression text, ISparqlExpression pattern, ISparqlExpression options)
{
this._textExpr = text;
this._patternExpr = pattern;
//Get the Pattern
if (pattern is ConstantTerm)
{
//If the Pattern is a Node Expression Term then it is a fixed Pattern
INode n = pattern.Evaluate(null, 0);
if (n.NodeType == NodeType.Literal)
{
//Try to parse as a Regular Expression
try
{
string p = ((ILiteralNode)n).Value;
Regex temp = new Regex(p);
//It's a Valid Pattern
this._fixedPattern = true;
//this._useInStr = p.ToCharArray().All(c => Char.IsLetterOrDigit(c) || Char.IsWhiteSpace(c));
this._pattern = p;
}
catch
{
//No catch actions
}
}
}
//Get the Options
if (options != null)
{
this._optionExpr = options;
if (options is ConstantTerm)
{
this.ConfigureOptions(options.Evaluate(null, 0), false);
this._fixedOptions = true;
if (this._fixedPattern) this._regex = new Regex(this._pattern, this._options);
}
}
else
{
if (this._fixedPattern) this._regex = new Regex(this._pattern);
}
}
示例15: TryCreateExpression
public bool TryCreateExpression(Uri u, List<ISparqlExpression> args, Dictionary<string, ISparqlExpression> scalarArguments, out ISparqlExpression expr)
{
// If any scalar arguments are present, it can't be a BrightstarDB function
if (scalarArguments.Count > 0)
{
expr = null;
return false;
}
var func = u.ToString();
if (func.StartsWith(BrightstarFunctionsNamespace))
{
func = func.Substring(BrightstarFunctionsNamespace.Length);
ISparqlExpression brightstarFunc = null;
switch (func)
{
case BitAnd:
if (args.Count == 2)
{
brightstarFunc = new BitAndFunc(args[0], args[1]);
}
else
{
throw new RdfParseException("Incorrect number of arguments for the BrightstarDB bit_and() function.");
}
break;
case BitOr:
if (args.Count == 2)
{
brightstarFunc = new BitOrFunc(args[0], args[1]);
}
else
{
throw new RdfParseException("Incorrect number of arguments for the BrightstarDB bit_and() function.");
}
break;
}
if (brightstarFunc != null)
{
expr = brightstarFunc;
return true;
}
}
expr = null;
return false;
}