本文整理汇总了C#中Pipeline.SetSource方法的典型用法代码示例。如果您正苦于以下问题:C# Pipeline.SetSource方法的具体用法?C# Pipeline.SetSource怎么用?C# Pipeline.SetSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pipeline
的用法示例。
在下文中一共展示了Pipeline.SetSource方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testListProperty
public void testListProperty()
{
var _Graph = TinkerGraphFactory.CreateTinkerGraph();
var _Marko = _Graph.VertexById(1);
var _Vadas = _Graph.VertexById(2);
var _Pipe = new PropertyPipe<String, Object>(Keys: "name");
var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>, String>(_Pipe);
_Pipeline.SetSource(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>() { _Marko, _Vadas }.GetEnumerator());
var _Counter = 0;
while (_Pipeline.MoveNext())
{
var _Name = _Pipeline.Current;
Assert.IsTrue(_Name.Equals("vadas") || _Name.Equals("marko"));
_Counter++;
}
Assert.AreEqual(2, _Counter);
}
示例2: TestPathPipe
public void TestPathPipe()
{
var _graph = DemoGraphFactory.CreateSimpleGraph();
var Alice = _graph.VertexById("Alice").AsMutable();
var _Pipe1 = new OutEdgesPipe<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>();
var _Pipe2 = new InVertexPipe<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>();
var _Pipe3 = new PathPipe<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>>();
var _Pipeline = new Pipeline<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>,
IEnumerable<Object>>(_Pipe1, _Pipe2, _Pipe3);
_Pipeline.SetSource(new SingleEnumerator<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>>(Alice));
// Via pipeline...
var query1 = _Pipeline.Select(path => path.Select(q => ((IIdentifier<String>) q).Id)).ToArray();
Assert.AreEqual(3, query1.Length);
Assert.AreEqual(3, query1[0].Count(), "'" + query1[0].AggString() + "' is invalid!");
Assert.AreEqual(3, query1[1].Count(), "'" + query1[1].AggString() + "' is invalid!");
Assert.AreEqual(3, query1[2].Count(), "'" + query1[2].AggString() + "' is invalid!");
Assert.AreEqual("Alice|Alice -loves-> Bob|Bob", query1[0].AggString());
Assert.AreEqual("Alice|0|Bob", query1[1].AggString());
Assert.AreEqual("Alice|2|Carol", query1[2].AggString());
// Via extention methods...
var query2 = Alice.OutE().InV().Paths().ToArray();
Assert.AreEqual(3, query2.Length);
Assert.AreEqual(3, query2[0].Count(), "'" + query2[0].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
Assert.AreEqual(3, query2[1].Count(), "'" + query2[1].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
Assert.AreEqual(3, query2[2].Count(), "'" + query2[2].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
var query3 = Alice.Out().Paths().ToArray();
Assert.AreEqual(3, query2.Length);
Assert.AreEqual(3, query2[0].Count(), "'" + query2[0].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
Assert.AreEqual(3, query2[1].Count(), "'" + query2[1].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
Assert.AreEqual(3, query2[2].Count(), "'" + query2[2].Select(q => ((IIdentifier<String>) q).Id).AggString() + "' is invalid!");
}
示例3: testUniquePathFilter
public void testUniquePathFilter()
{
var _Graph = TinkerGraphFactory.CreateTinkerGraph();
var _Pipe1 = new OutEdgesPipe <UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>();
var _Pipe2 = new InVertexPipe <UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>();
var _Pipe3 = new InEdgesPipe <UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>();
var _Pipe4 = new OutVertexPipe<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>();
var _Pipe5 = new UniquePathFilterPipe<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>();
var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>,
IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>(_Pipe1, _Pipe2, _Pipe3, _Pipe4, _Pipe5);
_Pipeline.SetSource(new SingleEnumerator<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>(_Graph.VertexById(1)));
var _Counter = 0;
foreach (var _Object in _Pipeline)
{
_Counter++;
Assert.IsTrue(_Object.Equals(_Graph.VertexById(6)) ||
_Object.Equals(_Graph.VertexById(4)));
}
Assert.AreEqual(2, _Counter);
}
示例4: testPropertyFilter
public void testPropertyFilter()
{
var _Graph = TinkerGraphFactory.CreateTinkerGraph();
var _Marko = _Graph.VertexById(1);
var _Pipe1 = new OutEdgesPipe<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>();
var _Pipe2 = new InVertexPipe<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>();
var _Pipe3 = new VertexPropertyFilterPipe<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>("lang", v => v == "java");
var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>,
IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>(new List<IPipe>() { _Pipe1, _Pipe2, _Pipe3 });
_Pipeline.SetSource(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>() { _Marko }.GetEnumerator());
var _Counter = 0;
while (_Pipeline.MoveNext())
{
_Counter++;
var _Vertex = _Pipeline.Current;
Assert.AreEqual(3, _Vertex.Id);
Assert.AreEqual("java", _Vertex.GetProperty("lang"));
Assert.AreEqual("lop", _Vertex.GetProperty("name"));
}
Assert.AreEqual(1, _Counter);
}
示例5: testPipeBasic
public void testPipeBasic()
{
var _Graph = TinkerGraphFactory.CreateTinkerGraph();
var _Marko = _Graph.VertexById(1);
var _Pipe1 = new OutEdgesPipe<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>();
var _Pipe2 = new InVertexPipe<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>();
var _Pipe3 = new PathPipe<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>();
var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>,
IEnumerable<Object>>(_Pipe1, _Pipe2, _Pipe3);
_Pipeline.SetSource(new SingleEnumerator<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>(_Marko));
foreach (var _Path in _Pipeline)
{
Assert.AreEqual(_Marko, _Path.ElementAt(0));
Assert.IsTrue(_Path.ElementAt(1) is IPropertyEdge);
Assert.IsTrue(_Path.ElementAt(2) is IPropertyVertex);
}
}
示例6: testBasicGather
public void testBasicGather()
{
var _Graph = TinkerGraphFactory.CreateTinkerGraph();
var _Pipe0 = new OutEdgesPipe<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>();
var _Pipe1 = new InVertexPipe<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>();
var _Pipe2 = new GatherPipe<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>();
var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>,
IEnumerable<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>>(_Pipe0, _Pipe1, _Pipe2);
_Pipeline.SetSource(new SingleEnumerator<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object>>(_Graph.VertexById(1)));
while (_Pipeline.MoveNext())
Console.WriteLine(_Pipeline.Current + "--->");// + pipeline.Path);
}
示例7: Main
public static void Main(String[] myArgs)
{
var _GeraServer = new GeraServer();
var _Account1 = _GeraServer.CreateAccount(new AccountId("Account1"));
var _Repository1 = _GeraServer.CreateRepository(new RepositoryId("Repository1"));
var _SemanticGraph = _Repository1.CreateGraph(new GraphId("GeraGraph"));
// curl -H "Accept: text/html" http://127.0.0.1:8182
// Vertex properties
var _FirstName = FOAF.FirstName("FirstName");
var _Nick = FOAF.Nick ("Nick");
var _LastName = FOAF.LastName ("LastName");
// Edges
var _knows = FOAF.Knows ("knows");
// Vertices
var _Alice = _SemanticGraph.AddVertex(new VertexId(1), v => v.SetProperty(_FirstName, "Alice"));
var _Bob = _SemanticGraph.AddVertex(new VertexId(2), v => v.SetProperty(_FirstName, "Bob"));
var _Carol = _SemanticGraph.AddVertex(new VertexId(3), v => v.SetProperty(_FirstName, "Carol"));
// Edges
var _Alice_Bob = _SemanticGraph.AddEdge(_Alice, _Bob, new EdgeId(1), _knows);
var _Alice_Carol = _SemanticGraph.AddEdge(_Alice, _Carol, new EdgeId(2), _knows);
var _Carol_Bob = _SemanticGraph.AddEdge(_Carol, _Bob, new EdgeId(3), _knows);
// Some very simple traversals
foreach (var _Vertex in _SemanticGraph.Vertices())
{
foreach (var _Edge in _Vertex.OutEdges())
Console.WriteLine("V({0}) --Fwd({1})-> V({2})", _Vertex.Id, _Edge.Id, _Edge.InVertex.Id);
foreach (var _Edge in _Vertex.InEdges())
Console.WriteLine("V({0}) <~Bwd({1})~~ V({2})", _Vertex.Id, _Edge.Id, _Edge.OutVertex.Id);
}
Console.WriteLine("---------");
foreach (var _Edge in _SemanticGraph.Edges())
{
Console.WriteLine("V({0}) --Fwd({1})-> V({2})", _Edge.OutVertex.Id, _Edge.Id, _Edge.InVertex.Id);
}
var _AllFoaf1 = _SemanticGraph.V().Out(_knows).Out(_knows).Prop(_FirstName).Cast<String>().ToList();
// ToDo: Would be nice if the result would be a n-tuple.
var _AllFoaf2 = _SemanticGraph.V().Out(_knows).Out(_knows).Prop(GDB.Id(), _FirstName).ToList();
var _Pipeline = new Pipeline<IPropertyVertex<VertexId, RevisionId, SemanticProperty, SemanticProperty, Object,
EdgeId, RevisionId, SemanticProperty, SemanticProperty, Object,
MultiEdgeId, RevisionId, SemanticProperty, SemanticProperty, Object,
HyperEdgeId, RevisionId, SemanticProperty, SemanticProperty, Object>,
IPropertyVertex<VertexId, RevisionId, SemanticProperty, SemanticProperty, Object,
EdgeId, RevisionId, SemanticProperty, SemanticProperty, Object,
MultiEdgeId, RevisionId, SemanticProperty, SemanticProperty, Object,
HyperEdgeId, RevisionId, SemanticProperty, SemanticProperty, Object>>
(v => v.Out(_knows).Out(_knows));
var _FriendsFriends = _Pipeline.SetSource(_Alice).ToList();
while (true)
{
Thread.Sleep(100);
}
}
示例8: Main
//#region (static) StartMonoCSharpREPLShell(Args)
///// <summary>
///// The Mono C# REPL Shell
///// </summary>
//public static void StartMonoCSharpREPLShell(params String[] Args)
//{
// #region Feel free to step through...
// _Compiler = new Runner();
// var a = _Compiler.Execute("Math.Abs(-42);");
// var b = _Compiler.Execute("Math.Sin(Math.PI / 6);");
// var c = _Compiler.Execute("class Fact { public int Run(int n) { return n <= 0 ? 1 : n*Run(n-1); } }");
// var d = _Compiler.Execute("new Fact().Run(5);");
// var e = _Compiler.Execute("\"abcdefgh\".Substring(1, 2);");
// var f = _Compiler.Execute("class Echo { public Object Print(Object o) { return o; } }");
// var g = _Compiler.Execute("var test = 123;");
// var h = _Compiler.Execute("new Echo().Print(test);");
// #endregion
// #region Start the interactive (read-eval-print loop) shell...
// var _Report = new Report(new ConsoleReportPrinter());
// var _CLP = new CommandLineParser(_Report);
// _CLP.UnknownOptionHandler += Mono.Driver.HandleExtraArguments;
// var _Settings = _CLP.ParseArguments(Args);
// if (_Settings == null || _Report.Errors > 0)
// Environment.Exit(1);
// var _Evaluator = new Evaluator(_Settings, _Report)
// {
// InteractiveBaseClass = typeof(InteractiveBaseShell),
// DescribeTypeExpressions = true
// };
// //// Adding a assembly twice will lead to delayed errors...
// //_Evaluator.ReferenceAssembly(typeof(YourAssembly).Assembly);
// _Evaluator.ReferenceAssembly(typeof(Bragi).Assembly);
// _Evaluator.ReferenceAssembly(typeof(IPropertyGraph).Assembly);
// _Evaluator.ReferenceAssembly(typeof(GraphFactory).Assembly);
// var u1 = _Compiler.Execute("using de.ahzf.Bragi;");
// var u2 = _Compiler.Execute("using de.ahzf.Blueprints;");
// var u3 = _Compiler.Execute("using de.ahzf.Balder.PropertyGraphs;");
// var u4 = _Compiler.Execute("using de.ahzf.Balder.PropertyGraphs.InMemory");
// var _CSharpShell = new CSharpShell(_Evaluator, "BragiShell").Run();
// #endregion
//}
//#endregion
/// <summary>
/// Main...
/// </summary>
/// <param name="Args">Arguments...</param>
public static void Main(String[] Args)
{
var _graph = DemoGraphFactory.CreateSimpleGraph();
var Alice = _graph.VertexById("Alice").AsMutable();
var _Pipe1 = new OutEdgesPipe<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>();
var _Pipe2 = new InVertexPipe<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>();
var _Pipe3 = new PathPipe<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>>();
var _Pipeline = new Pipeline<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>,
IEnumerable<Object>>(_Pipe1, _Pipe2, _Pipe3);
_Pipeline.SetSource(new SingleEnumerator<IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object,
String, Int64, String, String, Object>>(Alice));
var x1 = _Pipeline.Select(path => path.Select(q => ((IIdentifier<String>)q).Id).Aggregate((a, b) => a + "|" + b));
var x2 = Alice.OutE().InV().Paths().ToArray();
foreach (var _Path in x1)
{
//var a0 = _Path.ElementAt(0);
//var b0 = _Path.ElementAt(1) is IReadOnlyGenericPropertyEdge <String, Int64, String, String, Object,
// String, Int64, String, String, Object,
// String, Int64, String, String, Object,
// String, Int64, String, String, Object>;
//var c0 = _Path.ElementAt(2) is IReadOnlyGenericPropertyVertex<String, Int64, String, String, Object,
// String, Int64, String, String, Object,
// String, Int64, String, String, Object,
// String, Int64, String, String, Object>;
}
//.........这里部分代码省略.........