本文整理汇总了C#中Notation.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Notation.Select方法的具体用法?C# Notation.Select怎么用?C# Notation.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notation
的用法示例。
在下文中一共展示了Notation.Select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: command_BeforeExecute
private void command_BeforeExecute(Command source, Notation notation, Optimizer optimizer, QueryContext context)
{
this.context = context;
Notation.Record[] recs = notation.Select(Descriptor.Root, 1);
if (recs.Length > 0)
{
Notation.Record[] recsd = notation.Select(recs[0].Arg0, Descriptor.Binding, 1);
if (recsd.Length > 0)
throw new ESQLException("Query parameters is not supported in XQueryConsole", null);
}
if (context.UseSampleData)
{
String path = Path.Combine(
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Data");
if (Directory.Exists(path))
context.DatabaseDictionary.SearchPath = path;
}
}
示例2: ProcessQueryExp
private void ProcessQueryExp(Notation notation, Symbol qexpr, QueryContext context)
{
Notation.Record[] recs = notation.Select(qexpr,
new Descriptor[] { Descriptor.Union, Descriptor.Except }, 2);
if (recs.Length > 0)
{
ProcessQueryExp(notation, recs[0].Arg0, context);
ProcessQueryTerm(notation, recs[0].Arg1, context);
}
else
ProcessQueryTerm(notation, qexpr, context);
ConfirmBindings(notation, qexpr, context);
}
示例3: ProcessComputedConstructor
private object ProcessComputedConstructor(Notation notation, Symbol sym)
{
Notation.Record[] recs = notation.Select(sym, new Descriptor[] { Descriptor.CompDocConstructor,
Descriptor.CompElemConstructor, Descriptor.CompAttrConstructor, Descriptor.CompTextConstructor,
Descriptor.CompCommentConstructor, Descriptor.CompPIConstructor });
if (recs.Length > 0)
{
switch (recs[0].descriptor)
{
case Descriptor.CompDocConstructor:
return Lisp.List(ID.DynCreateDocument,
ProcessExprList(notation, recs[0].args[0]));
case Descriptor.CompElemConstructor:
case Descriptor.CompAttrConstructor:
{
object expr = EmptyIterator.Shared;
if (recs[0].args[1] != null)
expr = ProcessExprList(notation, recs[0].args[1]);
object name;
if (recs[0].args[0] is Qname)
{
Qname qn = (Qname)recs[0].args[0];
if (recs[0].descriptor == Descriptor.CompElemConstructor)
name = QNameValue.Parse(qn.Name, _context.NamespaceManager, _context.NamespaceManager.DefaultNamespace);
else
name = QNameValue.Parse(qn.Name, _context.NamespaceManager, String.Empty);
if (recs[0].descriptor == Descriptor.CompElemConstructor)
return Lisp.List(ID.DynCreateElement, name, expr);
else
return Lisp.List(ID.DynCreateAttribute, name, Lisp.List(ID.FormatValue, expr));
}
else
{
XmlNamespaceManager nsmgr = new XmlNamespaceManager(_context.nameTable);
foreach (KeyValuePair<string, string> k in _context.NamespaceManager.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml))
nsmgr.AddNamespace(k.Key, k.Value);
name = Lisp.List(ID.AtomizeX, ProcessExprList(notation, recs[0].args[0]));
if (recs[0].descriptor == Descriptor.CompElemConstructor)
return Lisp.List(ID.DynCreateElement, name, nsmgr, expr);
else
return Lisp.List(ID.DynCreateAttribute, name, nsmgr, Lisp.List(ID.FormatValue, expr));
}
}
case Descriptor.CompTextConstructor:
return Lisp.List(ID.DynCreateText, Lisp.List(ID.FormatValue,
ProcessExprList(notation, recs[0].args[0])));
case Descriptor.CompCommentConstructor:
return Lisp.List(ID.DynCreateComment, Lisp.List(ID.FormatValue,
ProcessExprList(notation, recs[0].args[0])));
case Descriptor.CompPIConstructor:
{
object name;
if (recs[0].args[0] is Qname)
name = ((Qname)recs[0].args[0]).Name;
else
name = Lisp.List(ID.FormatValue, ProcessExprList(notation, recs[0].args[0]));
return Lisp.List(ID.DynCreatePi, name, Lisp.List(ID.FormatValue,
ProcessExprList(notation, recs[0].args[1])));
}
default:
throw new InvalidOperationException();
}
}
else
throw new InvalidOperationException();
}
示例4: ProcessFLORExpr
private object ProcessFLORExpr(Notation notation, Notation.Record rec)
{
int stack_pos = _varTable.BeginFrame();
Symbol[] arr = Lisp.ToArray<Symbol>(rec.args[0]);
List<FLWORItem> flworItems = new List<FLWORItem>();
bool stable = false;
for (int k = 0; k < arr.Length; k++)
{
Notation.Record[] recs = notation.Select(arr[k]);
switch (recs[0].descriptor)
{
case Descriptor.For:
{
Symbol[] arr2 = Lisp.ToArray<Symbol>(recs[0].args[0]);
for (int s = 0; s < arr2.Length; s++)
{
Notation.Record[] recs2 = notation.Select(arr2[s],
Descriptor.ForClauseOperator, 4);
if (recs.Length > 0)
{
FLWORItem item = new FLWORItem();
item.desc = Descriptor.For;
if (notation.Flag(arr[k], Descriptor.Parallel))
item.parallel = true;
VarName name = (VarName)recs2[0].Arg0;
item.var = ProcessVarName(name);
item.assignExpr = ProcessExprSingle(notation, recs2[0].Arg3);
item.convert = true;
if (recs2[0].Arg1 == null)
{
XQuerySequenceType type = EvalExprType(item.assignExpr);
if (type.TypeCode != XmlTypeCode.Item)
{
item.varType = new XQuerySequenceType(type.TypeCode, XmlTypeCardinality.One);
item.convert = false;
}
else
item.varType = XQuerySequenceType.Item;
}
else
item.varType = ProcessTypeDecl(notation, recs2[0].Arg1);
item.pos = null;
if (recs2[0].Arg2 != null)
{
VarName posname = (VarName)recs2[0].Arg2;
if (posname.Name == name.Name)
throw new XQueryException(Properties.Resources.XQST0089, posname.Name);
item.pos = ProcessVarName(posname);
}
_varTable.PushVar(item.var, item.varType);
if (item.pos != null)
_varTable.PushVar(item.pos, new XQuerySequenceType(XmlTypeCode.Integer));
flworItems.Add(item);
}
}
}
break;
case Descriptor.Let:
{
Symbol[] arr2 = Lisp.ToArray<Symbol>(recs[0].args[0]);
for (int s = 0; s < arr2.Length; s++)
{
Notation.Record[] recs2 = notation.Select(arr2[s],
Descriptor.LetClauseOperator, 3);
if (recs.Length > 0)
{
FLWORItem item = new FLWORItem();
item.desc = Descriptor.Let;
item.var = ProcessVarName((VarName)recs2[0].Arg0);
item.assignExpr = ProcessExprSingle(notation, recs2[0].Arg2);
item.convert = true;
if (recs2[0].Arg1 == null)
{
XQuerySequenceType type = EvalExprType(item.assignExpr);
if (type.Cardinality == XmlTypeCardinality.One)
{
item.varType = type;
item.convert = false;
}
else
item.varType = XQuerySequenceType.Item;
}
else
item.varType = ProcessTypeDecl(notation, recs2[0].Arg1);
_varTable.PushVar(item.var, item.varType);
flworItems.Add(item);
}
}
}
break;
}
}
XQueryOrderSpec[] orderSpec = null;
XQueryExprBase expr = XQueryExpr.Create(_context,
new object[] { ProcessExprSingle(notation, rec.Arg3) });
if (rec.Arg2 != null)
{
Notation.Record[] recs = notation.Select(rec.Arg2, new Descriptor[] {
Descriptor.OrderBy, Descriptor.StableOrderBy });
//.........这里部分代码省略.........
示例5: ProcessExtensionExpr
private object ProcessExtensionExpr(Notation notation, Notation.Record rec)
{
Symbol[] arr = Lisp.ToArray<Symbol>(rec.args[0]);
foreach (Symbol sym in arr)
{
Notation.Record[] recs = notation.Select(sym, Descriptor.Pragma, 2);
if (recs.Length > 0)
{
QNameValue qn = QNameValue.Parse(((Qname)recs[0].Arg0).Name, _context.NamespaceManager, "");
if (qn.Prefix == "")
throw new XQueryException(Properties.Resources.ExpectedQNamePrefix, "pragma", qn.ToString());
Literal lit = (Literal)recs[0].Arg1;
if (qn.NamespaceUri == XmlReservedNs.NsWmhExt)
{
if (qn.LocalName == "cache")
{
XQueryExprBase expr = ProcessExpr(notation, rec.args[1]);
if (expr is XQueryExpr)
return new XQueryCachedExpr(_context, (XQueryExpr)expr).ToLispFunction();
else
return expr.ToLispFunction();
}
}
}
}
return ProcessExpr(notation, rec.args[1]).ToLispFunction();
}
示例6: PostProcess
private void PostProcess(Notation notation, object prolog)
{
if (prolog != null)
{
Symbol[] arr = Lisp.ToArray<Symbol>(prolog);
foreach (Symbol sym in arr)
{
Notation.Record[] recs = notation.Select(sym);
if (recs.Length > 0)
switch (recs[0].descriptor)
{
case Descriptor.DeclareFunction:
ProcessFuncDecl(notation, recs[0]);
break;
case Descriptor.VarDecl:
ProcessVarDecl(notation, recs[0]);
break;
}
}
}
}
示例7: ProcessParamList
private FunctionParameter[] ProcessParamList(Notation notation, object p)
{
List<FunctionParameter> res = new List<FunctionParameter>();
if (p != null)
{
Symbol[] arr = Lisp.ToArray<Symbol>(p);
HashSet<VarName> hs = new HashSet<VarName>();
for (int k = 0; k < arr.Length; k++)
{
FunctionParameter parameter = new FunctionParameter();
VarName name = (VarName)arr[k];
if (hs.Contains(name))
throw new XQueryException(Properties.Resources.XQST0039, name);
hs.Add(name);
parameter.id = ProcessVarName(name);
Notation.Record[] recs = notation.Select(arr[k], Descriptor.TypeDecl, 1);
if (recs.Length > 0)
parameter.type = ProcessTypeDecl(notation, recs[0].Arg0);
else
parameter.type = XQuerySequenceType.Item;
res.Add(parameter);
}
}
return res.ToArray();
}
示例8: ProcessTypeDecl
private XQuerySequenceType ProcessTypeDecl(Notation notation, Symbol sym)
{
if (sym.Tag == Tag.TokenWrapper &&
((TokenWrapper)sym).Data == Token.EMPTY_SEQUENCE)
return XQuerySequenceType.Void;
else
{
XQuerySequenceType type = ProcessItemType(notation, sym);
Notation.Record[] recs = notation.Select(sym, Descriptor.Occurrence, 1);
if (recs.Length > 0)
{
type = new XQuerySequenceType(type);
TokenWrapper w = (TokenWrapper)recs[0].Arg0;
switch (w.Data)
{
case Token.Indicator1: // (*)
type.Cardinality = XmlTypeCardinality.ZeroOrMore;
break;
case Token.Indicator2: // (+)
type.Cardinality = XmlTypeCardinality.OneOrMore;
break;
case Token.Indicator3: // (?)
type.Cardinality = XmlTypeCardinality.ZeroOrOne;
break;
}
}
return type;
}
}
示例9: ProcessImportModule
private void ProcessImportModule(Notation notation, object prolog)
{
if (prolog != null)
{
Symbol[] arr = Lisp.ToArray<Symbol>(prolog);
foreach (Symbol sym in arr)
{
Notation.Record[] recs = notation.Select(sym);
if (recs.Length > 0 &&
recs[0].descriptor == Descriptor.ImportModule)
ProcessImportModule(notation, recs[0]);
}
}
}
示例10: ProcessNodeTest
private object ProcessNodeTest(Notation notation, Symbol sym, bool attr)
{
if (sym.Tag == Tag.TokenWrapper)
return XmlQualifiedNameTest.New(null, null);
else if (sym.Tag == Tag.Qname)
{
Qname qn = (Qname)sym;
XmlQualifiedName qualifiedName = QNameParser.Parse(qn.Name, _context.NamespaceManager,
attr ? "" : _context.NamespaceManager.DefaultNamespace, _context.nameTable);
return XmlQualifiedNameTest.New(qualifiedName.Name, qualifiedName.Namespace);
}
else
{
Notation.Record[] recs = notation.Select(sym, new Descriptor[] { Descriptor.Wildcard1, Descriptor.Wildcard2 }, 1);
if (recs.Length > 0)
{
Qname qname = (Qname)recs[0].Arg0;
switch (recs[0].descriptor)
{
case Descriptor.Wildcard1:
{
string ns = _context.NamespaceManager.LookupNamespace(qname.Name);
if (ns == null)
throw new XQueryException(Properties.Resources.XPST0081, qname.Name);
return XmlQualifiedNameTest.New(null, ns);
}
case Descriptor.Wildcard2:
return XmlQualifiedNameTest.New(_context.nameTable.Add(qname.Name), null);
default:
throw new InvalidOperationException();
}
}
else
return ProcessKindTest(notation, sym);
}
}
示例11: ProcessPredicateList
private XQueryExprBase ProcessPredicateList(Notation notation, Symbol sym, XQueryExprBase ancestor)
{
Notation.Record[] recs = notation.Select(sym, Descriptor.PredicateList, 1);
if (recs.Length > 0)
{
Symbol[] arr = Lisp.ToArray<Symbol>(recs[0].args[0]);
List<XQueryExprBase> filter = new List<XQueryExprBase>();
for (int k = 0; k < arr.Length; k++)
{
Notation.Record[] recs1 = notation.Select(arr[k], Descriptor.Predicate, 1);
if (recs1.Length > 0)
filter.Add(ProcessExpr(notation, recs1[0].args[0]));
}
XQueryFilterExpr filterExpr = new XQueryFilterExpr(_context, filter.ToArray());
filterExpr.Source = ancestor;
return filterExpr;
}
return ancestor;
}
示例12: ProcessAxisStep
private XQueryExprBase ProcessAxisStep(Notation notation, Notation.Record rec)
{
if (rec.Arg0.Tag == Tag.TokenWrapper && ((TokenWrapper)rec.Arg0).Data == Token.DOUBLE_PERIOD)
return new XQueryStepExpr(XQueryPathExprType.Parent, _context);
else
{
Notation.Record[] recs = notation.Select(rec.Arg0, new Descriptor[] { Descriptor.ForwardStep,
Descriptor.AbbrevForward, Descriptor.ReverseStep });
if (recs.Length > 0)
{
switch (recs[0].descriptor)
{
case Descriptor.ForwardStep:
return ProcessPredicateList(notation, rec.Arg0,
ProcessForwardStep(notation, recs[0]));
case Descriptor.AbbrevForward:
return ProcessPredicateList(notation, rec.Arg0,
ProcessAbbrevForward(notation, recs[0]));
case Descriptor.ReverseStep:
return ProcessPredicateList(notation, rec.Arg0,
ProcessReverseStep(notation, recs[0]));
default:
throw new InvalidOperationException();
}
}
else
return ProcessPredicateList(notation, rec.Arg0, new XQueryStepExpr(
ProcessNodeTest(notation, rec.Arg0, false), XQueryPathExprType.Child, _context));
}
}
示例13: ProcessModuleDecl
private void ProcessModuleDecl(Notation notation, Symbol sym)
{
Notation.Record[] recs = notation.Select(sym, Descriptor.ModuleNamespace, 2);
if (recs.Length > 0)
{
Qname name = (Qname)recs[0].Arg0;
Literal ns = (Literal)recs[0].Arg1;
_context.AddNamespace(name.Name, ns.Data);
}
}
示例14: ProcessStepExpr
private XQueryExprBase ProcessStepExpr(Notation notation, Symbol sym)
{
Notation.Record[] recs = notation.Select(sym, new Descriptor[] { Descriptor.AxisStep,
Descriptor.FilterExpr }, 1);
if (recs.Length > 0)
{
switch (recs[0].descriptor)
{
case Descriptor.AxisStep:
return ProcessAxisStep(notation, recs[0]);
case Descriptor.FilterExpr:
return ProcessFilterExpr(notation, recs[0]);
default:
throw new InvalidOperationException();
}
}
else
throw new InvalidOperationException();
}
示例15: ProcessRelativePathExpr
private void ProcessRelativePathExpr(Notation notation, Symbol sym, List<XQueryExprBase> steps)
{
Notation.Record[] recs = notation.Select(sym, new Descriptor[] { Descriptor.Child,
Descriptor.Descendant }, 2);
if (recs.Length > 0)
{
ProcessRelativePathExpr(notation, recs[0].Arg0, steps);
if (recs[0].descriptor == Descriptor.Descendant)
steps.Add(new XQueryStepExpr(XQuerySequenceType.Node,
XQueryPathExprType.DescendantOrSelf, _context));
steps.Add(ProcessStepExpr(notation, recs[0].Arg1));
}
else
steps.Add(ProcessStepExpr(notation, sym));
}