本文整理汇总了C#中ISparqlExpression.Value方法的典型用法代码示例。如果您正苦于以下问题:C# ISparqlExpression.Value方法的具体用法?C# ISparqlExpression.Value怎么用?C# ISparqlExpression.Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISparqlExpression
的用法示例。
在下文中一共展示了ISparqlExpression.Value方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckArgument
private ILiteralNode CheckArgument(ISparqlExpression expr, SparqlEvaluationContext context, int bindingID,
Func<Uri, bool> argumentTypeValidator)
{
INode temp = expr.Value(context, bindingID);
if (temp != null)
{
if (temp.NodeType == NodeType.Literal)
{
ILiteralNode lit = (ILiteralNode) temp;
if (lit.DataType != null)
{
if (argumentTypeValidator(lit.DataType))
{
//Appropriately typed literals are fine
return lit;
}
throw new RdfQueryException(
"Unable to evaluate a substring as one of the argument expressions returned a typed literal with an invalid type");
}
if (argumentTypeValidator(new Uri(XmlSpecsHelper.XmlSchemaDataTypeString)))
{
//Untyped Literals are treated as Strings and may be returned when the argument allows strings
return lit;
}
throw new RdfQueryException(
"Unable to evalaute a substring as one of the argument expressions returned an untyped literal");
}
throw new RdfQueryException(
"Unable to evaluate a substring as one of the argument expressions returned a non-literal");
}
throw new RdfQueryException(
"Unable to evaluate a substring as one of the argument expressions evaluated to null");
}
示例2: XPathReplaceFunction
/// <summary>
/// Creates a new XPath 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 XPathReplaceFunction(ISparqlExpression text, ISparqlExpression find, ISparqlExpression replace,
ISparqlExpression options)
{
_textExpr = text;
//Get the Pattern
if (find is NodeExpressionTerm)
{
//If the Pattern is a Node Expression Term then it is a fixed Pattern
INode n = find.Value(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
_fixedPattern = true;
_find = p;
}
catch
{
//No catch actions
}
}
}
else
{
_findExpr = find;
}
//Get the Replace
if (replace is NodeExpressionTerm)
{
//If the Replace is a Node Expresison Term then it is a fixed Pattern
INode n = replace.Value(null, 0);
if (n.NodeType == NodeType.Literal)
{
_replace = ((ILiteralNode) n).Value;
_fixedReplace = true;
}
}
else
{
_replaceExpr = replace;
}
//Get the Options
if (options != null)
{
if (options is NodeExpressionTerm)
{
ConfigureOptions(options.Value(null, 0), false);
}
else
{
_optionExpr = options;
}
}
}
示例3: ArqStringJoinFunction
/// <summary>
/// Creates a new ARQ String Join function
/// </summary>
/// <param name = "sepExpr">Separator Expression</param>
/// <param name = "expressions">Expressions to concatentate</param>
public ArqStringJoinFunction(ISparqlExpression sepExpr, IEnumerable<ISparqlExpression> expressions)
{
if (sepExpr is NodeExpressionTerm)
{
INode temp = sepExpr.Value(null, 0);
if (temp.NodeType == NodeType.Literal)
{
_separator = ((ILiteralNode) temp).Value;
_fixedSeparator = true;
}
else
{
_sep = sepExpr;
}
}
else
{
_sep = sepExpr;
}
_exprs.AddRange(expressions);
}
示例4: 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 NodeExpressionTerm)
{
//If the Pattern is a Node Expression Term then it is a fixed Pattern
INode n = pattern.Value(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 NodeExpressionTerm)
{
this.ConfigureOptions(options.Value(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);
}
}