diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..d85fad9
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,13 @@
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
diff --git a/Directory.Packages.props b/Directory.Packages.props
new file mode 100644
index 0000000..a75ec41
--- /dev/null
+++ b/Directory.Packages.props
@@ -0,0 +1,16 @@
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GraphEngine.Tests/BasicTests.cs b/GraphEngine.Tests/BasicTests.cs
index de98b08..4ec4e28 100644
--- a/GraphEngine.Tests/BasicTests.cs
+++ b/GraphEngine.Tests/BasicTests.cs
@@ -1,22 +1,17 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
+
+[TestClass]
+public class BasicTests
{
- using System;
- using GraphEngine;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using VDS.RDF;
- using Linq = System.Linq.Expressions;
- using LinqExpression = System.Linq.Expressions.Expression;
-
- [TestClass]
- public class BasicTests
+ [TestMethod]
+ public void POC()
{
- [TestMethod]
- public void POC()
- {
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
@prefix xt: .
@@ -41,18 +36,18 @@ public void POC()
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var result = Expression.Parse(s).LinqExpression;
+ var result = Expression.Parse(s).LinqExpression;
- Console.WriteLine(result.GetDebugView());
- }
+ Console.WriteLine(result.GetDebugView());
+ }
- [TestMethod]
- public void Lambda()
- {
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ [TestMethod]
+ public void Lambda()
+ {
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
@prefix xt: .
@@ -69,19 +64,19 @@ public void Lambda()
.
");
- var s = g.GetUriNode(":s").In(g);
- var result = (Linq.LambdaExpression)Expression.Parse(s).LinqExpression;
+ var s = g.GetUriNode(":s").In(g);
+ var result = (Linq.LambdaExpression)Expression.Parse(s).LinqExpression;
- var a = result.Compile().DynamicInvoke();
+ var a = result.Compile().DynamicInvoke();
- Console.WriteLine(a);
- }
+ Console.WriteLine(a);
+ }
- [TestMethod]
- public void NewWithArguments()
- {
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ [TestMethod]
+ public void NewWithArguments()
+ {
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix xsd: .
@prefix : .
@@ -96,18 +91,18 @@ public void NewWithArguments()
) ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var result = Expression.Parse(s).LinqExpression;
+ var result = Expression.Parse(s).LinqExpression;
- Console.WriteLine(result.GetDebugView());
- }
+ Console.WriteLine(result.GetDebugView());
+ }
- [TestMethod]
- public void NewWithoutArguments()
- {
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ [TestMethod]
+ public void NewWithoutArguments()
+ {
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix xsd: .
@prefix : .
@@ -117,18 +112,18 @@ public void NewWithoutArguments()
] ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var result = Expression.Parse(s).LinqExpression;
+ var result = Expression.Parse(s).LinqExpression;
- Console.WriteLine(result.GetDebugView());
- }
+ Console.WriteLine(result.GetDebugView());
+ }
- [TestMethod]
- public void Assign()
- {
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ [TestMethod]
+ public void Assign()
+ {
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix xsd: .
@prefix : .
@prefix xt: .
@@ -145,41 +140,41 @@ public void Assign()
] ;
.
");
- var s = g.GetUriNode(":s").In(g);
-
- var result = Expression.Parse(s).LinqExpression;
-
- Console.WriteLine(result.GetDebugView());
- }
-
- [TestMethod]
- public void Factorial()
- {
- var value = LinqExpression.Parameter(typeof(int));
- var result = LinqExpression.Parameter(typeof(int));
- var label = LinqExpression.Label(typeof(int));
- var expected = LinqExpression.Block(
- new[] { result },
- LinqExpression.Assign(
- result,
- LinqExpression.Constant(1)),
- LinqExpression.Loop(
- LinqExpression.Condition(
- LinqExpression.GreaterThan(
- value,
- LinqExpression.Constant(1)),
- LinqExpression.MultiplyAssign(
- result,
- LinqExpression.PostDecrementAssign(
- value)),
- LinqExpression.Break(
- label,
- result),
- typeof(void)),
- label));
-
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ var s = g.GetUriNode(":s").In(g);
+
+ var result = Expression.Parse(s).LinqExpression;
+
+ Console.WriteLine(result.GetDebugView());
+ }
+
+ [TestMethod]
+ public void Factorial()
+ {
+ var value = LinqExpression.Parameter(typeof(int));
+ var result = LinqExpression.Parameter(typeof(int));
+ var label = LinqExpression.Label(typeof(int));
+ var expected = LinqExpression.Block(
+ [result],
+ LinqExpression.Assign(
+ result,
+ LinqExpression.Constant(1)),
+ LinqExpression.Loop(
+ LinqExpression.Condition(
+ LinqExpression.GreaterThan(
+ value,
+ LinqExpression.Constant(1)),
+ LinqExpression.MultiplyAssign(
+ result,
+ LinqExpression.PostDecrementAssign(
+ value)),
+ LinqExpression.Break(
+ label,
+ result),
+ typeof(void)),
+ label));
+
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix xsd: .
@prefix : .
@prefix xt: .
@@ -245,22 +240,22 @@ public void Factorial()
) ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void Default()
- {
- var expected = LinqExpression.Default(typeof(byte));
+ [TestMethod]
+ public void Default()
+ {
+ var expected = LinqExpression.Default(typeof(byte));
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -269,25 +264,25 @@ public void Default()
] ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void NewArrayBounds()
- {
- var expected =
- LinqExpression.NewArrayBounds(
- typeof(long),
- LinqExpression.Constant(0L));
+ [TestMethod]
+ public void NewArrayBounds()
+ {
+ var expected =
+ LinqExpression.NewArrayBounds(
+ typeof(long),
+ LinqExpression.Constant(0L));
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -302,22 +297,22 @@ public void NewArrayBounds()
) ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void NewArrayInit()
- {
- var expected = LinqExpression.NewArrayInit(typeof(long), LinqExpression.Constant(0L));
+ [TestMethod]
+ public void NewArrayInit()
+ {
+ var expected = LinqExpression.NewArrayInit(typeof(long), LinqExpression.Constant(0L));
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -332,24 +327,24 @@ public void NewArrayInit()
) ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void TryFault()
- {
- var expected = LinqExpression.TryFault(
- LinqExpression.Constant(0L),
- LinqExpression.Constant(0L));
+ [TestMethod]
+ public void TryFault()
+ {
+ var expected = LinqExpression.TryFault(
+ LinqExpression.Constant(0L),
+ LinqExpression.Constant(0L));
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -360,24 +355,24 @@ public void TryFault()
:constantValue 0 ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void TryFinally()
- {
- var expected = LinqExpression.TryFinally(
- LinqExpression.Constant(0L),
- LinqExpression.Constant(0L));
+ [TestMethod]
+ public void TryFinally()
+ {
+ var expected = LinqExpression.TryFinally(
+ LinqExpression.Constant(0L),
+ LinqExpression.Constant(0L));
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -388,26 +383,26 @@ public void TryFinally()
:constantValue 0 ;
.
");
- var s = g.GetUriNode(":s").In(g);
-
- var actual = Expression.Parse(s).LinqExpression;
+ var s = g.GetUriNode(":s").In(g);
- Console.WriteLine(actual.GetDebugView());
+ var actual = Expression.Parse(s).LinqExpression;
- actual.Should().Be(expected);
- }
+ Console.WriteLine(actual.GetDebugView());
- [TestMethod]
- public void TryCatchTypeBody()
- {
- var expected = LinqExpression.TryCatch(
- LinqExpression.Constant(0L),
- LinqExpression.Catch(
- typeof(Exception),
- LinqExpression.Constant(0L)));
+ actual.Should().Be(expected);
+ }
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ [TestMethod]
+ public void TryCatchTypeBody()
+ {
+ var expected = LinqExpression.TryCatch(
+ LinqExpression.Constant(0L),
+ LinqExpression.Catch(
+ typeof(Exception),
+ LinqExpression.Constant(0L)));
+
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -425,27 +420,27 @@ public void TryCatchTypeBody()
:constantValue 0 ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void TryCatchVariableBody()
- {
- var expected = LinqExpression.TryCatch(
- LinqExpression.Constant(0L),
- LinqExpression.Catch(
- LinqExpression.Parameter(
- typeof(Exception)),
- LinqExpression.Constant(0L)));
+ [TestMethod]
+ public void TryCatchVariableBody()
+ {
+ var expected = LinqExpression.TryCatch(
+ LinqExpression.Constant(0L),
+ LinqExpression.Catch(
+ LinqExpression.Parameter(
+ typeof(Exception)),
+ LinqExpression.Constant(0L)));
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -465,29 +460,29 @@ public void TryCatchVariableBody()
:constantValue 0 ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void TryCatchTypeBodyFilter()
- {
- var expected = LinqExpression.TryCatch(
+ [TestMethod]
+ public void TryCatchTypeBodyFilter()
+ {
+ var expected = LinqExpression.TryCatch(
+ LinqExpression.Constant(0L),
+ LinqExpression.Catch(
+ typeof(Exception),
LinqExpression.Constant(0L),
- LinqExpression.Catch(
- typeof(Exception),
+ LinqExpression.Equal(
LinqExpression.Constant(0L),
- LinqExpression.Equal(
- LinqExpression.Constant(0L),
- LinqExpression.Constant(0L))));
+ LinqExpression.Constant(0L))));
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
@prefix xt: .
@@ -511,30 +506,30 @@ public void TryCatchTypeBodyFilter()
:constantValue 0 ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void TryCatchVariableBodyFilter()
- {
- var expected = LinqExpression.TryCatch(
+ [TestMethod]
+ public void TryCatchVariableBodyFilter()
+ {
+ var expected = LinqExpression.TryCatch(
+ LinqExpression.Constant(0L),
+ LinqExpression.Catch(
+ LinqExpression.Parameter(
+ typeof(Exception)),
LinqExpression.Constant(0L),
- LinqExpression.Catch(
- LinqExpression.Parameter(
- typeof(Exception)),
+ LinqExpression.Equal(
LinqExpression.Constant(0L),
- LinqExpression.Equal(
- LinqExpression.Constant(0L),
- LinqExpression.Constant(0L))));
+ LinqExpression.Constant(0L))));
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
@prefix xt: .
@@ -560,26 +555,26 @@ public void TryCatchVariableBodyFilter()
:constantValue 0 ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
-
- [TestMethod]
- public void ArrayAccess()
- {
- var expected = LinqExpression.ArrayAccess(
- LinqExpression.Parameter(
- typeof(int[])),
- LinqExpression.Parameter(
- typeof(int)));
+ actual.Should().Be(expected);
+ }
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ [TestMethod]
+ public void ArrayAccess()
+ {
+ var expected = LinqExpression.ArrayAccess(
+ LinqExpression.Parameter(
+ typeof(int[])),
+ LinqExpression.Parameter(
+ typeof(int)));
+
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -597,49 +592,49 @@ public void ArrayAccess()
) ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void Empty()
- {
- var expected = LinqExpression.Empty();
+ [TestMethod]
+ public void Empty()
+ {
+ var expected = LinqExpression.Empty();
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
a :Empty ;
.
");
- var s = g.GetUriNode(":s").In(g);
-
- var actual = Expression.Parse(s).LinqExpression;
+ var s = g.GetUriNode(":s").In(g);
- Console.WriteLine(actual.GetDebugView());
+ var actual = Expression.Parse(s).LinqExpression;
- actual.Should().Be(expected);
- }
+ Console.WriteLine(actual.GetDebugView());
- [TestMethod]
- public void Label()
- {
- var expected = LinqExpression.Label(
- LinqExpression.Label(
- typeof(int),
- "target"),
- LinqExpression.Parameter(
- typeof(int)));
+ actual.Should().Be(expected);
+ }
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ [TestMethod]
+ public void Label()
+ {
+ var expected = LinqExpression.Label(
+ LinqExpression.Label(
+ typeof(int),
+ "target"),
+ LinqExpression.Parameter(
+ typeof(int)));
+
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -656,26 +651,26 @@ public void Label()
:typeName ""System.Int32"" ;
.
");
- var s = g.GetUriNode(":s").In(g);
-
- var actual = Expression.Parse(s).LinqExpression;
+ var s = g.GetUriNode(":s").In(g);
- Console.WriteLine(actual.GetDebugView());
+ var actual = Expression.Parse(s).LinqExpression;
- actual.Should().Be(expected);
- }
+ Console.WriteLine(actual.GetDebugView());
- [TestMethod]
- public void ArrayIndex_index()
- {
- var expected = LinqExpression.ArrayIndex(
- LinqExpression.Parameter(
- typeof(int[])),
- LinqExpression.Parameter(
- typeof(int)));
+ actual.Should().Be(expected);
+ }
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ [TestMethod]
+ public void ArrayIndex_index()
+ {
+ var expected = LinqExpression.ArrayIndex(
+ LinqExpression.Parameter(
+ typeof(int[])),
+ LinqExpression.Parameter(
+ typeof(int)));
+
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -691,29 +686,28 @@ public void ArrayIndex_index()
] ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void ArrayIndex_indexes()
- {
- var expected = LinqExpression.ArrayIndex(
+ [TestMethod]
+ public void ArrayIndex_indexes()
+ {
+ var expected = LinqExpression.ArrayIndex(
+ LinqExpression.Parameter(
+ typeof(int[])),
+ [
LinqExpression.Parameter(
- typeof(int[])),
- new[]
- {
- LinqExpression.Parameter(
- typeof(int)),
- });
-
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ typeof(int)),
+ ]);
+
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -731,23 +725,23 @@ public void ArrayIndex_indexes()
) ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void Condition()
- {
- var param = LinqExpression.Parameter(typeof(bool));
- var expected = LinqExpression.Condition(param, param, param);
+ [TestMethod]
+ public void Condition()
+ {
+ var param = LinqExpression.Parameter(typeof(bool));
+ var expected = LinqExpression.Condition(param, param, param);
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -762,26 +756,26 @@ public void Condition()
] ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
-
- [TestMethod]
- public void ConditionType()
- {
- var expected = LinqExpression.Condition(
- LinqExpression.Parameter(typeof(bool)),
- LinqExpression.Parameter(typeof(SampleClass)),
- LinqExpression.Parameter(typeof(SampleDerivedClass)),
- typeof(SampleClass));
+ actual.Should().Be(expected);
+ }
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ [TestMethod]
+ public void ConditionType()
+ {
+ var expected = LinqExpression.Condition(
+ LinqExpression.Parameter(typeof(bool)),
+ LinqExpression.Parameter(typeof(SampleClass)),
+ LinqExpression.Parameter(typeof(SampleDerivedClass)),
+ typeof(SampleClass));
+
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -793,23 +787,23 @@ public void ConditionType()
_:C1 :typeName ""GraphEngine.Tests.SampleClass, GraphEngine.Tests"" .
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void IfThen()
- {
- var param = LinqExpression.Parameter(typeof(bool));
- var expected = LinqExpression.IfThen(param, param);
+ [TestMethod]
+ public void IfThen()
+ {
+ var param = LinqExpression.Parameter(typeof(bool));
+ var expected = LinqExpression.IfThen(param, param);
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -824,23 +818,23 @@ public void IfThen()
] ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void IfThenElse()
- {
- var param = LinqExpression.Parameter(typeof(bool));
- var expected = LinqExpression.IfThenElse(param, param, param);
+ [TestMethod]
+ public void IfThenElse()
+ {
+ var param = LinqExpression.Parameter(typeof(bool));
+ var expected = LinqExpression.IfThenElse(param, param, param);
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -856,20 +850,20 @@ public void IfThenElse()
] ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
+ }
- [TestMethod]
- public void EatYourOwnDogfood()
- {
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ [TestMethod]
+ public void EatYourOwnDogfood()
+ {
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix : .
:s
@@ -889,32 +883,31 @@ public void EatYourOwnDogfood()
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var parsed = Expression.Parse(s).LinqExpression;
- var lambdaExpression = (Linq.LambdaExpression)parsed;
- var lambda = lambdaExpression.Compile();
+ var parsed = Expression.Parse(s).LinqExpression;
+ var lambdaExpression = (Linq.LambdaExpression)parsed;
+ var lambda = lambdaExpression.Compile();
- Assert.AreEqual(g.Triples.Count, 12); // 8 explicit, 4 implicit
- var result = lambda.DynamicInvoke(g);
- Assert.AreEqual(g.Triples.Count, 0);
- }
+ Assert.AreEqual(g.Triples.Count, 12); // 8 explicit, 4 implicit
+ var result = lambda.DynamicInvoke(g);
+ Assert.AreEqual(g.Triples.Count, 0);
+ }
- [TestMethod]
- public void ReasoningPOC()
- {
- using var g = new GraphEngine.Graph();
- g.LoadFromEmbeddedResource("GraphEngine.Tests.Resources.Examples.FibonacciSequenceUntyped.ttl, GraphEngine.Tests");
+ [TestMethod]
+ public void ReasoningPOC()
+ {
+ using var g = new GraphEngine.Graph();
+ g.LoadFromEmbeddedResource("GraphEngine.Tests.Resources.Examples.FibonacciSequenceUntyped.ttl, GraphEngine.Tests");
- var s = g.GetUriNode(new Uri("http://example.com/s")).In(g);
+ var s = g.GetUriNode(new Uri("http://example.com/s")).In(g);
- var expression = Expression.Parse(s).LinqExpression;
- Console.WriteLine(expression.GetDebugView());
+ var expression = Expression.Parse(s).LinqExpression;
+ Console.WriteLine(expression.GetDebugView());
- var lambda = LinqExpression.Lambda(expression);
- var actual = lambda.Compile().DynamicInvoke();
+ var lambda = LinqExpression.Lambda(expression);
+ var actual = lambda.Compile().DynamicInvoke();
- Assert.AreEqual(21L, actual);
- }
+ Assert.AreEqual(21L, actual);
}
}
diff --git a/GraphEngine.Tests/BinaryTests.cs b/GraphEngine.Tests/BinaryTests.cs
index 4676ed9..f7a05a6 100644
--- a/GraphEngine.Tests/BinaryTests.cs
+++ b/GraphEngine.Tests/BinaryTests.cs
@@ -1,77 +1,73 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
+
+[TestClass]
+public class BinaryTests : TestBase
{
- using System;
- using System.Collections.Generic;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Linq = System.Linq.Expressions;
- using LinqExpression = System.Linq.Expressions.Expression;
-
- [TestClass]
- public class BinaryTests : TestBase
+ public static IEnumerable Data
{
- public static IEnumerable Data
+ get
{
- get
- {
- yield return new object[] { Linq.ExpressionType.Add };
- yield return new object[] { Linq.ExpressionType.AddAssign };
- yield return new object[] { Linq.ExpressionType.AddAssignChecked };
- yield return new object[] { Linq.ExpressionType.AddChecked };
- yield return new object[] { Linq.ExpressionType.And };
- yield return new object[] { Linq.ExpressionType.AndAlso, typeof(bool) };
- yield return new object[] { Linq.ExpressionType.AndAssign };
- yield return new object[] { Linq.ExpressionType.ArrayIndex, typeof(int[]), typeof(int) };
- yield return new object[] { Linq.ExpressionType.Assign };
- yield return new object[] { Linq.ExpressionType.Coalesce, typeof(object) };
- yield return new object[] { Linq.ExpressionType.Divide };
- yield return new object[] { Linq.ExpressionType.DivideAssign };
- yield return new object[] { Linq.ExpressionType.Equal };
- yield return new object[] { Linq.ExpressionType.ExclusiveOr };
- yield return new object[] { Linq.ExpressionType.ExclusiveOrAssign };
- yield return new object[] { Linq.ExpressionType.GreaterThan };
- yield return new object[] { Linq.ExpressionType.GreaterThanOrEqual };
- yield return new object[] { Linq.ExpressionType.LeftShift };
- yield return new object[] { Linq.ExpressionType.LeftShiftAssign };
- yield return new object[] { Linq.ExpressionType.LessThan };
- yield return new object[] { Linq.ExpressionType.LessThanOrEqual };
- yield return new object[] { Linq.ExpressionType.Modulo };
- yield return new object[] { Linq.ExpressionType.ModuloAssign };
- yield return new object[] { Linq.ExpressionType.Multiply };
- yield return new object[] { Linq.ExpressionType.MultiplyAssign };
- yield return new object[] { Linq.ExpressionType.MultiplyAssignChecked };
- yield return new object[] { Linq.ExpressionType.MultiplyChecked };
- yield return new object[] { Linq.ExpressionType.NotEqual };
- yield return new object[] { Linq.ExpressionType.Or };
- yield return new object[] { Linq.ExpressionType.OrAssign };
- yield return new object[] { Linq.ExpressionType.OrElse, typeof(bool) };
- yield return new object[] { Linq.ExpressionType.Power, typeof(double) };
- yield return new object[] { Linq.ExpressionType.PowerAssign, typeof(double) };
- yield return new object[] { Linq.ExpressionType.RightShift };
- yield return new object[] { Linq.ExpressionType.RightShiftAssign };
- yield return new object[] { Linq.ExpressionType.Subtract };
- yield return new object[] { Linq.ExpressionType.SubtractAssign };
- yield return new object[] { Linq.ExpressionType.SubtractAssignChecked };
- yield return new object[] { Linq.ExpressionType.SubtractChecked };
- }
+ yield return [Linq.ExpressionType.Add];
+ yield return [Linq.ExpressionType.AddAssign];
+ yield return [Linq.ExpressionType.AddAssignChecked];
+ yield return [Linq.ExpressionType.AddChecked];
+ yield return [Linq.ExpressionType.And];
+ yield return [Linq.ExpressionType.AndAlso, typeof(bool)];
+ yield return [Linq.ExpressionType.AndAssign];
+ yield return [Linq.ExpressionType.ArrayIndex, typeof(int[]), typeof(int)];
+ yield return [Linq.ExpressionType.Assign];
+ yield return [Linq.ExpressionType.Coalesce, typeof(object)];
+ yield return [Linq.ExpressionType.Divide];
+ yield return [Linq.ExpressionType.DivideAssign];
+ yield return [Linq.ExpressionType.Equal];
+ yield return [Linq.ExpressionType.ExclusiveOr];
+ yield return [Linq.ExpressionType.ExclusiveOrAssign];
+ yield return [Linq.ExpressionType.GreaterThan];
+ yield return [Linq.ExpressionType.GreaterThanOrEqual];
+ yield return [Linq.ExpressionType.LeftShift];
+ yield return [Linq.ExpressionType.LeftShiftAssign];
+ yield return [Linq.ExpressionType.LessThan];
+ yield return [Linq.ExpressionType.LessThanOrEqual];
+ yield return [Linq.ExpressionType.Modulo];
+ yield return [Linq.ExpressionType.ModuloAssign];
+ yield return [Linq.ExpressionType.Multiply];
+ yield return [Linq.ExpressionType.MultiplyAssign];
+ yield return [Linq.ExpressionType.MultiplyAssignChecked];
+ yield return [Linq.ExpressionType.MultiplyChecked];
+ yield return [Linq.ExpressionType.NotEqual];
+ yield return [Linq.ExpressionType.Or];
+ yield return [Linq.ExpressionType.OrAssign];
+ yield return [Linq.ExpressionType.OrElse, typeof(bool)];
+ yield return [Linq.ExpressionType.Power, typeof(double)];
+ yield return [Linq.ExpressionType.PowerAssign, typeof(double)];
+ yield return [Linq.ExpressionType.RightShift];
+ yield return [Linq.ExpressionType.RightShiftAssign];
+ yield return [Linq.ExpressionType.Subtract];
+ yield return [Linq.ExpressionType.SubtractAssign];
+ yield return [Linq.ExpressionType.SubtractAssignChecked];
+ yield return [Linq.ExpressionType.SubtractChecked];
}
+ }
- [TestMethod]
- [DynamicData(nameof(Data))]
- public void Regular(Linq.ExpressionType binaryType, Type leftType = null, Type rightType = null)
- {
- leftType ??= typeof(int);
- rightType ??= leftType;
+ [TestMethod]
+ [DynamicData(nameof(Data))]
+ public void Regular(Linq.ExpressionType binaryType, System.Type? leftType = null, System.Type? rightType = null)
+ {
+ leftType ??= typeof(int);
+ rightType ??= leftType;
- var expected = LinqExpression.MakeBinary(
- binaryType,
- LinqExpression.Parameter(
- leftType),
- LinqExpression.Parameter(
- rightType));
+ var expected = LinqExpression.MakeBinary(
+ binaryType,
+ LinqExpression.Parameter(
+ leftType),
+ LinqExpression.Parameter(
+ rightType));
- var actual = $@"
+ var actual = $@"
@prefix : .
@prefix xt: .
@@ -90,20 +86,20 @@ public void Regular(Linq.ExpressionType binaryType, Type leftType = null, Type r
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void ReferenceEquals()
- {
- var expected =
- LinqExpression.ReferenceEqual(
- LinqExpression.Parameter(
- typeof(object)),
- LinqExpression.Parameter(
- typeof(object)));
+ [TestMethod]
+ public void ReferenceEquals()
+ {
+ var expected =
+ LinqExpression.ReferenceEqual(
+ LinqExpression.Parameter(
+ typeof(object)),
+ LinqExpression.Parameter(
+ typeof(object)));
- var actual = $@"
+ var actual = $@"
@prefix : .
:s
@@ -121,20 +117,20 @@ public void ReferenceEquals()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void ReferenceNotEquals()
- {
- var expected =
- LinqExpression.ReferenceNotEqual(
- LinqExpression.Parameter(
- typeof(object)),
- LinqExpression.Parameter(
- typeof(object)));
+ [TestMethod]
+ public void ReferenceNotEquals()
+ {
+ var expected =
+ LinqExpression.ReferenceNotEqual(
+ LinqExpression.Parameter(
+ typeof(object)),
+ LinqExpression.Parameter(
+ typeof(object)));
- var actual = $@"
+ var actual = $@"
@prefix : .
:s
@@ -152,23 +148,23 @@ public void ReferenceNotEquals()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Method()
- {
- var zero =
- LinqExpression.Default(
- typeof(long));
+ [TestMethod]
+ public void Method()
+ {
+ var zero =
+ LinqExpression.Default(
+ typeof(long));
- var expected =
- LinqExpression.Add(
- zero,
- zero,
- typeof(SampleClass).GetMethod(nameof(SampleClass.Equal)));
+ var expected =
+ LinqExpression.Add(
+ zero,
+ zero,
+ typeof(SampleClass).GetMethod(nameof(SampleClass.Equal)));
- var actual = $@"
+ var actual = $@"
@prefix : .
@prefix xt: .
@@ -191,27 +187,27 @@ public void Method()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Conversion()
- {
- var @object = typeof(object);
- var @null =
- LinqExpression.Default(
- @object);
+ ShouldBe(actual, expected);
+ }
- var expected =
- LinqExpression.Coalesce(
- @null,
+ [TestMethod]
+ public void Conversion()
+ {
+ var @object = typeof(object);
+ var @null =
+ LinqExpression.Default(
+ @object);
+
+ var expected =
+ LinqExpression.Coalesce(
+ @null,
+ @null,
+ LinqExpression.Lambda(
@null,
- LinqExpression.Lambda(
- @null,
- LinqExpression.Parameter(
- @object)));
+ LinqExpression.Parameter(
+ @object)));
- var actual = $@"
+ var actual = $@"
@prefix : .
@prefix xt: .
@@ -233,24 +229,24 @@ public void Conversion()
_:null :defaultType _:object .
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void LiftToNull()
- {
- var zero =
- LinqExpression.Default(
- typeof(int?));
-
- var expected =
- LinqExpression.LessThan(
- zero,
- zero,
- true,
- null);
-
- var actual = $@"
+ [TestMethod]
+ public void LiftToNull()
+ {
+ var zero =
+ LinqExpression.Default(
+ typeof(int?));
+
+ var expected =
+ LinqExpression.LessThan(
+ zero,
+ zero,
+ true,
+ null);
+
+ var actual = $@"
@prefix : .
@prefix xt: .
@@ -268,7 +264,6 @@ public void LiftToNull()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/BlockTests.cs b/GraphEngine.Tests/BlockTests.cs
index b720930..ca5f3e6 100644
--- a/GraphEngine.Tests/BlockTests.cs
+++ b/GraphEngine.Tests/BlockTests.cs
@@ -1,21 +1,20 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class BlockTests : TestBase
+[TestClass]
+public class BlockTests : TestBase
+{
+ [TestMethod]
+ public void Expressions()
{
- [TestMethod]
- public void Expressions()
- {
- var expected =
- LinqExpression.Block(
- LinqExpression.Default(typeof(string)));
-
- var actual = @"
+ var expected =
+ LinqExpression.Block(
+ LinqExpression.Default(typeof(string)));
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -30,26 +29,24 @@ public void Expressions()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void ExpressionsVariables()
- {
- var expected =
- LinqExpression.Block(
- new[]
- {
- LinqExpression.Parameter(
- typeof(string)),
- },
- new[]
- {
- LinqExpression.Default(
- typeof(string)),
- });
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void ExpressionsVariables()
+ {
+ var expected =
+ LinqExpression.Block(
+ [
+ LinqExpression.Parameter(
+ typeof(string)),
+ ],
+ [
+ LinqExpression.Default(
+ typeof(string)),
+ ]);
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -71,18 +68,18 @@ public void ExpressionsVariables()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void TypeExpressions()
- {
- var expected =
- LinqExpression.Block(
- typeof(object),
- LinqExpression.Default(typeof(string)));
+ [TestMethod]
+ public void TypeExpressions()
+ {
+ var expected =
+ LinqExpression.Block(
+ typeof(object),
+ LinqExpression.Default(typeof(string)));
- var actual = @"
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -100,27 +97,25 @@ public void TypeExpressions()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void TypeExpressionsVariables()
- {
- var expected =
- LinqExpression.Block(
- typeof(object),
- new[]
- {
- LinqExpression.Parameter(
- typeof(string)),
- },
- new[]
- {
- LinqExpression.Default(
- typeof(string)),
- });
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void TypeExpressionsVariables()
+ {
+ var expected =
+ LinqExpression.Block(
+ typeof(object),
+ [
+ LinqExpression.Parameter(
+ typeof(string)),
+ ],
+ [
+ LinqExpression.Default(
+ typeof(string)),
+ ]);
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -145,7 +140,6 @@ public void TypeExpressionsVariables()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/CallTests.cs b/GraphEngine.Tests/CallTests.cs
index 549ae3a..b2a7285 100644
--- a/GraphEngine.Tests/CallTests.cs
+++ b/GraphEngine.Tests/CallTests.cs
@@ -1,22 +1,20 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class CallTests : TestBase
+[TestClass]
+public class CallTests : TestBase
+{
+ [TestMethod]
+ public void Method()
{
- [TestMethod]
- public void Method()
- {
- var expected =
- LinqExpression.Call(
- typeof(SampleClass).GetMethod(nameof(SampleClass.StaticMethod)));
-
- var actual = @"
+ var expected =
+ LinqExpression.Call(
+ typeof(SampleClass).GetMethod(nameof(SampleClass.StaticMethod)));
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -30,18 +28,18 @@ public void Method()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Method_Arguments()
- {
- var expected =
- LinqExpression.Call(
- typeof(SampleClass).GetMethod(nameof(SampleClass.StaticMethodWithArgument)),
- LinqExpression.Constant(0L));
+ [TestMethod]
+ public void Method_Arguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ typeof(SampleClass).GetMethod(nameof(SampleClass.StaticMethodWithArgument)),
+ LinqExpression.Constant(0L));
- var actual = @"
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -60,17 +58,17 @@ public void Method_Arguments()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Method_TypeArguments()
- {
- var expected =
- LinqExpression.Call(
- typeof(SampleClass).GetMethod(nameof(SampleClass.GenericStaticMethod)).MakeGenericMethod(typeof(object)));
+ [TestMethod]
+ public void Method_TypeArguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ typeof(SampleClass).GetMethod(nameof(SampleClass.GenericStaticMethod)).MakeGenericMethod(typeof(object)));
- var actual = @"
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -89,18 +87,18 @@ public void Method_TypeArguments()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Method_TypeArguments_Arguments()
- {
- var expected =
- LinqExpression.Call(
- typeof(SampleClass).GetMethod(nameof(SampleClass.GenericStaticMethodWithArgument)).MakeGenericMethod(typeof(object)),
- LinqExpression.Constant(0L));
+ [TestMethod]
+ public void Method_TypeArguments_Arguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ typeof(SampleClass).GetMethod(nameof(SampleClass.GenericStaticMethodWithArgument)).MakeGenericMethod(typeof(object)),
+ LinqExpression.Constant(0L));
- var actual = @"
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -124,19 +122,19 @@ public void Method_TypeArguments_Arguments()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Method_Instance()
- {
- var expected =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- typeof(SampleClass).GetMethod(nameof(SampleClass.InstanceMethod)));
+ [TestMethod]
+ public void Method_Instance()
+ {
+ var expected =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ typeof(SampleClass).GetMethod(nameof(SampleClass.InstanceMethod)));
- var actual = @"
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -155,20 +153,20 @@ public void Method_Instance()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Method_Instance_Arguments()
- {
- var expected =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- typeof(SampleClass).GetMethod(nameof(SampleClass.InstanceMethodWithArgument)),
- LinqExpression.Constant(0L));
+ ShouldBe(actual, expected);
+ }
- var actual = @"
+ [TestMethod]
+ public void Method_Instance_Arguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ typeof(SampleClass).GetMethod(nameof(SampleClass.InstanceMethodWithArgument)),
+ LinqExpression.Constant(0L));
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -192,19 +190,19 @@ public void Method_Instance_Arguments()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Method_Instance_TypeArguments()
- {
- var expected =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- typeof(SampleClass).GetMethod(nameof(SampleClass.GenericInstanceMethod)).MakeGenericMethod(typeof(object)));
+ [TestMethod]
+ public void Method_Instance_TypeArguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ typeof(SampleClass).GetMethod(nameof(SampleClass.GenericInstanceMethod)).MakeGenericMethod(typeof(object)));
- var actual = @"
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -228,20 +226,20 @@ public void Method_Instance_TypeArguments()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Method_Instance_TypeArguments_Arguments()
- {
- var expected =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- typeof(SampleClass).GetMethod(nameof(SampleClass.GenericInstanceMethodWithArgument)).MakeGenericMethod(typeof(object)),
- LinqExpression.Constant(0L));
+ ShouldBe(actual, expected);
+ }
- var actual = @"
+ [TestMethod]
+ public void Method_Instance_TypeArguments_Arguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ typeof(SampleClass).GetMethod(nameof(SampleClass.GenericInstanceMethodWithArgument)).MakeGenericMethod(typeof(object)),
+ LinqExpression.Constant(0L));
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -270,20 +268,20 @@ public void Method_Instance_TypeArguments_Arguments()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Type()
- {
- var expected =
- LinqExpression.Call(
- typeof(SampleClass),
- nameof(SampleClass.StaticMethod),
- Array.Empty(),
- Array.Empty());
+ ShouldBe(actual, expected);
+ }
- var actual = @"
+ [TestMethod]
+ public void Type()
+ {
+ var expected =
+ LinqExpression.Call(
+ typeof(SampleClass),
+ nameof(SampleClass.StaticMethod),
+ [],
+ []);
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -295,23 +293,22 @@ public void Type()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Type_Arguments()
- {
- var expected =
- LinqExpression.Call(
- typeof(SampleClass),
- nameof(SampleClass.StaticMethodWithArgument),
- Array.Empty(),
- new[]
- {
- LinqExpression.Constant(0L),
- });
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void Type_Arguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ typeof(SampleClass),
+ nameof(SampleClass.StaticMethodWithArgument),
+ [],
+ [
+ LinqExpression.Constant(0L),
+ ]);
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -328,23 +325,22 @@ public void Type_Arguments()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Type_TypeArguments()
- {
- var expected =
- LinqExpression.Call(
- typeof(SampleClass),
- nameof(SampleClass.GenericStaticMethod),
- new[]
- {
- typeof(object),
- },
- Array.Empty());
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void Type_TypeArguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ typeof(SampleClass),
+ nameof(SampleClass.GenericStaticMethod),
+ [
+ typeof(object),
+ ],
+ []);
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -361,26 +357,24 @@ public void Type_TypeArguments()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Type_TypeArguments_Arguments()
- {
- var expected =
- LinqExpression.Call(
- typeof(SampleClass),
- nameof(SampleClass.GenericStaticMethodWithArgument),
- new[]
- {
- typeof(object),
- },
- new[]
- {
- LinqExpression.Constant(0L),
- });
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void Type_TypeArguments_Arguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ typeof(SampleClass),
+ nameof(SampleClass.GenericStaticMethodWithArgument),
+ [
+ typeof(object),
+ ],
+ [
+ LinqExpression.Constant(0L),
+ ]);
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -402,21 +396,21 @@ public void Type_TypeArguments_Arguments()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Default()
- {
- var expected =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- nameof(SampleClass.InstanceMethod),
- Array.Empty(),
- Array.Empty());
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void Default()
+ {
+ var expected =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ nameof(SampleClass.InstanceMethod),
+ [],
+ []);
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -430,24 +424,23 @@ public void Default()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Default_Arguments()
- {
- var expected =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- nameof(SampleClass.InstanceMethodWithArgument),
- Array.Empty(),
- new[]
- {
- LinqExpression.Constant(0L),
- });
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void Default_Arguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ nameof(SampleClass.InstanceMethodWithArgument),
+ [],
+ [
+ LinqExpression.Constant(0L),
+ ]);
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -466,24 +459,23 @@ public void Default_Arguments()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Default_TypeArguments()
- {
- var expected =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- nameof(SampleClass.GenericInstanceMethod),
- new[]
- {
- typeof(object),
- },
- Array.Empty());
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void Default_TypeArguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ nameof(SampleClass.GenericInstanceMethod),
+ [
+ typeof(object),
+ ],
+ []);
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -502,27 +494,25 @@ public void Default_TypeArguments()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Instance_TypeArgumentss_Arguments()
- {
- var expected =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- nameof(SampleClass.GenericInstanceMethodWithArgument),
- new[]
- {
- typeof(object),
- },
- new[]
- {
- LinqExpression.Constant(0L),
- });
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void Instance_TypeArgumentss_Arguments()
+ {
+ var expected =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ nameof(SampleClass.GenericInstanceMethodWithArgument),
+ [
+ typeof(object),
+ ],
+ [
+ LinqExpression.Constant(0L),
+ ]);
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -546,7 +536,6 @@ public void Instance_TypeArgumentss_Arguments()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/ClearDebugInfoTests.cs b/GraphEngine.Tests/ClearDebugInfoTests.cs
index ee8dd69..b203f83 100644
--- a/GraphEngine.Tests/ClearDebugInfoTests.cs
+++ b/GraphEngine.Tests/ClearDebugInfoTests.cs
@@ -1,22 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class ClearDebugInfoTests : TestBase
+[TestClass]
+public class ClearDebugInfoTests : TestBase
+{
+ [TestMethod]
+ public void Default()
{
- [TestMethod]
- public void Default()
- {
- var expected =
- LinqExpression.ClearDebugInfo(
- LinqExpression.SymbolDocument(
- string.Empty));
+ var expected =
+ LinqExpression.ClearDebugInfo(
+ LinqExpression.SymbolDocument(
+ string.Empty));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -27,7 +26,6 @@ public void Default()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/ConstantTests.cs b/GraphEngine.Tests/ConstantTests.cs
index eefe4b9..3ee6c21 100644
--- a/GraphEngine.Tests/ConstantTests.cs
+++ b/GraphEngine.Tests/ConstantTests.cs
@@ -1,22 +1,20 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using VDS.RDF;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class ConstantTests : TestBase
+[TestClass]
+public class ConstantTests : TestBase
+{
+ [TestMethod]
+ public void Null()
{
- [TestMethod]
- public void Null()
- {
- var expected =
- LinqExpression.Constant(
- null);
-
- const string actual = @"
+ var expected =
+ LinqExpression.Constant(
+ null);
+
+ const string actual = @"
@prefix : .
:s
@@ -24,18 +22,18 @@ public void Null()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Null_with_type()
- {
- var expected =
- LinqExpression.Constant(
- null,
- typeof(string));
+ [TestMethod]
+ public void Null_with_type()
+ {
+ var expected =
+ LinqExpression.Constant(
+ null,
+ typeof(string));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -45,17 +43,17 @@ public void Null_with_type()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Uri()
- {
- var expected =
- LinqExpression.Constant(
- UriFactory.Create("urn:s"));
+ [TestMethod]
+ public void Uri()
+ {
+ var expected =
+ LinqExpression.Constant(
+ UriFactory.Create("urn:s"));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -63,17 +61,17 @@ public void Uri()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void LangString()
- {
- var expected =
- LinqExpression.Constant(
- new NodeFactory(new NodeFactoryOptions()).CreateLiteralNode(string.Empty, "en"));
+ [TestMethod]
+ public void LangString()
+ {
+ var expected =
+ LinqExpression.Constant(
+ new NodeFactory(new NodeFactoryOptions()).CreateLiteralNode(string.Empty, "en"));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -81,17 +79,17 @@ public void LangString()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Long_value()
- {
- var expected =
- LinqExpression.Constant(
- 0L);
+ [TestMethod]
+ public void Long_value()
+ {
+ var expected =
+ LinqExpression.Constant(
+ 0L);
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -99,17 +97,17 @@ public void Long_value()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Int_value()
- {
- var expected =
- LinqExpression.Constant(
- 0);
+ [TestMethod]
+ public void Int_value()
+ {
+ var expected =
+ LinqExpression.Constant(
+ 0);
- const string actual = @"
+ const string actual = @"
@prefix xsd: .
@prefix : .
@@ -118,17 +116,17 @@ public void Int_value()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void String_value()
- {
- var expected =
- LinqExpression.Constant(
- "x");
+ [TestMethod]
+ public void String_value()
+ {
+ var expected =
+ LinqExpression.Constant(
+ "x");
- const string actual = @"
+ const string actual = @"
@prefix xsd: .
@prefix : .
@@ -137,7 +135,6 @@ public void String_value()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/DebugInfoTests.cs b/GraphEngine.Tests/DebugInfoTests.cs
index 6d9510a..49d9666 100644
--- a/GraphEngine.Tests/DebugInfoTests.cs
+++ b/GraphEngine.Tests/DebugInfoTests.cs
@@ -1,27 +1,25 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class DebugInfoTests : TestBase
+[TestClass]
+public class DebugInfoTests : TestBase
+{
+ [TestMethod]
+ public void Default()
{
- [TestMethod]
- public void Default()
- {
- var expected =
- LinqExpression.DebugInfo(
- LinqExpression.SymbolDocument(
- string.Empty),
- 1,
- 1,
- 1,
- 1);
-
- const string actual = @"
+ var expected =
+ LinqExpression.DebugInfo(
+ LinqExpression.SymbolDocument(
+ string.Empty),
+ 1,
+ 1,
+ 1,
+ 1);
+
+ const string actual = @"
@prefix : .
:s
@@ -35,23 +33,23 @@ public void Default()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Language()
- {
- var expected =
- LinqExpression.DebugInfo(
- LinqExpression.SymbolDocument(
- string.Empty,
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5")),
- 1,
- 1,
- 1,
- 1);
-
- const string actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void Language()
+ {
+ var expected =
+ LinqExpression.DebugInfo(
+ LinqExpression.SymbolDocument(
+ string.Empty,
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5")),
+ 1,
+ 1,
+ 1,
+ 1);
+
+ const string actual = @"
@prefix : .
:s
@@ -66,24 +64,24 @@ public void Language()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void LanguageVendor()
- {
- var expected =
- LinqExpression.DebugInfo(
- LinqExpression.SymbolDocument(
- string.Empty,
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5"),
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a6")),
- 1,
- 1,
- 1,
- 1);
-
- const string actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void LanguageVendor()
+ {
+ var expected =
+ LinqExpression.DebugInfo(
+ LinqExpression.SymbolDocument(
+ string.Empty,
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5"),
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a6")),
+ 1,
+ 1,
+ 1,
+ 1);
+
+ const string actual = @"
@prefix : .
:s
@@ -99,25 +97,25 @@ public void LanguageVendor()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void LanguageVendorType()
- {
- var expected =
- LinqExpression.DebugInfo(
- LinqExpression.SymbolDocument(
- string.Empty,
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5"),
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a6"),
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a7")),
- 1,
- 1,
- 1,
- 1);
-
- const string actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void LanguageVendorType()
+ {
+ var expected =
+ LinqExpression.DebugInfo(
+ LinqExpression.SymbolDocument(
+ string.Empty,
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5"),
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a6"),
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a7")),
+ 1,
+ 1,
+ 1,
+ 1);
+
+ const string actual = @"
@prefix : .
:s
@@ -134,7 +132,6 @@ public void LanguageVendorType()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/DynamicTests.cs b/GraphEngine.Tests/DynamicTests.cs
index c689642..6627d78 100644
--- a/GraphEngine.Tests/DynamicTests.cs
+++ b/GraphEngine.Tests/DynamicTests.cs
@@ -1,33 +1,30 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using Microsoft.CSharp.RuntimeBinder;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Linq = System.Linq.Expressions;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using Microsoft.CSharp.RuntimeBinder;
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class DynamicTests : TestBase
+[TestClass]
+public class DynamicTests : TestBase
+{
+ [TestMethod]
+ public void InvokeMember()
{
- [TestMethod]
- public void InvokeMember()
- {
- var expected =
- LinqExpression.Dynamic(
- Binder.InvokeMember(
- CSharpBinderFlags.None,
- "ToString",
- null,
- null,
- new[]
- {
- CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
- }),
- typeof(object),
- LinqExpression.Constant(0L));
+ var expected =
+ LinqExpression.Dynamic(
+ Binder.InvokeMember(
+ CSharpBinderFlags.None,
+ "ToString",
+ null,
+ null,
+ [
+ CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
+ ]),
+ typeof(object),
+ LinqExpression.Constant(0L));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -49,28 +46,27 @@ public void InvokeMember()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void BinaryOperation()
- {
- var expected =
- LinqExpression.Dynamic(
- Binder.BinaryOperation(
- CSharpBinderFlags.None,
- Linq.ExpressionType.Add,
- null,
- new[]
- {
- CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
- }),
- typeof(object),
- LinqExpression.Constant(2L),
- LinqExpression.Constant(3L));
+ [TestMethod]
+ public void BinaryOperation()
+ {
+ var expected =
+ LinqExpression.Dynamic(
+ Binder.BinaryOperation(
+ CSharpBinderFlags.None,
+ Linq.ExpressionType.Add,
+ null,
+ [
+ CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
+ CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
+ ]),
+ typeof(object),
+ LinqExpression.Constant(2L),
+ LinqExpression.Constant(3L));
- const string actual = @"
+ const string actual = @"
@prefix : .
@prefix xt: .
@@ -97,7 +93,6 @@ public void BinaryOperation()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/ExampleTests.cs b/GraphEngine.Tests/ExampleTests.cs
index 168ee3f..9c2f9e4 100644
--- a/GraphEngine.Tests/ExampleTests.cs
+++ b/GraphEngine.Tests/ExampleTests.cs
@@ -1,56 +1,51 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
+
+[TestClass]
+public class ExampleTests
{
- using System;
- using System.Linq;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using VDS.RDF;
- using LinqExpression = System.Linq.Expressions.Expression;
-
- [TestClass]
- public class ExampleTests
+ [TestMethod]
+ public void FibonacciXml()
{
- [TestMethod]
- public void FibonacciXml()
- {
- using var g = new Graph();
- g.LoadFromEmbeddedResource("GraphEngine.Tests.Resources.Examples.FibonacciSequence.xml,GraphEngine.Tests");
-
- NewMethod(g);
- }
-
- [TestMethod]
- public void FibonacciTurtle()
- {
- using var g = new Graph();
- g.LoadFromEmbeddedResource("GraphEngine.Tests.Resources.Examples.FibonacciSequence.ttl,GraphEngine.Tests");
-
- NewMethod(g);
- }
-
- [TestMethod]
- public void FibonacciJson()
- {
- using var ts = new TripleStore();
- ts.LoadFromEmbeddedResource("GraphEngine.Tests.Resources.Examples.FibonacciSequence.json,GraphEngine.Tests");
- var g = ts.Graphs.Single();
- g.NamespaceMap.AddNamespace(string.Empty, UriFactory.Create("http://example.com/"));
-
- NewMethod(g);
- }
-
- private static void NewMethod(IGraph g)
- {
- var s = g.GetUriNode(":s").In(g);
-
- var expression = Expression.Parse(s).LinqExpression;
- Console.WriteLine(expression.GetDebugView());
-
- var lambda = LinqExpression.Lambda(expression);
- var actual = lambda.Compile().DynamicInvoke();
-
- Assert.AreEqual(21L, actual);
- }
+ using var g = new Graph();
+ g.LoadFromEmbeddedResource("GraphEngine.Tests.Resources.Examples.FibonacciSequence.xml,GraphEngine.Tests");
+
+ NewMethod(g);
+ }
+
+ [TestMethod]
+ public void FibonacciTurtle()
+ {
+ using var g = new Graph();
+ g.LoadFromEmbeddedResource("GraphEngine.Tests.Resources.Examples.FibonacciSequence.ttl,GraphEngine.Tests");
+
+ NewMethod(g);
+ }
+
+ [TestMethod]
+ public void FibonacciJson()
+ {
+ using var ts = new TripleStore();
+ ts.LoadFromEmbeddedResource("GraphEngine.Tests.Resources.Examples.FibonacciSequence.json,GraphEngine.Tests");
+ var g = ts.Graphs.Single();
+ g.NamespaceMap.AddNamespace(string.Empty, UriFactory.Create("http://example.com/"));
+
+ NewMethod(g);
+ }
+
+ private static void NewMethod(IGraph g)
+ {
+ var s = g.GetUriNode(":s").In(g);
+
+ var expression = Expression.Parse(s).LinqExpression;
+ Console.WriteLine(expression.GetDebugView());
+
+ var lambda = LinqExpression.Lambda(expression);
+ var actual = lambda.Compile().DynamicInvoke();
+
+ Assert.AreEqual(21L, actual);
}
}
diff --git a/GraphEngine.Tests/ExpressionAssertions.cs b/GraphEngine.Tests/ExpressionAssertions.cs
index c4be7a7..d374d06 100644
--- a/GraphEngine.Tests/ExpressionAssertions.cs
+++ b/GraphEngine.Tests/ExpressionAssertions.cs
@@ -1,29 +1,22 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using FluentAssertions;
- using FluentAssertions.Execution;
- using FluentAssertions.Primitives;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
- internal class ExpressionAssertions : ReferenceTypeAssertions
- {
- internal ExpressionAssertions(LinqExpression expression)
- : base(expression)
- {
- }
+using FluentAssertions.Execution;
+using FluentAssertions.Primitives;
+using LinqExpression = System.Linq.Expressions.Expression;
- protected override string Identifier => "expression";
+internal class ExpressionAssertions(LinqExpression expression) : ReferenceTypeAssertions(expression)
+{
+ protected override string Identifier => "expression";
- internal AndConstraint Be(LinqExpression expected, string because = "", params object[] becauseArgs)
- {
- Execute.Assertion
- .BecauseOf(because, becauseArgs)
- .ForCondition(ExpressionTreeToolkit.ExpressionEqualityComparer.Default.Equals(this.Subject, expected))
- .FailWith("Expected {context:expression} to be equal to {0}{reason}, but {1} was not.", expected, this.Subject);
+ internal AndConstraint Be(LinqExpression expected, string because = "", params object[] becauseArgs)
+ {
+ Execute.Assertion
+ .BecauseOf(because, becauseArgs)
+ .ForCondition(ExpressionTreeToolkit.ExpressionEqualityComparer.Default.Equals(this.Subject, expected))
+ .FailWith("Expected {context:expression} to be equal to {0}{reason}, but {1} was not.", expected, this.Subject);
- return new AndConstraint(this);
- }
+ return new AndConstraint(this);
}
}
diff --git a/GraphEngine.Tests/FieldTests.cs b/GraphEngine.Tests/FieldTests.cs
index 3a69c51..fdedb1a 100644
--- a/GraphEngine.Tests/FieldTests.cs
+++ b/GraphEngine.Tests/FieldTests.cs
@@ -1,22 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class FieldTests : TestBase
+[TestClass]
+public class FieldTests : TestBase
+{
+ [TestMethod]
+ public void ExpressionName()
{
- [TestMethod]
- public void ExpressionName()
- {
- var expected =
- LinqExpression.Field(
- LinqExpression.Parameter(typeof(SampleClass)),
- nameof(SampleClass.InstanceField));
+ var expected =
+ LinqExpression.Field(
+ LinqExpression.Parameter(typeof(SampleClass)),
+ nameof(SampleClass.InstanceField));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -30,19 +29,19 @@ public void ExpressionName()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void ExpressionTypeName()
- {
- var expected =
- LinqExpression.Field(
- LinqExpression.Parameter(typeof(SampleDerivedClass)),
- typeof(SampleClass),
- nameof(SampleClass.InstanceField));
+ [TestMethod]
+ public void ExpressionTypeName()
+ {
+ var expected =
+ LinqExpression.Field(
+ LinqExpression.Parameter(typeof(SampleDerivedClass)),
+ typeof(SampleClass),
+ nameof(SampleClass.InstanceField));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -59,19 +58,19 @@ public void ExpressionTypeName()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void TypeName()
- {
- var expected =
- LinqExpression.Field(
- null,
- typeof(SampleClass),
- nameof(SampleClass.StaticField));
+ [TestMethod]
+ public void TypeName()
+ {
+ var expected =
+ LinqExpression.Field(
+ null,
+ typeof(SampleClass),
+ nameof(SampleClass.StaticField));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -83,7 +82,6 @@ public void TypeName()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/GraphEngine.Tests.csproj b/GraphEngine.Tests/GraphEngine.Tests.csproj
index 337c462..62f03d9 100644
--- a/GraphEngine.Tests/GraphEngine.Tests.csproj
+++ b/GraphEngine.Tests/GraphEngine.Tests.csproj
@@ -1,26 +1,23 @@
-
+
- net7.0
-
false
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GraphEngine.Tests/ListInitTests.cs b/GraphEngine.Tests/ListInitTests.cs
index fcb7f6b..7ebaedb 100644
--- a/GraphEngine.Tests/ListInitTests.cs
+++ b/GraphEngine.Tests/ListInitTests.cs
@@ -1,26 +1,24 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System.Collections.Generic;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class ListInitTests : TestBase
+[TestClass]
+public class ListInitTests : TestBase
+{
+ [TestMethod]
+ public void Default()
{
- [TestMethod]
- public void Default()
- {
- var expected =
- LinqExpression.ListInit(
- LinqExpression.New(
- typeof(List)),
- LinqExpression.ElementInit(
- typeof(List).GetMethod("Add"),
- LinqExpression.Constant(0L)));
+ var expected =
+ LinqExpression.ListInit(
+ LinqExpression.New(
+ typeof(List)),
+ LinqExpression.ElementInit(
+ typeof(List).GetMethod("Add"),
+ LinqExpression.Constant(0L)));
- var actual = @"
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -48,7 +46,6 @@ public void Default()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/MemberInitTests.cs b/GraphEngine.Tests/MemberInitTests.cs
index 0b88ba3..dc8b373 100644
--- a/GraphEngine.Tests/MemberInitTests.cs
+++ b/GraphEngine.Tests/MemberInitTests.cs
@@ -1,23 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System.Collections.Generic;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class MemberInitTests : TestBase
+[TestClass]
+public class MemberInitTests : TestBase
+{
+ [TestMethod]
+ public void No_bindings()
{
- [TestMethod]
- public void No_bindings()
- {
- var expected =
- LinqExpression.MemberInit(
- LinqExpression.New(
- typeof(SampleClass)));
-
- var actual = @"
+ var expected =
+ LinqExpression.MemberInit(
+ LinqExpression.New(
+ typeof(SampleClass)));
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -30,21 +28,21 @@ public void No_bindings()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void Bind()
- {
- var expected =
- LinqExpression.MemberInit(
- LinqExpression.New(
- typeof(SampleClass)),
- LinqExpression.Bind(
- typeof(SampleClass).GetField(nameof(SampleClass.InstanceField)),
- LinqExpression.Constant(string.Empty)));
+ ShouldBe(actual, expected);
+ }
- var actual = @"
+ [TestMethod]
+ public void Bind()
+ {
+ var expected =
+ LinqExpression.MemberInit(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ LinqExpression.Bind(
+ typeof(SampleClass).GetField(nameof(SampleClass.InstanceField)),
+ LinqExpression.Constant(string.Empty)));
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -70,23 +68,23 @@ public void Bind()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void ListBind()
- {
- var expected =
- LinqExpression.MemberInit(
- LinqExpression.New(
- typeof(SampleClass)),
- LinqExpression.ListBind(
- typeof(SampleClass).GetProperty(nameof(SampleClass.ListProperty)),
- LinqExpression.ElementInit(
- typeof(List).GetMethod("Add"),
- LinqExpression.Constant(0L))));
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void ListBind()
+ {
+ var expected =
+ LinqExpression.MemberInit(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ LinqExpression.ListBind(
+ typeof(SampleClass).GetProperty(nameof(SampleClass.ListProperty)),
+ LinqExpression.ElementInit(
+ typeof(List).GetMethod("Add"),
+ LinqExpression.Constant(0L))));
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -124,24 +122,24 @@ public void ListBind()
.
";
- ShouldBe(actual, expected);
- }
-
- [TestMethod]
- public void MemberBind()
- {
- var expected =
- LinqExpression.MemberInit(
- LinqExpression.New(
- typeof(SampleClass)),
- LinqExpression.MemberBind(
- typeof(SampleClass).GetField(nameof(SampleClass.ComplexField)),
- LinqExpression.Bind(
- typeof(SampleClass).GetField(nameof(SampleClass.InstanceField)),
- LinqExpression.Constant(
- string.Empty))));
-
- var actual = @"
+ ShouldBe(actual, expected);
+ }
+
+ [TestMethod]
+ public void MemberBind()
+ {
+ var expected =
+ LinqExpression.MemberInit(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ LinqExpression.MemberBind(
+ typeof(SampleClass).GetField(nameof(SampleClass.ComplexField)),
+ LinqExpression.Bind(
+ typeof(SampleClass).GetField(nameof(SampleClass.InstanceField)),
+ LinqExpression.Constant(
+ string.Empty))));
+
+ var actual = @"
@prefix xsd: .
@prefix : .
@@ -177,7 +175,6 @@ public void MemberBind()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/PropertyOrFieldTests.cs b/GraphEngine.Tests/PropertyOrFieldTests.cs
index 195af2f..f6c0dbd 100644
--- a/GraphEngine.Tests/PropertyOrFieldTests.cs
+++ b/GraphEngine.Tests/PropertyOrFieldTests.cs
@@ -1,24 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System;
- using FluentAssertions;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class PropertyOrFieldTests : TestBase
+[TestClass]
+public class PropertyOrFieldTests : TestBase
+{
+ [TestMethod]
+ public void Name()
{
- [TestMethod]
- public void Name()
- {
- var expected =
- LinqExpression.PropertyOrField(
- LinqExpression.Parameter(typeof(SampleClass)),
- nameof(SampleClass.InstanceField));
-
- const string actual = @"
+ var expected =
+ LinqExpression.PropertyOrField(
+ LinqExpression.Parameter(typeof(SampleClass)),
+ nameof(SampleClass.InstanceField));
+
+ const string actual = @"
@prefix : .
:s
@@ -27,18 +24,18 @@ public void Name()
.
";
- ((Action)(() => ShouldBe(actual, expected))).Should().Throw();
- }
+ ((Action)(() => ShouldBe(actual, expected))).Should().Throw();
+ }
- [TestMethod]
- public void ExpressionName()
- {
- var expected =
- LinqExpression.PropertyOrField(
- LinqExpression.Parameter(typeof(SampleClass)),
- nameof(SampleClass.InstanceField));
+ [TestMethod]
+ public void ExpressionName()
+ {
+ var expected =
+ LinqExpression.PropertyOrField(
+ LinqExpression.Parameter(typeof(SampleClass)),
+ nameof(SampleClass.InstanceField));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -52,7 +49,6 @@ public void ExpressionName()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/PropertyTests.cs b/GraphEngine.Tests/PropertyTests.cs
index d86fdb1..19ca9a7 100644
--- a/GraphEngine.Tests/PropertyTests.cs
+++ b/GraphEngine.Tests/PropertyTests.cs
@@ -1,22 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class PropertyTests : TestBase
+[TestClass]
+public class PropertyTests : TestBase
+{
+ [TestMethod]
+ public void NameExpression()
{
- [TestMethod]
- public void NameExpression()
- {
- var expected =
- LinqExpression.Property(
- LinqExpression.Parameter(typeof(SampleClass)),
- nameof(SampleClass.InstanceProperty));
-
- const string actual = @"
+ var expected =
+ LinqExpression.Property(
+ LinqExpression.Parameter(typeof(SampleClass)),
+ nameof(SampleClass.InstanceProperty));
+
+ const string actual = @"
@prefix : .
:s
@@ -30,19 +29,19 @@ public void NameExpression()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void NameExpressionType()
- {
- var expected =
- LinqExpression.Property(
- LinqExpression.Parameter(typeof(SampleDerivedClass)),
- typeof(SampleClass),
- nameof(SampleClass.InstanceProperty));
+ [TestMethod]
+ public void NameExpressionType()
+ {
+ var expected =
+ LinqExpression.Property(
+ LinqExpression.Parameter(typeof(SampleDerivedClass)),
+ typeof(SampleClass),
+ nameof(SampleClass.InstanceProperty));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -59,19 +58,19 @@ public void NameExpressionType()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void NameType()
- {
- var expected =
- LinqExpression.Property(
- null,
- typeof(SampleClass),
- nameof(SampleClass.StaticProperty));
+ [TestMethod]
+ public void NameType()
+ {
+ var expected =
+ LinqExpression.Property(
+ null,
+ typeof(SampleClass),
+ nameof(SampleClass.StaticProperty));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -83,19 +82,19 @@ public void NameType()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void NameExpressionArguments()
- {
- var expected =
- LinqExpression.Property(
- LinqExpression.Parameter(typeof(SampleClass)),
- "Indexer",
- LinqExpression.Parameter(typeof(int)));
+ [TestMethod]
+ public void NameExpressionArguments()
+ {
+ var expected =
+ LinqExpression.Property(
+ LinqExpression.Parameter(typeof(SampleClass)),
+ "Indexer",
+ LinqExpression.Parameter(typeof(int)));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -116,7 +115,6 @@ public void NameExpressionArguments()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/RethrowTests.cs b/GraphEngine.Tests/RethrowTests.cs
index e3c8b0b..8ec6479 100644
--- a/GraphEngine.Tests/RethrowTests.cs
+++ b/GraphEngine.Tests/RethrowTests.cs
@@ -1,21 +1,19 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class RethrowTests : TestBase
+[TestClass]
+public class RethrowTests : TestBase
+{
+ [TestMethod]
+ public void Default()
{
- [TestMethod]
- public void Default()
- {
- var expected =
- LinqExpression.Rethrow();
+ var expected =
+ LinqExpression.Rethrow();
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -23,17 +21,17 @@ public void Default()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Type()
- {
- var expected =
- LinqExpression.Rethrow(
- typeof(Exception));
+ [TestMethod]
+ public void Type()
+ {
+ var expected =
+ LinqExpression.Rethrow(
+ typeof(Exception));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -44,7 +42,6 @@ public void Type()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/RuntimeVariablesTests.cs b/GraphEngine.Tests/RuntimeVariablesTests.cs
index d30b81f..bf88bc6 100644
--- a/GraphEngine.Tests/RuntimeVariablesTests.cs
+++ b/GraphEngine.Tests/RuntimeVariablesTests.cs
@@ -1,22 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class RuntimeVariablesTests : TestBase
+[TestClass]
+public class RuntimeVariablesTests : TestBase
+{
+ [TestMethod]
+ public void Default()
{
- [TestMethod]
- public void Default()
- {
- var expected =
- LinqExpression.RuntimeVariables(
- LinqExpression.Parameter(
- typeof(object)));
+ var expected =
+ LinqExpression.RuntimeVariables(
+ LinqExpression.Parameter(
+ typeof(object)));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -30,7 +29,6 @@ public void Default()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/SampleClass.cs b/GraphEngine.Tests/SampleClass.cs
index 693303d..29968e3 100644
--- a/GraphEngine.Tests/SampleClass.cs
+++ b/GraphEngine.Tests/SampleClass.cs
@@ -1,80 +1,79 @@
// MIT License, Copyright 2020 Samu Lang
-#pragma warning disable CA1051 // Do not declare visible instance fields
-#pragma warning disable CA1801 // Review unused parameters
+#pragma warning disable IDE0079 // Remove unnecessary suppression
+#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
#pragma warning disable CA2211 // Non-constant fields should not be visible
#pragma warning disable SA1401 // Fields should be private
-#pragma warning disable SA1402 // File may only contain a single type
+#pragma warning disable CA1822 // Mark members as static
+#pragma warning disable IDE0060 // Remove unused parameter
-namespace GraphEngine.Tests
-{
- using System;
- using System.Collections.Generic;
- using System.Runtime.CompilerServices;
+namespace GraphEngine.Tests;
- public class SampleClass
- {
- public static string StaticField;
- public string InstanceField;
- public SampleClass ComplexField;
+using System.Runtime.CompilerServices;
- public static string StaticProperty { get; set; }
+public class SampleClass
+{
+ public static string StaticField;
+ public string InstanceField;
+ public SampleClass ComplexField;
- public string InstanceProperty { get; set; }
+ public static string StaticProperty { get; set; }
- public List ListProperty { get; }
+ public string InstanceProperty { get; set; }
- [IndexerName("Indexer")]
- public string this[int index]
- {
- get => default;
- set { }
- }
+ public List ListProperty { get; }
- public static bool Equal(long obj1, long obj2) => throw new NotImplementedException();
+ [IndexerName("Indexer")]
+ public string this[int index]
+ {
+ get => default!;
+ set { }
+ }
- public static void StaticMethod()
- {
- }
+ public static bool Equal(long obj1, long obj2) => throw new NotImplementedException();
- public static void GenericStaticMethod()
- {
- }
+ public static void StaticMethod()
+ {
+ }
- public static void StaticMethodWithArgument(long arg)
- {
- }
+ public static void GenericStaticMethod()
+ {
+ }
- public static bool StaticFunctionWithArgument(bool arg) => default;
+ public static void StaticMethodWithArgument(long arg)
+ {
+ }
- public static void GenericStaticMethodWithArgument(long arg)
- {
- }
+ public static bool StaticFunctionWithArgument(bool arg) => default;
- public void InstanceMethod()
- {
- }
+ public static void GenericStaticMethodWithArgument(long arg)
+ {
+ }
- public void GenericInstanceMethod()
- {
- }
+ public void InstanceMethod()
+ {
+ }
- public void InstanceMethodWithArgument(long arg)
- {
- }
+ public void GenericInstanceMethod()
+ {
+ }
- public void GenericInstanceMethodWithArgument(long arg)
- {
- }
+ public void InstanceMethodWithArgument(long arg)
+ {
}
- public class SampleDerivedClass : SampleClass
+ public void GenericInstanceMethodWithArgument(long arg)
{
}
}
-#pragma warning restore CA1051 // Do not declare visible instance fields
-#pragma warning restore CA1801 // Review unused parameters
+public class SampleDerivedClass : SampleClass
+{
+}
+
+#pragma warning restore IDE0060 // Remove unused parameter
+#pragma warning restore CA1822 // Mark members as static
#pragma warning restore CA2211 // Non-constant fields should not be visible
#pragma warning restore SA1401 // Fields should be private
-#pragma warning restore SA1402 // File may only contain a single type
+#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
+#pragma warning restore IDE0079 // Remove unnecessary suppression
diff --git a/GraphEngine.Tests/SchemaTests.cs b/GraphEngine.Tests/SchemaTests.cs
index 47c9dc2..2106abb 100644
--- a/GraphEngine.Tests/SchemaTests.cs
+++ b/GraphEngine.Tests/SchemaTests.cs
@@ -1,244 +1,236 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text.RegularExpressions;
- using FluentAssertions;
- using GraphEngine.Ontology;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using VDS.RDF;
- using VDS.RDF.Parsing;
+namespace GraphEngine.Tests;
- [TestClass]
- public class SchemaTests
- {
- private static readonly Ontology.Graph OntologyGraph = new ();
- private static string ontologyString;
+using System.Text.RegularExpressions;
+using GraphEngine.Ontology;
+using VDS.RDF.Parsing;
- private static IEnumerable Ontologies => OntologyGraph.Ontologies.Select(o => new[] { o });
+[TestClass]
+public class SchemaTests
+{
+ private static readonly Ontology.Graph OntologyGraph = new ();
+ private static string ontologyString;
- private static IEnumerable Properties => OntologyGraph.DatatypeProperties.Union(OntologyGraph.ObjectProperties).Select(p => new[] { p });
+ private static IEnumerable Ontologies => OntologyGraph.Ontologies.Select(o => new[] { o });
- private static IEnumerable ObjectProperties => OntologyGraph.ObjectProperties.Select(p => new[] { p });
+ private static IEnumerable Properties => OntologyGraph.DatatypeProperties.Union(OntologyGraph.ObjectProperties).Select(p => new[] { p });
- private static IEnumerable Classes => OntologyGraph.Classes.Select(c => new[] { c });
+ private static IEnumerable ObjectProperties => OntologyGraph.ObjectProperties.Select(p => new[] { p });
- private static IEnumerable Resources => Ontologies.Union(Classes).Union(Properties);
+ private static IEnumerable Classes => OntologyGraph.Classes.Select(c => new[] { c });
- private static IEnumerable ClassNames =>
- Regex.Matches(ontologyString, @"^:\p{Lu}\w*", RegexOptions.Multiline)
- .Select(m => m.Value)
- .Pairwise();
+ private static IEnumerable Resources => Ontologies.Union(Classes).Union(Properties);
- private static IEnumerable PropertyNames =>
- Regex.Matches(ontologyString, @"^:\p{Ll}\w*", RegexOptions.Multiline)
- .Select(m => m.Value)
- .Pairwise();
+ private static IEnumerable ClassNames =>
+ Regex.Matches(ontologyString, @"^:\p{Lu}\w*", RegexOptions.Multiline)
+ .Select(m => m.Value)
+ .Pairwise();
- [ClassInitialize]
- public static void ClassInit(TestContext context)
- {
- OntologyGraph.LoadFromEmbeddedResource("GraphEngine.Resources.Schema.ttl, GraphEngine");
+ private static IEnumerable PropertyNames =>
+ Regex.Matches(ontologyString, @"^:\p{Ll}\w*", RegexOptions.Multiline)
+ .Select(m => m.Value)
+ .Pairwise();
- using var reader = new StreamReader(typeof(Ontology.Graph).Assembly.GetManifestResourceStream("GraphEngine.Resources.Schema.ttl"));
- ontologyString = reader.ReadToEnd();
- }
+ [ClassInitialize]
+ public static void ClassInit(TestContext context)
+ {
+ OntologyGraph.LoadFromEmbeddedResource("GraphEngine.Resources.Schema.ttl, GraphEngine");
- [TestMethod]
- [DynamicData(nameof(Classes))]
- public void Class_name_is_in_pascal_case(Class @class)
- {
- Vocabulary.BaseUri.MakeRelativeUri(@class.Uri).ToString().Should().MatchRegex(@"^[A-Z]([a-z]|[A-Z]|[0-9])*$", "classes must be PascalCased");
- }
+ using var reader = new StreamReader(typeof(Ontology.Graph).Assembly.GetManifestResourceStream("GraphEngine.Resources.Schema.ttl"));
+ ontologyString = reader.ReadToEnd();
+ }
- [TestMethod]
- [DynamicData(nameof(Classes))]
- public void Class_superclasses_are_classes(Class @class)
- {
- foreach (var superclass in @class.SubClassOf.Where(Is_from_namespace))
- {
- superclass.Should().Match(s => OntologyGraph.Classes.Contains(s), "superclasses must have class definitions");
- }
- }
+ [TestMethod]
+ [DynamicData(nameof(Classes))]
+ public void Class_name_is_in_pascal_case(Class @class)
+ {
+ Vocabulary.BaseUri.MakeRelativeUri(@class.Uri).ToString().Should().MatchRegex(@"^[A-Z]([a-z]|[A-Z]|[0-9])*$", "classes must be PascalCased");
+ }
- [TestMethod]
- [DynamicData(nameof(ClassNames))]
- public void Classes_are_ordered(string a, string b)
+ [TestMethod]
+ [DynamicData(nameof(Classes))]
+ public void Class_superclasses_are_classes(Class @class)
+ {
+ foreach (var superclass in @class.SubClassOf.Where(Is_from_namespace))
{
- new[] { a, b }.Should().BeInAscendingOrder("classes must be ordered alphabetically");
+ superclass.Should().Match(s => OntologyGraph.Classes.Contains(s), "superclasses must have class definitions");
}
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Comment_is_literal(Resource resource)
- {
- foreach (var comment in resource.Comments)
- {
- comment.NodeType.Should().Be(NodeType.Literal, "commentss must be literals");
- }
- }
+ [TestMethod]
+ [DynamicData(nameof(ClassNames))]
+ public void Classes_are_ordered(string a, string b)
+ {
+ new[] { a, b }.Should().BeInAscendingOrder("classes must be ordered alphabetically");
+ }
- // TODO: Enable
- // [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Comment_is_not_empty(Resource resource)
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Comment_is_literal(Resource resource)
+ {
+ foreach (var comment in resource.Comments)
{
- foreach (var comment in resource.Comments.LiteralNodes())
- {
- comment.Value.Should().NotBeEmpty("comments must not be empty");
- }
+ comment.NodeType.Should().Be(NodeType.Literal, "commentss must be literals");
}
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Comment_is_string(Resource resource)
+ // TODO: Enable
+ // [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Comment_is_not_empty(Resource resource)
+ {
+ foreach (var comment in resource.Comments.LiteralNodes())
{
- foreach (var comment in resource.Comments.LiteralNodes().Where(comment => comment.DataType is not null))
- {
- comment.DataType.AbsoluteUri.Should().BeOneOf(RdfSpecsHelper.RdfLangString, XmlSpecsHelper.XmlSchemaDataTypeString, "commentss must be strings");
- }
+ comment.Value.Should().NotBeEmpty("comments must not be empty");
}
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Label_is_literal(Resource resource)
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Comment_is_string(Resource resource)
+ {
+ foreach (var comment in resource.Comments.LiteralNodes().Where(comment => comment.DataType is not null))
{
- foreach (var label in resource.Labels)
- {
- label.NodeType.Should().Be(NodeType.Literal, "labels must be literals");
- }
+ comment.DataType.AbsoluteUri.Should().BeOneOf(RdfSpecsHelper.RdfLangString, XmlSpecsHelper.XmlSchemaDataTypeString, "commentss must be strings");
}
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Label_is_not_empty(Resource resource)
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Label_is_literal(Resource resource)
+ {
+ foreach (var label in resource.Labels)
{
- foreach (var label in resource.Labels.LiteralNodes())
- {
- label.Value.Should().NotBeEmpty("labels must not be empty");
- }
+ label.NodeType.Should().Be(NodeType.Literal, "labels must be literals");
}
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Label_is_string(Resource resource)
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Label_is_not_empty(Resource resource)
+ {
+ foreach (var label in resource.Labels.LiteralNodes())
{
- foreach (var label in resource.Labels.LiteralNodes().Where(label => label.DataType is not null))
- {
- label.DataType.AbsoluteUri.Should().BeOneOf(RdfSpecsHelper.RdfLangString, XmlSpecsHelper.XmlSchemaDataTypeString, "labels must be strings");
- }
+ label.Value.Should().NotBeEmpty("labels must not be empty");
}
+ }
- [TestMethod]
- [DynamicData(nameof(ObjectProperties))]
- public void Object_property_ranges_are_classes(Property property)
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Label_is_string(Resource resource)
+ {
+ foreach (var label in resource.Labels.LiteralNodes().Where(label => label.DataType is not null))
{
- foreach (var range in property.Ranges.Where(Is_from_namespace))
- {
- range.Should().Match(r => OntologyGraph.Classes.Contains(r), "ranges must have class definitions");
- }
+ label.DataType.AbsoluteUri.Should().BeOneOf(RdfSpecsHelper.RdfLangString, XmlSpecsHelper.XmlSchemaDataTypeString, "labels must be strings");
}
+ }
- [TestMethod]
- public void Only_one_ontology()
+ [TestMethod]
+ [DynamicData(nameof(ObjectProperties))]
+ public void Object_property_ranges_are_classes(Property property)
+ {
+ foreach (var range in property.Ranges.Where(Is_from_namespace))
{
- Ontologies.Should().ContainSingle("graph must define exactly one ontology");
+ range.Should().Match(r => OntologyGraph.Classes.Contains(r), "ranges must have class definitions");
}
+ }
- [TestMethod]
- [DynamicData(nameof(Ontologies))]
- public void Ontology_has_correct_uri(Resource ontology)
- {
- ontology.Should().Be(Vocabulary.Ontology, "ontology must have correct URI");
- }
+ [TestMethod]
+ public void Only_one_ontology()
+ {
+ Ontologies.Should().ContainSingle("graph must define exactly one ontology");
+ }
- [TestMethod]
- [DynamicData(nameof(PropertyNames))]
- public void Properties_are_ordered(string a, string b)
- {
- new[] { a, b }.Should().BeInAscendingOrder("properties must be ordered alphabetically");
- }
+ [TestMethod]
+ [DynamicData(nameof(Ontologies))]
+ public void Ontology_has_correct_uri(Resource ontology)
+ {
+ ontology.Should().Be(Vocabulary.Ontology, "ontology must have correct URI");
+ }
- [TestMethod]
- [DynamicData(nameof(Properties))]
- public void Property_domains_are_classes(Property property)
- {
- foreach (var domain in property.Domains.Where(Is_from_namespace))
- {
- domain.Should().Match(d => OntologyGraph.Classes.Contains(d), "domains must have class definitions");
- }
- }
+ [TestMethod]
+ [DynamicData(nameof(PropertyNames))]
+ public void Properties_are_ordered(string a, string b)
+ {
+ new[] { a, b }.Should().BeInAscendingOrder("properties must be ordered alphabetically");
+ }
- [TestMethod]
- [DynamicData(nameof(Properties))]
- public void Property_has_one_domain(Property property)
+ [TestMethod]
+ [DynamicData(nameof(Properties))]
+ public void Property_domains_are_classes(Property property)
+ {
+ foreach (var domain in property.Domains.Where(Is_from_namespace))
{
- property.Domains.Should().ContainSingle("properties must have exactly one domain");
+ domain.Should().Match(d => OntologyGraph.Classes.Contains(d), "domains must have class definitions");
}
+ }
- [TestMethod]
- [DynamicData(nameof(Properties))]
- public void Property_has_one_range(Property property)
- {
- property.Ranges.Should().ContainSingle("properties must have exactly one range");
- }
+ [TestMethod]
+ [DynamicData(nameof(Properties))]
+ public void Property_has_one_domain(Property property)
+ {
+ property.Domains.Should().ContainSingle("properties must have exactly one domain");
+ }
- [TestMethod]
- [DynamicData(nameof(Properties))]
- public void Property_name_is_in_camel_case(Property property)
- {
- Vocabulary.BaseUri.MakeRelativeUri(property.Uri).ToString().Should().MatchRegex(@"^[a-z]([a-z]|[A-Z]|[0-9])*$", "properties must be camelCased");
- }
+ [TestMethod]
+ [DynamicData(nameof(Properties))]
+ public void Property_has_one_range(Property property)
+ {
+ property.Ranges.Should().ContainSingle("properties must have exactly one range");
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Resource_has_one_comment(Resource resource)
- {
- resource.Comments.Should().ContainSingle("resources must have exactly one comment");
- }
+ [TestMethod]
+ [DynamicData(nameof(Properties))]
+ public void Property_name_is_in_camel_case(Property property)
+ {
+ Vocabulary.BaseUri.MakeRelativeUri(property.Uri).ToString().Should().MatchRegex(@"^[a-z]([a-z]|[A-Z]|[0-9])*$", "properties must be camelCased");
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Resource_has_one_label(Resource resource)
- {
- resource.Labels.Should().ContainSingle("resources must have exactly one label");
- }
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Resource_has_one_comment(Resource resource)
+ {
+ resource.Comments.Should().ContainSingle("resources must have exactly one comment");
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Resource_has_one_type(Resource resource)
- {
- resource.Types.Should().ContainSingle("resources must have exactly one type");
- }
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Resource_has_one_label(Resource resource)
+ {
+ resource.Labels.Should().ContainSingle("resources must have exactly one label");
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Resource_is_defined_by_correct_ontology(Resource resource)
- {
- CollectionAssert.AreEqual(OntologyGraph.Ontologies.ToList(), resource.IsDefinedBy.ToList(), "resources must be defined by correct ontology");
- }
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Resource_has_one_type(Resource resource)
+ {
+ resource.Types.Should().ContainSingle("resources must have exactly one type");
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Resource_is_defined_by_one_ontology(Resource resource)
- {
- resource.IsDefinedBy.Should().ContainSingle("resources must be defined by exactly one ontology");
- }
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Resource_is_defined_by_correct_ontology(Resource resource)
+ {
+ CollectionAssert.AreEqual(OntologyGraph.Ontologies.ToList(), resource.IsDefinedBy.ToList(), "resources must be defined by correct ontology");
+ }
- [TestMethod]
- [DynamicData(nameof(Resources))]
- public void Resource_is_from_namespace(Resource resource)
- {
- resource.Should().Match(r => Is_from_namespace(r), "resources must be from correct namespace");
- }
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Resource_is_defined_by_one_ontology(Resource resource)
+ {
+ resource.IsDefinedBy.Should().ContainSingle("resources must be defined by exactly one ontology");
+ }
- private static bool Is_from_namespace(Resource resource)
- {
- return Vocabulary.BaseUri.IsBaseOf(resource.Uri) && !Vocabulary.BaseUri.MakeRelativeUri(resource.Uri).ToString().Contains('/', StringComparison.Ordinal);
- }
+ [TestMethod]
+ [DynamicData(nameof(Resources))]
+ public void Resource_is_from_namespace(Resource resource)
+ {
+ resource.Should().Match(r => Is_from_namespace(r), "resources must be from correct namespace");
+ }
+
+ private static bool Is_from_namespace(Resource resource)
+ {
+ return Vocabulary.BaseUri.IsBaseOf(resource.Uri) && !Vocabulary.BaseUri.MakeRelativeUri(resource.Uri).ToString().Contains('/', StringComparison.Ordinal);
}
}
diff --git a/GraphEngine.Tests/SerialisingVisitorTests.cs b/GraphEngine.Tests/SerialisingVisitorTests.cs
index c988451..2ac0cf1 100644
--- a/GraphEngine.Tests/SerialisingVisitorTests.cs
+++ b/GraphEngine.Tests/SerialisingVisitorTests.cs
@@ -1,974 +1,954 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
+namespace GraphEngine.Tests;
+
+using Microsoft.CSharp.RuntimeBinder;
+using VDS.RDF.Writing;
+using LinqExpression = System.Linq.Expressions.Expression;
+
+[TestClass]
+public class SerialisingVisitorTests
{
- using System;
- using System.Collections.Generic;
- using Microsoft.CSharp.RuntimeBinder;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using VDS.RDF.Writing;
- using Linq = System.Linq.Expressions;
- using LinqExpression = System.Linq.Expressions.Expression;
-
- [TestClass]
- public class SerialisingVisitorTests
- {
- [TestMethod]
- public void ArrayAccess()
- {
- var expression =
- LinqExpression.ArrayAccess(
- LinqExpression.Parameter(
- typeof(int[])),
+ [TestMethod]
+ public void ArrayAccess()
+ {
+ var expression =
+ LinqExpression.ArrayAccess(
+ LinqExpression.Parameter(
+ typeof(int[])),
+ LinqExpression.Parameter(
+ typeof(int)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void ArrayIndex_index()
+ {
+ var expression =
+ LinqExpression.ArrayIndex(
+ LinqExpression.Parameter(
+ typeof(int[])),
+ LinqExpression.Parameter(
+ typeof(int)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void ArrayIndex_indexes()
+ {
+ var expression =
+ LinqExpression.ArrayIndex(
+ LinqExpression.Parameter(
+ typeof(int[])),
+ [
LinqExpression.Parameter(
- typeof(int)));
+ typeof(int)),
+ ]);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Binary()
+ {
+ var param = LinqExpression.Parameter(typeof(int));
+ var expression = LinqExpression.Add(param, param);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void BinaryMethod()
+ {
+ var zero =
+ LinqExpression.Default(
+ typeof(long));
- ShouldRoundrip(expression);
- }
+ var expression =
+ LinqExpression.Add(
+ zero,
+ zero,
+ typeof(SampleClass).GetMethod(nameof(SampleClass.Equal)));
- [TestMethod]
- public void ArrayIndex_index()
- {
- var expression =
- LinqExpression.ArrayIndex(
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void BinaryLiftToNull()
+ {
+ var zero =
+ LinqExpression.Default(
+ typeof(int?));
+
+ var expression =
+ LinqExpression.LessThan(
+ zero,
+ zero,
+ true,
+ null);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void BinaryConversion()
+ {
+ var @object = typeof(object);
+ var @null =
+ LinqExpression.Default(
+ @object);
+
+ var expression =
+ LinqExpression.Coalesce(
+ @null,
+ @null,
+ LinqExpression.Lambda(
+ @null,
LinqExpression.Parameter(
- typeof(int[])),
+ @object)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Dynamic_InvokeMember()
+ {
+ var expression =
+ LinqExpression.Dynamic(
+ Binder.InvokeMember(
+ CSharpBinderFlags.None,
+ "ToString",
+ null,
+ null,
+ [
+ CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
+ ]),
+ typeof(object),
+ LinqExpression.Constant(0L));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Dynamic_BinaryOperation()
+ {
+ var expression =
+ LinqExpression.Dynamic(
+ Binder.BinaryOperation(
+ CSharpBinderFlags.None,
+ Linq.ExpressionType.Add,
+ null,
+ [
+ CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
+ CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
+ ]),
+ typeof(object),
+ LinqExpression.Constant(2L),
+ LinqExpression.Constant(3L));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Empty()
+ {
+ var expression = LinqExpression.Empty();
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Block_Expressions()
+ {
+ var expression =
+ LinqExpression.Block(
+ LinqExpression.Default(typeof(string)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Block_ExpressionsVariables()
+ {
+ var expression =
+ LinqExpression.Block(
+ [
LinqExpression.Parameter(
- typeof(int)));
+ typeof(string)),
+ ],
+ [
+ LinqExpression.Default(
+ typeof(string)),
+ ]);
- ShouldRoundrip(expression);
- }
+ ShouldRoundrip(expression);
+ }
- [TestMethod]
- public void ArrayIndex_indexes()
- {
- var expression =
- LinqExpression.ArrayIndex(
+ [TestMethod]
+ public void Block_TypeExpressions()
+ {
+ var expression =
+ LinqExpression.Block(
+ typeof(object),
+ LinqExpression.Default(typeof(string)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Block_TypeExpressionsVariables()
+ {
+ var expression =
+ LinqExpression.Block(
+ typeof(object),
+ [
LinqExpression.Parameter(
- typeof(int[])),
- new[]
- {
- LinqExpression.Parameter(
- typeof(int)),
- });
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Binary()
- {
- var param = LinqExpression.Parameter(typeof(int));
- var expression = LinqExpression.Add(param, param);
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void BinaryMethod()
- {
- var zero =
- LinqExpression.Default(
- typeof(long));
+ typeof(string)),
+ ],
+ [
+ LinqExpression.Default(
+ typeof(string)),
+ ]);
- var expression =
- LinqExpression.Add(
- zero,
- zero,
- typeof(SampleClass).GetMethod(nameof(SampleClass.Equal)));
+ ShouldRoundrip(expression);
+ }
- ShouldRoundrip(expression);
- }
+ [TestMethod]
+ public void Break()
+ {
+ var expression = LinqExpression.Break(
+ LinqExpression.Label(
+ typeof(void)));
- [TestMethod]
- public void BinaryLiftToNull()
- {
- var zero =
- LinqExpression.Default(
- typeof(int?));
-
- var expression =
- LinqExpression.LessThan(
- zero,
- zero,
- true,
- null);
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void BinaryConversion()
- {
- var @object = typeof(object);
- var @null =
- LinqExpression.Default(
- @object);
+ ShouldRoundrip(expression);
+ }
- var expression =
- LinqExpression.Coalesce(
- @null,
- @null,
- LinqExpression.Lambda(
- @null,
- LinqExpression.Parameter(
- @object)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Dynamic_InvokeMember()
- {
- var expression =
- LinqExpression.Dynamic(
- Binder.InvokeMember(
- CSharpBinderFlags.None,
- "ToString",
- null,
- null,
- new[]
- {
- CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
- }),
+ [TestMethod]
+ public void Call_Method()
+ {
+ var expression =
+ LinqExpression.Call(
+ typeof(SampleClass).GetMethod(nameof(SampleClass.StaticMethod)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Method_Arguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ typeof(SampleClass).GetMethod(nameof(SampleClass.StaticMethodWithArgument)),
+ LinqExpression.Constant(0L));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Method_TypeArguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ typeof(SampleClass).GetMethod(nameof(SampleClass.GenericStaticMethod)).MakeGenericMethod(typeof(object)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Method_TypeArguments_Arguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ typeof(SampleClass).GetMethod(nameof(SampleClass.GenericStaticMethodWithArgument)).MakeGenericMethod(typeof(object)),
+ LinqExpression.Constant(0L));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Method_Instance()
+ {
+ var expression =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ typeof(SampleClass).GetMethod(nameof(SampleClass.InstanceMethod)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Method_Instance_Arguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ typeof(SampleClass).GetMethod(nameof(SampleClass.InstanceMethodWithArgument)),
+ LinqExpression.Constant(0L));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Method_Instance_TypeArguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ typeof(SampleClass).GetMethod(nameof(SampleClass.GenericInstanceMethod)).MakeGenericMethod(typeof(object)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Method_Instance_TypeArguments_Arguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ typeof(SampleClass).GetMethod(nameof(SampleClass.GenericInstanceMethodWithArgument)).MakeGenericMethod(typeof(object)),
+ LinqExpression.Constant(0L));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Type()
+ {
+ var expression =
+ LinqExpression.Call(
+ typeof(SampleClass),
+ nameof(SampleClass.StaticMethod),
+ [],
+ []);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Type_Arguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ typeof(SampleClass),
+ nameof(SampleClass.StaticMethodWithArgument),
+ [],
+ [
+ LinqExpression.Constant(0L),
+ ]);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Type_TypeArguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ typeof(SampleClass),
+ nameof(SampleClass.GenericStaticMethod),
+ [
typeof(object),
- LinqExpression.Constant(0L));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Dynamic_BinaryOperation()
- {
- var expression =
- LinqExpression.Dynamic(
- Binder.BinaryOperation(
- CSharpBinderFlags.None,
- Linq.ExpressionType.Add,
- null,
- new[]
- {
- CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
- CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
- }),
+ ],
+ []);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Type_TypeArguments_Arguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ typeof(SampleClass),
+ nameof(SampleClass.GenericStaticMethodWithArgument),
+ [
typeof(object),
- LinqExpression.Constant(2L),
- LinqExpression.Constant(3L));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Empty()
- {
- var expression = LinqExpression.Empty();
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Block_Expressions()
- {
- var expression =
- LinqExpression.Block(
- LinqExpression.Default(typeof(string)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Block_ExpressionsVariables()
- {
- var expression =
- LinqExpression.Block(
- new[]
- {
- LinqExpression.Parameter(
- typeof(string)),
- },
- new[]
- {
- LinqExpression.Default(
- typeof(string)),
- });
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Block_TypeExpressions()
- {
- var expression =
- LinqExpression.Block(
+ ],
+ [
+ LinqExpression.Constant(0L),
+ ]);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Default()
+ {
+ var expression =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ nameof(SampleClass.InstanceMethod),
+ [],
+ []);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Default_Arguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ nameof(SampleClass.InstanceMethodWithArgument),
+ [],
+ [
+ LinqExpression.Constant(0L),
+ ]);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Call_Default_TypeArguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ nameof(SampleClass.GenericInstanceMethod),
+ [
typeof(object),
- LinqExpression.Default(typeof(string)));
+ ],
+ []);
- ShouldRoundrip(expression);
- }
+ ShouldRoundrip(expression);
+ }
- [TestMethod]
- public void Block_TypeExpressionsVariables()
- {
- var expression =
- LinqExpression.Block(
+ [TestMethod]
+ public void Call_Instance_TypeArgumentss_Arguments()
+ {
+ var expression =
+ LinqExpression.Call(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ nameof(SampleClass.GenericInstanceMethodWithArgument),
+ [
typeof(object),
- new[]
- {
- LinqExpression.Parameter(
- typeof(string)),
- },
- new[]
- {
- LinqExpression.Default(
- typeof(string)),
- });
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Break()
- {
- var expression = LinqExpression.Break(
- LinqExpression.Label(
- typeof(void)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Method()
- {
- var expression =
- LinqExpression.Call(
- typeof(SampleClass).GetMethod(nameof(SampleClass.StaticMethod)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Method_Arguments()
- {
- var expression =
- LinqExpression.Call(
- typeof(SampleClass).GetMethod(nameof(SampleClass.StaticMethodWithArgument)),
- LinqExpression.Constant(0L));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Method_TypeArguments()
- {
- var expression =
- LinqExpression.Call(
- typeof(SampleClass).GetMethod(nameof(SampleClass.GenericStaticMethod)).MakeGenericMethod(typeof(object)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Method_TypeArguments_Arguments()
- {
- var expression =
- LinqExpression.Call(
- typeof(SampleClass).GetMethod(nameof(SampleClass.GenericStaticMethodWithArgument)).MakeGenericMethod(typeof(object)),
- LinqExpression.Constant(0L));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Method_Instance()
- {
- var expression =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- typeof(SampleClass).GetMethod(nameof(SampleClass.InstanceMethod)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Method_Instance_Arguments()
- {
- var expression =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- typeof(SampleClass).GetMethod(nameof(SampleClass.InstanceMethodWithArgument)),
- LinqExpression.Constant(0L));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Method_Instance_TypeArguments()
- {
- var expression =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- typeof(SampleClass).GetMethod(nameof(SampleClass.GenericInstanceMethod)).MakeGenericMethod(typeof(object)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Method_Instance_TypeArguments_Arguments()
- {
- var expression =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- typeof(SampleClass).GetMethod(nameof(SampleClass.GenericInstanceMethodWithArgument)).MakeGenericMethod(typeof(object)),
- LinqExpression.Constant(0L));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Type()
- {
- var expression =
- LinqExpression.Call(
- typeof(SampleClass),
- nameof(SampleClass.StaticMethod),
- Array.Empty(),
- Array.Empty());
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Type_Arguments()
- {
- var expression =
- LinqExpression.Call(
- typeof(SampleClass),
- nameof(SampleClass.StaticMethodWithArgument),
- Array.Empty(),
- new[]
- {
- LinqExpression.Constant(0L),
- });
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Type_TypeArguments()
- {
- var expression =
- LinqExpression.Call(
- typeof(SampleClass),
- nameof(SampleClass.GenericStaticMethod),
- new[]
- {
- typeof(object),
- },
- Array.Empty());
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Type_TypeArguments_Arguments()
- {
- var expression =
- LinqExpression.Call(
- typeof(SampleClass),
- nameof(SampleClass.GenericStaticMethodWithArgument),
- new[]
- {
- typeof(object),
- },
- new[]
- {
- LinqExpression.Constant(0L),
- });
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Default()
- {
- var expression =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- nameof(SampleClass.InstanceMethod),
- Array.Empty(),
- Array.Empty());
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Default_Arguments()
- {
- var expression =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- nameof(SampleClass.InstanceMethodWithArgument),
- Array.Empty(),
- new[]
- {
- LinqExpression.Constant(0L),
- });
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Default_TypeArguments()
- {
- var expression =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- nameof(SampleClass.GenericInstanceMethod),
- new[]
- {
- typeof(object),
- },
- Array.Empty());
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Call_Instance_TypeArgumentss_Arguments()
- {
- var expression =
- LinqExpression.Call(
- LinqExpression.New(
- typeof(SampleClass)),
- nameof(SampleClass.GenericInstanceMethodWithArgument),
- new[]
- {
- typeof(object),
- },
- new[]
- {
- LinqExpression.Constant(0L),
- });
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Condition()
- {
- var param = LinqExpression.Parameter(typeof(bool));
- var expression = LinqExpression.Condition(param, param, param);
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void ConditionType()
- {
- var expression = LinqExpression.Condition(
- LinqExpression.Parameter(typeof(bool)),
+ ],
+ [
+ LinqExpression.Constant(0L),
+ ]);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Condition()
+ {
+ var param = LinqExpression.Parameter(typeof(bool));
+ var expression = LinqExpression.Condition(param, param, param);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void ConditionType()
+ {
+ var expression = LinqExpression.Condition(
+ LinqExpression.Parameter(typeof(bool)),
+ LinqExpression.Parameter(typeof(SampleDerivedClass)),
+ LinqExpression.Parameter(typeof(SampleClass)),
+ typeof(SampleClass));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void DebugInfo()
+ {
+ var expression =
+ LinqExpression.DebugInfo(
+ LinqExpression.SymbolDocument(
+ string.Empty),
+ 1,
+ 1,
+ 1,
+ 1);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void DebugInfo_language()
+ {
+ var expression =
+ LinqExpression.DebugInfo(
+ LinqExpression.SymbolDocument(
+ string.Empty,
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5")),
+ 1,
+ 1,
+ 1,
+ 1);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void DebugInfo_language_vendor()
+ {
+ var expression =
+ LinqExpression.DebugInfo(
+ LinqExpression.SymbolDocument(
+ string.Empty,
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5"),
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a6")),
+ 1,
+ 1,
+ 1,
+ 1);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void DebugInfo_language_vendor_type()
+ {
+ var expression =
+ LinqExpression.DebugInfo(
+ LinqExpression.SymbolDocument(
+ string.Empty,
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5"),
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a6"),
+ new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a7")),
+ 1,
+ 1,
+ 1,
+ 1);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void DebugInfo_clear()
+ {
+ var expression =
+ LinqExpression.ClearDebugInfo(
+ LinqExpression.SymbolDocument(
+ string.Empty));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Factorial()
+ {
+ var value = LinqExpression.Parameter(typeof(int), "value");
+ var result = LinqExpression.Parameter(typeof(int), "result");
+ var label = LinqExpression.Label(typeof(int), "label");
+ var one = LinqExpression.Constant(1);
+ var expression = LinqExpression.Block(
+ [result],
+ LinqExpression.Assign(
+ result,
+ one),
+ LinqExpression.Loop(
+ LinqExpression.Condition(
+ LinqExpression.GreaterThan(
+ value,
+ one),
+ LinqExpression.MultiplyAssign(
+ result,
+ LinqExpression.PostDecrementAssign(
+ value)),
+ LinqExpression.Break(
+ label,
+ result),
+ typeof(void)),
+ label));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void IfThen()
+ {
+ var param = LinqExpression.Parameter(typeof(bool));
+ var expression = LinqExpression.IfThen(param, param);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void IfThenElse()
+ {
+ var param = LinqExpression.Parameter(typeof(bool));
+ var expression = LinqExpression.IfThenElse(param, param, param);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Lambda()
+ {
+ var expression =
+ LinqExpression.Lambda(LinqExpression.Empty());
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void ListInit()
+ {
+ var expression =
+ LinqExpression.ListInit(
+ LinqExpression.New(
+ typeof(List)),
+ LinqExpression.ElementInit(
+ typeof(List).GetMethod("Add"),
+ LinqExpression.Constant(0L)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberAccess_field_expression()
+ {
+ var expression =
+ LinqExpression.Field(
+ LinqExpression.Parameter(typeof(SampleClass)),
+ nameof(SampleClass.InstanceField));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberAccess_field_expression_type()
+ {
+ var expression =
+ LinqExpression.Field(
LinqExpression.Parameter(typeof(SampleDerivedClass)),
+ typeof(SampleClass),
+ nameof(SampleClass.InstanceField));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberAccess_field_type()
+ {
+ var expression =
+ LinqExpression.Field(
+ null,
+ typeof(SampleClass),
+ nameof(SampleClass.StaticField));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberAccess_property_expression()
+ {
+ var expression =
+ LinqExpression.Property(
LinqExpression.Parameter(typeof(SampleClass)),
- typeof(SampleClass));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void DebugInfo()
- {
- var expression =
- LinqExpression.DebugInfo(
- LinqExpression.SymbolDocument(
- string.Empty),
- 1,
- 1,
- 1,
- 1);
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void DebugInfo_language()
- {
- var expression =
- LinqExpression.DebugInfo(
- LinqExpression.SymbolDocument(
- string.Empty,
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5")),
- 1,
- 1,
- 1,
- 1);
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void DebugInfo_language_vendor()
- {
- var expression =
- LinqExpression.DebugInfo(
- LinqExpression.SymbolDocument(
- string.Empty,
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5"),
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a6")),
- 1,
- 1,
- 1,
- 1);
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void DebugInfo_language_vendor_type()
- {
- var expression =
- LinqExpression.DebugInfo(
- LinqExpression.SymbolDocument(
- string.Empty,
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a5"),
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a6"),
- new Guid("61eac4f1-bb04-4197-a7bd-eb5749f343a7")),
- 1,
- 1,
- 1,
- 1);
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void DebugInfo_clear()
- {
- var expression =
- LinqExpression.ClearDebugInfo(
- LinqExpression.SymbolDocument(
- string.Empty));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Factorial()
- {
- var value = LinqExpression.Parameter(typeof(int), "value");
- var result = LinqExpression.Parameter(typeof(int), "result");
- var label = LinqExpression.Label(typeof(int), "label");
- var one = LinqExpression.Constant(1);
- var expression = LinqExpression.Block(
- new[] { result },
- LinqExpression.Assign(
- result,
- one),
- LinqExpression.Loop(
- LinqExpression.Condition(
- LinqExpression.GreaterThan(
- value,
- one),
- LinqExpression.MultiplyAssign(
- result,
- LinqExpression.PostDecrementAssign(
- value)),
- LinqExpression.Break(
- label,
- result),
- typeof(void)),
- label));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void IfThen()
- {
- var param = LinqExpression.Parameter(typeof(bool));
- var expression = LinqExpression.IfThen(param, param);
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void IfThenElse()
- {
- var param = LinqExpression.Parameter(typeof(bool));
- var expression = LinqExpression.IfThenElse(param, param, param);
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Lambda()
- {
- var expression =
- LinqExpression.Lambda(LinqExpression.Empty());
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void ListInit()
- {
- var expression =
- LinqExpression.ListInit(
- LinqExpression.New(
- typeof(List)),
+ nameof(SampleClass.InstanceProperty));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberAccess_property_expression_type()
+ {
+ var expression =
+ LinqExpression.Property(
+ LinqExpression.Parameter(typeof(SampleDerivedClass)),
+ typeof(SampleClass),
+ nameof(SampleClass.InstanceProperty));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberAccess_property_type()
+ {
+ var expression =
+ LinqExpression.Property(
+ null,
+ typeof(SampleClass),
+ nameof(SampleClass.StaticProperty));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberAccess_property_expression_arguments()
+ {
+ var expression =
+ LinqExpression.Property(
+ LinqExpression.Parameter(typeof(SampleClass)),
+ "Indexer",
+ LinqExpression.Parameter(typeof(int)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberInit_no_bindings()
+ {
+ var expression =
+ LinqExpression.MemberInit(
+ LinqExpression.New(
+ typeof(SampleClass)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberInit_bind()
+ {
+ var expression =
+ LinqExpression.MemberInit(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ LinqExpression.Bind(
+ typeof(SampleClass).GetField(nameof(SampleClass.InstanceField)),
+ LinqExpression.Constant(string.Empty)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberInit_list_bind()
+ {
+ var expression =
+ LinqExpression.MemberInit(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ LinqExpression.ListBind(
+ typeof(SampleClass).GetProperty(nameof(SampleClass.ListProperty)),
LinqExpression.ElementInit(
typeof(List).GetMethod("Add"),
- LinqExpression.Constant(0L)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberAccess_field_expression()
- {
- var expression =
- LinqExpression.Field(
- LinqExpression.Parameter(typeof(SampleClass)),
- nameof(SampleClass.InstanceField));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberAccess_field_expression_type()
- {
- var expression =
- LinqExpression.Field(
- LinqExpression.Parameter(typeof(SampleDerivedClass)),
- typeof(SampleClass),
- nameof(SampleClass.InstanceField));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberAccess_field_type()
- {
- var expression =
- LinqExpression.Field(
- null,
- typeof(SampleClass),
- nameof(SampleClass.StaticField));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberAccess_property_expression()
- {
- var expression =
- LinqExpression.Property(
- LinqExpression.Parameter(typeof(SampleClass)),
- nameof(SampleClass.InstanceProperty));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberAccess_property_expression_type()
- {
- var expression =
- LinqExpression.Property(
- LinqExpression.Parameter(typeof(SampleDerivedClass)),
- typeof(SampleClass),
- nameof(SampleClass.InstanceProperty));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberAccess_property_type()
- {
- var expression =
- LinqExpression.Property(
- null,
- typeof(SampleClass),
- nameof(SampleClass.StaticProperty));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberAccess_property_expression_arguments()
- {
- var expression =
- LinqExpression.Property(
- LinqExpression.Parameter(typeof(SampleClass)),
- "Indexer",
- LinqExpression.Parameter(typeof(int)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberInit_no_bindings()
- {
- var expression =
- LinqExpression.MemberInit(
- LinqExpression.New(
- typeof(SampleClass)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberInit_bind()
- {
- var expression =
- LinqExpression.MemberInit(
- LinqExpression.New(
- typeof(SampleClass)),
+ LinqExpression.Constant(0L))));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void MemberInit_member_bind()
+ {
+ var expression =
+ LinqExpression.MemberInit(
+ LinqExpression.New(
+ typeof(SampleClass)),
+ LinqExpression.MemberBind(
+ typeof(SampleClass).GetField(nameof(SampleClass.ComplexField)),
LinqExpression.Bind(
typeof(SampleClass).GetField(nameof(SampleClass.InstanceField)),
- LinqExpression.Constant(string.Empty)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberInit_list_bind()
- {
- var expression =
- LinqExpression.MemberInit(
- LinqExpression.New(
- typeof(SampleClass)),
- LinqExpression.ListBind(
- typeof(SampleClass).GetProperty(nameof(SampleClass.ListProperty)),
- LinqExpression.ElementInit(
- typeof(List).GetMethod("Add"),
- LinqExpression.Constant(0L))));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void MemberInit_member_bind()
- {
- var expression =
- LinqExpression.MemberInit(
- LinqExpression.New(
- typeof(SampleClass)),
- LinqExpression.MemberBind(
- typeof(SampleClass).GetField(nameof(SampleClass.ComplexField)),
- LinqExpression.Bind(
- typeof(SampleClass).GetField(nameof(SampleClass.InstanceField)),
- LinqExpression.Constant(
- string.Empty))));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void NewArrayBounds()
- {
- var expression =
- LinqExpression.NewArrayBounds(
- typeof(long),
- LinqExpression.Constant(0L));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void NewArrayInit()
- {
- var expression =
- LinqExpression.NewArrayInit(
- typeof(long),
- LinqExpression.Constant(0L));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Parameter()
- {
- var expression = LinqExpression.Parameter(typeof(object));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Parameter_with_name()
- {
- var expression = LinqExpression.Parameter(typeof(object), "param");
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void ReferenceEqual()
- {
- var expression =
- LinqExpression.ReferenceEqual(
- LinqExpression.Parameter(
- typeof(object)),
- LinqExpression.Parameter(
- typeof(object)));
+ LinqExpression.Constant(
+ string.Empty))));
- ShouldRoundrip(expression);
- }
+ ShouldRoundrip(expression);
+ }
- [TestMethod]
- public void ReferenceNotEqual()
- {
- var expression =
- LinqExpression.ReferenceNotEqual(
- LinqExpression.Parameter(
- typeof(object)),
- LinqExpression.Parameter(
- typeof(object)));
+ [TestMethod]
+ public void NewArrayBounds()
+ {
+ var expression =
+ LinqExpression.NewArrayBounds(
+ typeof(long),
+ LinqExpression.Constant(0L));
- ShouldRoundrip(expression);
- }
+ ShouldRoundrip(expression);
+ }
- [TestMethod]
- public void RuntimeVariables()
- {
- var expression =
- LinqExpression.RuntimeVariables(
- LinqExpression.Parameter(
- typeof(object)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Throw()
- {
- var expression =
- LinqExpression.Throw(null);
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Throw_value()
- {
- var expression =
- LinqExpression.Throw(
- LinqExpression.New(
- typeof(ArgumentException)));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Throw_type()
- {
- var expression =
- LinqExpression.Throw(
- null,
- typeof(Exception));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Throw_value_type()
- {
- var expression =
- LinqExpression.Throw(
- LinqExpression.New(
- typeof(ArgumentException)),
- typeof(Exception));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Rethrow()
- {
- var expression =
- LinqExpression.Rethrow();
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Rethrow_type()
- {
- var expression =
- LinqExpression.Rethrow(
- typeof(Exception));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void TypeArguments()
- {
- var expression = LinqExpression.Parameter(typeof(IEquatable));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void TypeBinary_equal()
- {
- var expression =
- LinqExpression.TypeEqual(
- LinqExpression.Empty(),
- typeof(object));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void TypeBinary_is()
- {
- var expression =
- LinqExpression.TypeIs(
- LinqExpression.Empty(),
- typeof(object));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void Unary()
- {
- var expression = LinqExpression.ArrayLength(LinqExpression.Parameter(typeof(int[])));
-
- ShouldRoundrip(expression);
- }
-
- [TestMethod]
- public void UnaryMethod()
- {
- var expression =
- LinqExpression.Negate(
- LinqExpression.Default(
- typeof(bool)),
- typeof(SampleClass).GetMethod(nameof(SampleClass.StaticFunctionWithArgument)));
+ [TestMethod]
+ public void NewArrayInit()
+ {
+ var expression =
+ LinqExpression.NewArrayInit(
+ typeof(long),
+ LinqExpression.Constant(0L));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Parameter()
+ {
+ var expression = LinqExpression.Parameter(typeof(object));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Parameter_with_name()
+ {
+ var expression = LinqExpression.Parameter(typeof(object), "param");
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void ReferenceEqual()
+ {
+ var expression =
+ LinqExpression.ReferenceEqual(
+ LinqExpression.Parameter(
+ typeof(object)),
+ LinqExpression.Parameter(
+ typeof(object)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void ReferenceNotEqual()
+ {
+ var expression =
+ LinqExpression.ReferenceNotEqual(
+ LinqExpression.Parameter(
+ typeof(object)),
+ LinqExpression.Parameter(
+ typeof(object)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void RuntimeVariables()
+ {
+ var expression =
+ LinqExpression.RuntimeVariables(
+ LinqExpression.Parameter(
+ typeof(object)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Throw()
+ {
+ var expression =
+ LinqExpression.Throw(null);
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Throw_value()
+ {
+ var expression =
+ LinqExpression.Throw(
+ LinqExpression.New(
+ typeof(ArgumentException)));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Throw_type()
+ {
+ var expression =
+ LinqExpression.Throw(
+ null,
+ typeof(Exception));
- ShouldRoundrip(expression);
- }
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Throw_value_type()
+ {
+ var expression =
+ LinqExpression.Throw(
+ LinqExpression.New(
+ typeof(ArgumentException)),
+ typeof(Exception));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Rethrow()
+ {
+ var expression =
+ LinqExpression.Rethrow();
+
+ ShouldRoundrip(expression);
+ }
- private static void ShouldRoundrip(LinqExpression original)
- {
- using var g = new GraphEngine.Graph();
- var s = g.CreateBlankNode().In(g);
+ [TestMethod]
+ public void Rethrow_type()
+ {
+ var expression =
+ LinqExpression.Rethrow(
+ typeof(Exception));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void TypeArguments()
+ {
+ var expression = LinqExpression.Parameter(typeof(IEquatable));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void TypeBinary_equal()
+ {
+ var expression =
+ LinqExpression.TypeEqual(
+ LinqExpression.Empty(),
+ typeof(object));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void TypeBinary_is()
+ {
+ var expression =
+ LinqExpression.TypeIs(
+ LinqExpression.Empty(),
+ typeof(object));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void Unary()
+ {
+ var expression = LinqExpression.ArrayLength(LinqExpression.Parameter(typeof(int[])));
+
+ ShouldRoundrip(expression);
+ }
+
+ [TestMethod]
+ public void UnaryMethod()
+ {
+ var expression =
+ LinqExpression.Negate(
+ LinqExpression.Default(
+ typeof(bool)),
+ typeof(SampleClass).GetMethod(nameof(SampleClass.StaticFunctionWithArgument)));
+
+ ShouldRoundrip(expression);
+ }
+
+ private static void ShouldRoundrip(LinqExpression original)
+ {
+ using var g = new GraphEngine.Graph();
+ var s = g.CreateBlankNode().In(g);
- new SerialisingVisitor(s).Visit(original);
- new CompressingTurtleWriter(WriterCompressionLevel.Medium).Save(g, Console.Out, true);
- Console.WriteLine();
+ new SerialisingVisitor(s).Visit(original);
+ new CompressingTurtleWriter(WriterCompressionLevel.Medium).Save(g, Console.Out, true);
+ Console.WriteLine();
- var processed = GraphEngine.Expression.Parse(s).LinqExpression;
- Console.WriteLine(processed.GetDebugView());
+ var processed = GraphEngine.Expression.Parse(s).LinqExpression;
+ Console.WriteLine(processed.GetDebugView());
- processed.Should().Be(original);
- }
+ processed.Should().Be(original);
}
}
diff --git a/GraphEngine.Tests/SetterTests.cs b/GraphEngine.Tests/SetterTests.cs
index a49edb6..1883402 100644
--- a/GraphEngine.Tests/SetterTests.cs
+++ b/GraphEngine.Tests/SetterTests.cs
@@ -1,19 +1,15 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using VDS.RDF;
+namespace GraphEngine.Tests;
- [TestClass]
- public class SetterTests
+[TestClass]
+public class SetterTests
+{
+ [TestMethod]
+ public void All()
{
- [TestMethod]
- public void All()
- {
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix xsd: .
@prefix : .
@@ -37,28 +33,27 @@ public void All()
) ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var aa = new Collection(s, Vocabulary.ArrayIndexIndexes, Expression.Parse);
- foreach (Parameter index in aa)
- {
- Console.WriteLine(index.Type.Name);
- }
+ var aa = new Collection(s, Vocabulary.ArrayIndexIndexes, Expression.Parse);
+ foreach (Parameter index in aa)
+ {
+ Console.WriteLine(index.Type.Name);
+ }
- var item = new Parameter(s.Graph.CreateBlankNode().In(g));
- var type = new GraphEngine.Type(s.Graph.CreateBlankNode().In(g));
- type.Name = "X";
- var typeA = new GraphEngine.Type(s.Graph.CreateBlankNode().In(g));
- typeA.Name = "Y";
- type.Arguments.Add(typeA);
- item.Type = type;
+ var item = new Parameter(s.Graph.CreateBlankNode().In(g));
+ var type = new GraphEngine.Type(s.Graph.CreateBlankNode().In(g));
+ type.Name = "X";
+ var typeA = new GraphEngine.Type(s.Graph.CreateBlankNode().In(g));
+ typeA.Name = "Y";
+ type.Arguments.Add(typeA);
+ item.Type = type;
- aa.Add(item);
+ aa.Add(item);
- foreach (Parameter index in aa)
- {
- Console.WriteLine(index.Type.Name);
- }
+ foreach (Parameter index in aa)
+ {
+ Console.WriteLine(index.Type.Name);
}
}
}
diff --git a/GraphEngine.Tests/SwitchTests.cs b/GraphEngine.Tests/SwitchTests.cs
index 0667fbb..3195a03 100644
--- a/GraphEngine.Tests/SwitchTests.cs
+++ b/GraphEngine.Tests/SwitchTests.cs
@@ -1,31 +1,28 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System;
- using System.Reflection;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using VDS.RDF;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using System.Reflection;
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class SwitchTests
+[TestClass]
+public class SwitchTests
+{
+ [TestMethod]
+ public void All()
{
- [TestMethod]
- public void All()
- {
- var expected =
- LinqExpression.Switch(
- typeof(SampleClass),
- LinqExpression.Constant(0L),
+ var expected =
+ LinqExpression.Switch(
+ typeof(SampleClass),
+ LinqExpression.Constant(0L),
+ LinqExpression.Default(typeof(SampleDerivedClass)),
+ typeof(SampleClass).GetMethod("Equal"),
+ LinqExpression.SwitchCase(
LinqExpression.Default(typeof(SampleDerivedClass)),
- typeof(SampleClass).GetMethod("Equal"),
- LinqExpression.SwitchCase(
- LinqExpression.Default(typeof(SampleDerivedClass)),
- LinqExpression.Constant(0L)));
+ LinqExpression.Constant(0L)));
- using var g = new GraphEngine.Graph();
- g.LoadFromString(@"
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(@"
@prefix xsd: .
@prefix : .
@@ -63,19 +60,18 @@ public void All()
:constantValue 0 ;
.
");
- var s = g.GetUriNode(":s").In(g);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- actual.Should().Be(expected);
+ actual.Should().Be(expected);
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- // Make sure custom type is used
- Assert.AreEqual(typeof(SampleClass), actual.Type);
+ // Make sure custom type is used
+ Assert.AreEqual(typeof(SampleClass), actual.Type);
- // Make sure custom comparison is used
- Assert.ThrowsException(() => LinqExpression.Lambda(actual).Compile().DynamicInvoke());
- }
+ // Make sure custom comparison is used
+ Assert.ThrowsException(() => LinqExpression.Lambda(actual).Compile().DynamicInvoke());
}
}
diff --git a/GraphEngine.Tests/TestBase.cs b/GraphEngine.Tests/TestBase.cs
index ba5c195..c8ab5c9 100644
--- a/GraphEngine.Tests/TestBase.cs
+++ b/GraphEngine.Tests/TestBase.cs
@@ -1,24 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System;
- using VDS.RDF;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- public class TestBase
+public class TestBase
+{
+ protected static void ShouldBe(string rdf, LinqExpression expected)
{
- protected static void ShouldBe(string rdf, LinqExpression expected)
- {
- using var g = new GraphEngine.Graph();
- g.LoadFromString(rdf);
- var s = g.GetUriNode(":s").In(g);
+ using var g = new GraphEngine.Graph();
+ g.LoadFromString(rdf);
+ var s = g.GetUriNode(":s").In(g);
- var actual = Expression.Parse(s).LinqExpression;
+ var actual = Expression.Parse(s).LinqExpression;
- Console.WriteLine(actual.GetDebugView());
+ Console.WriteLine(actual.GetDebugView());
- actual.Should().Be(expected);
- }
+ actual.Should().Be(expected);
}
}
diff --git a/GraphEngine.Tests/TestExtensions.cs b/GraphEngine.Tests/TestExtensions.cs
index 974d921..1637953 100644
--- a/GraphEngine.Tests/TestExtensions.cs
+++ b/GraphEngine.Tests/TestExtensions.cs
@@ -1,42 +1,39 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
+namespace GraphEngine.Tests;
+
+using System.Reflection;
+
+internal static class TestExtensions
{
- using System.Collections.Generic;
- using System.Reflection;
- using Linq = System.Linq.Expressions;
+ internal static string GetDebugView(this Linq.Expression exp) => (string)typeof(Linq.Expression).GetProperty("DebugView", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(exp);
- internal static class TestExtensions
- {
- internal static string GetDebugView(this Linq.Expression exp) => (string)typeof(Linq.Expression).GetProperty("DebugView", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(exp);
+ /*
+ * TODO: Replcae invocations
+ * with `actual.Should().BeEquivalentTo(expected, options => options.Using(ExpressionTreeToolkit.ExpressionEqualityComparer.Default));`
+ * once available
+ * see https://github.com/fluentassertions/fluentassertions/blob/c192ca014ae920c96f76a747b72bf110c31ba153/Src/FluentAssertions/Equivalency/SelfReferenceEquivalencyAssertionOptions.cs
+ * and https://github.com/fluentassertions/fluentassertions/blob/c7ec7c6d1603478566c09062d90dcc2433fdf534/Src/FluentAssertions/Equivalency/EqualityComparerEquivalencyStep.cs
+ */
+ internal static ExpressionAssertions Should(this Linq.Expression expression) => new ExpressionAssertions(expression);
- /*
- * TODO: Replcae invocations
- * with `actual.Should().BeEquivalentTo(expected, options => options.Using(ExpressionTreeToolkit.ExpressionEqualityComparer.Default));`
- * once available
- * see https://github.com/fluentassertions/fluentassertions/blob/c192ca014ae920c96f76a747b72bf110c31ba153/Src/FluentAssertions/Equivalency/SelfReferenceEquivalencyAssertionOptions.cs
- * and https://github.com/fluentassertions/fluentassertions/blob/c7ec7c6d1603478566c09062d90dcc2433fdf534/Src/FluentAssertions/Equivalency/EqualityComparerEquivalencyStep.cs
- */
- internal static ExpressionAssertions Should(this Linq.Expression expression) => new ExpressionAssertions(expression);
+ internal static IEnumerable Pairwise(this IEnumerable enumerable)
+ {
+ var previous = default(T);
- internal static IEnumerable Pairwise(this IEnumerable enumerable)
+ using var e = enumerable.GetEnumerator();
+ if (e.MoveNext())
{
- var previous = default(T);
-
- using var e = enumerable.GetEnumerator();
- if (e.MoveNext())
- {
- previous = e.Current;
- }
+ previous = e.Current;
+ }
- while (e.MoveNext())
+ while (e.MoveNext())
+ {
+ yield return new[]
{
- yield return new[]
- {
- previous,
- previous = e.Current,
- };
- }
+ previous,
+ previous = e.Current,
+ };
}
}
}
diff --git a/GraphEngine.Tests/ThrowTests.cs b/GraphEngine.Tests/ThrowTests.cs
index 681ea64..4872238 100644
--- a/GraphEngine.Tests/ThrowTests.cs
+++ b/GraphEngine.Tests/ThrowTests.cs
@@ -1,21 +1,19 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using System;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class ThrowTests : TestBase
+[TestClass]
+public class ThrowTests : TestBase
+{
+ [TestMethod]
+ public void Default()
{
- [TestMethod]
- public void Default()
- {
- var expected =
- LinqExpression.Throw(null);
+ var expected =
+ LinqExpression.Throw(null);
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -23,18 +21,18 @@ public void Default()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Value()
- {
- var expected =
- LinqExpression.Throw(
- LinqExpression.New(
- typeof(ArgumentException)));
+ [TestMethod]
+ public void Value()
+ {
+ var expected =
+ LinqExpression.Throw(
+ LinqExpression.New(
+ typeof(ArgumentException)));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -46,19 +44,19 @@ public void Value()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Value_type()
- {
- var expected =
- LinqExpression.Throw(
- LinqExpression.New(
- typeof(ArgumentException)),
- typeof(Exception));
+ [TestMethod]
+ public void Value_type()
+ {
+ var expected =
+ LinqExpression.Throw(
+ LinqExpression.New(
+ typeof(ArgumentException)),
+ typeof(Exception));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -73,18 +71,18 @@ public void Value_type()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Type()
- {
- var expected =
- LinqExpression.Throw(
- null,
- typeof(Exception));
+ [TestMethod]
+ public void Type()
+ {
+ var expected =
+ LinqExpression.Throw(
+ null,
+ typeof(Exception));
- const string actual = @"
+ const string actual = @"
@prefix : .
:s
@@ -94,7 +92,6 @@ public void Type()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/TypeBinaryTests.cs b/GraphEngine.Tests/TypeBinaryTests.cs
index f82ae44..4c70dc5 100644
--- a/GraphEngine.Tests/TypeBinaryTests.cs
+++ b/GraphEngine.Tests/TypeBinaryTests.cs
@@ -1,22 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
-{
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using LinqExpression = System.Linq.Expressions.Expression;
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
- [TestClass]
- public class TypeBinaryTests : TestBase
+[TestClass]
+public class TypeBinaryTests : TestBase
+{
+ [TestMethod]
+ public void TypeEqual()
{
- [TestMethod]
- public void TypeEqual()
- {
- var expected =
- LinqExpression.TypeEqual(
- LinqExpression.Empty(),
- typeof(object));
-
- const string actual = @"
+ var expected =
+ LinqExpression.TypeEqual(
+ LinqExpression.Empty(),
+ typeof(object));
+
+ const string actual = @"
@prefix : .
@prefix xt: .
@@ -31,18 +30,18 @@ public void TypeEqual()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void TypeIs()
- {
- var expected =
- LinqExpression.TypeIs(
- LinqExpression.Empty(),
- typeof(object));
+ [TestMethod]
+ public void TypeIs()
+ {
+ var expected =
+ LinqExpression.TypeIs(
+ LinqExpression.Empty(),
+ typeof(object));
- const string actual = @"
+ const string actual = @"
@prefix : .
@prefix xt: .
@@ -57,7 +56,6 @@ public void TypeIs()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.Tests/UnaryTests.cs b/GraphEngine.Tests/UnaryTests.cs
index 7579de3..66f8116 100644
--- a/GraphEngine.Tests/UnaryTests.cs
+++ b/GraphEngine.Tests/UnaryTests.cs
@@ -1,57 +1,53 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Tests
+namespace GraphEngine.Tests;
+
+using LinqExpression = System.Linq.Expressions.Expression;
+
+[TestClass]
+public class UnaryTests : TestBase
{
- using System;
- using System.Collections.Generic;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Linq = System.Linq.Expressions;
- using LinqExpression = System.Linq.Expressions.Expression;
-
- [TestClass]
- public class UnaryTests : TestBase
+ public static IEnumerable UnTypedData
{
- public static IEnumerable UnTypedData
+ get
{
- get
- {
- yield return new object[] { Linq.ExpressionType.ArrayLength, typeof(object[]) };
- yield return new object[] { Linq.ExpressionType.Decrement };
- yield return new object[] { Linq.ExpressionType.Increment };
- yield return new object[] { Linq.ExpressionType.IsFalse, typeof(bool) };
- yield return new object[] { Linq.ExpressionType.IsTrue, typeof(bool) };
- yield return new object[] { Linq.ExpressionType.Negate };
- yield return new object[] { Linq.ExpressionType.NegateChecked };
- yield return new object[] { Linq.ExpressionType.Not };
- yield return new object[] { Linq.ExpressionType.OnesComplement };
- yield return new object[] { Linq.ExpressionType.PostDecrementAssign };
- yield return new object[] { Linq.ExpressionType.PostIncrementAssign };
- yield return new object[] { Linq.ExpressionType.PreDecrementAssign };
- yield return new object[] { Linq.ExpressionType.PreIncrementAssign };
- yield return new object[] { Linq.ExpressionType.UnaryPlus };
- }
+ yield return new object[] { Linq.ExpressionType.ArrayLength, typeof(object[]) };
+ yield return new object[] { Linq.ExpressionType.Decrement };
+ yield return new object[] { Linq.ExpressionType.Increment };
+ yield return new object[] { Linq.ExpressionType.IsFalse, typeof(bool) };
+ yield return new object[] { Linq.ExpressionType.IsTrue, typeof(bool) };
+ yield return new object[] { Linq.ExpressionType.Negate };
+ yield return new object[] { Linq.ExpressionType.NegateChecked };
+ yield return new object[] { Linq.ExpressionType.Not };
+ yield return new object[] { Linq.ExpressionType.OnesComplement };
+ yield return new object[] { Linq.ExpressionType.PostDecrementAssign };
+ yield return new object[] { Linq.ExpressionType.PostIncrementAssign };
+ yield return new object[] { Linq.ExpressionType.PreDecrementAssign };
+ yield return new object[] { Linq.ExpressionType.PreIncrementAssign };
+ yield return new object[] { Linq.ExpressionType.UnaryPlus };
}
+ }
- public static IEnumerable TypedData
+ public static IEnumerable TypedData
+ {
+ get
{
- get
- {
- yield return new object[] { Linq.ExpressionType.Convert };
- yield return new object[] { Linq.ExpressionType.ConvertChecked };
- yield return new object[] { Linq.ExpressionType.TypeAs };
- yield return new object[] { Linq.ExpressionType.Unbox, typeof(int) };
- }
+ yield return new object[] { Linq.ExpressionType.Convert };
+ yield return new object[] { Linq.ExpressionType.ConvertChecked };
+ yield return new object[] { Linq.ExpressionType.TypeAs };
+ yield return new object[] { Linq.ExpressionType.Unbox, typeof(int) };
}
+ }
- [TestMethod]
- [DynamicData(nameof(UnTypedData))]
- public void UnTyped(Linq.ExpressionType expression, Type operandType = null)
- {
- operandType ??= typeof(int);
+ [TestMethod]
+ [DynamicData(nameof(UnTypedData))]
+ public void UnTyped(Linq.ExpressionType expression, System.Type operandType = null)
+ {
+ operandType ??= typeof(int);
- var expected = LinqExpression.MakeUnary(expression, LinqExpression.Parameter(operandType), null);
+ var expected = LinqExpression.MakeUnary(expression, LinqExpression.Parameter(operandType), null);
- var actual = $@"
+ var actual = $@"
@prefix : .
@prefix xt: .
@@ -65,19 +61,19 @@ public void UnTyped(Linq.ExpressionType expression, Type operandType = null)
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- [DynamicData(nameof(TypedData))]
- public void Typed(Linq.ExpressionType expression, Type type = null)
- {
- var operandType = typeof(object);
- type ??= operandType;
+ [TestMethod]
+ [DynamicData(nameof(TypedData))]
+ public void Typed(Linq.ExpressionType expression, System.Type type = null)
+ {
+ var operandType = typeof(object);
+ type ??= operandType;
- var expected = LinqExpression.MakeUnary(expression, LinqExpression.Parameter(operandType), type);
+ var expected = LinqExpression.MakeUnary(expression, LinqExpression.Parameter(operandType), type);
- var actual = $@"
+ var actual = $@"
@prefix : .
@prefix xt: .
@@ -94,15 +90,15 @@ public void Typed(Linq.ExpressionType expression, Type type = null)
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Quote()
- {
- var expected = LinqExpression.MakeUnary(Linq.ExpressionType.Quote, LinqExpression.Lambda(LinqExpression.Constant(0L)), null);
+ [TestMethod]
+ public void Quote()
+ {
+ var expected = LinqExpression.MakeUnary(Linq.ExpressionType.Quote, LinqExpression.Lambda(LinqExpression.Constant(0L)), null);
- var actual = $@"
+ var actual = $@"
@prefix : .
@prefix xt: .
@@ -116,19 +112,19 @@ public void Quote()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
+ }
- [TestMethod]
- public void Method()
- {
- var expected =
- LinqExpression.Negate(
- LinqExpression.Default(
- typeof(bool)),
- typeof(SampleClass).GetMethod(nameof(SampleClass.StaticFunctionWithArgument)));
+ [TestMethod]
+ public void Method()
+ {
+ var expected =
+ LinqExpression.Negate(
+ LinqExpression.Default(
+ typeof(bool)),
+ typeof(SampleClass).GetMethod(nameof(SampleClass.StaticFunctionWithArgument)));
- var actual = $@"
+ var actual = $@"
@prefix : .
@prefix xt: .
@@ -148,7 +144,6 @@ public void Method()
.
";
- ShouldBe(actual, expected);
- }
+ ShouldBe(actual, expected);
}
}
diff --git a/GraphEngine.sln b/GraphEngine.sln
index 617902b..0391681 100644
--- a/GraphEngine.sln
+++ b/GraphEngine.sln
@@ -10,6 +10,8 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{95B632D7-6E0F-4F80-8F59-8443861DC3EA}"
ProjectSection(SolutionItems) = preProject
.github\workflows\CI.yml = .github\workflows\CI.yml
+ Directory.Build.props = Directory.Build.props
+ Directory.Packages.props = Directory.Packages.props
IDEAS = IDEAS
README.md = README.md
.github\workflows\Release.yml = .github\workflows\Release.yml
diff --git a/GraphEngine/.editorconfig b/GraphEngine/.editorconfig
new file mode 100644
index 0000000..ee83259
--- /dev/null
+++ b/GraphEngine/.editorconfig
@@ -0,0 +1,281 @@
+# Remove the line below if you want to inherit .editorconfig settings from higher directories
+root = true
+
+# C# files
+[*.cs]
+
+#### Core EditorConfig Options ####
+
+# Indentation and spacing
+indent_size = 4
+indent_style = space
+tab_width = 4
+
+# New line preferences
+end_of_line = crlf
+insert_final_newline = false
+
+#### .NET Code Actions ####
+
+# Type members
+dotnet_hide_advanced_members = false
+dotnet_member_insertion_location = with_other_members_of_the_same_kind
+dotnet_property_generation_behavior = prefer_throwing_properties
+
+# Symbol search
+dotnet_search_reference_assemblies = true
+
+#### .NET Coding Conventions ####
+
+# Organize usings
+dotnet_separate_import_directive_groups = false
+dotnet_sort_system_directives_first = false
+file_header_template = unset
+
+# this. and Me. preferences
+dotnet_style_qualification_for_event = true
+dotnet_style_qualification_for_field = true
+dotnet_style_qualification_for_method = true
+dotnet_style_qualification_for_property = true
+
+# Language keywords vs BCL types preferences
+dotnet_style_predefined_type_for_locals_parameters_members = true
+dotnet_style_predefined_type_for_member_access = true
+
+# Parentheses preferences
+dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary
+dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary
+dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary
+
+# Modifier preferences
+dotnet_style_require_accessibility_modifiers = for_non_interface_members
+
+# Expression-level preferences
+dotnet_prefer_system_hash_code = true
+dotnet_style_coalesce_expression = true
+dotnet_style_collection_initializer = true
+dotnet_style_explicit_tuple_names = true
+dotnet_style_namespace_match_folder = true
+dotnet_style_null_propagation = true
+dotnet_style_object_initializer = true
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+dotnet_style_prefer_auto_properties = true
+dotnet_style_prefer_collection_expression = when_types_loosely_match
+dotnet_style_prefer_compound_assignment = true
+dotnet_style_prefer_conditional_expression_over_assignment = true
+dotnet_style_prefer_conditional_expression_over_return = true
+dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
+dotnet_style_prefer_inferred_anonymous_type_member_names = true
+dotnet_style_prefer_inferred_tuple_names = true
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true
+dotnet_style_prefer_simplified_boolean_expressions = true
+dotnet_style_prefer_simplified_interpolation = true
+
+# Field preferences
+dotnet_style_readonly_field = true
+
+# Parameter preferences
+dotnet_code_quality_unused_parameters = all
+
+# Suppression preferences
+dotnet_remove_unnecessary_suppression_exclusions = none
+
+# New line preferences
+dotnet_style_allow_multiple_blank_lines_experimental = false
+dotnet_style_allow_statement_immediately_after_block_experimental = false
+
+#### C# Coding Conventions ####
+
+# var preferences
+csharp_style_var_elsewhere = true:suggestion
+csharp_style_var_for_built_in_types = true:suggestion
+csharp_style_var_when_type_is_apparent = true:suggestion
+
+# Expression-bodied members
+csharp_style_expression_bodied_accessors = true:silent
+csharp_style_expression_bodied_constructors = true:silent
+csharp_style_expression_bodied_indexers = true:silent
+csharp_style_expression_bodied_lambdas = true:silent
+csharp_style_expression_bodied_local_functions = true:silent
+csharp_style_expression_bodied_methods = true:silent
+csharp_style_expression_bodied_operators = true:silent
+csharp_style_expression_bodied_properties = true:silent
+
+# Pattern matching preferences
+csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
+csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
+csharp_style_prefer_extended_property_pattern = true:suggestion
+csharp_style_prefer_not_pattern = true:suggestion
+csharp_style_prefer_pattern_matching = true:silent
+csharp_style_prefer_switch_expression = true:suggestion
+
+# Null-checking preferences
+csharp_style_conditional_delegate_call = true:suggestion
+
+# Modifier preferences
+csharp_prefer_static_anonymous_function = true:suggestion
+csharp_prefer_static_local_function = true:suggestion
+csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
+csharp_style_prefer_readonly_struct = true:suggestion
+csharp_style_prefer_readonly_struct_member = true:suggestion
+
+# Code-block preferences
+csharp_prefer_braces = true:silent
+csharp_prefer_simple_using_statement = true:suggestion
+csharp_prefer_system_threading_lock = true:suggestion
+csharp_style_namespace_declarations = file_scoped:silent
+csharp_style_prefer_method_group_conversion = true:silent
+csharp_style_prefer_primary_constructors = true:suggestion
+csharp_style_prefer_top_level_statements = true:silent
+
+# Expression-level preferences
+csharp_prefer_simple_default_expression = true:suggestion
+csharp_style_deconstructed_variable_declaration = true:suggestion
+csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
+csharp_style_inlined_variable_declaration = true:suggestion
+csharp_style_prefer_index_operator = true:suggestion
+csharp_style_prefer_local_over_anonymous_function = true:suggestion
+csharp_style_prefer_null_check_over_type_check = true:suggestion
+csharp_style_prefer_range_operator = true:suggestion
+csharp_style_prefer_tuple_swap = true:suggestion
+csharp_style_prefer_utf8_string_literals = true:suggestion
+csharp_style_throw_expression = true:suggestion
+csharp_style_unused_value_assignment_preference = discard_variable:suggestion
+csharp_style_unused_value_expression_statement_preference = discard_variable:silent
+
+# 'using' directive preferences
+csharp_using_directive_placement = outside_namespace:silent
+
+# New line preferences
+csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
+csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
+csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
+csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:silent
+csharp_style_allow_embedded_statements_on_same_line_experimental = false:silent
+
+#### C# Formatting Rules ####
+
+# New line preferences
+csharp_new_line_before_catch = true
+csharp_new_line_before_else = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_open_brace = all
+csharp_new_line_between_query_expression_clauses = true
+
+# Indentation preferences
+csharp_indent_block_contents = true
+csharp_indent_braces = false
+csharp_indent_case_contents = true
+csharp_indent_case_contents_when_block = true
+csharp_indent_labels = one_less_than_current
+csharp_indent_switch_labels = true
+
+# Space preferences
+csharp_space_after_cast = false
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_after_comma = true
+csharp_space_after_dot = false
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_after_semicolon_in_for_statement = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_around_declaration_statements = false
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_before_comma = false
+csharp_space_before_dot = false
+csharp_space_before_open_square_brackets = false
+csharp_space_before_semicolon_in_for_statement = false
+csharp_space_between_empty_square_brackets = false
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_declaration_name_and_open_parenthesis = false
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_parentheses = false
+csharp_space_between_square_brackets = false
+
+# Wrapping preferences
+csharp_preserve_single_line_blocks = true
+csharp_preserve_single_line_statements = true
+
+#### Naming styles ####
+
+# Naming rules
+
+dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
+dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
+dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
+
+dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.types_should_be_pascal_case.symbols = types
+dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
+
+dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
+dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
+
+# Symbol specifications
+
+dotnet_naming_symbols.interface.applicable_kinds = interface
+dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.interface.required_modifiers =
+
+dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
+dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.types.required_modifiers =
+
+dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
+dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.non_field_members.required_modifiers =
+
+# Naming styles
+
+dotnet_naming_style.pascal_case.required_prefix =
+dotnet_naming_style.pascal_case.required_suffix =
+dotnet_naming_style.pascal_case.word_separator =
+dotnet_naming_style.pascal_case.capitalization = pascal_case
+
+dotnet_naming_style.begins_with_i.required_prefix = I
+dotnet_naming_style.begins_with_i.required_suffix =
+dotnet_naming_style.begins_with_i.word_separator =
+dotnet_naming_style.begins_with_i.capitalization = pascal_case
+
+[*.{cs,vb}]
+dotnet_style_coalesce_expression = true:suggestion
+dotnet_style_null_propagation = true:suggestion
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
+dotnet_style_prefer_auto_properties = true:silent
+dotnet_style_object_initializer = true:suggestion
+dotnet_style_collection_initializer = true:suggestion
+dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
+dotnet_style_prefer_conditional_expression_over_assignment = true:silent
+dotnet_style_prefer_conditional_expression_over_return = true:silent
+dotnet_style_explicit_tuple_names = true:suggestion
+dotnet_style_prefer_inferred_tuple_names = true:suggestion
+dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
+dotnet_style_prefer_compound_assignment = true:suggestion
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+tab_width = 4
+indent_size = 4
+end_of_line = crlf
+dotnet_style_prefer_simplified_interpolation = true:suggestion
+dotnet_style_qualification_for_field = false:suggestion
+dotnet_style_qualification_for_property = false:suggestion
+dotnet_style_qualification_for_method = false:suggestion
+dotnet_style_qualification_for_event = false:suggestion
+dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
+dotnet_style_namespace_match_folder = true:suggestion
+dotnet_style_readonly_field = true:suggestion
+dotnet_style_predefined_type_for_locals_parameters_members = true:silent
+dotnet_style_predefined_type_for_member_access = true:silent
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
+dotnet_style_allow_multiple_blank_lines_experimental = false:silent
+dotnet_style_allow_statement_immediately_after_block_experimental = false:silent
+dotnet_code_quality_unused_parameters = all:suggestion
+dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:silent
+dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:silent
+dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:silent
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
\ No newline at end of file
diff --git a/GraphEngine/ArgumentInfo.cs b/GraphEngine/ArgumentInfo.cs
index 805987e..00a2c4b 100644
--- a/GraphEngine/ArgumentInfo.cs
+++ b/GraphEngine/ArgumentInfo.cs
@@ -1,26 +1,17 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Diagnostics;
- using Microsoft.CSharp.RuntimeBinder;
+namespace GraphEngine;
- public class ArgumentInfo : Node
- {
- [DebuggerStepThrough]
- public ArgumentInfo(NodeWithGraph node)
- : base(node)
- {
- }
+using Microsoft.CSharp.RuntimeBinder;
- internal CSharpArgumentInfo Info =>
- CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null);
+public class ArgumentInfo(NodeWithGraph node) : Node(node)
+{
+ internal CSharpArgumentInfo Info =>
+ CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null);
- internal static ArgumentInfo Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new ArgumentInfo(node)
- };
- }
+ internal static ArgumentInfo Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new ArgumentInfo(node)
+ };
}
diff --git a/GraphEngine/BaseBind.cs b/GraphEngine/BaseBind.cs
index 846f28d..42f3cbe 100644
--- a/GraphEngine/BaseBind.cs
+++ b/GraphEngine/BaseBind.cs
@@ -1,55 +1,39 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Diagnostics;
- using VDS.RDF;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public abstract class BaseBind : Node
+public abstract class BaseBind(NodeWithGraph node, INode type) : Node(node, type)
+{
+ public Member Member
{
- [DebuggerStepThrough]
- internal BaseBind(NodeWithGraph node)
- : base(node)
- {
- }
+ get => GetRequired(BindMember, Member.Parse);
- public Member Member
- {
- get => this.GetRequired(BindMember, Member.Parse);
+ set => SetRequired(BindMember, value);
+ }
- set => this.SetRequired(BindMember, value);
- }
+ public abstract Linq.MemberBinding LinqMemberBinding { get; }
- public abstract Linq.MemberBinding LinqMemberBinding { get; }
+ public static BaseBind Create(NodeWithGraph node, Linq.MemberBindingType kind) => kind switch
+ {
+ Linq.MemberBindingType.Assignment => new Bind(node),
+ Linq.MemberBindingType.MemberBinding => new MemberBind(node),
+ Linq.MemberBindingType.ListBinding => new ListBind(node),
- public static BaseBind Create(NodeWithGraph node, Linq.MemberBindingType kind) => kind switch
- {
- Linq.MemberBindingType.Assignment => new Bind(node),
- Linq.MemberBindingType.MemberBinding => new MemberBind(node),
- Linq.MemberBindingType.ListBinding => new ListBind(node),
+ _ => throw new Exception("{type} is not memberbind")
+ };
- _ => throw new Exception("{type} is not memberbind")
- };
+ internal static BaseBind Parse(NodeWithGraph node)
+ {
+ ArgumentNullException.ThrowIfNull(node);
- internal static BaseBind Parse(NodeWithGraph node)
+ return Vocabulary.RdfType.ObjectOf(node) switch
{
- if (node is null)
- {
- throw new ArgumentNullException(nameof(node));
- }
-
- return Vocabulary.RdfType.ObjectOf(node) switch
- {
- INode t when t.Equals(Vocabulary.Bind) => new Bind(node),
- INode t when t.Equals(Vocabulary.ListBind) => new ListBind(node),
- INode t when t.Equals(Vocabulary.MemberBind) => new MemberBind(node),
-
- null => throw new Exception($"type not found on node {node}"),
- INode t => throw new Exception($"unknown bind type {t} on node {node}"),
- };
- }
+ INode t when t.Equals(Vocabulary.Bind) => new Bind(node),
+ INode t when t.Equals(Vocabulary.ListBind) => new ListBind(node),
+ INode t when t.Equals(Vocabulary.MemberBind) => new MemberBind(node),
+
+ null => throw new Exception($"type not found on node {node}"),
+ var t => throw new Exception($"unknown bind type {t} on node {node}"),
+ };
}
}
diff --git a/GraphEngine/BinaryOperation.cs b/GraphEngine/BinaryOperation.cs
index 4bc3c4b..7c9e1b8 100644
--- a/GraphEngine/BinaryOperation.cs
+++ b/GraphEngine/BinaryOperation.cs
@@ -1,26 +1,16 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using Microsoft.CSharp.RuntimeBinder;
+namespace GraphEngine;
- public class BinaryOperation : Binder
- {
- [DebuggerStepThrough]
- public BinaryOperation(NodeWithGraph node)
- : base(node)
- {
- this.RdfType = Vocabulary.BinaryOperation;
- }
+using System.Runtime.CompilerServices;
+using Microsoft.CSharp.RuntimeBinder;
- internal override CallSiteBinder SystemBinder =>
- Microsoft.CSharp.RuntimeBinder.Binder.BinaryOperation(
- CSharpBinderFlags.None,
- this.ExpressionType.LinqExpressionType,
- null,
- from a in this.Arguments select a.Info);
- }
+public class BinaryOperation(NodeWithGraph node) : Binder(node, Vocabulary.BinaryOperation)
+{
+ internal override CallSiteBinder SystemBinder =>
+ Microsoft.CSharp.RuntimeBinder.Binder.BinaryOperation(
+ CSharpBinderFlags.None,
+ ExpressionType.LinqExpressionType,
+ null,
+ from a in Arguments select a.Info);
}
diff --git a/GraphEngine/Bind.cs b/GraphEngine/Bind.cs
index e3a9e9a..8ccbeaf 100644
--- a/GraphEngine/Bind.cs
+++ b/GraphEngine/Bind.cs
@@ -1,25 +1,15 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Bind : BaseBind
+public class Bind(NodeWithGraph node) : BaseBind(node, Vocabulary.Bind)
+{
+ public Expression Expression
{
- [DebuggerStepThrough]
- internal Bind(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.Bind;
-
- public Expression Expression
- {
- get => this.GetRequired(BindExpression, Expression.Parse);
+ get => GetRequired(BindExpression, Expression.Parse);
- set => this.SetRequired(BindExpression, value);
- }
-
- public override Linq.MemberBinding LinqMemberBinding => Linq.Expression.Bind(this.Member.ReflectionMember, this.Expression.LinqExpression);
+ set => SetRequired(BindExpression, value);
}
+
+ public override Linq.MemberBinding LinqMemberBinding => Linq.Expression.Bind(Member.ReflectionMember, Expression.LinqExpression);
}
diff --git a/GraphEngine/Binder.cs b/GraphEngine/Binder.cs
index b4971e2..f11f9a8 100644
--- a/GraphEngine/Binder.cs
+++ b/GraphEngine/Binder.cs
@@ -1,55 +1,40 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
+namespace GraphEngine;
+
+using System.Runtime.CompilerServices;
+
+public abstract class Binder(NodeWithGraph node, INode type) : Node(node, type)
{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Runtime.CompilerServices;
- using VDS.RDF;
- using static Vocabulary;
-
- public abstract class Binder : Node
+ public string Name
{
- [DebuggerStepThrough]
- protected Binder(NodeWithGraph node)
- : base(node)
- {
- }
+ get => GetRequired(BinderName, AsString);
- public string Name
- {
- get => this.GetRequired(BinderName, AsString);
+ set => SetOptional(BinderName, value);
+ }
- set => this.SetOptional(BinderName, value);
- }
+ public ExpressionType? ExpressionType
+ {
+ get => GetOptional(BinderExpressionType, ExpressionType.Parse);
- public ExpressionType? ExpressionType
- {
- get => this.GetOptional(BinderExpressionType, ExpressionType.Parse);
+ set => SetOptional(BinderExpressionType, value);
+ }
- set => this.SetOptional(BinderExpressionType, value);
- }
+ public ICollection Arguments => Collection(BinderArguments, ArgumentInfo.Parse);
- public ICollection Arguments => this.Collection(BinderArguments, ArgumentInfo.Parse);
+ internal abstract CallSiteBinder SystemBinder { get; }
- internal abstract CallSiteBinder SystemBinder { get; }
+ internal static Binder Parse(NodeWithGraph node)
+ {
+ ArgumentNullException.ThrowIfNull(node);
- internal static Binder Parse(NodeWithGraph node)
+ return Vocabulary.RdfType.ObjectOf(node) switch
{
- if (node is null)
- {
- throw new ArgumentNullException(nameof(node));
- }
-
- return Vocabulary.RdfType.ObjectOf(node) switch
- {
- INode t when t.Equals(Vocabulary.InvokeMember) => new InvokeMember(node),
- INode t when t.Equals(Vocabulary.BinaryOperation) => new BinaryOperation(node),
-
- null => throw new Exception($"type not found on node {node}"),
- INode t => throw new Exception($"unknown binder type {t} on node {node}"),
- };
- }
+ INode t when t.Equals(Vocabulary.InvokeMember) => new InvokeMember(node),
+ INode t when t.Equals(Vocabulary.BinaryOperation) => new BinaryOperation(node),
+
+ null => throw new Exception($"type not found on node {node}"),
+ var t => throw new Exception($"unknown binder type {t} on node {node}"),
+ };
}
}
diff --git a/GraphEngine/Case.cs b/GraphEngine/Case.cs
index b0a6cdc..06cfaf4 100644
--- a/GraphEngine/Case.cs
+++ b/GraphEngine/Case.cs
@@ -1,36 +1,23 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Case : Node
+public class Case(NodeWithGraph node) : Node(node)
+{
+ public Expression Body
{
- [DebuggerStepThrough]
- internal Case(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Expression Body
- {
- get => this.GetRequired(CaseBody, Expression.Parse);
+ get => GetRequired(CaseBody, Expression.Parse);
- set => this.SetRequired(CaseBody, value);
- }
+ set => SetRequired(CaseBody, value);
+ }
- public ICollection TestValues => this.Collection(CaseTestValues, Expression.Parse);
+ public ICollection TestValues => Collection(CaseTestValues, Expression.Parse);
- public Linq.SwitchCase LinqSwitchCase => Linq.Expression.SwitchCase(this.Body.LinqExpression, this.TestValues.LinqExpressions());
+ public Linq.SwitchCase LinqSwitchCase => Linq.Expression.SwitchCase(Body.LinqExpression, TestValues.LinqExpressions());
- internal static Case Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new Case(node)
- };
- }
+ internal static Case Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new Case(node)
+ };
}
diff --git a/GraphEngine/Catch.cs b/GraphEngine/Catch.cs
index 481ee4c..9e93e81 100644
--- a/GraphEngine/Catch.cs
+++ b/GraphEngine/Catch.cs
@@ -1,61 +1,49 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Catch : Node
+public class Catch(NodeWithGraph node) : Node(node)
+{
+ public Type? Type
{
- [DebuggerStepThrough]
- internal Catch(NodeWithGraph node)
- : base(node)
- {
- }
+ get => GetOptional(CatchType, Type.Parse);
- public Type? Type
- {
- get => this.GetOptional(CatchType, Type.Parse);
-
- set => this.SetOptional(CatchType, value);
- }
+ set => SetOptional(CatchType, value);
+ }
- public Expression Body
- {
- get => this.GetRequired(CatchBody, Expression.Parse);
+ public Expression Body
+ {
+ get => GetRequired(CatchBody, Expression.Parse);
- set => this.SetRequired(CatchBody, value);
- }
+ set => SetRequired(CatchBody, value);
+ }
- public Parameter? Variable
- {
- get => this.GetOptional(CatchVariable, Parameter.Parse);
+ public Parameter? Variable
+ {
+ get => GetOptional(CatchVariable, Parameter.Parse);
- set => this.SetOptional(CatchVariable, value);
- }
+ set => SetOptional(CatchVariable, value);
+ }
- public Expression? Filter
- {
- get => this.GetOptional(CatchFilter, Expression.Parse);
+ public Expression? Filter
+ {
+ get => GetOptional(CatchFilter, Expression.Parse);
- set => this.SetOptional(CatchFilter, value);
- }
+ set => SetOptional(CatchFilter, value);
+ }
- public Linq.CatchBlock LinqCatchBlock
+ public Linq.CatchBlock LinqCatchBlock
+ {
+ get
{
- get
- {
- var variable = this.Variable?.LinqParameter;
- return Linq.Expression.MakeCatchBlock(this.Type?.SystemType ?? variable?.Type, variable, this.Body.LinqExpression, this.Filter?.LinqExpression);
- }
+ var variable = Variable?.LinqParameter;
+ return Linq.Expression.MakeCatchBlock(Type?.SystemType ?? variable?.Type, variable, Body.LinqExpression, Filter?.LinqExpression);
}
-
- internal static Catch Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new Catch(node)
- };
}
+
+ internal static Catch Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new Catch(node)
+ };
}
diff --git a/GraphEngine/Collection.cs b/GraphEngine/Collection.cs
index be37de5..5665e16 100644
--- a/GraphEngine/Collection.cs
+++ b/GraphEngine/Collection.cs
@@ -1,102 +1,88 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
+namespace GraphEngine;
+
+using System.Collections;
+
+public class Collection(NodeWithGraph subject, INode predicate) : ICollection
{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using VDS.RDF;
+ public int Count => !IsValid(out var listRoot)
+ ? 0
+ : subject.Graph.GetListItems(listRoot).Count();
- public class Collection : ICollection
- {
- private readonly NodeWithGraph subject;
- private readonly INode predicate;
+ public bool IsReadOnly => false;
+
+ protected IEnumerable X => !IsValid(out var listRoot)
+ ? []
+ : subject.Graph.GetListItems(listRoot).Select(n => n.In(subject.Graph));
- public Collection(NodeWithGraph subject, INode predicate)
+ public void Add(NodeWithGraph item)
+ {
+ if (!IsValid(out var listRoot))
{
- this.subject = subject;
- this.predicate = predicate;
+ subject.Graph.Assert(subject, predicate, subject.Graph.AssertList(item.AsEnumerable()));
+ return;
}
- public int Count => !this.IsValid(out var listRoot)
- ? 0
- : this.subject.Graph.GetListItems(listRoot).Count();
+ subject.Graph.AddToList(listRoot, item.AsEnumerable());
+ }
+
+ public void Clear()
+ {
+ if (!IsValid(out var listRoot))
+ {
+ return;
+ }
- public bool IsReadOnly => false;
+ subject.Graph.RetractList(listRoot);
+ subject.Graph.Retract(subject, predicate, listRoot);
+ }
- protected IEnumerable X => !this.IsValid(out var listRoot)
- ? Enumerable.Empty()
- : this.subject.Graph.GetListItems(listRoot).Select(n => n.In(this.subject.Graph));
+ public bool Contains(NodeWithGraph item) => IsValid(out var listRoot) && subject.Graph.GetListItems(listRoot).Contains(item);
- public void Add(NodeWithGraph item)
+ public void CopyTo(NodeWithGraph[] array, int arrayIndex)
+ {
+ if (!IsValid(out var listRoot))
{
- if (!this.IsValid(out var listRoot))
- {
- this.subject.Graph.Assert(this.subject, this.predicate, this.subject.Graph.AssertList(item.AsEnumerable()));
- return;
- }
-
- this.subject.Graph.AddToList(listRoot, item.AsEnumerable());
+ return;
}
- public void Clear()
- {
- if (!this.IsValid(out var listRoot))
- {
- return;
- }
+ subject.Graph.GetListItems(listRoot).ToList().CopyTo(array, arrayIndex);
+ }
- this.subject.Graph.RetractList(listRoot);
- this.subject.Graph.Retract(this.subject, this.predicate, listRoot);
- }
+ IEnumerator IEnumerable.GetEnumerator() => X.GetEnumerator();
- public bool Contains(NodeWithGraph item) => this.IsValid(out var listRoot) && this.subject.Graph.GetListItems(listRoot).Contains(item);
+ IEnumerator IEnumerable.GetEnumerator() =>
+ ((IEnumerable)this).GetEnumerator();
- public void CopyTo(NodeWithGraph[] array, int arrayIndex)
+ public bool Remove(NodeWithGraph item)
+ {
+ if (!IsValid(out var listRoot))
{
- if (!this.IsValid(out var listRoot))
- {
- return;
- }
-
- this.subject.Graph.GetListItems(listRoot).ToList().CopyTo(array, arrayIndex);
+ return false;
}
- IEnumerator IEnumerable.GetEnumerator() => this.X.GetEnumerator();
+ var contains = subject.Graph.GetListItems(listRoot).Contains(item);
- IEnumerator IEnumerable.GetEnumerator() =>
- ((IEnumerable)this).GetEnumerator();
+ subject.Graph.RemoveFromList(listRoot, item.AsEnumerable());
- public bool Remove(NodeWithGraph item)
- {
- if (!this.IsValid(out var listRoot))
- {
- return false;
- }
-
- var contains = this.subject.Graph.GetListItems(listRoot).Contains(item);
+ return contains;
+ }
- this.subject.Graph.RemoveFromList(listRoot, item.AsEnumerable());
+ private bool IsValid(out NodeWithGraph? listRoot)
+ {
+ listRoot = predicate.ObjectOf(subject);
- return contains;
+ if (listRoot is null)
+ {
+ return false;
}
- private bool IsValid(out NodeWithGraph? listRoot)
+ if (!listRoot.IsListRoot(subject.Graph))
{
- listRoot = this.predicate.ObjectOf(this.subject);
-
- if (listRoot is null)
- {
- return false;
- }
-
- if (!listRoot.IsListRoot(this.subject.Graph))
- {
- throw new Exception("not collection");
- }
-
- return true;
+ throw new Exception("not collection");
}
+
+ return true;
}
}
diff --git a/GraphEngine/Collection{T}.cs b/GraphEngine/Collection{T}.cs
index 80ccee1..f508043 100644
--- a/GraphEngine/Collection{T}.cs
+++ b/GraphEngine/Collection{T}.cs
@@ -1,32 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using VDS.RDF;
-
- public class Collection : Collection, ICollection
- where T : NodeWithGraph
- {
- private readonly Func parser;
+namespace GraphEngine;
- public Collection(NodeWithGraph subject, INode predicate, Func parser)
- : base(subject, predicate)
- => this.parser = parser;
+using System.Collections;
- public void Add(T item) => base.Add(item);
+public class Collection(NodeWithGraph subject, INode predicate, Func parser) : Collection(subject, predicate), ICollection
+ where T : NodeWithGraph
+{
+ public void Add(T item) => base.Add(item);
- public bool Contains(T item) => base.Contains(item);
+ public bool Contains(T item) => base.Contains(item);
- public void CopyTo(T[] array, int arrayIndex) => this.X.ToList().CopyTo(array, arrayIndex);
+ public void CopyTo(T[] array, int arrayIndex) => X.ToList().CopyTo(array, arrayIndex);
- public IEnumerator GetEnumerator() => this.X.Select(this.parser).GetEnumerator();
+ public IEnumerator GetEnumerator() => X.Select(parser).GetEnumerator();
- IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)this).GetEnumerator();
+ IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)this).GetEnumerator();
- public bool Remove(T item) => base.Remove(item);
- }
+ public bool Remove(T item) => base.Remove(item);
}
diff --git a/GraphEngine/ElementInit.cs b/GraphEngine/ElementInit.cs
index 8a77273..e3740a1 100644
--- a/GraphEngine/ElementInit.cs
+++ b/GraphEngine/ElementInit.cs
@@ -1,36 +1,23 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class ElementInit : Node
+public class ElementInit(NodeWithGraph node) : Node(node)
+{
+ public Method AddMethod
{
- [DebuggerStepThrough]
- internal ElementInit(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Method AddMethod
- {
- get => this.GetRequired(ElementInitAddMethod, Method.Parse);
+ get => GetRequired(ElementInitAddMethod, Method.Parse);
- set => this.SetRequired(ElementInitAddMethod, value);
- }
+ set => SetRequired(ElementInitAddMethod, value);
+ }
- public ICollection Arguments => this.Collection(ElementInitArguments, Expression.Parse);
+ public ICollection Arguments => Collection(ElementInitArguments, Expression.Parse);
- public Linq.ElementInit LinqElementInit => Linq.Expression.ElementInit(this.AddMethod.ReflectionMethod, this.Arguments.LinqExpressions());
+ public Linq.ElementInit LinqElementInit => Linq.Expression.ElementInit(AddMethod.ReflectionMethod, Arguments.LinqExpressions());
- internal static ElementInit Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new ElementInit(node)
- };
- }
+ internal static ElementInit Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new ElementInit(node)
+ };
}
diff --git a/GraphEngine/ExpressionType.cs b/GraphEngine/ExpressionType.cs
index 8cd6d7c..9171c2f 100644
--- a/GraphEngine/ExpressionType.cs
+++ b/GraphEngine/ExpressionType.cs
@@ -1,153 +1,141 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Diagnostics;
- using VDS.RDF;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class ExpressionType : Node
+public class ExpressionType(NodeWithGraph node) : Node(node)
+{
+ public Linq.ExpressionType LinqExpressionType => this switch
{
- [DebuggerStepThrough]
- public ExpressionType(NodeWithGraph node)
- : base(node)
- {
- }
+ var n when n.Equals(Vocabulary.ExpressionTypes.Add) => Linq.ExpressionType.Add,
+ var n when n.Equals(Vocabulary.ExpressionTypes.AddAssign) => Linq.ExpressionType.AddAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.AddAssignChecked) => Linq.ExpressionType.AddAssignChecked,
+ var n when n.Equals(Vocabulary.ExpressionTypes.AddChecked) => Linq.ExpressionType.AddChecked,
+ var n when n.Equals(Vocabulary.ExpressionTypes.And) => Linq.ExpressionType.And,
+ var n when n.Equals(Vocabulary.ExpressionTypes.AndAlso) => Linq.ExpressionType.AndAlso,
+ var n when n.Equals(Vocabulary.ExpressionTypes.AndAssign) => Linq.ExpressionType.AndAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.ArrayIndex) => Linq.ExpressionType.ArrayIndex,
+ var n when n.Equals(Vocabulary.ExpressionTypes.ArrayLength) => Linq.ExpressionType.ArrayLength,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Assign) => Linq.ExpressionType.Assign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Coalesce) => Linq.ExpressionType.Coalesce,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Convert) => Linq.ExpressionType.Convert,
+ var n when n.Equals(Vocabulary.ExpressionTypes.ConvertChecked) => Linq.ExpressionType.ConvertChecked,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Decrement) => Linq.ExpressionType.Decrement,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Divide) => Linq.ExpressionType.Divide,
+ var n when n.Equals(Vocabulary.ExpressionTypes.DivideAssign) => Linq.ExpressionType.DivideAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Equal) => Linq.ExpressionType.Equal,
+ var n when n.Equals(Vocabulary.ExpressionTypes.ExclusiveOr) => Linq.ExpressionType.ExclusiveOr,
+ var n when n.Equals(Vocabulary.ExpressionTypes.ExclusiveOrAssign) => Linq.ExpressionType.ExclusiveOrAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.GreaterThan) => Linq.ExpressionType.GreaterThan,
+ var n when n.Equals(Vocabulary.ExpressionTypes.GreaterThanOrEqual) => Linq.ExpressionType.GreaterThanOrEqual,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Increment) => Linq.ExpressionType.Increment,
+ var n when n.Equals(Vocabulary.ExpressionTypes.IsFalse) => Linq.ExpressionType.IsFalse,
+ var n when n.Equals(Vocabulary.ExpressionTypes.IsTrue) => Linq.ExpressionType.IsTrue,
+ var n when n.Equals(Vocabulary.ExpressionTypes.LeftShift) => Linq.ExpressionType.LeftShift,
+ var n when n.Equals(Vocabulary.ExpressionTypes.LeftShiftAssign) => Linq.ExpressionType.LeftShiftAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.LessThan) => Linq.ExpressionType.LessThan,
+ var n when n.Equals(Vocabulary.ExpressionTypes.LessThanOrEqual) => Linq.ExpressionType.LessThanOrEqual,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Modulo) => Linq.ExpressionType.Modulo,
+ var n when n.Equals(Vocabulary.ExpressionTypes.ModuloAssign) => Linq.ExpressionType.ModuloAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Multiply) => Linq.ExpressionType.Multiply,
+ var n when n.Equals(Vocabulary.ExpressionTypes.MultiplyAssign) => Linq.ExpressionType.MultiplyAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.MultiplyAssignChecked) => Linq.ExpressionType.MultiplyAssignChecked,
+ var n when n.Equals(Vocabulary.ExpressionTypes.MultiplyChecked) => Linq.ExpressionType.MultiplyChecked,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Negate) => Linq.ExpressionType.Negate,
+ var n when n.Equals(Vocabulary.ExpressionTypes.NegateChecked) => Linq.ExpressionType.NegateChecked,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Not) => Linq.ExpressionType.Not,
+ var n when n.Equals(Vocabulary.ExpressionTypes.NotEqual) => Linq.ExpressionType.NotEqual,
+ var n when n.Equals(Vocabulary.ExpressionTypes.OnesComplement) => Linq.ExpressionType.OnesComplement,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Or) => Linq.ExpressionType.Or,
+ var n when n.Equals(Vocabulary.ExpressionTypes.OrAssign) => Linq.ExpressionType.OrAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.OrElse) => Linq.ExpressionType.OrElse,
+ var n when n.Equals(Vocabulary.ExpressionTypes.PostDecrementAssign) => Linq.ExpressionType.PostDecrementAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.PostIncrementAssign) => Linq.ExpressionType.PostIncrementAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Power) => Linq.ExpressionType.Power,
+ var n when n.Equals(Vocabulary.ExpressionTypes.PowerAssign) => Linq.ExpressionType.PowerAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.PreDecrementAssign) => Linq.ExpressionType.PreDecrementAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.PreIncrementAssign) => Linq.ExpressionType.PreIncrementAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Quote) => Linq.ExpressionType.Quote,
+ var n when n.Equals(Vocabulary.ExpressionTypes.RightShift) => Linq.ExpressionType.RightShift,
+ var n when n.Equals(Vocabulary.ExpressionTypes.RightShiftAssign) => Linq.ExpressionType.RightShiftAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Subtract) => Linq.ExpressionType.Subtract,
+ var n when n.Equals(Vocabulary.ExpressionTypes.SubtractAssign) => Linq.ExpressionType.SubtractAssign,
+ var n when n.Equals(Vocabulary.ExpressionTypes.SubtractAssignChecked) => Linq.ExpressionType.SubtractAssignChecked,
+ var n when n.Equals(Vocabulary.ExpressionTypes.SubtractChecked) => Linq.ExpressionType.SubtractChecked,
+ var n when n.Equals(Vocabulary.ExpressionTypes.TypeAs) => Linq.ExpressionType.TypeAs,
+ var n when n.Equals(Vocabulary.ExpressionTypes.TypeEqual) => Linq.ExpressionType.TypeEqual,
+ var n when n.Equals(Vocabulary.ExpressionTypes.TypeIs) => Linq.ExpressionType.TypeIs,
+ var n when n.Equals(Vocabulary.ExpressionTypes.UnaryPlus) => Linq.ExpressionType.UnaryPlus,
+ var n when n.Equals(Vocabulary.ExpressionTypes.Unbox) => Linq.ExpressionType.Unbox,
- public Linq.ExpressionType LinqExpressionType => this switch
- {
- var n when n.Equals(Vocabulary.ExpressionTypes.Add) => Linq.ExpressionType.Add,
- var n when n.Equals(Vocabulary.ExpressionTypes.AddAssign) => Linq.ExpressionType.AddAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.AddAssignChecked) => Linq.ExpressionType.AddAssignChecked,
- var n when n.Equals(Vocabulary.ExpressionTypes.AddChecked) => Linq.ExpressionType.AddChecked,
- var n when n.Equals(Vocabulary.ExpressionTypes.And) => Linq.ExpressionType.And,
- var n when n.Equals(Vocabulary.ExpressionTypes.AndAlso) => Linq.ExpressionType.AndAlso,
- var n when n.Equals(Vocabulary.ExpressionTypes.AndAssign) => Linq.ExpressionType.AndAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.ArrayIndex) => Linq.ExpressionType.ArrayIndex,
- var n when n.Equals(Vocabulary.ExpressionTypes.ArrayLength) => Linq.ExpressionType.ArrayLength,
- var n when n.Equals(Vocabulary.ExpressionTypes.Assign) => Linq.ExpressionType.Assign,
- var n when n.Equals(Vocabulary.ExpressionTypes.Coalesce) => Linq.ExpressionType.Coalesce,
- var n when n.Equals(Vocabulary.ExpressionTypes.Convert) => Linq.ExpressionType.Convert,
- var n when n.Equals(Vocabulary.ExpressionTypes.ConvertChecked) => Linq.ExpressionType.ConvertChecked,
- var n when n.Equals(Vocabulary.ExpressionTypes.Decrement) => Linq.ExpressionType.Decrement,
- var n when n.Equals(Vocabulary.ExpressionTypes.Divide) => Linq.ExpressionType.Divide,
- var n when n.Equals(Vocabulary.ExpressionTypes.DivideAssign) => Linq.ExpressionType.DivideAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.Equal) => Linq.ExpressionType.Equal,
- var n when n.Equals(Vocabulary.ExpressionTypes.ExclusiveOr) => Linq.ExpressionType.ExclusiveOr,
- var n when n.Equals(Vocabulary.ExpressionTypes.ExclusiveOrAssign) => Linq.ExpressionType.ExclusiveOrAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.GreaterThan) => Linq.ExpressionType.GreaterThan,
- var n when n.Equals(Vocabulary.ExpressionTypes.GreaterThanOrEqual) => Linq.ExpressionType.GreaterThanOrEqual,
- var n when n.Equals(Vocabulary.ExpressionTypes.Increment) => Linq.ExpressionType.Increment,
- var n when n.Equals(Vocabulary.ExpressionTypes.IsFalse) => Linq.ExpressionType.IsFalse,
- var n when n.Equals(Vocabulary.ExpressionTypes.IsTrue) => Linq.ExpressionType.IsTrue,
- var n when n.Equals(Vocabulary.ExpressionTypes.LeftShift) => Linq.ExpressionType.LeftShift,
- var n when n.Equals(Vocabulary.ExpressionTypes.LeftShiftAssign) => Linq.ExpressionType.LeftShiftAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.LessThan) => Linq.ExpressionType.LessThan,
- var n when n.Equals(Vocabulary.ExpressionTypes.LessThanOrEqual) => Linq.ExpressionType.LessThanOrEqual,
- var n when n.Equals(Vocabulary.ExpressionTypes.Modulo) => Linq.ExpressionType.Modulo,
- var n when n.Equals(Vocabulary.ExpressionTypes.ModuloAssign) => Linq.ExpressionType.ModuloAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.Multiply) => Linq.ExpressionType.Multiply,
- var n when n.Equals(Vocabulary.ExpressionTypes.MultiplyAssign) => Linq.ExpressionType.MultiplyAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.MultiplyAssignChecked) => Linq.ExpressionType.MultiplyAssignChecked,
- var n when n.Equals(Vocabulary.ExpressionTypes.MultiplyChecked) => Linq.ExpressionType.MultiplyChecked,
- var n when n.Equals(Vocabulary.ExpressionTypes.Negate) => Linq.ExpressionType.Negate,
- var n when n.Equals(Vocabulary.ExpressionTypes.NegateChecked) => Linq.ExpressionType.NegateChecked,
- var n when n.Equals(Vocabulary.ExpressionTypes.Not) => Linq.ExpressionType.Not,
- var n when n.Equals(Vocabulary.ExpressionTypes.NotEqual) => Linq.ExpressionType.NotEqual,
- var n when n.Equals(Vocabulary.ExpressionTypes.OnesComplement) => Linq.ExpressionType.OnesComplement,
- var n when n.Equals(Vocabulary.ExpressionTypes.Or) => Linq.ExpressionType.Or,
- var n when n.Equals(Vocabulary.ExpressionTypes.OrAssign) => Linq.ExpressionType.OrAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.OrElse) => Linq.ExpressionType.OrElse,
- var n when n.Equals(Vocabulary.ExpressionTypes.PostDecrementAssign) => Linq.ExpressionType.PostDecrementAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.PostIncrementAssign) => Linq.ExpressionType.PostIncrementAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.Power) => Linq.ExpressionType.Power,
- var n when n.Equals(Vocabulary.ExpressionTypes.PowerAssign) => Linq.ExpressionType.PowerAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.PreDecrementAssign) => Linq.ExpressionType.PreDecrementAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.PreIncrementAssign) => Linq.ExpressionType.PreIncrementAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.Quote) => Linq.ExpressionType.Quote,
- var n when n.Equals(Vocabulary.ExpressionTypes.RightShift) => Linq.ExpressionType.RightShift,
- var n when n.Equals(Vocabulary.ExpressionTypes.RightShiftAssign) => Linq.ExpressionType.RightShiftAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.Subtract) => Linq.ExpressionType.Subtract,
- var n when n.Equals(Vocabulary.ExpressionTypes.SubtractAssign) => Linq.ExpressionType.SubtractAssign,
- var n when n.Equals(Vocabulary.ExpressionTypes.SubtractAssignChecked) => Linq.ExpressionType.SubtractAssignChecked,
- var n when n.Equals(Vocabulary.ExpressionTypes.SubtractChecked) => Linq.ExpressionType.SubtractChecked,
- var n when n.Equals(Vocabulary.ExpressionTypes.TypeAs) => Linq.ExpressionType.TypeAs,
- var n when n.Equals(Vocabulary.ExpressionTypes.TypeEqual) => Linq.ExpressionType.TypeEqual,
- var n when n.Equals(Vocabulary.ExpressionTypes.TypeIs) => Linq.ExpressionType.TypeIs,
- var n when n.Equals(Vocabulary.ExpressionTypes.UnaryPlus) => Linq.ExpressionType.UnaryPlus,
- var n when n.Equals(Vocabulary.ExpressionTypes.Unbox) => Linq.ExpressionType.Unbox,
-
- var unknown => throw new InvalidOperationException($"Unknown expression type node {unknown}"),
- };
+ var unknown => throw new InvalidOperationException($"Unknown expression type node {unknown}"),
+ };
- internal static ExpressionType Create(Linq.ExpressionType expressionType, IGraph graph) => Parse(new NodeWithGraph(
- expressionType switch
- {
- Linq.ExpressionType.Add => Vocabulary.ExpressionTypes.Add,
- Linq.ExpressionType.AddAssign => Vocabulary.ExpressionTypes.AddAssign,
- Linq.ExpressionType.AddAssignChecked => Vocabulary.ExpressionTypes.AddAssignChecked,
- Linq.ExpressionType.AddChecked => Vocabulary.ExpressionTypes.AddChecked,
- Linq.ExpressionType.And => Vocabulary.ExpressionTypes.And,
- Linq.ExpressionType.AndAlso => Vocabulary.ExpressionTypes.AndAlso,
- Linq.ExpressionType.AndAssign => Vocabulary.ExpressionTypes.AndAssign,
- Linq.ExpressionType.ArrayIndex => Vocabulary.ExpressionTypes.ArrayIndex,
- Linq.ExpressionType.ArrayLength => Vocabulary.ExpressionTypes.ArrayLength,
- Linq.ExpressionType.Assign => Vocabulary.ExpressionTypes.Assign,
- Linq.ExpressionType.Coalesce => Vocabulary.ExpressionTypes.Coalesce,
- Linq.ExpressionType.Convert => Vocabulary.ExpressionTypes.Convert,
- Linq.ExpressionType.ConvertChecked => Vocabulary.ExpressionTypes.ConvertChecked,
- Linq.ExpressionType.Decrement => Vocabulary.ExpressionTypes.Decrement,
- Linq.ExpressionType.Divide => Vocabulary.ExpressionTypes.Divide,
- Linq.ExpressionType.DivideAssign => Vocabulary.ExpressionTypes.DivideAssign,
- Linq.ExpressionType.Equal => Vocabulary.ExpressionTypes.Equal,
- Linq.ExpressionType.ExclusiveOr => Vocabulary.ExpressionTypes.ExclusiveOr,
- Linq.ExpressionType.ExclusiveOrAssign => Vocabulary.ExpressionTypes.ExclusiveOrAssign,
- Linq.ExpressionType.GreaterThan => Vocabulary.ExpressionTypes.GreaterThan,
- Linq.ExpressionType.GreaterThanOrEqual => Vocabulary.ExpressionTypes.GreaterThanOrEqual,
- Linq.ExpressionType.Increment => Vocabulary.ExpressionTypes.Increment,
- Linq.ExpressionType.IsFalse => Vocabulary.ExpressionTypes.IsFalse,
- Linq.ExpressionType.IsTrue => Vocabulary.ExpressionTypes.IsTrue,
- Linq.ExpressionType.LeftShift => Vocabulary.ExpressionTypes.LeftShift,
- Linq.ExpressionType.LeftShiftAssign => Vocabulary.ExpressionTypes.LeftShiftAssign,
- Linq.ExpressionType.LessThan => Vocabulary.ExpressionTypes.LessThan,
- Linq.ExpressionType.LessThanOrEqual => Vocabulary.ExpressionTypes.LessThanOrEqual,
- Linq.ExpressionType.Modulo => Vocabulary.ExpressionTypes.Modulo,
- Linq.ExpressionType.ModuloAssign => Vocabulary.ExpressionTypes.ModuloAssign,
- Linq.ExpressionType.Multiply => Vocabulary.ExpressionTypes.Multiply,
- Linq.ExpressionType.MultiplyAssign => Vocabulary.ExpressionTypes.MultiplyAssign,
- Linq.ExpressionType.MultiplyAssignChecked => Vocabulary.ExpressionTypes.MultiplyAssignChecked,
- Linq.ExpressionType.MultiplyChecked => Vocabulary.ExpressionTypes.MultiplyChecked,
- Linq.ExpressionType.Negate => Vocabulary.ExpressionTypes.Negate,
- Linq.ExpressionType.NegateChecked => Vocabulary.ExpressionTypes.NegateChecked,
- Linq.ExpressionType.Not => Vocabulary.ExpressionTypes.Not,
- Linq.ExpressionType.NotEqual => Vocabulary.ExpressionTypes.NotEqual,
- Linq.ExpressionType.OnesComplement => Vocabulary.ExpressionTypes.OnesComplement,
- Linq.ExpressionType.Or => Vocabulary.ExpressionTypes.Or,
- Linq.ExpressionType.OrAssign => Vocabulary.ExpressionTypes.OrAssign,
- Linq.ExpressionType.OrElse => Vocabulary.ExpressionTypes.OrElse,
- Linq.ExpressionType.PostDecrementAssign => Vocabulary.ExpressionTypes.PostDecrementAssign,
- Linq.ExpressionType.PostIncrementAssign => Vocabulary.ExpressionTypes.PostIncrementAssign,
- Linq.ExpressionType.Power => Vocabulary.ExpressionTypes.Power,
- Linq.ExpressionType.PowerAssign => Vocabulary.ExpressionTypes.PowerAssign,
- Linq.ExpressionType.PreDecrementAssign => Vocabulary.ExpressionTypes.PreDecrementAssign,
- Linq.ExpressionType.PreIncrementAssign => Vocabulary.ExpressionTypes.PreIncrementAssign,
- Linq.ExpressionType.Quote => Vocabulary.ExpressionTypes.Quote,
- Linq.ExpressionType.RightShift => Vocabulary.ExpressionTypes.RightShift,
- Linq.ExpressionType.RightShiftAssign => Vocabulary.ExpressionTypes.RightShiftAssign,
- Linq.ExpressionType.Subtract => Vocabulary.ExpressionTypes.Subtract,
- Linq.ExpressionType.SubtractAssign => Vocabulary.ExpressionTypes.SubtractAssign,
- Linq.ExpressionType.SubtractAssignChecked => Vocabulary.ExpressionTypes.SubtractAssignChecked,
- Linq.ExpressionType.SubtractChecked => Vocabulary.ExpressionTypes.SubtractChecked,
- Linq.ExpressionType.TypeAs => Vocabulary.ExpressionTypes.TypeAs,
- Linq.ExpressionType.TypeEqual => Vocabulary.ExpressionTypes.TypeEqual,
- Linq.ExpressionType.TypeIs => Vocabulary.ExpressionTypes.TypeIs,
- Linq.ExpressionType.UnaryPlus => Vocabulary.ExpressionTypes.UnaryPlus,
- Linq.ExpressionType.Unbox => Vocabulary.ExpressionTypes.Unbox,
+ internal static ExpressionType Create(Linq.ExpressionType expressionType, IGraph graph) => Parse(new NodeWithGraph(
+ expressionType switch
+ {
+ Linq.ExpressionType.Add => Vocabulary.ExpressionTypes.Add,
+ Linq.ExpressionType.AddAssign => Vocabulary.ExpressionTypes.AddAssign,
+ Linq.ExpressionType.AddAssignChecked => Vocabulary.ExpressionTypes.AddAssignChecked,
+ Linq.ExpressionType.AddChecked => Vocabulary.ExpressionTypes.AddChecked,
+ Linq.ExpressionType.And => Vocabulary.ExpressionTypes.And,
+ Linq.ExpressionType.AndAlso => Vocabulary.ExpressionTypes.AndAlso,
+ Linq.ExpressionType.AndAssign => Vocabulary.ExpressionTypes.AndAssign,
+ Linq.ExpressionType.ArrayIndex => Vocabulary.ExpressionTypes.ArrayIndex,
+ Linq.ExpressionType.ArrayLength => Vocabulary.ExpressionTypes.ArrayLength,
+ Linq.ExpressionType.Assign => Vocabulary.ExpressionTypes.Assign,
+ Linq.ExpressionType.Coalesce => Vocabulary.ExpressionTypes.Coalesce,
+ Linq.ExpressionType.Convert => Vocabulary.ExpressionTypes.Convert,
+ Linq.ExpressionType.ConvertChecked => Vocabulary.ExpressionTypes.ConvertChecked,
+ Linq.ExpressionType.Decrement => Vocabulary.ExpressionTypes.Decrement,
+ Linq.ExpressionType.Divide => Vocabulary.ExpressionTypes.Divide,
+ Linq.ExpressionType.DivideAssign => Vocabulary.ExpressionTypes.DivideAssign,
+ Linq.ExpressionType.Equal => Vocabulary.ExpressionTypes.Equal,
+ Linq.ExpressionType.ExclusiveOr => Vocabulary.ExpressionTypes.ExclusiveOr,
+ Linq.ExpressionType.ExclusiveOrAssign => Vocabulary.ExpressionTypes.ExclusiveOrAssign,
+ Linq.ExpressionType.GreaterThan => Vocabulary.ExpressionTypes.GreaterThan,
+ Linq.ExpressionType.GreaterThanOrEqual => Vocabulary.ExpressionTypes.GreaterThanOrEqual,
+ Linq.ExpressionType.Increment => Vocabulary.ExpressionTypes.Increment,
+ Linq.ExpressionType.IsFalse => Vocabulary.ExpressionTypes.IsFalse,
+ Linq.ExpressionType.IsTrue => Vocabulary.ExpressionTypes.IsTrue,
+ Linq.ExpressionType.LeftShift => Vocabulary.ExpressionTypes.LeftShift,
+ Linq.ExpressionType.LeftShiftAssign => Vocabulary.ExpressionTypes.LeftShiftAssign,
+ Linq.ExpressionType.LessThan => Vocabulary.ExpressionTypes.LessThan,
+ Linq.ExpressionType.LessThanOrEqual => Vocabulary.ExpressionTypes.LessThanOrEqual,
+ Linq.ExpressionType.Modulo => Vocabulary.ExpressionTypes.Modulo,
+ Linq.ExpressionType.ModuloAssign => Vocabulary.ExpressionTypes.ModuloAssign,
+ Linq.ExpressionType.Multiply => Vocabulary.ExpressionTypes.Multiply,
+ Linq.ExpressionType.MultiplyAssign => Vocabulary.ExpressionTypes.MultiplyAssign,
+ Linq.ExpressionType.MultiplyAssignChecked => Vocabulary.ExpressionTypes.MultiplyAssignChecked,
+ Linq.ExpressionType.MultiplyChecked => Vocabulary.ExpressionTypes.MultiplyChecked,
+ Linq.ExpressionType.Negate => Vocabulary.ExpressionTypes.Negate,
+ Linq.ExpressionType.NegateChecked => Vocabulary.ExpressionTypes.NegateChecked,
+ Linq.ExpressionType.Not => Vocabulary.ExpressionTypes.Not,
+ Linq.ExpressionType.NotEqual => Vocabulary.ExpressionTypes.NotEqual,
+ Linq.ExpressionType.OnesComplement => Vocabulary.ExpressionTypes.OnesComplement,
+ Linq.ExpressionType.Or => Vocabulary.ExpressionTypes.Or,
+ Linq.ExpressionType.OrAssign => Vocabulary.ExpressionTypes.OrAssign,
+ Linq.ExpressionType.OrElse => Vocabulary.ExpressionTypes.OrElse,
+ Linq.ExpressionType.PostDecrementAssign => Vocabulary.ExpressionTypes.PostDecrementAssign,
+ Linq.ExpressionType.PostIncrementAssign => Vocabulary.ExpressionTypes.PostIncrementAssign,
+ Linq.ExpressionType.Power => Vocabulary.ExpressionTypes.Power,
+ Linq.ExpressionType.PowerAssign => Vocabulary.ExpressionTypes.PowerAssign,
+ Linq.ExpressionType.PreDecrementAssign => Vocabulary.ExpressionTypes.PreDecrementAssign,
+ Linq.ExpressionType.PreIncrementAssign => Vocabulary.ExpressionTypes.PreIncrementAssign,
+ Linq.ExpressionType.Quote => Vocabulary.ExpressionTypes.Quote,
+ Linq.ExpressionType.RightShift => Vocabulary.ExpressionTypes.RightShift,
+ Linq.ExpressionType.RightShiftAssign => Vocabulary.ExpressionTypes.RightShiftAssign,
+ Linq.ExpressionType.Subtract => Vocabulary.ExpressionTypes.Subtract,
+ Linq.ExpressionType.SubtractAssign => Vocabulary.ExpressionTypes.SubtractAssign,
+ Linq.ExpressionType.SubtractAssignChecked => Vocabulary.ExpressionTypes.SubtractAssignChecked,
+ Linq.ExpressionType.SubtractChecked => Vocabulary.ExpressionTypes.SubtractChecked,
+ Linq.ExpressionType.TypeAs => Vocabulary.ExpressionTypes.TypeAs,
+ Linq.ExpressionType.TypeEqual => Vocabulary.ExpressionTypes.TypeEqual,
+ Linq.ExpressionType.TypeIs => Vocabulary.ExpressionTypes.TypeIs,
+ Linq.ExpressionType.UnaryPlus => Vocabulary.ExpressionTypes.UnaryPlus,
+ Linq.ExpressionType.Unbox => Vocabulary.ExpressionTypes.Unbox,
- var unknown => throw new InvalidOperationException($"Uknown expression type {unknown}")
- }, graph));
+ var unknown => throw new InvalidOperationException($"Uknown expression type {unknown}")
+ }, graph));
- internal static ExpressionType Parse(NodeWithGraph node) => new (node);
- }
+ internal static ExpressionType Parse(NodeWithGraph node) => new (node);
}
diff --git a/GraphEngine/Expressions/ArrayAccess.cs b/GraphEngine/Expressions/ArrayAccess.cs
index f689001..957de10 100644
--- a/GraphEngine/Expressions/ArrayAccess.cs
+++ b/GraphEngine/Expressions/ArrayAccess.cs
@@ -1,29 +1,17 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class ArrayAccess : Expression
+public class ArrayAccess(NodeWithGraph node) : Expression(node)
+{
+ public Expression Array
{
- [DebuggerStepThrough]
- internal ArrayAccess(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Expression Array
- {
- get => this.GetRequired(ArrayAccessArray, Expression.Parse);
+ get => GetRequired(ArrayAccessArray, Expression.Parse);
- set => this.SetRequired(ArrayAccessArray, value);
- }
+ set => SetRequired(ArrayAccessArray, value);
+ }
- public ICollection Indexes => this.Collection(ArrayAccessIndexes, Expression.Parse);
+ public ICollection Indexes => Collection(ArrayAccessIndexes, Expression.Parse);
- public override Linq.Expression LinqExpression => Linq.Expression.ArrayAccess(this.Array.LinqExpression, this.Indexes.LinqExpressions());
- }
+ public override Linq.Expression LinqExpression => Linq.Expression.ArrayAccess(Array.LinqExpression, Indexes.LinqExpressions());
}
diff --git a/GraphEngine/Expressions/ArrayIndex.cs b/GraphEngine/Expressions/ArrayIndex.cs
index cced36a..4f54a76 100644
--- a/GraphEngine/Expressions/ArrayIndex.cs
+++ b/GraphEngine/Expressions/ArrayIndex.cs
@@ -1,40 +1,28 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class ArrayIndex : Expression
+public class ArrayIndex(NodeWithGraph node) : Expression(node)
+{
+ public Expression Array
{
- [DebuggerStepThrough]
- internal ArrayIndex(NodeWithGraph node)
- : base(node)
- {
- }
+ get => GetRequired(ArrayIndexArray, Expression.Parse);
- public Expression Array
- {
- get => this.GetRequired(ArrayIndexArray, Expression.Parse);
-
- set => this.SetRequired(ArrayIndexArray, value);
- }
+ set => SetRequired(ArrayIndexArray, value);
+ }
- public Expression? Index
- {
- get => this.GetOptional(ArrayIndexIndex, Expression.Parse);
+ public Expression? Index
+ {
+ get => GetOptional(ArrayIndexIndex, Expression.Parse);
- set => this.SetOptional(ArrayIndexIndex, value);
- }
+ set => SetOptional(ArrayIndexIndex, value);
+ }
- public ICollection Indexes => this.Collection(ArrayIndexIndexes, Expression.Parse);
+ public ICollection Indexes => Collection(ArrayIndexIndexes, Expression.Parse);
- public override Linq.Expression LinqExpression => this.Index switch
- {
- not null => Linq.Expression.ArrayIndex(this.Array.LinqExpression, this.Index.LinqExpression),
- _ => Linq.Expression.ArrayIndex(this.Array.LinqExpression, this.Indexes.LinqExpressions())
- };
- }
+ public override Linq.Expression LinqExpression => Index switch
+ {
+ not null => Linq.Expression.ArrayIndex(Array.LinqExpression, Index.LinqExpression),
+ _ => Linq.Expression.ArrayIndex(Array.LinqExpression, Indexes.LinqExpressions())
+ };
}
diff --git a/GraphEngine/Expressions/BaseGoto.cs b/GraphEngine/Expressions/BaseGoto.cs
index cfca356..7760ac9 100644
--- a/GraphEngine/Expressions/BaseGoto.cs
+++ b/GraphEngine/Expressions/BaseGoto.cs
@@ -1,52 +1,41 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public abstract class BaseGoto : Expression
+public abstract class BaseGoto(NodeWithGraph node, INode type) : Expression(node, type)
+{
+ public Target Target
{
- [DebuggerStepThrough]
- protected BaseGoto(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Target Target
- {
- get => this.GetRequired(GotoTarget, Target.Parse);
+ get => GetRequired(GotoTarget, Target.Parse);
- set => this.SetRequired(GotoTarget, value);
- }
+ set => SetRequired(GotoTarget, value);
+ }
- public Type? Type
- {
- get => this.GetOptional(GotoType, Type.Parse);
+ public Type? Type
+ {
+ get => GetOptional(GotoType, Type.Parse);
- set => this.SetOptional(GotoType, value);
- }
+ set => SetOptional(GotoType, value);
+ }
- public Expression? Value
- {
- get => this.GetOptional(GotoValue, Expression.Parse);
+ public Expression? Value
+ {
+ get => GetOptional(GotoValue, Expression.Parse);
- set => this.SetOptional(GotoValue, value);
- }
+ set => SetOptional(GotoValue, value);
+ }
- public override Linq.Expression LinqExpression => Linq.Expression.MakeGoto(this.Kind, this.Target.LinqTarget, this.Value?.LinqExpression, this.Type?.SystemType ?? typeof(void));
+ public override Linq.Expression LinqExpression => Linq.Expression.MakeGoto(Kind, Target.LinqTarget, Value?.LinqExpression, Type?.SystemType ?? typeof(void));
- protected abstract Linq.GotoExpressionKind Kind { get; }
+ protected abstract Linq.GotoExpressionKind Kind { get; }
- public static BaseGoto Create(NodeWithGraph node, Linq.GotoExpressionKind kind) => kind switch
- {
- Linq.GotoExpressionKind.Goto => new Goto(node),
- Linq.GotoExpressionKind.Return => new Return(node),
- Linq.GotoExpressionKind.Break => new Break(node),
- Linq.GotoExpressionKind.Continue => new Continue(node),
+ public static BaseGoto Create(NodeWithGraph node, Linq.GotoExpressionKind kind) => kind switch
+ {
+ Linq.GotoExpressionKind.Goto => new Goto(node),
+ Linq.GotoExpressionKind.Return => new Return(node),
+ Linq.GotoExpressionKind.Break => new Break(node),
+ Linq.GotoExpressionKind.Continue => new Continue(node),
- _ => throw new System.Exception("{type} is not goto")
- };
- }
+ _ => throw new System.Exception("{type} is not goto")
+ };
}
diff --git a/GraphEngine/Expressions/Binary.cs b/GraphEngine/Expressions/Binary.cs
index 8a4b059..5c193b5 100644
--- a/GraphEngine/Expressions/Binary.cs
+++ b/GraphEngine/Expressions/Binary.cs
@@ -1,120 +1,107 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
+namespace GraphEngine;
+
+public class Binary(NodeWithGraph node, INode? type = default) : Expression(node, type)
{
- using System;
- using System.Diagnostics;
- using VDS.RDF;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+ public Expression Left
+ {
+ get => GetRequired(BinaryLeft, Expression.Parse);
+
+ set => SetRequired(BinaryLeft, value);
+ }
+
+ public Expression Right
+ {
+ get => GetRequired(BinaryRight, Expression.Parse);
+
+ set => SetRequired(BinaryRight, value);
+ }
+
+ public ExpressionType ExpressionType
+ {
+ get => GetRequired(BinaryExpressionType, ExpressionType.Parse);
+
+ set => SetRequired(BinaryExpressionType, value);
+ }
- public class Binary : Expression
+ public Method? Method
{
- [DebuggerStepThrough]
- public Binary(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Expression Left
- {
- get => this.GetRequired(BinaryLeft, Expression.Parse);
-
- set => this.SetRequired(BinaryLeft, value);
- }
-
- public Expression Right
- {
- get => this.GetRequired(BinaryRight, Expression.Parse);
-
- set => this.SetRequired(BinaryRight, value);
- }
-
- public ExpressionType ExpressionType
- {
- get => this.GetRequired(BinaryExpressionType, ExpressionType.Parse);
-
- set => this.SetRequired(BinaryExpressionType, value);
- }
-
- public Method? Method
- {
- get => this.GetOptional(BinaryMethod, Method.Parse);
-
- set => this.SetOptional(BinaryMethod, value);
- }
-
- public bool? LiftToNull
- {
- get => this.GetOptionalS(BinaryLiftToNull, AsBool);
-
- set => this.SetOptional(BinaryLiftToNull, value);
- }
-
- public Lambda? Conversion
- {
- get => this.GetOptional(BinaryConversion, Lambda.Parse);
-
- set => this.SetOptional(BinaryConversion, value);
- }
-
- public override Linq.Expression LinqExpression =>
- Linq.Expression.MakeBinary(
- this.ExpressionType.LinqExpressionType,
- this.Left.LinqExpression,
- this.Right.LinqExpression,
- this.LiftToNull ?? false,
- this.Method?.ReflectionMethod,
- this.Conversion?.LinqLambda);
-
- public static Binary Create(NodeWithGraph node, Linq.ExpressionType type) => (node, type) switch
- {
- (node: NodeWithGraph n, type:
- Linq.ExpressionType.Add or
- Linq.ExpressionType.AddAssign or
- Linq.ExpressionType.AddAssignChecked or
- Linq.ExpressionType.AddChecked or
- Linq.ExpressionType.And or
- Linq.ExpressionType.AndAlso or
- Linq.ExpressionType.AndAssign or
- Linq.ExpressionType.ArrayIndex or
- Linq.ExpressionType.Assign or
- Linq.ExpressionType.Coalesce or
- Linq.ExpressionType.Divide or
- Linq.ExpressionType.DivideAssign or
- Linq.ExpressionType.Equal or
- Linq.ExpressionType.ExclusiveOr or
- Linq.ExpressionType.ExclusiveOrAssign or
- Linq.ExpressionType.GreaterThan or
- Linq.ExpressionType.GreaterThanOrEqual or
- Linq.ExpressionType.LeftShift or
- Linq.ExpressionType.LeftShiftAssign or
- Linq.ExpressionType.LessThan or
- Linq.ExpressionType.LessThanOrEqual or
- Linq.ExpressionType.Modulo or
- Linq.ExpressionType.ModuloAssign or
- Linq.ExpressionType.Multiply or
- Linq.ExpressionType.MultiplyAssign or
- Linq.ExpressionType.MultiplyAssignChecked or
- Linq.ExpressionType.MultiplyChecked or
- Linq.ExpressionType.NotEqual or
- Linq.ExpressionType.Or or
- Linq.ExpressionType.OrAssign or
- Linq.ExpressionType.OrElse or
- Linq.ExpressionType.Power or
- Linq.ExpressionType.PowerAssign or
- Linq.ExpressionType.RightShift or
- Linq.ExpressionType.RightShiftAssign or
- Linq.ExpressionType.Subtract or
- Linq.ExpressionType.SubtractAssign or
- Linq.ExpressionType.SubtractAssignChecked or
- Linq.ExpressionType.SubtractChecked) => new Binary(n)
- {
- ExpressionType = ExpressionType.Create(type, n.Graph),
- },
-
- (node: null, _) => throw new ArgumentNullException(nameof(node)),
- _ => throw new InvalidOperationException($"{type} is not binary"),
- };
+ get => GetOptional(BinaryMethod, Method.Parse);
+
+ set => SetOptional(BinaryMethod, value);
+ }
+
+ public bool? LiftToNull
+ {
+ get => GetOptionalS(BinaryLiftToNull, AsBool);
+
+ set => SetOptional(BinaryLiftToNull, value);
+ }
+
+ public Lambda? Conversion
+ {
+ get => GetOptional(BinaryConversion, Lambda.Parse);
+
+ set => SetOptional(BinaryConversion, value);
}
+
+ public override Linq.Expression LinqExpression =>
+ Linq.Expression.MakeBinary(
+ ExpressionType.LinqExpressionType,
+ Left.LinqExpression,
+ Right.LinqExpression,
+ LiftToNull ?? false,
+ Method?.ReflectionMethod,
+ Conversion?.LinqLambda);
+
+ public static Binary Create(NodeWithGraph node, Linq.ExpressionType type) => (node, type) switch
+ {
+ (node: NodeWithGraph n, type:
+ Linq.ExpressionType.Add or
+ Linq.ExpressionType.AddAssign or
+ Linq.ExpressionType.AddAssignChecked or
+ Linq.ExpressionType.AddChecked or
+ Linq.ExpressionType.And or
+ Linq.ExpressionType.AndAlso or
+ Linq.ExpressionType.AndAssign or
+ Linq.ExpressionType.ArrayIndex or
+ Linq.ExpressionType.Assign or
+ Linq.ExpressionType.Coalesce or
+ Linq.ExpressionType.Divide or
+ Linq.ExpressionType.DivideAssign or
+ Linq.ExpressionType.Equal or
+ Linq.ExpressionType.ExclusiveOr or
+ Linq.ExpressionType.ExclusiveOrAssign or
+ Linq.ExpressionType.GreaterThan or
+ Linq.ExpressionType.GreaterThanOrEqual or
+ Linq.ExpressionType.LeftShift or
+ Linq.ExpressionType.LeftShiftAssign or
+ Linq.ExpressionType.LessThan or
+ Linq.ExpressionType.LessThanOrEqual or
+ Linq.ExpressionType.Modulo or
+ Linq.ExpressionType.ModuloAssign or
+ Linq.ExpressionType.Multiply or
+ Linq.ExpressionType.MultiplyAssign or
+ Linq.ExpressionType.MultiplyAssignChecked or
+ Linq.ExpressionType.MultiplyChecked or
+ Linq.ExpressionType.NotEqual or
+ Linq.ExpressionType.Or or
+ Linq.ExpressionType.OrAssign or
+ Linq.ExpressionType.OrElse or
+ Linq.ExpressionType.Power or
+ Linq.ExpressionType.PowerAssign or
+ Linq.ExpressionType.RightShift or
+ Linq.ExpressionType.RightShiftAssign or
+ Linq.ExpressionType.Subtract or
+ Linq.ExpressionType.SubtractAssign or
+ Linq.ExpressionType.SubtractAssignChecked or
+ Linq.ExpressionType.SubtractChecked) => new Binary(n)
+ {
+ ExpressionType = ExpressionType.Create(type, n.Graph),
+ },
+
+ (node: null, _) => throw new ArgumentNullException(nameof(node)),
+ _ => throw new InvalidOperationException($"{type} is not binary"),
+ };
}
diff --git a/GraphEngine/Expressions/Block.cs b/GraphEngine/Expressions/Block.cs
index 1a155b2..993f0eb 100644
--- a/GraphEngine/Expressions/Block.cs
+++ b/GraphEngine/Expressions/Block.cs
@@ -1,45 +1,32 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Block : Expression
+public class Block(NodeWithGraph node) : Expression(node)
+{
+ public Type? Type
{
- [DebuggerStepThrough]
- internal Block(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Type? Type
- {
- get => this.GetOptional(BlockType, Type.Parse);
-
- set => this.SetOptional(BlockType, value);
- }
+ get => GetOptional(BlockType, Type.Parse);
- public ICollection Expressions => this.Collection(BlockExpressions, Expression.Parse);
-
- public ICollection Variables => this.Collection(BlockVariables, Parameter.Parse);
+ set => SetOptional(BlockType, value);
+ }
- public override Linq.Expression LinqExpression => (type: this.Type, empty: !this.Variables.Any()) switch
- {
- (type: not null, _) => Linq.Expression.Block(
- this.Type.SystemType,
- from e in this.Variables select e.LinqParameter,
- this.Expressions.LinqExpressions()),
+ public ICollection Expressions => Collection(BlockExpressions, Expression.Parse);
- (_, empty: true) => Linq.Expression.Block(
- this.Expressions.LinqExpressions().ToArray()),
+ public ICollection Variables => Collection(BlockVariables, Parameter.Parse);
- _ => Linq.Expression.Block(
- from e in this.Variables select e.LinqParameter,
- this.Expressions.LinqExpressions()),
- };
- }
+ public override Linq.Expression LinqExpression => (type: Type, empty: !Variables.Any()) switch
+ {
+ (type: not null, _) => Linq.Expression.Block(
+ Type.SystemType,
+ from e in Variables select e.LinqParameter,
+ Expressions.LinqExpressions()),
+
+ (_, empty: true) => Linq.Expression.Block(
+ Expressions.LinqExpressions().ToArray()),
+
+ _ => Linq.Expression.Block(
+ from e in Variables select e.LinqParameter,
+ Expressions.LinqExpressions()),
+ };
}
diff --git a/GraphEngine/Expressions/Call.cs b/GraphEngine/Expressions/Call.cs
index 4100c96..70825a2 100644
--- a/GraphEngine/Expressions/Call.cs
+++ b/GraphEngine/Expressions/Call.cs
@@ -1,71 +1,58 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Call : Expression
+public class Call(NodeWithGraph node) : Expression(node)
+{
+ public Expression? Instance
{
- [DebuggerStepThrough]
- internal Call(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Expression? Instance
- {
- get => this.GetOptional(CallInstance, Expression.Parse);
-
- set => this.SetOptional(CallInstance, value);
- }
+ get => GetOptional(CallInstance, Expression.Parse);
- public Type? Type
- {
- get => this.GetOptional(CallType, Type.Parse);
-
- set => this.SetOptional(CallType, value);
- }
+ set => SetOptional(CallInstance, value);
+ }
- public Method? Method
- {
- get => this.GetOptional(CallMethod, Method.Parse);
+ public Type? Type
+ {
+ get => GetOptional(CallType, Type.Parse);
- set => this.SetOptional(CallMethod, value);
- }
+ set => SetOptional(CallType, value);
+ }
- public string? MethodName
- {
- get => this.GetOptional(CallMethodName, AsString);
+ public Method? Method
+ {
+ get => GetOptional(CallMethod, Method.Parse);
- set => this.SetOptional(CallMethodName, value);
- }
+ set => SetOptional(CallMethod, value);
+ }
- public ICollection Arguments => this.Collection(CallArguments, Expression.Parse);
+ public string? MethodName
+ {
+ get => GetOptional(CallMethodName, AsString);
- public ICollection TypeArguments => this.Collection(CallTypeArguments, Type.Parse);
+ set => SetOptional(CallMethodName, value);
+ }
- public override Linq.Expression LinqExpression => this switch
- {
- Call { Method.ReflectionMethod: not null } => Linq.Expression.Call(
- this.Instance?.LinqExpression,
- this.Method.ReflectionMethod,
- this.Arguments.LinqExpressions()),
+ public ICollection Arguments => Collection(CallArguments, Expression.Parse);
- Call { Type: not null } => Linq.Expression.Call(
- this.Type.SystemType,
- this.MethodName,
- (from typeArg in this.TypeArguments select typeArg.SystemType).ToArray(),
- this.Arguments.LinqExpressions().ToArray()),
+ public ICollection TypeArguments => Collection(CallTypeArguments, Type.Parse);
- _ => Linq.Expression.Call(
- this.Instance.LinqExpression,
- this.MethodName,
- (from typeArg in this.TypeArguments select typeArg.SystemType).ToArray(),
- this.Arguments.LinqExpressions().ToArray())
- };
- }
+ public override Linq.Expression LinqExpression => this switch
+ {
+ Call { Method.ReflectionMethod: not null } => Linq.Expression.Call(
+ Instance?.LinqExpression,
+ Method.ReflectionMethod,
+ Arguments.LinqExpressions()),
+
+ Call { Type: not null } => Linq.Expression.Call(
+ Type.SystemType,
+ MethodName,
+ (from typeArg in TypeArguments select typeArg.SystemType).ToArray(),
+ Arguments.LinqExpressions().ToArray()),
+
+ _ => Linq.Expression.Call(
+ Instance.LinqExpression,
+ MethodName,
+ (from typeArg in TypeArguments select typeArg.SystemType).ToArray(),
+ Arguments.LinqExpressions().ToArray())
+ };
}
diff --git a/GraphEngine/Expressions/ClearDebugInfo.cs b/GraphEngine/Expressions/ClearDebugInfo.cs
index 6ba16b1..b4fef22 100644
--- a/GraphEngine/Expressions/ClearDebugInfo.cs
+++ b/GraphEngine/Expressions/ClearDebugInfo.cs
@@ -1,17 +1,8 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
-
- public class ClearDebugInfo : DebugInfo
- {
- [DebuggerStepThrough]
- internal ClearDebugInfo(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.ClearDebugInfo;
+namespace GraphEngine;
- public override Linq.Expression LinqExpression => Linq.Expression.ClearDebugInfo(this.Document.LinqDocument);
- }
+public class ClearDebugInfo(NodeWithGraph node) : DebugInfo(node, Vocabulary.ClearDebugInfo)
+{
+ public override Linq.Expression LinqExpression => Linq.Expression.ClearDebugInfo(Document.LinqDocument);
}
diff --git a/GraphEngine/Expressions/Condition.cs b/GraphEngine/Expressions/Condition.cs
index 0d7850c..acce416 100644
--- a/GraphEngine/Expressions/Condition.cs
+++ b/GraphEngine/Expressions/Condition.cs
@@ -1,51 +1,40 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Condition : Expression
+public class Condition(NodeWithGraph node, INode? type = default) : Expression(node, type)
+{
+ public Expression Test
{
- [DebuggerStepThrough]
- internal Condition(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Expression Test
- {
- get => this.GetRequired(ConditionTest, Expression.Parse);
+ get => GetRequired(ConditionTest, Expression.Parse);
- set => this.SetRequired(ConditionTest, value);
- }
-
- public Expression IfTrue
- {
- get => this.GetRequired(ConditionIfTrue, Expression.Parse);
+ set => SetRequired(ConditionTest, value);
+ }
- set => this.SetRequired(ConditionIfTrue, value);
- }
+ public Expression IfTrue
+ {
+ get => GetRequired(ConditionIfTrue, Expression.Parse);
- public Expression IfFalse
- {
- get => this.GetRequired(ConditionIfFalse, Expression.Parse);
+ set => SetRequired(ConditionIfTrue, value);
+ }
- set => this.SetRequired(ConditionIfFalse, value);
- }
+ public Expression IfFalse
+ {
+ get => GetRequired(ConditionIfFalse, Expression.Parse);
- public Type? Type
- {
- get => this.GetOptional(ConditionType, Type.Parse);
+ set => SetRequired(ConditionIfFalse, value);
+ }
- set => this.SetOptional(ConditionType, value);
- }
+ public Type? Type
+ {
+ get => GetOptional(ConditionType, Type.Parse);
- public override Linq.Expression LinqExpression => this.Type switch
- {
- Type type => Linq.Expression.Condition(this.Test.LinqExpression, this.IfTrue.LinqExpression, this.IfFalse.LinqExpression, type.SystemType),
- _ => Linq.Expression.Condition(this.Test.LinqExpression, this.IfTrue.LinqExpression, this.IfFalse.LinqExpression)
- };
+ set => SetOptional(ConditionType, value);
}
+
+ public override Linq.Expression LinqExpression => Type switch
+ {
+ Type type => Linq.Expression.Condition(Test.LinqExpression, IfTrue.LinqExpression, IfFalse.LinqExpression, type.SystemType),
+ _ => Linq.Expression.Condition(Test.LinqExpression, IfTrue.LinqExpression, IfFalse.LinqExpression)
+ };
}
diff --git a/GraphEngine/Expressions/Constant.cs b/GraphEngine/Expressions/Constant.cs
index 470e802..3b1df5e 100644
--- a/GraphEngine/Expressions/Constant.cs
+++ b/GraphEngine/Expressions/Constant.cs
@@ -1,37 +1,26 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Constant : Expression
+public class Constant(NodeWithGraph node) : Expression(node)
+{
+ public object? Value
{
- [DebuggerStepThrough]
- internal Constant(NodeWithGraph node)
- : base(node)
- {
- }
-
- public object? Value
- {
- get => this.GetOptional(ConstantValue, AsObject);
-
- set => this.SetOptional(ConstantValue, value);
- }
+ get => GetOptional(ConstantValue, AsObject);
- public Type? Type
- {
- get => this.GetOptional(ConstantType, Type.Parse);
+ set => SetOptional(ConstantValue, value);
+ }
- set => this.SetOptional(ConstantType, value);
- }
+ public Type? Type
+ {
+ get => GetOptional(ConstantType, Type.Parse);
- public override Linq.Expression LinqExpression => this.Type switch
- {
- Type type => Linq.Expression.Constant(this.Value, type.SystemType),
- _ => Linq.Expression.Constant(this.Value)
- };
+ set => SetOptional(ConstantType, value);
}
+
+ public override Linq.Expression LinqExpression => Type switch
+ {
+ Type type => Linq.Expression.Constant(Value, type.SystemType),
+ _ => Linq.Expression.Constant(Value)
+ };
}
diff --git a/GraphEngine/Expressions/DebugInfo.cs b/GraphEngine/Expressions/DebugInfo.cs
index cd59eb2..8d72d80 100644
--- a/GraphEngine/Expressions/DebugInfo.cs
+++ b/GraphEngine/Expressions/DebugInfo.cs
@@ -1,54 +1,43 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class DebugInfo : Expression
+public class DebugInfo(NodeWithGraph node, INode? type = default) : Expression(node, type)
+{
+ public SymbolDocument Document
{
- [DebuggerStepThrough]
- internal DebugInfo(NodeWithGraph node)
- : base(node)
- {
- }
-
- public SymbolDocument Document
- {
- get => this.GetRequired(DebugInfoDocument, n => new SymbolDocument(n));
-
- set => this.SetRequired(DebugInfoDocument, value);
- }
+ get => GetRequired(DebugInfoDocument, n => new SymbolDocument(n));
- public int StartLine
- {
- get => this.GetRequiredS(DebugInfoStartLine, AsInt);
+ set => SetRequired(DebugInfoDocument, value);
+ }
- set => this.SetRequired(DebugInfoStartLine, value);
- }
+ public int StartLine
+ {
+ get => GetRequiredS(DebugInfoStartLine, AsInt);
- public int StartColumn
- {
- get => this.GetRequiredS(DebugInfoStartColumn, AsInt);
+ set => SetRequired(DebugInfoStartLine, value);
+ }
- set => this.SetRequired(DebugInfoStartColumn, value);
- }
+ public int StartColumn
+ {
+ get => GetRequiredS(DebugInfoStartColumn, AsInt);
- public int EndLine
- {
- get => this.GetRequiredS(DebugInfoEndLine, AsInt);
+ set => SetRequired(DebugInfoStartColumn, value);
+ }
- set => this.SetRequired(DebugInfoEndLine, value);
- }
+ public int EndLine
+ {
+ get => GetRequiredS(DebugInfoEndLine, AsInt);
- public int EndColumn
- {
- get => this.GetRequiredS(DebugInfoEndColumn, AsInt);
+ set => SetRequired(DebugInfoEndLine, value);
+ }
- set => this.SetRequired(DebugInfoEndColumn, value);
- }
+ public int EndColumn
+ {
+ get => GetRequiredS(DebugInfoEndColumn, AsInt);
- public override Linq.Expression LinqExpression => Linq.Expression.DebugInfo(this.Document.LinqDocument, this.StartLine, this.StartColumn, this.EndLine, this.EndColumn);
+ set => SetRequired(DebugInfoEndColumn, value);
}
+
+ public override Linq.Expression LinqExpression => Linq.Expression.DebugInfo(Document.LinqDocument, StartLine, StartColumn, EndLine, EndColumn);
}
diff --git a/GraphEngine/Expressions/Default.cs b/GraphEngine/Expressions/Default.cs
index 9c1cccf..bf27847 100644
--- a/GraphEngine/Expressions/Default.cs
+++ b/GraphEngine/Expressions/Default.cs
@@ -1,26 +1,15 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Default : Expression
+public class Default(NodeWithGraph node) : Expression(node)
+{
+ public Type Type
{
- [DebuggerStepThrough]
- internal Default(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Type Type
- {
- get => this.GetRequired(DefaultType, Type.Parse);
+ get => GetRequired(DefaultType, Type.Parse);
- set => this.SetRequired(DefaultType, value);
- }
-
- public override Linq.Expression LinqExpression => Linq.Expression.Default(this.Type.SystemType);
+ set => SetRequired(DefaultType, value);
}
+
+ public override Linq.Expression LinqExpression => Linq.Expression.Default(Type.SystemType);
}
diff --git a/GraphEngine/Expressions/Dynamic.cs b/GraphEngine/Expressions/Dynamic.cs
index 8d076b2..ae9fbda 100644
--- a/GraphEngine/Expressions/Dynamic.cs
+++ b/GraphEngine/Expressions/Dynamic.cs
@@ -1,40 +1,28 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Dynamic : Expression
+public class Dynamic(NodeWithGraph node) : Expression(node)
+{
+ public Binder Binder
{
- [DebuggerStepThrough]
- internal Dynamic(NodeWithGraph node)
- : base(node)
- {
- }
+ get => GetRequired(DynamicBinder, Binder.Parse);
- public Binder Binder
- {
- get => this.GetRequired(DynamicBinder, Binder.Parse);
-
- set => this.SetRequired(DynamicBinder, value);
- }
+ set => SetRequired(DynamicBinder, value);
+ }
- public Type ReturnType
- {
- get => this.GetRequired(DynamicReturnType, Type.Parse);
+ public Type ReturnType
+ {
+ get => GetRequired(DynamicReturnType, Type.Parse);
- set => this.SetRequired(DynamicReturnType, value);
- }
+ set => SetRequired(DynamicReturnType, value);
+ }
- public ICollection Arguments => this.Collection(DynamicArguments, Expression.Parse);
+ public ICollection Arguments => Collection(DynamicArguments, Expression.Parse);
- public override Linq.Expression LinqExpression =>
- Linq.Expression.Dynamic(
- this.Binder.SystemBinder,
- this.ReturnType.SystemType,
- this.Arguments.LinqExpressions());
- }
+ public override Linq.Expression LinqExpression =>
+ Linq.Expression.Dynamic(
+ Binder.SystemBinder,
+ ReturnType.SystemType,
+ Arguments.LinqExpressions());
}
diff --git a/GraphEngine/Expressions/Empty.cs b/GraphEngine/Expressions/Empty.cs
index 9725bc6..e16c6ca 100644
--- a/GraphEngine/Expressions/Empty.cs
+++ b/GraphEngine/Expressions/Empty.cs
@@ -1,17 +1,8 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
-
- public class Empty : Expression
- {
- [DebuggerStepThrough]
- internal Empty(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.Empty;
+namespace GraphEngine;
- public override Linq.Expression LinqExpression => Linq.Expression.Empty();
- }
+public class Empty(NodeWithGraph node) : Expression(node, Vocabulary.Empty)
+{
+ public override Linq.Expression LinqExpression => Linq.Expression.Empty();
}
diff --git a/GraphEngine/Expressions/Expression.cs b/GraphEngine/Expressions/Expression.cs
index 825a368..f66a20d 100644
--- a/GraphEngine/Expressions/Expression.cs
+++ b/GraphEngine/Expressions/Expression.cs
@@ -1,28 +1,16 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
+namespace GraphEngine;
+
+public abstract partial class Expression(NodeWithGraph node, INode? type = default) : Node(node, type)
{
- using System;
- using System.Diagnostics;
- using VDS.RDF;
- using Linq = System.Linq.Expressions;
+ public abstract Linq.Expression LinqExpression { get; }
- public abstract partial class Expression : Node
+ // TODO: Handle non-expressions, e.g. uri node = System.Uri, blank node = new object()
+ public static Expression Parse(NodeWithGraph node) => node switch
{
- [DebuggerStepThrough]
- protected Expression(NodeWithGraph node)
- : base(node)
- {
- }
-
- public abstract Linq.Expression LinqExpression { get; }
-
- // TODO: Handle non-expressions, e.g. uri node = System.Uri, blank node = new object()
- public static Expression Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- { NodeType: NodeType.Blank or NodeType.Uri } => ParseResource(node),
- _ => throw new Exception($"unknown node type {node.NodeType} on node {node}")
- };
- }
+ null => throw new ArgumentNullException(nameof(node)),
+ { NodeType: NodeType.Blank or NodeType.Uri } => ParseResource(node),
+ _ => throw new Exception($"unknown node type {node.NodeType} on node {node}")
+ };
}
diff --git a/GraphEngine/Expressions/Expression.generated.cs b/GraphEngine/Expressions/Expression.generated.cs
index 04a97b5..026bc3e 100644
--- a/GraphEngine/Expressions/Expression.generated.cs
+++ b/GraphEngine/Expressions/Expression.generated.cs
@@ -1,57 +1,53 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using VDS.RDF;
+namespace GraphEngine;
- public abstract partial class Expression
+public abstract partial class Expression
+{
+ private static Expression ParseResource(NodeWithGraph node) => Vocabulary.RdfType.ObjectOf(node) switch
{
- private static Expression ParseResource(NodeWithGraph node) => Vocabulary.RdfType.ObjectOf(node) switch
- {
- INode t when t.Equals(Vocabulary.ArrayAccess) => new ArrayAccess(node),
- INode t when t.Equals(Vocabulary.ArrayIndex) => new ArrayIndex(node),
- INode t when t.Equals(Vocabulary.Block) => new Block(node),
- INode t when t.Equals(Vocabulary.Binary) => new Binary(node),
- INode t when t.Equals(Vocabulary.Break) => new Break(node),
- INode t when t.Equals(Vocabulary.Call) => new Call(node),
- INode t when t.Equals(Vocabulary.ClearDebugInfo) => new ClearDebugInfo(node),
- INode t when t.Equals(Vocabulary.Condition) => new Condition(node),
- INode t when t.Equals(Vocabulary.Constant) => new Constant(node),
- INode t when t.Equals(Vocabulary.Continue) => new Continue(node),
- INode t when t.Equals(Vocabulary.DebugInfo) => new DebugInfo(node),
- INode t when t.Equals(Vocabulary.Default) => new Default(node),
- INode t when t.Equals(Vocabulary.Dynamic) => new Dynamic(node),
- INode t when t.Equals(Vocabulary.Empty) => new Empty(node),
- INode t when t.Equals(Vocabulary.Field) => new Field(node),
- INode t when t.Equals(Vocabulary.Goto) => new Goto(node),
- INode t when t.Equals(Vocabulary.IfThen) => new IfThen(node),
- INode t when t.Equals(Vocabulary.IfThenElse) => new IfThenElse(node),
- INode t when t.Equals(Vocabulary.Invoke) => new Invoke(node),
- INode t when t.Equals(Vocabulary.Label) => new Label(node),
- INode t when t.Equals(Vocabulary.Lambda) => new Lambda(node),
- INode t when t.Equals(Vocabulary.ListInit) => new ListInit(node),
- INode t when t.Equals(Vocabulary.Loop) => new Loop(node),
- INode t when t.Equals(Vocabulary.MemberInit) => new MemberInit(node),
- INode t when t.Equals(Vocabulary.New) => new New(node),
- INode t when t.Equals(Vocabulary.NewArrayBounds) => new NewArrayBounds(node),
- INode t when t.Equals(Vocabulary.NewArrayInit) => new NewArrayInit(node),
- INode t when t.Equals(Vocabulary.Parameter) => new Parameter(node),
- INode t when t.Equals(Vocabulary.Property) => new Property(node),
- INode t when t.Equals(Vocabulary.PropertyOrField) => new PropertyOrField(node),
- INode t when t.Equals(Vocabulary.ReferenceEqual) => new ReferenceEqual(node),
- INode t when t.Equals(Vocabulary.ReferenceNotEqual) => new ReferenceNotEqual(node),
- INode t when t.Equals(Vocabulary.Rethrow) => new Rethrow(node),
- INode t when t.Equals(Vocabulary.Return) => new Return(node),
- INode t when t.Equals(Vocabulary.RuntimeVariables) => new RuntimeVariables(node),
- INode t when t.Equals(Vocabulary.Switch) => new Switch(node),
- INode t when t.Equals(Vocabulary.Throw) => new Throw(node),
- INode t when t.Equals(Vocabulary.Try) => new Try(node),
- INode t when t.Equals(Vocabulary.TypeBinary) => new TypeBinary(node),
- INode t when t.Equals(Vocabulary.Unary) => new Unary(node),
- INode t when t.Equals(Vocabulary.Variable) => new Variable(node),
+ INode t when t.Equals(Vocabulary.ArrayAccess) => new ArrayAccess(node),
+ INode t when t.Equals(Vocabulary.ArrayIndex) => new ArrayIndex(node),
+ INode t when t.Equals(Vocabulary.Block) => new Block(node),
+ INode t when t.Equals(Vocabulary.Binary) => new Binary(node),
+ INode t when t.Equals(Vocabulary.Break) => new Break(node),
+ INode t when t.Equals(Vocabulary.Call) => new Call(node),
+ INode t when t.Equals(Vocabulary.ClearDebugInfo) => new ClearDebugInfo(node),
+ INode t when t.Equals(Vocabulary.Condition) => new Condition(node),
+ INode t when t.Equals(Vocabulary.Constant) => new Constant(node),
+ INode t when t.Equals(Vocabulary.Continue) => new Continue(node),
+ INode t when t.Equals(Vocabulary.DebugInfo) => new DebugInfo(node),
+ INode t when t.Equals(Vocabulary.Default) => new Default(node),
+ INode t when t.Equals(Vocabulary.Dynamic) => new Dynamic(node),
+ INode t when t.Equals(Vocabulary.Empty) => new Empty(node),
+ INode t when t.Equals(Vocabulary.Field) => new Field(node),
+ INode t when t.Equals(Vocabulary.Goto) => new Goto(node),
+ INode t when t.Equals(Vocabulary.IfThen) => new IfThen(node),
+ INode t when t.Equals(Vocabulary.IfThenElse) => new IfThenElse(node),
+ INode t when t.Equals(Vocabulary.Invoke) => new Invoke(node),
+ INode t when t.Equals(Vocabulary.Label) => new Label(node),
+ INode t when t.Equals(Vocabulary.Lambda) => new Lambda(node),
+ INode t when t.Equals(Vocabulary.ListInit) => new ListInit(node),
+ INode t when t.Equals(Vocabulary.Loop) => new Loop(node),
+ INode t when t.Equals(Vocabulary.MemberInit) => new MemberInit(node),
+ INode t when t.Equals(Vocabulary.New) => new New(node),
+ INode t when t.Equals(Vocabulary.NewArrayBounds) => new NewArrayBounds(node),
+ INode t when t.Equals(Vocabulary.NewArrayInit) => new NewArrayInit(node),
+ INode t when t.Equals(Vocabulary.Parameter) => new Parameter(node),
+ INode t when t.Equals(Vocabulary.Property) => new Property(node),
+ INode t when t.Equals(Vocabulary.PropertyOrField) => new PropertyOrField(node),
+ INode t when t.Equals(Vocabulary.ReferenceEqual) => new ReferenceEqual(node),
+ INode t when t.Equals(Vocabulary.ReferenceNotEqual) => new ReferenceNotEqual(node),
+ INode t when t.Equals(Vocabulary.Rethrow) => new Rethrow(node),
+ INode t when t.Equals(Vocabulary.Return) => new Return(node),
+ INode t when t.Equals(Vocabulary.RuntimeVariables) => new RuntimeVariables(node),
+ INode t when t.Equals(Vocabulary.Switch) => new Switch(node),
+ INode t when t.Equals(Vocabulary.Throw) => new Throw(node),
+ INode t when t.Equals(Vocabulary.Try) => new Try(node),
+ INode t when t.Equals(Vocabulary.TypeBinary) => new TypeBinary(node),
+ INode t when t.Equals(Vocabulary.Unary) => new Unary(node),
+ INode t when t.Equals(Vocabulary.Variable) => new Variable(node),
- _ => throw new Exception($"unknown type {Vocabulary.RdfType.ObjectOf(node)} on node {node}")
- };
- }
+ _ => throw new Exception($"unknown type {Vocabulary.RdfType.ObjectOf(node)} on node {node}")
+ };
}
diff --git a/GraphEngine/Expressions/Expression.tt b/GraphEngine/Expressions/Expression.tt
index 38ac7c6..785ca08 100644
--- a/GraphEngine/Expressions/Expression.tt
+++ b/GraphEngine/Expressions/Expression.tt
@@ -11,29 +11,25 @@
<#+
private void GenerateNamespace()
{#>
-namespace GraphEngine
-{
- using System;
- using VDS.RDF;
+namespace GraphEngine;
- public abstract partial class Expression
+public abstract partial class Expression
+{
+ private static Expression ParseResource(NodeWithGraph node) => Vocabulary.RdfType.ObjectOf(node) switch
{
- private static Expression ParseResource(NodeWithGraph node) => Vocabulary.RdfType.ObjectOf(node) switch
- {
<#+
GenerateProperties();
#>
- _ => throw new Exception($"unknown type {Vocabulary.RdfType.ObjectOf(node)} on node {node}")
- };
- }
+ _ => throw new Exception($"unknown type {Vocabulary.RdfType.ObjectOf(node)} on node {node}")
+ };
}<#+}
private void GenerateProperties()
{
foreach(var item in Data)
{#>
- INode t when t.Equals(Vocabulary.<#= item #>) => new <#= item #>(node),
+ INode t when t.Equals(Vocabulary.<#= item #>) => new <#= item #>(node),
<#+}
}
diff --git a/GraphEngine/Expressions/Field.cs b/GraphEngine/Expressions/Field.cs
index 23d30ab..e317873 100644
--- a/GraphEngine/Expressions/Field.cs
+++ b/GraphEngine/Expressions/Field.cs
@@ -1,21 +1,12 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Field : MemberAccess
+public class Field(NodeWithGraph node) : MemberAccess(node, Vocabulary.Field)
+{
+ public override Linq.Expression LinqExpression => Type switch
{
- [DebuggerStepThrough]
- internal Field(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.Field;
-
- public override Linq.Expression LinqExpression => this.Type switch
- {
- not null => Linq.Expression.Field(this.Expression?.LinqExpression, this.Type.SystemType, this.Name),
- _ => Linq.Expression.Field(this.Expression?.LinqExpression, this.Name)
- };
- }
+ Type type => Linq.Expression.Field(Expression?.LinqExpression, type.SystemType, Name),
+ _ => Linq.Expression.Field(Expression?.LinqExpression, Name)
+ };
}
diff --git a/GraphEngine/Expressions/Gotos.generated.cs b/GraphEngine/Expressions/Gotos.generated.cs
index 0f637c1..296a318 100644
--- a/GraphEngine/Expressions/Gotos.generated.cs
+++ b/GraphEngine/Expressions/Gotos.generated.cs
@@ -1,39 +1,24 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
-
- public class Goto : BaseGoto
- {
- [DebuggerStepThrough]
- internal Goto(NodeWithGraph node) : base(node) => this.RdfType = Vocabulary.Goto;
-
- protected override Linq.GotoExpressionKind Kind => Linq.GotoExpressionKind.Goto;
- }
-
- public class Return : BaseGoto
- {
- [DebuggerStepThrough]
- internal Return(NodeWithGraph node) : base(node) => this.RdfType = Vocabulary.Return;
+namespace GraphEngine;
- protected override Linq.GotoExpressionKind Kind => Linq.GotoExpressionKind.Return;
- }
-
- public class Break : BaseGoto
- {
- [DebuggerStepThrough]
- internal Break(NodeWithGraph node) : base(node) => this.RdfType = Vocabulary.Break;
+public class Goto(NodeWithGraph node) : BaseGoto(node, Vocabulary.Goto)
+{
+ protected override Linq.GotoExpressionKind Kind => Linq.GotoExpressionKind.Goto;
+}
- protected override Linq.GotoExpressionKind Kind => Linq.GotoExpressionKind.Break;
- }
+public class Return(NodeWithGraph node) : BaseGoto(node, Vocabulary.Return)
+{
+ protected override Linq.GotoExpressionKind Kind => Linq.GotoExpressionKind.Return;
+}
- public class Continue : BaseGoto
- {
- [DebuggerStepThrough]
- internal Continue(NodeWithGraph node) : base(node) => this.RdfType = Vocabulary.Continue;
+public class Break(NodeWithGraph node) : BaseGoto(node, Vocabulary.Break)
+{
+ protected override Linq.GotoExpressionKind Kind => Linq.GotoExpressionKind.Break;
+}
- protected override Linq.GotoExpressionKind Kind => Linq.GotoExpressionKind.Continue;
- }
+public class Continue(NodeWithGraph node) : BaseGoto(node, Vocabulary.Continue)
+{
+ protected override Linq.GotoExpressionKind Kind => Linq.GotoExpressionKind.Continue;
}
+
diff --git a/GraphEngine/Expressions/Gotos.tt b/GraphEngine/Expressions/Gotos.tt
index 5462869..397ff53 100644
--- a/GraphEngine/Expressions/Gotos.tt
+++ b/GraphEngine/Expressions/Gotos.tt
@@ -11,26 +11,20 @@
<#+
private void GenerateNamespace()
{#>
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
<#+
GenerateClasses();
-#>}<#+}
+}
private void GenerateClasses()
{
foreach(var item in Enum.GetValues(typeof(GotoExpressionKind)))
{#>
- public class <#= item #> : BaseGoto
- {
- [DebuggerStepThrough]
- internal <#= item #>(NodeWithGraph node) : base(node) => this.RdfType = Vocabulary.<#= item #>;
-
- protected override Linq.GotoExpressionKind Kind => Linq.GotoExpressionKind.<#= item #>;
- }
+public class <#= item #>(NodeWithGraph node) : BaseGoto(node, Vocabulary.<#= item #>)
+{
+ protected override Linq.GotoExpressionKind Kind => Linq.GotoExpressionKind.<#= item #>;
+}
<#+}
}
#>
diff --git a/GraphEngine/Expressions/IfThen.cs b/GraphEngine/Expressions/IfThen.cs
index d93a0fa..0dccf6f 100644
--- a/GraphEngine/Expressions/IfThen.cs
+++ b/GraphEngine/Expressions/IfThen.cs
@@ -1,17 +1,8 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
-
- public class IfThen : Condition
- {
- [DebuggerStepThrough]
- internal IfThen(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.IfThen;
+namespace GraphEngine;
- public override Linq.Expression LinqExpression => Linq.Expression.IfThen(this.Test.LinqExpression, this.IfTrue.LinqExpression);
- }
+public class IfThen(NodeWithGraph node) : Condition(node, Vocabulary.IfThen)
+{
+ public override Linq.Expression LinqExpression => Linq.Expression.IfThen(Test.LinqExpression, IfTrue.LinqExpression);
}
diff --git a/GraphEngine/Expressions/IfThenElse.cs b/GraphEngine/Expressions/IfThenElse.cs
index c3c0425..8629dee 100644
--- a/GraphEngine/Expressions/IfThenElse.cs
+++ b/GraphEngine/Expressions/IfThenElse.cs
@@ -1,17 +1,8 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
-
- public class IfThenElse : Condition
- {
- [DebuggerStepThrough]
- internal IfThenElse(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.IfThenElse;
+namespace GraphEngine;
- public override Linq.Expression LinqExpression => Linq.Expression.IfThenElse(this.Test.LinqExpression, this.IfTrue.LinqExpression, this.IfFalse.LinqExpression);
- }
+public class IfThenElse(NodeWithGraph node) : Condition(node, Vocabulary.IfThenElse)
+{
+ public override Linq.Expression LinqExpression => Linq.Expression.IfThenElse(Test.LinqExpression, IfTrue.LinqExpression, IfFalse.LinqExpression);
}
diff --git a/GraphEngine/Expressions/Invoke.cs b/GraphEngine/Expressions/Invoke.cs
index b934cb2..71ce814 100644
--- a/GraphEngine/Expressions/Invoke.cs
+++ b/GraphEngine/Expressions/Invoke.cs
@@ -1,29 +1,17 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Invoke : Expression
+public class Invoke(NodeWithGraph node) : Expression(node)
+{
+ public Expression Expression
{
- [DebuggerStepThrough]
- internal Invoke(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Expression Expression
- {
- get => this.GetRequired(InvokeExpression, Expression.Parse);
+ get => GetRequired(InvokeExpression, Expression.Parse);
- set => this.SetRequired(InvokeExpression, value);
- }
+ set => SetRequired(InvokeExpression, value);
+ }
- public ICollection Arguments => this.Collection(InvokeArguments, Expression.Parse);
+ public ICollection Arguments => Collection(InvokeArguments, Expression.Parse);
- public override Linq.Expression LinqExpression => Linq.Expression.Invoke(this.Expression.LinqExpression, this.Arguments.LinqExpressions());
- }
+ public override Linq.Expression LinqExpression => Linq.Expression.Invoke(Expression.LinqExpression, Arguments.LinqExpressions());
}
diff --git a/GraphEngine/Expressions/Label.cs b/GraphEngine/Expressions/Label.cs
index 6d22d82..a7bcc2c 100644
--- a/GraphEngine/Expressions/Label.cs
+++ b/GraphEngine/Expressions/Label.cs
@@ -1,33 +1,22 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Label : Expression
+public class Label(NodeWithGraph node) : Expression(node)
+{
+ public Target Target
{
- [DebuggerStepThrough]
- internal Label(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Target Target
- {
- get => this.GetRequired(LabelTarget, Target.Parse);
-
- set => this.SetRequired(LabelTarget, value);
- }
+ get => GetRequired(LabelTarget, Target.Parse);
- public Expression? DefaultValue
- {
- get => this.GetOptional(LabelDefaultValue, Expression.Parse);
+ set => SetRequired(LabelTarget, value);
+ }
- set => this.SetOptional(LabelDefaultValue, value);
- }
+ public Expression? DefaultValue
+ {
+ get => GetOptional(LabelDefaultValue, Expression.Parse);
- public override Linq.Expression LinqExpression => Linq.Expression.Label(this.Target.LinqTarget, this.DefaultValue?.LinqExpression);
+ set => SetOptional(LabelDefaultValue, value);
}
+
+ public override Linq.Expression LinqExpression => Linq.Expression.Label(Target.LinqTarget, DefaultValue?.LinqExpression);
}
diff --git a/GraphEngine/Expressions/Lambda.cs b/GraphEngine/Expressions/Lambda.cs
index ffb7a41..eb2dc64 100644
--- a/GraphEngine/Expressions/Lambda.cs
+++ b/GraphEngine/Expressions/Lambda.cs
@@ -1,43 +1,28 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Linq.Expressions;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Lambda : Expression
+public class Lambda(NodeWithGraph node) : Expression(node)
+{
+ public Expression Body
{
- [DebuggerStepThrough]
- internal Lambda(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Expression Body
- {
- get => this.GetRequired(LambdaBody, Expression.Parse);
+ get => GetRequired(LambdaBody, Expression.Parse);
- set => this.SetRequired(LambdaBody, value);
- }
+ set => SetRequired(LambdaBody, value);
+ }
- public ICollection Parameters => this.Collection(LambdaParameters, Parameter.Parse);
+ public ICollection Parameters => Collection(LambdaParameters, Parameter.Parse);
- public override Linq.Expression LinqExpression => this.LinqLambda;
+ public override Linq.Expression LinqExpression => LinqLambda;
- public LambdaExpression LinqLambda =>
- Linq.Expression.Lambda(
- this.Body.LinqExpression,
- from param in this.Parameters select param.LinqParameter);
+ public Linq.LambdaExpression LinqLambda =>
+ Linq.Expression.Lambda(
+ Body.LinqExpression,
+ from param in Parameters select param.LinqParameter);
- internal static new Lambda Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new Lambda(node)
- };
- }
+ internal static new Lambda Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new Lambda(node)
+ };
}
diff --git a/GraphEngine/Expressions/ListInit.cs b/GraphEngine/Expressions/ListInit.cs
index 9e2d9d6..ea87311 100644
--- a/GraphEngine/Expressions/ListInit.cs
+++ b/GraphEngine/Expressions/ListInit.cs
@@ -1,34 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- // TODO: Add overloads
- public class ListInit : Expression
+// TODO: Add overloads
+public class ListInit(NodeWithGraph node) : Expression(node)
+{
+ public New NewExpression
{
- [DebuggerStepThrough]
- internal ListInit(NodeWithGraph node)
- : base(node)
- {
- }
-
- public New NewExpression
- {
- get => this.GetRequired(ListInitNewExpression, New.Parse);
+ get => GetRequired(ListInitNewExpression, New.Parse);
- set => this.SetRequired(ListInitNewExpression, value);
- }
+ set => SetRequired(ListInitNewExpression, value);
+ }
- public ICollection Initializers => this.Collection(ListInitInitializers, ElementInit.Parse);
+ public ICollection Initializers => Collection(ListInitInitializers, ElementInit.Parse);
- public override Linq.Expression LinqExpression =>
- Linq.Expression.ListInit(
- this.NewExpression.LinqNewExpression,
- from i in this.Initializers select i.LinqElementInit);
- }
+ public override Linq.Expression LinqExpression =>
+ Linq.Expression.ListInit(
+ NewExpression.LinqNewExpression,
+ from i in Initializers select i.LinqElementInit);
}
diff --git a/GraphEngine/Expressions/Loop.cs b/GraphEngine/Expressions/Loop.cs
index 4181e1a..56a8885 100644
--- a/GraphEngine/Expressions/Loop.cs
+++ b/GraphEngine/Expressions/Loop.cs
@@ -1,45 +1,34 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
+namespace GraphEngine;
+
+internal class Loop(NodeWithGraph node) : Expression(node)
{
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+ public Expression Body
+ {
+ get => GetRequired(LoopBody, Expression.Parse);
+
+ set => SetRequired(LoopBody, value);
+ }
- internal class Loop : Expression
+ public Target? Break
{
- [DebuggerStepThrough]
- public Loop(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Expression Body
- {
- get => this.GetRequired(LoopBody, Expression.Parse);
-
- set => this.SetRequired(LoopBody, value);
- }
-
- public Target? Break
- {
- get => this.GetOptional(LoopBreak, Target.Parse);
-
- set => this.SetOptional(LoopBreak, value);
- }
-
- public Target? Continue
- {
- get => this.GetOptional(LoopContinue, Target.Parse);
-
- set => this.SetOptional(LoopContinue, value);
- }
-
- public override Linq.Expression LinqExpression => this switch
- {
- { Break: not null, Continue: not null } => Linq.Expression.Loop(this.Body.LinqExpression, this.Break.LinqTarget, this.Continue.LinqTarget),
- { Break: not null } => Linq.Expression.Loop(this.Body.LinqExpression, this.Break.LinqTarget),
- _ => Linq.Expression.Loop(this.Body.LinqExpression)
- };
+ get => GetOptional(LoopBreak, Target.Parse);
+
+ set => SetOptional(LoopBreak, value);
}
+
+ public Target? Continue
+ {
+ get => GetOptional(LoopContinue, Target.Parse);
+
+ set => SetOptional(LoopContinue, value);
+ }
+
+ public override Linq.Expression LinqExpression => this switch
+ {
+ { Break: not null, Continue: not null } => Linq.Expression.Loop(Body.LinqExpression, Break.LinqTarget, Continue.LinqTarget),
+ { Break: not null } => Linq.Expression.Loop(Body.LinqExpression, Break.LinqTarget),
+ _ => Linq.Expression.Loop(Body.LinqExpression)
+ };
}
diff --git a/GraphEngine/Expressions/MemberAccess.cs b/GraphEngine/Expressions/MemberAccess.cs
index cabc574..573ae40 100644
--- a/GraphEngine/Expressions/MemberAccess.cs
+++ b/GraphEngine/Expressions/MemberAccess.cs
@@ -1,37 +1,27 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using static Vocabulary;
+namespace GraphEngine;
- public abstract class MemberAccess : Expression
+public abstract class MemberAccess(NodeWithGraph node, INode type) : Expression(node, type)
+{
+ public Expression? Expression
{
- [DebuggerStepThrough]
- internal MemberAccess(NodeWithGraph node)
- : base(node)
- {
- }
+ get => GetOptional(MemberAccessExpression, Expression.Parse);
- public Expression? Expression
- {
- get => this.GetOptional(MemberAccessExpression, Expression.Parse);
-
- set => this.SetOptional(MemberAccessExpression, value);
- }
+ set => SetOptional(MemberAccessExpression, value);
+ }
- public string Name
- {
- get => this.GetRequired(MemberAccessName, AsString);
+ public string Name
+ {
+ get => GetRequired(MemberAccessName, AsString);
- set => this.SetRequired(MemberAccessName, value);
- }
+ set => SetRequired(MemberAccessName, value);
+ }
- public Type? Type
- {
- get => this.GetOptional(MemberAccessType, Type.Parse);
+ public Type? Type
+ {
+ get => GetOptional(MemberAccessType, Type.Parse);
- set => this.SetOptional(MemberAccessType, value);
- }
+ set => SetOptional(MemberAccessType, value);
}
}
diff --git a/GraphEngine/Expressions/MemberInit.cs b/GraphEngine/Expressions/MemberInit.cs
index fdbb514..f7a0397 100644
--- a/GraphEngine/Expressions/MemberInit.cs
+++ b/GraphEngine/Expressions/MemberInit.cs
@@ -1,32 +1,19 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class MemberInit : Expression
+public class MemberInit(NodeWithGraph node) : Expression(node)
+{
+ public New NewExpression
{
- [DebuggerStepThrough]
- internal MemberInit(NodeWithGraph node)
- : base(node)
- {
- }
-
- public New NewExpression
- {
- get => this.GetRequired(MemberInitNewExpression, New.Parse);
+ get => GetRequired(MemberInitNewExpression, New.Parse);
- set => this.SetRequired(MemberInitNewExpression, value);
- }
+ set => SetRequired(MemberInitNewExpression, value);
+ }
- public ICollection Bindings => this.Collection(MemberInitBindings, BaseBind.Parse);
+ public ICollection Bindings => Collection(MemberInitBindings, BaseBind.Parse);
- public override Linq.Expression LinqExpression => Linq.Expression.MemberInit(
- this.NewExpression.LinqNewExpression,
- from binding in this.Bindings select binding.LinqMemberBinding);
- }
+ public override Linq.Expression LinqExpression => Linq.Expression.MemberInit(
+ NewExpression.LinqNewExpression,
+ from binding in Bindings select binding.LinqMemberBinding);
}
diff --git a/GraphEngine/Expressions/New.cs b/GraphEngine/Expressions/New.cs
index ef93fac..81d30f7 100644
--- a/GraphEngine/Expressions/New.cs
+++ b/GraphEngine/Expressions/New.cs
@@ -1,52 +1,37 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using VDS.RDF;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
-
- // TODO: Add overloads
- // TODO: Create ConstructorInfo node
- public class New : Expression
- {
- [DebuggerStepThrough]
- internal New(NodeWithGraph node)
- : base(node)
- {
- }
+namespace GraphEngine;
- public ICollection Arguments => this.Collection(NewArguments, Expression.Parse);
+// TODO: Add overloads
+// TODO: Create ConstructorInfo node
+public class New(NodeWithGraph node) : Expression(node)
+{
+ public ICollection Arguments => Collection(NewArguments, Expression.Parse);
- public Type Type
- {
- get => this.GetRequired(NewType, Type.Parse);
+ public Type Type
+ {
+ get => GetRequired(NewType, Type.Parse);
- set => this.SetRequired(NewType, value);
- }
+ set => SetRequired(NewType, value);
+ }
- public override Linq.Expression LinqExpression => this.LinqNewExpression;
+ public override Linq.Expression LinqExpression => LinqNewExpression;
- internal Linq.NewExpression LinqNewExpression
+ internal Linq.NewExpression LinqNewExpression
+ {
+ get
{
- get
- {
- var argumentExpressions = this.Arguments.LinqExpressions();
- var types = (from expression in argumentExpressions select expression.Type).ToArray();
- var constructor = this.Type.SystemType.GetConstructor(types);
-
- return Linq.Expression.New(constructor, argumentExpressions);
- }
- }
+ var argumentExpressions = Arguments.LinqExpressions();
+ var types = (from expression in argumentExpressions select expression.Type).ToArray();
+ var constructor = Type.SystemType.GetConstructor(types);
- internal static new New Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new New(node)
- };
+ return Linq.Expression.New(constructor, argumentExpressions);
+ }
}
+
+ internal static new New Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new New(node)
+ };
}
diff --git a/GraphEngine/Expressions/NewArray.cs b/GraphEngine/Expressions/NewArray.cs
index e26e97a..8c3f4cd 100644
--- a/GraphEngine/Expressions/NewArray.cs
+++ b/GraphEngine/Expressions/NewArray.cs
@@ -1,33 +1,21 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
+namespace GraphEngine;
+
+public abstract class NewArray(NodeWithGraph node, INode type) : Expression(node, type)
{
- using System.Collections.Generic;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+ protected delegate Linq.NewArrayExpression NewArrayExpressionFactory(System.Type type, IEnumerable expressions);
- public abstract class NewArray : Expression
+ public Type Type
{
- [DebuggerStepThrough]
- internal NewArray(NodeWithGraph node)
- : base(node)
- {
- }
-
- protected delegate Linq.NewArrayExpression NewArrayExpressionFactory(System.Type type, IEnumerable expressions);
-
- public Type Type
- {
- get => this.GetRequired(NewArrayType, Type.Parse);
+ get => GetRequired(NewArrayType, Type.Parse);
- set => this.SetRequired(NewArrayType, value);
- }
+ set => SetRequired(NewArrayType, value);
+ }
- public ICollection Expressions => this.Collection(NewArrayExpressions, Expression.Parse);
+ public ICollection Expressions => Collection(NewArrayExpressions, Expression.Parse);
- public override Linq.Expression LinqExpression => this.FactoryMethod(this.Type.SystemType, this.Expressions.LinqExpressions());
+ public override Linq.Expression LinqExpression => FactoryMethod(Type.SystemType, Expressions.LinqExpressions());
- protected abstract NewArrayExpressionFactory FactoryMethod { get; }
- }
+ protected abstract NewArrayExpressionFactory FactoryMethod { get; }
}
diff --git a/GraphEngine/Expressions/NewArrayBounds.cs b/GraphEngine/Expressions/NewArrayBounds.cs
index 040a4b8..888a3e9 100644
--- a/GraphEngine/Expressions/NewArrayBounds.cs
+++ b/GraphEngine/Expressions/NewArrayBounds.cs
@@ -1,17 +1,8 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
-
- public class NewArrayBounds : NewArray
- {
- [DebuggerStepThrough]
- internal NewArrayBounds(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.NewArrayBounds;
+namespace GraphEngine;
- protected override NewArrayExpressionFactory FactoryMethod => Linq.Expression.NewArrayBounds;
- }
+public class NewArrayBounds(NodeWithGraph node) : NewArray(node, Vocabulary.NewArrayBounds)
+{
+ protected override NewArrayExpressionFactory FactoryMethod => Linq.Expression.NewArrayBounds;
}
diff --git a/GraphEngine/Expressions/NewArrayInit.cs b/GraphEngine/Expressions/NewArrayInit.cs
index f149a9b..a30acd8 100644
--- a/GraphEngine/Expressions/NewArrayInit.cs
+++ b/GraphEngine/Expressions/NewArrayInit.cs
@@ -1,17 +1,8 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
-
- public class NewArrayInit : NewArray
- {
- [DebuggerStepThrough]
- internal NewArrayInit(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.NewArrayInit;
+namespace GraphEngine;
- protected override NewArrayExpressionFactory FactoryMethod => Linq.Expression.NewArrayInit;
- }
+public class NewArrayInit(NodeWithGraph node) : NewArray(node, Vocabulary.NewArrayInit)
+{
+ protected override NewArrayExpressionFactory FactoryMethod => Linq.Expression.NewArrayInit;
}
diff --git a/GraphEngine/Expressions/Parameter.cs b/GraphEngine/Expressions/Parameter.cs
index ac40514..1d59f69 100644
--- a/GraphEngine/Expressions/Parameter.cs
+++ b/GraphEngine/Expressions/Parameter.cs
@@ -1,57 +1,43 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using VDS.RDF;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
-
- public class Parameter : Expression
- {
- private static readonly IDictionary Cache = new Dictionary();
+namespace GraphEngine;
- [DebuggerStepThrough]
- public Parameter(NodeWithGraph node)
- : base(node)
- {
- }
+public class Parameter(NodeWithGraph node) : Expression(node)
+{
+ private static readonly IDictionary Cache = new Dictionary();
- public Type Type
- {
- get => this.GetRequired(ParameterType, Type.Parse);
+ public Type Type
+ {
+ get => GetRequired(ParameterType, Type.Parse);
- set => this.SetRequired(ParameterType, value);
- }
+ set => SetRequired(ParameterType, value);
+ }
- public string? Name
- {
- get => this.GetOptional(ParameterName, AsString);
+ public string? Name
+ {
+ get => GetOptional(ParameterName, AsString);
- set => this.SetOptional(ParameterName, value);
- }
+ set => SetOptional(ParameterName, value);
+ }
- public override Linq.Expression LinqExpression => this.LinqParameter;
+ public override Linq.Expression LinqExpression => LinqParameter;
- public Linq.ParameterExpression LinqParameter
+ public Linq.ParameterExpression LinqParameter
+ {
+ get
{
- get
+ if (!Cache.TryGetValue(this, out var param))
{
- if (!Cache.TryGetValue(this, out var param))
- {
- param = Cache[this] = Linq.Expression.Parameter(this.Type.SystemType, this.Name);
- }
-
- return param;
+ param = Cache[this] = Linq.Expression.Parameter(Type.SystemType, Name);
}
- }
- internal static new Parameter Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new Parameter(node)
- };
+ return param;
+ }
}
+
+ internal static new Parameter Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new Parameter(node)
+ };
}
diff --git a/GraphEngine/Expressions/Property.cs b/GraphEngine/Expressions/Property.cs
index 07169ba..50da140 100644
--- a/GraphEngine/Expressions/Property.cs
+++ b/GraphEngine/Expressions/Property.cs
@@ -1,41 +1,27 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
+namespace GraphEngine;
+
+public class Property(NodeWithGraph node) : MemberAccess(node, Vocabulary.Property)
{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+ public ICollection Arguments => Collection(PropertyArguments, Expression.Parse);
- public class Property : MemberAccess
+ public override Linq.Expression LinqExpression
{
- [DebuggerStepThrough]
- internal Property(NodeWithGraph node)
- : base(node)
- {
- this.RdfType = Vocabulary.Property;
- }
-
- public ICollection Arguments => this.Collection(PropertyArguments, Expression.Parse);
-
- public override Linq.Expression LinqExpression
+ get
{
- get
+ var arguments = Arguments;
+ if (arguments.Any())
{
- var arguments = this.Arguments;
- if (arguments.Any())
- {
- return Linq.Expression.Property(this.Expression?.LinqExpression, this.Name, arguments.LinqExpressions().ToArray());
- }
-
- if (this.Type is Type type)
- {
- return Linq.Expression.Property(this.Expression?.LinqExpression, type.SystemType, this.Name);
- }
+ return Linq.Expression.Property(Expression?.LinqExpression, Name, arguments.LinqExpressions().ToArray());
+ }
- return Linq.Expression.Property(this.Expression?.LinqExpression, this.Name);
+ if (Type is Type type)
+ {
+ return Linq.Expression.Property(Expression?.LinqExpression, type.SystemType, Name);
}
+
+ return Linq.Expression.Property(Expression?.LinqExpression, Name);
}
}
}
diff --git a/GraphEngine/Expressions/PropertyOrField.cs b/GraphEngine/Expressions/PropertyOrField.cs
index c6a8cf1..7c8cecf 100644
--- a/GraphEngine/Expressions/PropertyOrField.cs
+++ b/GraphEngine/Expressions/PropertyOrField.cs
@@ -1,24 +1,12 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class PropertyOrField : MemberAccess
+public class PropertyOrField(NodeWithGraph node) : MemberAccess(node, Vocabulary.PropertyOrField)
+{
+ public override Linq.Expression LinqExpression => Expression switch
{
- [DebuggerStepThrough]
- internal PropertyOrField(NodeWithGraph node)
- : base(node)
- {
- this.RdfType = Vocabulary.PropertyOrField;
- }
-
- public override Linq.Expression LinqExpression => this.Expression switch
- {
- not null => Linq.Expression.PropertyOrField(this.Expression.LinqExpression, this.Name),
- _ => throw new InvalidOperationException($"Expression missing from node {this}")
- };
- }
+ not null => Linq.Expression.PropertyOrField(Expression.LinqExpression, Name),
+ _ => throw new InvalidOperationException($"Expression missing from node {this}")
+ };
}
diff --git a/GraphEngine/Expressions/ReferenceEqual.cs b/GraphEngine/Expressions/ReferenceEqual.cs
index 3b4a600..40843f7 100644
--- a/GraphEngine/Expressions/ReferenceEqual.cs
+++ b/GraphEngine/Expressions/ReferenceEqual.cs
@@ -1,17 +1,8 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
-
- public class ReferenceEqual : Binary
- {
- [DebuggerStepThrough]
- internal ReferenceEqual(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.ReferenceEqual;
+namespace GraphEngine;
- public override Linq.Expression LinqExpression => Linq.Expression.ReferenceEqual(this.Left.LinqExpression, this.Right.LinqExpression);
- }
+public class ReferenceEqual(NodeWithGraph node) : Binary(node, Vocabulary.ReferenceEqual)
+{
+ public override Linq.Expression LinqExpression => Linq.Expression.ReferenceEqual(Left.LinqExpression, Right.LinqExpression);
}
diff --git a/GraphEngine/Expressions/ReferenceNotEqual.cs b/GraphEngine/Expressions/ReferenceNotEqual.cs
index f631b5a..771b2b4 100644
--- a/GraphEngine/Expressions/ReferenceNotEqual.cs
+++ b/GraphEngine/Expressions/ReferenceNotEqual.cs
@@ -1,17 +1,8 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using Linq = System.Linq.Expressions;
-
- public class ReferenceNotEqual : Binary
- {
- [DebuggerStepThrough]
- internal ReferenceNotEqual(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.ReferenceNotEqual;
+namespace GraphEngine;
- public override Linq.Expression LinqExpression => Linq.Expression.ReferenceNotEqual(this.Left.LinqExpression, this.Right.LinqExpression);
- }
+public class ReferenceNotEqual(NodeWithGraph node) : Binary(node, Vocabulary.ReferenceNotEqual)
+{
+ public override Linq.Expression LinqExpression => Linq.Expression.ReferenceNotEqual(Left.LinqExpression, Right.LinqExpression);
}
diff --git a/GraphEngine/Expressions/Rethrow.cs b/GraphEngine/Expressions/Rethrow.cs
index 01cb7ec..3626c90 100644
--- a/GraphEngine/Expressions/Rethrow.cs
+++ b/GraphEngine/Expressions/Rethrow.cs
@@ -1,14 +1,5 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
+namespace GraphEngine;
- public class Rethrow : Throw
- {
- [DebuggerStepThrough]
- public Rethrow(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.Rethrow;
- }
-}
+public class Rethrow(NodeWithGraph node) : Throw(node, Vocabulary.Rethrow);
diff --git a/GraphEngine/Expressions/RuntimeVariables.cs b/GraphEngine/Expressions/RuntimeVariables.cs
index 5a0e211..1e1e739 100644
--- a/GraphEngine/Expressions/RuntimeVariables.cs
+++ b/GraphEngine/Expressions/RuntimeVariables.cs
@@ -1,23 +1,10 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
-
- public class RuntimeVariables : Expression
- {
- [DebuggerStepThrough]
- internal RuntimeVariables(NodeWithGraph node)
- : base(node)
- {
- }
+namespace GraphEngine;
- public ICollection Variables => this.Collection(RuntimeVariablesVariables, Parameter.Parse);
+public class RuntimeVariables(NodeWithGraph node) : Expression(node)
+{
+ public ICollection Variables => Collection(RuntimeVariablesVariables, Parameter.Parse);
- public override Linq.Expression LinqExpression => Linq.Expression.RuntimeVariables(from e in this.Variables select e.LinqParameter);
- }
+ public override Linq.Expression LinqExpression => Linq.Expression.RuntimeVariables(from e in Variables select e.LinqParameter);
}
diff --git a/GraphEngine/Expressions/Switch.cs b/GraphEngine/Expressions/Switch.cs
index 205b48a..d6511c2 100644
--- a/GraphEngine/Expressions/Switch.cs
+++ b/GraphEngine/Expressions/Switch.cs
@@ -1,51 +1,38 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Switch : Expression
+public class Switch(NodeWithGraph node) : Expression(node)
+{
+ public Type? Type
{
- [DebuggerStepThrough]
- internal Switch(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Type? Type
- {
- get => this.GetOptional(SwitchType, Type.Parse);
+ get => GetOptional(SwitchType, Type.Parse);
- set => this.SetOptional(SwitchType, value);
- }
+ set => SetOptional(SwitchType, value);
+ }
- public Expression SwitchValue
- {
- get => this.GetRequired(SwitchSwitchValue, Expression.Parse);
+ public Expression SwitchValue
+ {
+ get => GetRequired(SwitchSwitchValue, Expression.Parse);
- set => this.SetRequired(SwitchSwitchValue, value);
- }
+ set => SetRequired(SwitchSwitchValue, value);
+ }
- public Expression? DeafultBody
- {
- get => this.GetOptional(SwitchDefaultBody, Expression.Parse);
+ public Expression? DeafultBody
+ {
+ get => GetOptional(SwitchDefaultBody, Expression.Parse);
- set => this.SetOptional(SwitchDefaultBody, value);
- }
+ set => SetOptional(SwitchDefaultBody, value);
+ }
- public Method? Comparison
- {
- get => this.GetOptional(SwitchComparison, Method.Parse);
+ public Method? Comparison
+ {
+ get => GetOptional(SwitchComparison, Method.Parse);
- set => this.SetOptional(SwitchComparison, value);
- }
+ set => SetOptional(SwitchComparison, value);
+ }
- public ICollection Cases => this.Collection(SwitchCases, Case.Parse);
+ public ICollection Cases => Collection(SwitchCases, Case.Parse);
- public override Linq.Expression LinqExpression => Linq.Expression.Switch(this.Type?.SystemType, this.SwitchValue.LinqExpression, this.DeafultBody?.LinqExpression, this.Comparison?.ReflectionMethod, this.Cases.Select(@case => @case.LinqSwitchCase));
- }
+ public override Linq.Expression LinqExpression => Linq.Expression.Switch(Type?.SystemType, SwitchValue.LinqExpression, DeafultBody?.LinqExpression, Comparison?.ReflectionMethod, Cases.Select(@case => @case.LinqSwitchCase));
}
diff --git a/GraphEngine/Expressions/Throw.cs b/GraphEngine/Expressions/Throw.cs
index f1f92a9..0280eae 100644
--- a/GraphEngine/Expressions/Throw.cs
+++ b/GraphEngine/Expressions/Throw.cs
@@ -1,36 +1,25 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Throw : Expression
+public class Throw(NodeWithGraph node, INode? type = default) : Expression(node, type)
+{
+ public Expression? Value
{
- [DebuggerStepThrough]
- public Throw(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Expression? Value
- {
- get => this.GetOptional(ThrowValue, Expression.Parse);
-
- set => this.SetOptional(ThrowValue, value);
- }
+ get => GetOptional(ThrowValue, Expression.Parse);
- public Type? Type
- {
- get => this.GetOptional(ThrowType, Type.Parse);
+ set => SetOptional(ThrowValue, value);
+ }
- set => this.SetOptional(ThrowType, value);
- }
+ public Type? Type
+ {
+ get => GetOptional(ThrowType, Type.Parse);
- public override Linq.Expression LinqExpression =>
- Linq.Expression.Throw(
- this.Value?.LinqExpression,
- this.Type?.SystemType ?? typeof(void));
+ set => SetOptional(ThrowType, value);
}
+
+ public override Linq.Expression LinqExpression =>
+ Linq.Expression.Throw(
+ Value?.LinqExpression,
+ Type?.SystemType ?? typeof(void));
}
diff --git a/GraphEngine/Expressions/Try.cs b/GraphEngine/Expressions/Try.cs
index 3f3157e..99009dc 100644
--- a/GraphEngine/Expressions/Try.cs
+++ b/GraphEngine/Expressions/Try.cs
@@ -1,56 +1,43 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Try : Expression
+public class Try(NodeWithGraph node) : Expression(node)
+{
+ public Type? Type
{
- [DebuggerStepThrough]
- internal Try(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Type? Type
- {
- get => this.GetOptional(TryType, Type.Parse);
+ get => GetOptional(TryType, Type.Parse);
- set => this.SetOptional(TryType, value);
- }
+ set => SetOptional(TryType, value);
+ }
- public Expression Body
- {
- get => this.GetRequired(TryBody, Expression.Parse);
+ public Expression Body
+ {
+ get => GetRequired(TryBody, Expression.Parse);
- set => this.SetRequired(TryBody, value);
- }
+ set => SetRequired(TryBody, value);
+ }
- public Expression? Finally
- {
- get => this.GetOptional(TryFinally, Expression.Parse);
+ public Expression? Finally
+ {
+ get => GetOptional(TryFinally, Expression.Parse);
- set => this.SetOptional(TryFinally, value);
- }
+ set => SetOptional(TryFinally, value);
+ }
- public Expression? Fault
- {
- get => this.GetOptional(TryFault, Expression.Parse);
+ public Expression? Fault
+ {
+ get => GetOptional(TryFault, Expression.Parse);
- set => this.SetOptional(TryFault, value);
- }
+ set => SetOptional(TryFault, value);
+ }
- public ICollection Handlers => this.Collection(TryHandlers, Catch.Parse);
+ public ICollection Handlers => Collection(TryHandlers, Catch.Parse);
- public override Linq.Expression LinqExpression => Linq.Expression.MakeTry(
- this.Type?.SystemType,
- this.Body.LinqExpression,
- this.Finally?.LinqExpression,
- this.Fault?.LinqExpression,
- from h in this.Handlers select h.LinqCatchBlock);
- }
+ public override Linq.Expression LinqExpression => Linq.Expression.MakeTry(
+ Type?.SystemType,
+ Body.LinqExpression,
+ Finally?.LinqExpression,
+ Fault?.LinqExpression,
+ from h in Handlers select h.LinqCatchBlock);
}
diff --git a/GraphEngine/Expressions/TypeBinary.cs b/GraphEngine/Expressions/TypeBinary.cs
index 83ee162..841cb6e 100644
--- a/GraphEngine/Expressions/TypeBinary.cs
+++ b/GraphEngine/Expressions/TypeBinary.cs
@@ -1,47 +1,35 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class TypeBinary : Expression
+public class TypeBinary(NodeWithGraph node) : Expression(node)
+{
+ public ExpressionType ExpressionType
{
- [DebuggerStepThrough]
- public TypeBinary(NodeWithGraph node)
- : base(node)
- {
- }
-
- public ExpressionType ExpressionType
- {
- get => this.GetRequired(TypeBinaryExpressionType, ExpressionType.Parse);
+ get => GetRequired(TypeBinaryExpressionType, ExpressionType.Parse);
- set => this.SetRequired(TypeBinaryExpressionType, value);
- }
+ set => SetRequired(TypeBinaryExpressionType, value);
+ }
- public Expression Expression
- {
- get => this.GetRequired(TypeBinaryExpression, Expression.Parse);
+ public Expression Expression
+ {
+ get => GetRequired(TypeBinaryExpression, Expression.Parse);
- set => this.SetRequired(TypeBinaryExpression, value);
- }
+ set => SetRequired(TypeBinaryExpression, value);
+ }
- public Type Type
- {
- get => this.GetRequired(TypeBinaryType, Type.Parse);
+ public Type Type
+ {
+ get => GetRequired(TypeBinaryType, Type.Parse);
- set => this.SetRequired(TypeBinaryType, value);
- }
+ set => SetRequired(TypeBinaryType, value);
+ }
- public override Linq.Expression LinqExpression => this.ExpressionType.LinqExpressionType switch
- {
- Linq.ExpressionType.TypeEqual => Linq.Expression.TypeEqual(this.Expression.LinqExpression, this.Type.SystemType),
- Linq.ExpressionType.TypeIs => Linq.Expression.TypeIs(this.Expression.LinqExpression, this.Type.SystemType),
+ public override Linq.Expression LinqExpression => ExpressionType.LinqExpressionType switch
+ {
+ Linq.ExpressionType.TypeEqual => Linq.Expression.TypeEqual(Expression.LinqExpression, Type.SystemType),
+ Linq.ExpressionType.TypeIs => Linq.Expression.TypeIs(Expression.LinqExpression, Type.SystemType),
- var unknown => throw new InvalidOperationException($"{unknown} is not binarytype"),
- };
- }
+ var unknown => throw new InvalidOperationException($"{unknown} is not binarytype"),
+ };
}
diff --git a/GraphEngine/Expressions/Unary.cs b/GraphEngine/Expressions/Unary.cs
index 8c54828..a9b2672 100644
--- a/GraphEngine/Expressions/Unary.cs
+++ b/GraphEngine/Expressions/Unary.cs
@@ -1,80 +1,68 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class Unary : Expression
+public class Unary(NodeWithGraph node) : Expression(node)
+{
+ public Expression Operand
{
- [DebuggerStepThrough]
- public Unary(NodeWithGraph node)
- : base(node)
- {
- }
-
- public Expression Operand
- {
- get => this.GetRequired(UnaryOperand, Expression.Parse);
+ get => GetRequired(UnaryOperand, Expression.Parse);
- set => this.SetRequired(UnaryOperand, value);
- }
+ set => SetRequired(UnaryOperand, value);
+ }
- public Type? Type
- {
- get => this.GetOptional(UnaryType, Type.Parse);
+ public Type? Type
+ {
+ get => GetOptional(UnaryType, Type.Parse);
- set => this.SetOptional(UnaryType, value);
- }
+ set => SetOptional(UnaryType, value);
+ }
- public ExpressionType ExpressionType
- {
- get => this.GetRequired(UnaryExpressionType, ExpressionType.Parse);
+ public ExpressionType ExpressionType
+ {
+ get => GetRequired(UnaryExpressionType, ExpressionType.Parse);
- set => this.SetRequired(UnaryExpressionType, value);
- }
+ set => SetRequired(UnaryExpressionType, value);
+ }
- public Method? Method
- {
- get => this.GetOptional(UnaryMethod, Method.Parse);
+ public Method? Method
+ {
+ get => GetOptional(UnaryMethod, Method.Parse);
- set => this.SetOptional(UnaryMethod, value);
- }
+ set => SetOptional(UnaryMethod, value);
+ }
- public override Linq.Expression LinqExpression => Linq.Expression.MakeUnary(
- this.ExpressionType.LinqExpressionType,
- this.Operand.LinqExpression,
- this.Type?.SystemType,
- this.Method?.ReflectionMethod);
+ public override Linq.Expression LinqExpression => Linq.Expression.MakeUnary(
+ ExpressionType.LinqExpressionType,
+ Operand.LinqExpression,
+ Type?.SystemType,
+ Method?.ReflectionMethod);
- public static Unary Create(NodeWithGraph node, Linq.ExpressionType type) => type switch
+ public static Unary Create(NodeWithGraph node, Linq.ExpressionType type) => type switch
+ {
+ Linq.ExpressionType.ArrayLength or
+ Linq.ExpressionType.Convert or
+ Linq.ExpressionType.ConvertChecked or
+ Linq.ExpressionType.Decrement or
+ Linq.ExpressionType.Increment or
+ Linq.ExpressionType.IsFalse or
+ Linq.ExpressionType.IsTrue or
+ Linq.ExpressionType.Negate or
+ Linq.ExpressionType.NegateChecked or
+ Linq.ExpressionType.Not or
+ Linq.ExpressionType.OnesComplement or
+ Linq.ExpressionType.PostDecrementAssign or
+ Linq.ExpressionType.PostIncrementAssign or
+ Linq.ExpressionType.PreDecrementAssign or
+ Linq.ExpressionType.PreIncrementAssign or
+ Linq.ExpressionType.Quote or
+ Linq.ExpressionType.TypeAs or
+ Linq.ExpressionType.UnaryPlus or
+ Linq.ExpressionType.Unbox => new Unary(node)
{
- Linq.ExpressionType.ArrayLength or
- Linq.ExpressionType.Convert or
- Linq.ExpressionType.ConvertChecked or
- Linq.ExpressionType.Decrement or
- Linq.ExpressionType.Increment or
- Linq.ExpressionType.IsFalse or
- Linq.ExpressionType.IsTrue or
- Linq.ExpressionType.Negate or
- Linq.ExpressionType.NegateChecked or
- Linq.ExpressionType.Not or
- Linq.ExpressionType.OnesComplement or
- Linq.ExpressionType.PostDecrementAssign or
- Linq.ExpressionType.PostIncrementAssign or
- Linq.ExpressionType.PreDecrementAssign or
- Linq.ExpressionType.PreIncrementAssign or
- Linq.ExpressionType.Quote or
- Linq.ExpressionType.TypeAs or
- Linq.ExpressionType.UnaryPlus or
- Linq.ExpressionType.Unbox => new Unary(node)
- {
- ExpressionType = ExpressionType.Create(type, node.Graph),
- },
+ ExpressionType = ExpressionType.Create(type, node.Graph),
+ },
- _ => throw new Exception($"{type} is not unary"),
- };
- }
+ _ => throw new Exception($"{type} is not unary"),
+ };
}
diff --git a/GraphEngine/Expressions/Variable.cs b/GraphEngine/Expressions/Variable.cs
index 634e69d..42a361b 100644
--- a/GraphEngine/Expressions/Variable.cs
+++ b/GraphEngine/Expressions/Variable.cs
@@ -1,12 +1,5 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- public class Variable : Parameter
- {
- public Variable(NodeWithGraph node)
- : base(node)
- {
- }
- }
-}
+namespace GraphEngine;
+
+public class Variable(NodeWithGraph node) : Parameter(node);
diff --git a/GraphEngine/Extensions.cs b/GraphEngine/Extensions.cs
index eec1bca..dc1e0c9 100644
--- a/GraphEngine/Extensions.cs
+++ b/GraphEngine/Extensions.cs
@@ -1,68 +1,62 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using VDS.RDF;
- using VDS.RDF.Nodes;
- using VDS.RDF.Parsing;
- using Linq = System.Linq.Expressions;
-
- public static class Extensions
- {
- public static NodeWithGraph In(this INode node, IGraph graph) => new (node, graph);
+namespace GraphEngine;
- internal static IEnumerable ObjectsOf(this INode predicate, NodeWithGraph subject) =>
- from t in subject.Graph.GetTriplesWithSubjectPredicate(subject, predicate)
- select t.Object.In(subject.Graph);
+using System.Globalization;
+using VDS.RDF.Nodes;
+using VDS.RDF.Parsing;
- internal static NodeWithGraph? ObjectOf(this INode predicate, NodeWithGraph subject) => predicate.ObjectsOf(subject).FirstOrDefault();
+public static class Extensions
+{
+ public static NodeWithGraph In(this INode node, IGraph graph) => new (node, graph);
- internal static IEnumerable InstancesOf(this IGraph graph, INode @class) =>
- from t in graph.GetTriplesWithPredicateObject(Vocabulary.RdfType, @class)
- select t.Subject.In(graph);
+ internal static IEnumerable ObjectsOf(this INode predicate, NodeWithGraph subject) =>
+ from t in subject.Graph.GetTriplesWithSubjectPredicate(subject, predicate)
+ select t.Object.In(subject.Graph);
- internal static INode AsNode(this object value, IGraph graph) =>
- value switch
- {
- INode node => node,
- Uri uri => graph.CreateUriNode(uri),
- long number => graph.CreateLiteralNode(number.ToString(CultureInfo.InvariantCulture), UriFactory.Create(XmlSpecsHelper.XmlSchemaDataTypeInteger)),
- int number => graph.CreateLiteralNode(number.ToString(CultureInfo.InvariantCulture), UriFactory.Create(XmlSpecsHelper.XmlSchemaDataTypeInt)),
- Guid guid => graph.CreateUriNode(new Uri($"urn:uuid:{guid}")),
- bool bit => new BooleanNode(bit),
- _ => graph.CreateLiteralNode(value.ToString())
- };
+ internal static NodeWithGraph? ObjectOf(this INode predicate, NodeWithGraph subject) => predicate.ObjectsOf(subject).FirstOrDefault();
- internal static IEnumerable LinqExpressions(this IEnumerable expressions) =>
- from e in expressions
- select e.LinqExpression;
+ internal static IEnumerable InstancesOf(this IGraph graph, INode @class) =>
+ from t in graph.GetTriplesWithPredicateObject(Vocabulary.RdfType, @class)
+ select t.Subject.In(graph);
- internal static object AsObject(this NodeWithGraph wrapper) => wrapper switch
+ internal static INode AsNode(this object value, IGraph graph) =>
+ value switch
{
- IUriNode { NodeType: NodeType.Uri } uriNode => uriNode.Uri,
- ILiteralNode { NodeType: NodeType.Literal, DataType.AbsoluteUri: XmlSpecsHelper.XmlSchemaDataTypeString } literalNode => literalNode.Value,
- ILiteralNode { NodeType: NodeType.Literal, DataType.AbsoluteUri: XmlSpecsHelper.XmlSchemaDataTypeInteger } literalNode => long.Parse(literalNode.Value, CultureInfo.InvariantCulture),
- ILiteralNode { NodeType: NodeType.Literal, DataType.AbsoluteUri: XmlSpecsHelper.XmlSchemaDataTypeInt } literalNode => int.Parse(literalNode.Value, CultureInfo.InvariantCulture),
- _ => wrapper.Original,
+ INode node => node,
+ Uri uri => graph.CreateUriNode(uri),
+ long number => graph.CreateLiteralNode(number.ToString(CultureInfo.InvariantCulture), UriFactory.Create(XmlSpecsHelper.XmlSchemaDataTypeInteger)),
+ int number => graph.CreateLiteralNode(number.ToString(CultureInfo.InvariantCulture), UriFactory.Create(XmlSpecsHelper.XmlSchemaDataTypeInt)),
+ Guid guid => graph.CreateUriNode(new Uri($"urn:uuid:{guid}")),
+ bool bit => new BooleanNode(bit),
+ _ => graph.CreateLiteralNode(value.ToString())
};
- // See https://referencesource.microsoft.com/#System.Core/Microsoft/Scripting/Ast/BinaryExpression.cs,374
- internal static bool IsReferenceComparison(this Linq.BinaryExpression expression)
- {
- var left = expression.Left.Type;
- var right = expression.Right.Type;
- var method = expression.Method;
- var kind = expression.NodeType;
+ internal static IEnumerable LinqExpressions(this IEnumerable expressions) =>
+ from e in expressions
+ select e.LinqExpression;
- return (kind == Linq.ExpressionType.Equal || kind == Linq.ExpressionType.NotEqual) &&
- method == null && !left.IsValueType && !right.IsValueType;
- }
+ internal static object AsObject(this NodeWithGraph wrapper) => wrapper switch
+ {
+ IUriNode { NodeType: NodeType.Uri } uriNode => uriNode.Uri,
+ ILiteralNode { NodeType: NodeType.Literal, DataType.AbsoluteUri: XmlSpecsHelper.XmlSchemaDataTypeString } literalNode => literalNode.Value,
+ ILiteralNode { NodeType: NodeType.Literal, DataType.AbsoluteUri: XmlSpecsHelper.XmlSchemaDataTypeInteger } literalNode => long.Parse(literalNode.Value, CultureInfo.InvariantCulture),
+ ILiteralNode { NodeType: NodeType.Literal, DataType.AbsoluteUri: XmlSpecsHelper.XmlSchemaDataTypeInt } literalNode => int.Parse(literalNode.Value, CultureInfo.InvariantCulture),
+ _ => wrapper.Original,
+ };
+
+ // See https://referencesource.microsoft.com/#System.Core/Microsoft/Scripting/Ast/BinaryExpression.cs,374
+ internal static bool IsReferenceComparison(this Linq.BinaryExpression expression)
+ {
+ var left = expression.Left.Type;
+ var right = expression.Right.Type;
+ var method = expression.Method;
+ var kind = expression.NodeType;
- // See https://referencesource.microsoft.com/#System.Core/Microsoft/Scripting/Ast/TypeUtils.cs,d20b8274c8dc7b89
- internal static bool AreEquivalent(System.Type t1, System.Type t2) => t1 == t2 || t1.IsEquivalentTo(t2);
+ return (kind == Linq.ExpressionType.Equal || kind == Linq.ExpressionType.NotEqual) &&
+ method == null && !left.IsValueType && !right.IsValueType;
}
+
+ // See https://referencesource.microsoft.com/#System.Core/Microsoft/Scripting/Ast/TypeUtils.cs,d20b8274c8dc7b89
+ internal static bool AreEquivalent(System.Type t1, System.Type t2) => t1 == t2 || t1.IsEquivalentTo(t2);
}
diff --git a/GraphEngine/GlobalSuppressions.cs b/GraphEngine/GlobalSuppressions.cs
new file mode 100644
index 0000000..9701f12
--- /dev/null
+++ b/GraphEngine/GlobalSuppressions.cs
@@ -0,0 +1,5 @@
+// MIT License, Copyright 2020 Samu Lang
+
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:Prefix local calls with this", Justification = "Seems to be new default style")]
diff --git a/GraphEngine/Graph.cs b/GraphEngine/Graph.cs
index da1844f..f9c9d51 100644
--- a/GraphEngine/Graph.cs
+++ b/GraphEngine/Graph.cs
@@ -1,61 +1,55 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
+namespace GraphEngine;
+
+using VDS.RDF.Ontology;
+using VDS.RDF.Query.Inference;
+
+public class Graph : WrapperGraph
{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using VDS.RDF;
- using VDS.RDF.Ontology;
- using VDS.RDF.Query.Inference;
- using dotNetRDF = VDS.RDF;
-
- public class Graph : dotNetRDF.WrapperGraph
- {
- private static readonly IInferenceEngine Reasoner = new StaticRdfsReasoner();
+ private static readonly StaticRdfsReasoner Reasoner = new();
- static Graph()
- {
- using var schemaFull = new NonIndexedGraph();
- schemaFull.LoadFromEmbeddedResource("GraphEngine.Resources.Schema.ttl, GraphEngine");
+ static Graph()
+ {
+ using var schemaFull = new NonIndexedGraph();
+ schemaFull.LoadFromEmbeddedResource("GraphEngine.Resources.Schema.ttl, GraphEngine");
- using var schemaClean = new NonIndexedGraph();
- schemaClean.Assert(
- schemaFull
- .GetTriplesWithPredicate(dotNetRDF.UriFactory.Create(OntologyHelper.PropertyDomain))
- .Where(t => !ExcludedClasses.Contains(t.Object)));
+ using var schemaClean = new NonIndexedGraph();
+ schemaClean.Assert(
+ schemaFull
+ .GetTriplesWithPredicate(VDS.RDF.UriFactory.Create(OntologyHelper.PropertyDomain))
+ .Where(t => !ExcludedClasses.Contains(t.Object)));
- Reasoner.Initialise(schemaClean);
- }
+ Reasoner.Initialise(schemaClean);
+ }
- public Graph()
- : base()
- {
- this.AttachEventHandlers();
- this.TripleAsserted += this.Graph_TripleAsserted;
- }
+ public Graph()
+ : base()
+ {
+ AttachEventHandlers();
+ TripleAsserted += Graph_TripleAsserted;
+ }
- public Graph(IGraph g)
- : base(g)
- {
- Reasoner.Apply(this);
- this.TripleAsserted += this.Graph_TripleAsserted;
- }
+ public Graph(IGraph g)
+ : base(g)
+ {
+ Reasoner.Apply(this);
+ TripleAsserted += Graph_TripleAsserted;
+ }
- private static IEnumerable ExcludedClasses
+ private static IEnumerable ExcludedClasses
+ {
+ get
{
- get
- {
- yield return Vocabulary.BaseGoto;
- yield return Vocabulary.BaseBind;
- }
+ yield return Vocabulary.BaseGoto;
+ yield return Vocabulary.BaseBind;
}
+ }
- private void Graph_TripleAsserted(object sender, TripleEventArgs args)
- {
- using var g = new NonIndexedGraph();
- g.Assert(args.Triple);
- Reasoner.Apply(g, this);
- }
+ private void Graph_TripleAsserted(object sender, TripleEventArgs args)
+ {
+ using var g = new NonIndexedGraph();
+ g.Assert(args.Triple);
+ Reasoner.Apply(g, this);
}
}
diff --git a/GraphEngine/GraphEngine.csproj b/GraphEngine/GraphEngine.csproj
index e87be66..78ae5a8 100644
--- a/GraphEngine/GraphEngine.csproj
+++ b/GraphEngine/GraphEngine.csproj
@@ -1,8 +1,6 @@
- net7.0
- enable
ExpressionRDF
Samu Lang
https://github.com/langsamu/GraphEngine
@@ -17,6 +15,11 @@
AllEnabledByDefault
+
+
+
+
+
@@ -30,15 +33,9 @@
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
+
+
diff --git a/GraphEngine/InvokeMember.cs b/GraphEngine/InvokeMember.cs
index f9e5a59..50c28ff 100644
--- a/GraphEngine/InvokeMember.cs
+++ b/GraphEngine/InvokeMember.cs
@@ -1,24 +1,16 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Diagnostics;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using CSharp = Microsoft.CSharp.RuntimeBinder;
+namespace GraphEngine;
- public class InvokeMember : Binder
- {
- [DebuggerStepThrough]
- public InvokeMember(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.InvokeMember;
+using System.Runtime.CompilerServices;
+using CSharp = Microsoft.CSharp.RuntimeBinder;
- internal override CallSiteBinder SystemBinder => CSharp.Binder.InvokeMember(
- CSharp.CSharpBinderFlags.None,
- this.Name,
- null,
- null,
- from a in this.Arguments select a.Info);
- }
+public class InvokeMember(NodeWithGraph node) : Binder(node, Vocabulary.InvokeMember)
+{
+ internal override CallSiteBinder SystemBinder => CSharp.Binder.InvokeMember(
+ CSharp.CSharpBinderFlags.None,
+ Name,
+ null,
+ null,
+ from a in Arguments select a.Info);
}
diff --git a/GraphEngine/ListBind.cs b/GraphEngine/ListBind.cs
index 63c6cf7..4b37d92 100644
--- a/GraphEngine/ListBind.cs
+++ b/GraphEngine/ListBind.cs
@@ -1,26 +1,12 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
-
- public class ListBind : BaseBind
- {
- [DebuggerStepThrough]
- internal ListBind(NodeWithGraph node)
- : base(node)
- {
- this.RdfType = Vocabulary.ListBind;
- }
+namespace GraphEngine;
- public ICollection Initializers => this.Collection(ListBindInitializers, ElementInit.Parse);
+public class ListBind(NodeWithGraph node) : BaseBind(node, Vocabulary.ListBind)
+{
+ public ICollection Initializers => Collection(ListBindInitializers, ElementInit.Parse);
- public override Linq.MemberBinding LinqMemberBinding => Linq.Expression.ListBind(
- this.Member.ReflectionMember,
- from initializer in this.Initializers select initializer.LinqElementInit);
- }
+ public override Linq.MemberBinding LinqMemberBinding => Linq.Expression.ListBind(
+ Member.ReflectionMember,
+ from initializer in Initializers select initializer.LinqElementInit);
}
diff --git a/GraphEngine/Member.cs b/GraphEngine/Member.cs
index b4f1e49..171451f 100644
--- a/GraphEngine/Member.cs
+++ b/GraphEngine/Member.cs
@@ -1,41 +1,30 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Diagnostics;
- using System.Linq;
- using System.Reflection;
- using static Vocabulary;
+namespace GraphEngine;
- public class Member : Node
- {
- [DebuggerStepThrough]
- internal Member(NodeWithGraph node)
- : base(node)
- {
- }
+using System.Reflection;
- public Type Type
- {
- get => this.GetRequired(MemberType, Type.Parse);
+public class Member(NodeWithGraph node) : Node(node)
+{
+ public Type Type
+ {
+ get => GetRequired(MemberType, Type.Parse);
- set => this.SetRequired(MemberType, value);
- }
+ set => SetRequired(MemberType, value);
+ }
- public string Name
- {
- get => this.GetRequired(MemberName, AsString);
+ public string Name
+ {
+ get => GetRequired(MemberName, AsString);
- set => this.SetRequired(MemberName, value);
- }
+ set => SetRequired(MemberName, value);
+ }
- public MemberInfo ReflectionMember => this.Type.SystemType.GetMember(this.Name).Single();
+ public MemberInfo ReflectionMember => Type.SystemType.GetMember(Name).Single();
- internal static Member Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new Member(node)
- };
- }
+ internal static Member Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new Member(node)
+ };
}
diff --git a/GraphEngine/MemberBind.cs b/GraphEngine/MemberBind.cs
index ff641a5..8dae076 100644
--- a/GraphEngine/MemberBind.cs
+++ b/GraphEngine/MemberBind.cs
@@ -1,25 +1,13 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
-
- // TODO: Add overloads
- public class MemberBind : BaseBind
- {
- [DebuggerStepThrough]
- internal MemberBind(NodeWithGraph node)
- : base(node)
- => this.RdfType = Vocabulary.MemberBind;
+namespace GraphEngine;
- public ICollection Bindings => this.Collection(MemberBindBindings, BaseBind.Parse);
+// TODO: Add overloads
+public class MemberBind(NodeWithGraph node) : BaseBind(node, Vocabulary.MemberBind)
+{
+ public ICollection Bindings => Collection(MemberBindBindings, BaseBind.Parse);
- public override Linq.MemberBinding LinqMemberBinding => Linq.Expression.MemberBind(
- this.Member.ReflectionMember,
- from binding in this.Bindings select binding.LinqMemberBinding);
- }
+ public override Linq.MemberBinding LinqMemberBinding => Linq.Expression.MemberBind(
+ Member.ReflectionMember,
+ from binding in Bindings select binding.LinqMemberBinding);
}
diff --git a/GraphEngine/Method.cs b/GraphEngine/Method.cs
index 19894ee..f73c8a9 100644
--- a/GraphEngine/Method.cs
+++ b/GraphEngine/Method.cs
@@ -1,45 +1,33 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
+namespace GraphEngine;
+
+using System.Reflection;
+
+// TODO: Improve derivation
+public class Method(NodeWithGraph node) : Member(node)
{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Reflection;
- using static Vocabulary;
+ public ICollection TypeArguments => Collection(MethodTypeArguments, Type.Parse);
- // TODO: Improve derivation
- public class Method : Member
+ public MethodInfo? ReflectionMethod
{
- [DebuggerStepThrough]
- internal Method(NodeWithGraph node)
- : base(node)
+ get
{
- }
+ var methodInfo = Type.SystemType.GetMethod(Name);
- public ICollection TypeArguments => this.Collection(MethodTypeArguments, Type.Parse);
-
- public MethodInfo? ReflectionMethod
- {
- get
+ var typeArguments = TypeArguments.Select(ta => ta.SystemType).ToArray();
+ if (typeArguments.Any())
{
- var methodInfo = this.Type.SystemType.GetMethod(this.Name);
-
- var typeArguments = this.TypeArguments.Select(ta => ta.SystemType).ToArray();
- if (typeArguments.Any())
- {
- methodInfo = methodInfo.MakeGenericMethod(typeArguments);
- }
-
- return methodInfo;
+ methodInfo = methodInfo.MakeGenericMethod(typeArguments);
}
- }
- internal static new Method Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new Method(node)
- };
+ return methodInfo;
+ }
}
+
+ internal static new Method Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new Method(node)
+ };
}
diff --git a/GraphEngine/Node.cs b/GraphEngine/Node.cs
index 61f4767..4ed49b3 100644
--- a/GraphEngine/Node.cs
+++ b/GraphEngine/Node.cs
@@ -1,169 +1,167 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using VDS.RDF;
+namespace GraphEngine;
- public abstract partial class Node : NodeWithGraph
+public abstract partial class Node(NodeWithGraph node) : NodeWithGraph(node, node?.Graph ?? throw new ArgumentNullException(nameof(node)))
+{
+ public Node(NodeWithGraph node, INode? type = default)
+ : this(node)
{
- [DebuggerStepThrough]
- protected Node(NodeWithGraph node)
- : base(node, node?.Graph ?? throw new ArgumentNullException(nameof(node)))
+ if (type is null)
{
+ return;
}
- public INode? RdfType
- {
- get => Vocabulary.RdfType.ObjectOf(this);
+ RdfType = type;
+ }
+
+ public INode? RdfType
+ {
+ get => Vocabulary.RdfType.ObjectOf(this);
- set => this.SetOptional(Vocabulary.RdfType, value);
+ set => SetOptional(Vocabulary.RdfType, value);
+ }
+
+ protected static int AsInt(NodeWithGraph node)
+ {
+ if (node is null)
+ {
+ throw new ArgumentNullException(nameof(node));
}
- protected static int AsInt(NodeWithGraph node)
+ if (!(node.NodeType == NodeType.Literal && node is ILiteralNode literalNode))
{
- if (node is null)
- {
- throw new ArgumentNullException(nameof(node));
- }
+ throw new InvalidOperationException($"{node} is not literal node");
+ }
- if (!(node.NodeType == NodeType.Literal && node is ILiteralNode literalNode))
- {
- throw new InvalidOperationException($"{node} is not literal node");
- }
+ if (!int.TryParse(literalNode.Value, out var i))
+ {
+ throw new InvalidOperationException($"{node} is not valid int");
+ }
- if (!int.TryParse(literalNode.Value, out var i))
- {
- throw new InvalidOperationException($"{node} is not valid int");
- }
+ return i;
+ }
- return i;
- }
+ protected static object AsObject(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => node.AsObject()
+ };
- protected static object AsObject(NodeWithGraph node) => node switch
+ protected static string AsString(NodeWithGraph node)
+ {
+ if (node is null)
{
- null => throw new ArgumentNullException(nameof(node)),
- _ => node.AsObject()
- };
+ throw new ArgumentNullException(nameof(node));
+ }
- protected static string AsString(NodeWithGraph node)
+ if (!(node.NodeType == NodeType.Literal && node is ILiteralNode literalNode))
{
- if (node is null)
- {
- throw new ArgumentNullException(nameof(node));
- }
+ throw new InvalidOperationException($"{node} is not literal node");
+ }
- if (!(node.NodeType == NodeType.Literal && node is ILiteralNode literalNode))
- {
- throw new InvalidOperationException($"{node} is not literal node");
- }
+ return literalNode.Value;
+ }
- return literalNode.Value;
+ protected static Guid AsGuid(NodeWithGraph node)
+ {
+ if (node is null)
+ {
+ throw new ArgumentNullException(nameof(node));
}
- protected static Guid AsGuid(NodeWithGraph node)
+ if (!(node.NodeType == NodeType.Uri && node is IUriNode uriNode))
{
- if (node is null)
- {
- throw new ArgumentNullException(nameof(node));
- }
+ throw new InvalidOperationException($"{node} is not uri node");
+ }
- if (!(node.NodeType == NodeType.Uri && node is IUriNode uriNode))
- {
- throw new InvalidOperationException($"{node} is not uri node");
- }
+ var uri = uriNode.Uri;
- var uri = uriNode.Uri;
+ if (uri.Scheme != "urn")
+ {
+ throw new InvalidOperationException($"{uri} is not URN");
+ }
- if (uri.Scheme != "urn")
- {
- throw new InvalidOperationException($"{uri} is not URN");
- }
+ const string uuid = "uuid:";
+ var path = uri.AbsolutePath;
+ if (!path.StartsWith(uuid, StringComparison.Ordinal))
+ {
+ throw new InvalidOperationException($"{uri} is not UUID URN");
+ }
- const string uuid = "uuid:";
- var path = uri.AbsolutePath;
- if (!path.StartsWith(uuid, StringComparison.Ordinal))
- {
- throw new InvalidOperationException($"{uri} is not UUID URN");
- }
+ if (!Guid.TryParse(path.AsSpan(uuid.Length), out var g))
+ {
+ throw new InvalidOperationException($"{path} is not valid UUID");
+ }
- if (!Guid.TryParse(path.AsSpan(uuid.Length), out var g))
- {
- throw new InvalidOperationException($"{path} is not valid UUID");
- }
+ return g;
+ }
- return g;
+ protected static bool AsBool(NodeWithGraph node)
+ {
+ if (node is null)
+ {
+ throw new ArgumentNullException(nameof(node));
}
- protected static bool AsBool(NodeWithGraph node)
+ if (!(node.NodeType == NodeType.Literal && node is ILiteralNode literalNode))
{
- if (node is null)
- {
- throw new ArgumentNullException(nameof(node));
- }
+ throw new InvalidOperationException($"{node} is not literal node");
+ }
- if (!(node.NodeType == NodeType.Literal && node is ILiteralNode literalNode))
- {
- throw new InvalidOperationException($"{node} is not literal node");
- }
+ if (!bool.TryParse(literalNode.Value, out var b))
+ {
+ throw new InvalidOperationException($"{node} is not valid bool");
+ }
- if (!bool.TryParse(literalNode.Value, out var b))
- {
- throw new InvalidOperationException($"{node} is not valid bool");
- }
+ return b;
+ }
- return b;
- }
+ protected ICollection Collection(INode predicate, Func parser)
+ where T : NodeWithGraph =>
+ new Collection(this, predicate, parser);
- protected ICollection Collection(INode predicate, Func parser)
- where T : NodeWithGraph =>
- new Collection(this, predicate, parser);
+ protected void SetRequired(INode predicate, object @object) => SetOptional(
+ predicate,
+ @object ?? throw new ArgumentNullException(nameof(@object)));
- protected void SetRequired(INode predicate, object @object) => this.SetOptional(
- predicate,
- @object ?? throw new ArgumentNullException(nameof(@object)));
+ protected void SetOptional(INode predicate, object? @object)
+ {
+ Graph.Retract(
+ Graph.GetTriplesWithSubjectPredicate(
+ this,
+ predicate).ToList());
- protected void SetOptional(INode predicate, object? @object)
+ if (@object is not null)
{
- this.Graph.Retract(
- this.Graph.GetTriplesWithSubjectPredicate(
- this,
- predicate).ToList());
-
- if (@object is not null)
- {
- this.Graph.Assert(this, predicate, @object.AsNode(this.Graph));
- }
+ Graph.Assert(this, predicate, @object.AsNode(Graph));
}
+ }
- protected T? GetOptional(INode predicate, Func parser)
- where T : class =>
- predicate.ObjectsOf(this).Select(parser).SingleOrDefault();
-
- protected T? GetOptionalS(INode predicate, Func parser)
- where T : struct
- {
- var enumerable = predicate.ObjectsOf(this).Select(parser);
+ protected T? GetOptional(INode predicate, Func parser)
+ where T : class =>
+ predicate.ObjectsOf(this).Select(parser).SingleOrDefault();
- if (!enumerable.Any())
- {
- return null;
- }
+ protected T? GetOptionalS(INode predicate, Func parser)
+ where T : struct
+ {
+ var enumerable = predicate.ObjectsOf(this).Select(parser);
- return enumerable.Single();
+ if (!enumerable.Any())
+ {
+ return null;
}
- protected T GetRequired(INode predicate, Func parser)
- where T : class =>
- this.GetOptional(predicate, parser)
- ?? throw new Exception($"Single {predicate} not found on {this}");
-
- protected T GetRequiredS(INode predicate, Func parser)
- where T : struct =>
- this.GetOptionalS(predicate, parser)
- ?? throw new Exception($"Single {predicate} not found on {this}");
+ return enumerable.Single();
}
+
+ protected T GetRequired(INode predicate, Func parser)
+ where T : class =>
+ GetOptional(predicate, parser)
+ ?? throw new Exception($"Single {predicate} not found on {this}");
+
+ protected T GetRequiredS(INode predicate, Func parser)
+ where T : struct =>
+ GetOptionalS(predicate, parser)
+ ?? throw new Exception($"Single {predicate} not found on {this}");
}
diff --git a/GraphEngine/NodeWithGraph.cs b/GraphEngine/NodeWithGraph.cs
index ddcbff1..2602de0 100644
--- a/GraphEngine/NodeWithGraph.cs
+++ b/GraphEngine/NodeWithGraph.cs
@@ -1,17 +1,10 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using VDS.RDF;
-
- public class NodeWithGraph : WrapperNode
- {
- public NodeWithGraph(INode node, IGraph graph)
- : base(node)
- => this.Graph = graph;
+namespace GraphEngine;
- public IGraph Graph { get; }
+public class NodeWithGraph(INode node, IGraph graph) : WrapperNode(node)
+{
+ public IGraph Graph { get; } = graph;
- public INode Original => this.Node;
- }
+ public INode Original => Node;
}
diff --git a/GraphEngine/Ontology/Class.cs b/GraphEngine/Ontology/Class.cs
index b997d7d..79f1516 100644
--- a/GraphEngine/Ontology/Class.cs
+++ b/GraphEngine/Ontology/Class.cs
@@ -1,19 +1,8 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Ontology
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
-
- public class Class : Resource
- {
- [DebuggerStepThrough]
- public Class(NodeWithGraph node)
- : base(node)
- {
- }
+namespace GraphEngine.Ontology;
- public IEnumerable SubClassOf => from o in Vocabulary.SubClassOf.ObjectsOf(this) select new Class(o);
- }
+public class Class(NodeWithGraph node) : Resource(node)
+{
+ public IEnumerable SubClassOf => from o in Vocabulary.SubClassOf.ObjectsOf(this) select new Class(o);
}
diff --git a/GraphEngine/Ontology/Graph.cs b/GraphEngine/Ontology/Graph.cs
index 1e346d6..3734eea 100644
--- a/GraphEngine/Ontology/Graph.cs
+++ b/GraphEngine/Ontology/Graph.cs
@@ -1,19 +1,14 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Ontology
-{
- using System.Collections.Generic;
- using System.Linq;
- using VDS.RDF;
+namespace GraphEngine.Ontology;
- public class Graph : WrapperGraph
- {
- public IEnumerable Ontologies => from o in this.InstancesOf(Vocabulary.OwlOntology) select new Resource(o);
+public class Graph : WrapperGraph
+{
+ public IEnumerable Ontologies => from o in this.InstancesOf(Vocabulary.OwlOntology) select new Resource(o);
- public IEnumerable Classes => from o in this.InstancesOf(Vocabulary.OwlClass) select new Class(o);
+ public IEnumerable Classes => from o in this.InstancesOf(Vocabulary.OwlClass) select new Class(o);
- public IEnumerable ObjectProperties => from o in this.InstancesOf(Vocabulary.OwlObjectProperty) select new Property(o);
+ public IEnumerable ObjectProperties => from o in this.InstancesOf(Vocabulary.OwlObjectProperty) select new Property(o);
- public IEnumerable DatatypeProperties => from o in this.InstancesOf(Vocabulary.OwlDatatypeProperty) select new Property(o);
- }
+ public IEnumerable DatatypeProperties => from o in this.InstancesOf(Vocabulary.OwlDatatypeProperty) select new Property(o);
}
diff --git a/GraphEngine/Ontology/Property.cs b/GraphEngine/Ontology/Property.cs
index f4ac66d..9424254 100644
--- a/GraphEngine/Ontology/Property.cs
+++ b/GraphEngine/Ontology/Property.cs
@@ -1,21 +1,10 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Ontology
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
-
- public class Property : Resource
- {
- [DebuggerStepThrough]
- public Property(NodeWithGraph node)
- : base(node)
- {
- }
+namespace GraphEngine.Ontology;
- public IEnumerable Domains => from o in Vocabulary.RdfsDomain.ObjectsOf(this) select new Class(o);
+public class Property(NodeWithGraph node) : Resource(node)
+{
+ public IEnumerable Domains => from o in Vocabulary.RdfsDomain.ObjectsOf(this) select new Class(o);
- public IEnumerable Ranges => from o in Vocabulary.RdfsRange.ObjectsOf(this) select new Resource(o);
- }
+ public IEnumerable Ranges => from o in Vocabulary.RdfsRange.ObjectsOf(this) select new Resource(o);
}
diff --git a/GraphEngine/Ontology/Resource.cs b/GraphEngine/Ontology/Resource.cs
index 8b9c478..880acfc 100644
--- a/GraphEngine/Ontology/Resource.cs
+++ b/GraphEngine/Ontology/Resource.cs
@@ -1,29 +1,16 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine.Ontology
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using VDS.RDF;
-
- public class Resource : NodeWithGraph
- {
- [DebuggerStepThrough]
- public Resource(NodeWithGraph node)
- : base(node, node.Graph)
- {
- }
+namespace GraphEngine.Ontology;
- public Uri? Uri => (this as IUriNode)?.Uri;
+public class Resource(NodeWithGraph node) : NodeWithGraph(node, node.Graph)
+{
+ public Uri? Uri => (this as IUriNode)?.Uri;
- public IEnumerable Types => Vocabulary.RdfType.ObjectsOf(this);
+ public IEnumerable Types => Vocabulary.RdfType.ObjectsOf(this);
- public IEnumerable IsDefinedBy => from o in Vocabulary.RdfsIsDefinedBy.ObjectsOf(this) select new Resource(o);
+ public IEnumerable IsDefinedBy => from o in Vocabulary.RdfsIsDefinedBy.ObjectsOf(this) select new Resource(o);
- public IEnumerable Labels => Vocabulary.RdfsLabel.ObjectsOf(this);
+ public IEnumerable Labels => Vocabulary.RdfsLabel.ObjectsOf(this);
- public IEnumerable Comments => Vocabulary.RdfsComment.ObjectsOf(this);
- }
+ public IEnumerable Comments => Vocabulary.RdfsComment.ObjectsOf(this);
}
diff --git a/GraphEngine/SerialisingVisitor.cs b/GraphEngine/SerialisingVisitor.cs
index 15e3d53..a064ac0 100644
--- a/GraphEngine/SerialisingVisitor.cs
+++ b/GraphEngine/SerialisingVisitor.cs
@@ -1,743 +1,735 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections.Generic;
- using System.Dynamic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Reflection;
- using System.Runtime.CompilerServices;
- using Linq = System.Linq.Expressions;
+namespace GraphEngine;
- public class SerialisingVisitor : Linq.ExpressionVisitor
- {
- private readonly Dictionary mapping = new ();
- private readonly NodeWithGraph node;
- private readonly Stack path = new ();
- private bool initialised;
+using System.Dynamic;
+using System.Reflection;
+using System.Runtime.CompilerServices;
- public SerialisingVisitor(NodeWithGraph node)
- : base()
- => this.node = node ?? throw new ArgumentNullException(nameof(node));
+public class SerialisingVisitor(NodeWithGraph node) : Linq.ExpressionVisitor()
+{
+ private readonly Dictionary mapping = [];
+ private readonly NodeWithGraph node = node ?? throw new ArgumentNullException(nameof(node));
+ private readonly Stack path = new();
+ private bool initialised;
- private NodeWithGraph Current => this.path.Peek();
+ private NodeWithGraph Current => path.Peek();
- private NodeWithGraph this[object index]
+ private NodeWithGraph this[object index]
+ {
+ get
{
- get
+ if (!initialised)
{
- if (!this.initialised)
- {
- this.mapping[index] = this.node;
- this.initialised = true;
-
- return this.node;
- }
+ mapping[index] = node;
+ initialised = true;
- if (!this.mapping.TryGetValue(index, out var current))
- {
- current = this.mapping[index] = this.node.Graph.CreateBlankNode().In(this.node.Graph);
- }
-
- return current;
+ return node;
}
- }
- public override Linq.Expression Visit(Linq.Expression node)
- {
- using (this.Wrap(node))
+ if (!mapping.TryGetValue(index, out var current))
{
- return base.Visit(node);
+ current = mapping[index] = node.Graph.CreateBlankNode().In(node.Graph);
}
+
+ return current;
}
+ }
- protected override Linq.Expression VisitBinary(Linq.BinaryExpression node)
+ public override Linq.Expression Visit(Linq.Expression? node)
+ {
+ using (Wrap(node))
{
- if (node.NodeType == Linq.ExpressionType.ArrayIndex)
- {
- _ = new ArrayIndex(this.Current)
- {
- Array = this.VisitCacheParse(node.Left),
- Index = this.VisitCacheParse(node.Right),
- };
- }
- else
- {
- Binary binary;
-
- if (node.IsReferenceComparison())
- {
- if (node.NodeType == Linq.ExpressionType.Equal)
- {
- binary = new ReferenceEqual(this.Current);
- }
- else
- {
- binary = new ReferenceNotEqual(this.Current);
- }
- }
- else
- {
- binary = Binary.Create(this.Current, node.NodeType);
-
- if (node.Method is MethodInfo method)
- {
- binary.Method = this.VisitMethod(method);
- }
-
- if (node.Conversion is LambdaExpression lambda)
- {
- binary.Conversion = new Lambda(this.VisitCache(lambda));
- }
-
- if (node.IsLiftedToNull)
- {
- binary.LiftToNull = true;
- }
- }
-
- binary.Left = this.VisitCacheParse(node.Left);
- binary.Right = this.VisitCacheParse(node.Right);
- }
-
- return node;
+ return base.Visit(node);
}
+ }
- protected override Linq.Expression VisitBlock(Linq.BlockExpression node)
+ protected override Linq.Expression VisitBinary(Linq.BinaryExpression node)
+ {
+ if (node.NodeType == Linq.ExpressionType.ArrayIndex)
{
- var block = new Block(this.Current);
-
- if (!Extensions.AreEquivalent(node.Type, node.Expressions.Last().Type))
+ _ = new ArrayIndex(Current)
{
- block.Type = this.VisitType(node.Type);
- }
-
- foreach (var variable in node.Variables)
- {
- block.Variables.Add(new Parameter(this.VisitCache(variable)));
- }
-
- foreach (var blockExpression in node.Expressions)
- {
- block.Expressions.Add(this.VisitCacheParse(blockExpression));
- }
-
- return node;
+ Array = VisitCacheParse(node.Left),
+ Index = VisitCacheParse(node.Right),
+ };
}
-
- protected override Linq.Expression VisitConditional(Linq.ConditionalExpression node)
+ else
{
- Condition condition;
+ Binary binary;
- if (node.Type == typeof(void))
+ if (node.IsReferenceComparison())
{
- if (node.IfFalse is Linq.DefaultExpression defaultExpression && defaultExpression.Type == typeof(void))
+ if (node.NodeType == Linq.ExpressionType.Equal)
{
- condition = new IfThen(this.Current);
+ binary = new ReferenceEqual(Current);
}
else
{
- condition = new IfThenElse(this.Current)
- {
- IfFalse = this.VisitCacheParse(node.IfFalse),
- };
+ binary = new ReferenceNotEqual(Current);
}
}
else
{
- condition = new Condition(this.Current)
+ binary = Binary.Create(Current, node.NodeType);
+
+ if (node.Method is MethodInfo method)
{
- IfFalse = this.VisitCacheParse(node.IfFalse),
- };
+ binary.Method = VisitMethod(method);
+ }
- if (node.Type != node.IfTrue.Type)
+ if (node.Conversion is Linq.LambdaExpression lambda)
{
- condition.Type = this.VisitType(node.Type);
+ binary.Conversion = new Lambda(VisitCache(lambda));
}
- }
- condition.Test = this.VisitCacheParse(node.Test);
- condition.IfTrue = this.VisitCacheParse(node.IfTrue);
+ if (node.IsLiftedToNull)
+ {
+ binary.LiftToNull = true;
+ }
+ }
- return node;
+ binary.Left = VisitCacheParse(node.Left);
+ binary.Right = VisitCacheParse(node.Right);
}
- protected override Linq.Expression VisitConstant(Linq.ConstantExpression node)
- {
- var constant = new Constant(this.Current)
- {
- Value = node.Value,
- };
+ return node;
+ }
- if (node.Type != node.Value.GetType())
- {
- constant.Type = this.VisitType(node.Type);
- }
+ protected override Linq.Expression VisitBlock(Linq.BlockExpression node)
+ {
+ var block = new Block(Current);
- return node;
+ if (!Extensions.AreEquivalent(node.Type, node.Expressions.Last().Type))
+ {
+ block.Type = VisitType(node.Type);
}
- protected override Linq.Expression VisitDebugInfo(Linq.DebugInfoExpression node)
+ foreach (var variable in node.Variables)
{
- var debugInfo = node.IsClear switch
- {
- true => new ClearDebugInfo(this.Current),
- false => new DebugInfo(this.Current),
- };
-
- debugInfo.Document = this.VisitSymbolDocument(node.Document);
- debugInfo.StartLine = node.StartLine;
- debugInfo.StartColumn = node.StartLine;
- debugInfo.EndLine = node.EndLine;
- debugInfo.EndColumn = node.EndLine;
+ block.Variables.Add(new Parameter(VisitCache(variable)));
+ }
- return node;
+ foreach (var blockExpression in node.Expressions)
+ {
+ block.Expressions.Add(VisitCacheParse(blockExpression));
}
- protected override Linq.Expression VisitDefault(Linq.DefaultExpression node)
+ return node;
+ }
+
+ protected override Linq.Expression VisitConditional(Linq.ConditionalExpression node)
+ {
+ Condition condition;
+
+ if (node.Type == typeof(void))
{
- if (node.Type == typeof(void))
+ if (node.IfFalse is Linq.DefaultExpression defaultExpression && defaultExpression.Type == typeof(void))
{
- _ = new Empty(this.Current);
+ condition = new IfThen(Current);
}
else
{
- _ = new Default(this.Current)
+ condition = new IfThenElse(Current)
{
- Type = this.VisitType(node.Type),
+ IfFalse = VisitCacheParse(node.IfFalse),
};
}
-
- return node;
}
-
- protected override Linq.Expression VisitDynamic(Linq.DynamicExpression node)
+ else
{
- var dynamicNode = new Dynamic(this.Current)
+ condition = new Condition(Current)
{
- Binder = this.VisitBinder(node.Binder),
- ReturnType = this.VisitType(node.Type),
+ IfFalse = VisitCacheParse(node.IfFalse),
};
- foreach (var argument in node.Arguments)
+ if (node.Type != node.IfTrue.Type)
{
- dynamicNode.Arguments.Add(this.VisitCacheParse(argument));
+ condition.Type = VisitType(node.Type);
}
-
- return node;
}
- protected override Linq.ElementInit VisitElementInit(Linq.ElementInit node)
- {
- using (this.Wrap(node))
- {
- var elementInit = new ElementInit(this.Current)
- {
- AddMethod = this.VisitMethod(node.AddMethod),
- };
-
- foreach (var argument in node.Arguments)
- {
- elementInit.Arguments.Add(this.VisitCacheParse(argument));
- }
+ condition.Test = VisitCacheParse(node.Test);
+ condition.IfTrue = VisitCacheParse(node.IfTrue);
- return node;
- }
- }
+ return node;
+ }
- protected override Linq.Expression VisitExtension(Linq.Expression node)
+ protected override Linq.Expression VisitConstant(Linq.ConstantExpression node)
+ {
+ var constant = new Constant(Current)
{
- if (node is DynamicExpression dynamicExpression)
- {
- return this.VisitDynamic(dynamicExpression);
- }
+ Value = node.Value,
+ };
- throw new InvalidOperationException($"unknown extension {node}");
+ if (node.Type != node.Value.GetType())
+ {
+ constant.Type = VisitType(node.Type);
}
- protected override Linq.Expression VisitGoto(Linq.GotoExpression node)
+ return node;
+ }
+
+ protected override Linq.Expression VisitDebugInfo(Linq.DebugInfoExpression node)
+ {
+ var debugInfo = node.IsClear switch
{
- var @goto = BaseGoto.Create(this.Current, node.Kind);
+ true => new ClearDebugInfo(Current),
+ false => new DebugInfo(Current),
+ };
- @goto.Target = new Target(this[this.VisitLabelTarget(node.Target)]);
+ debugInfo.Document = VisitSymbolDocument(node.Document);
+ debugInfo.StartLine = node.StartLine;
+ debugInfo.StartColumn = node.StartLine;
+ debugInfo.EndLine = node.EndLine;
+ debugInfo.EndColumn = node.EndLine;
- if (node.Value is not null)
- {
- @goto.Value = this.VisitCacheParse(node.Value);
- }
+ return node;
+ }
- if (node.Type != typeof(void))
+ protected override Linq.Expression VisitDefault(Linq.DefaultExpression node)
+ {
+ if (node.Type == typeof(void))
+ {
+ _ = new Empty(Current);
+ }
+ else
+ {
+ _ = new Default(Current)
{
- @goto.Type = this.VisitType(node.Type);
- }
+ Type = VisitType(node.Type),
+ };
+ }
- return node;
+ return node;
+ }
+
+ protected override Linq.Expression VisitDynamic(Linq.DynamicExpression node)
+ {
+ var dynamicNode = new Dynamic(Current)
+ {
+ Binder = VisitBinder(node.Binder),
+ ReturnType = VisitType(node.Type),
+ };
+
+ foreach (var argument in node.Arguments)
+ {
+ dynamicNode.Arguments.Add(VisitCacheParse(argument));
}
- protected override Linq.Expression VisitIndex(Linq.IndexExpression node)
+ return node;
+ }
+
+ protected override Linq.ElementInit VisitElementInit(Linq.ElementInit node)
+ {
+ using (Wrap(node))
{
- if (node.Indexer is not null)
+ var elementInit = new ElementInit(Current)
{
- var property = new Property(this.Current)
- {
- Expression = this.VisitCacheParse(node.Object),
- Name = node.Indexer.Name,
- };
+ AddMethod = VisitMethod(node.AddMethod),
+ };
- foreach (var index in node.Arguments)
- {
- property.Arguments.Add(this.VisitCacheParse(index));
- }
- }
- else
+ foreach (var argument in node.Arguments)
{
- var arrayAccess = new ArrayAccess(this.Current)
- {
- Array = this.VisitCacheParse(node.Object),
- };
-
- foreach (var index in node.Arguments)
- {
- arrayAccess.Indexes.Add(this.VisitCacheParse(index));
- }
+ elementInit.Arguments.Add(VisitCacheParse(argument));
}
return node;
}
+ }
- protected override Linq.LabelTarget VisitLabelTarget(Linq.LabelTarget node)
+ protected override Linq.Expression VisitExtension(Linq.Expression node)
+ {
+ if (node is Linq.DynamicExpression dynamicExpression)
{
- using (this.Wrap(node))
- {
- var target = new Target(this.Current);
+ return VisitDynamic(dynamicExpression);
+ }
- if (node.Type != typeof(void))
- {
- target.Type = this.VisitType(node.Type);
- }
+ throw new InvalidOperationException($"unknown extension {node}");
+ }
- if (node.Name is not null)
- {
- target.Name = node.Name;
- }
+ protected override Linq.Expression VisitGoto(Linq.GotoExpression node)
+ {
+ var @goto = BaseGoto.Create(Current, node.Kind);
- return node;
- }
+ @goto.Target = new Target(this[VisitLabelTarget(node.Target)]);
+
+ if (node.Value is not null)
+ {
+ @goto.Value = VisitCacheParse(node.Value);
+ }
+
+ if (node.Type != typeof(void))
+ {
+ @goto.Type = VisitType(node.Type);
}
- protected override Linq.Expression VisitListInit(ListInitExpression node)
+ return node;
+ }
+
+ protected override Linq.Expression VisitIndex(Linq.IndexExpression node)
+ {
+ if (node.Indexer is not null)
{
- var listInit = new ListInit(this.Current)
+ var property = new Property(Current)
{
- NewExpression = new New(this.VisitCache(node.NewExpression)),
+ Expression = VisitCacheParse(node.Object),
+ Name = node.Indexer.Name,
};
- foreach (var initializer in node.Initializers)
+ foreach (var index in node.Arguments)
{
- listInit.Initializers.Add(new ElementInit(this[this.VisitElementInit(initializer)]));
+ property.Arguments.Add(VisitCacheParse(index));
}
-
- return node;
}
-
- protected override Linq.Expression VisitLambda(Expression node)
+ else
{
- var lambda = new Lambda(this.Current)
+ var arrayAccess = new ArrayAccess(Current)
{
- Body = this.VisitCacheParse(node.Body),
+ Array = VisitCacheParse(node.Object),
};
- foreach (var parameter in node.Parameters)
+ foreach (var index in node.Arguments)
{
- lambda.Parameters.Add(new Parameter(this.VisitCache(parameter)));
+ arrayAccess.Indexes.Add(VisitCacheParse(index));
}
-
- return node;
}
- protected override Linq.Expression VisitLoop(Linq.LoopExpression node)
+ return node;
+ }
+
+ protected override Linq.LabelTarget VisitLabelTarget(Linq.LabelTarget? node)
+ {
+ using (Wrap(node))
{
- var loop = new Loop(this.Current)
- {
- Body = this.VisitCacheParse(node.Body),
- };
+ var target = new Target(Current);
- if (node.ContinueLabel is not null)
+ if (node.Type != typeof(void))
{
- loop.Continue = new Target(this[this.VisitLabelTarget(node.ContinueLabel)]);
+ target.Type = VisitType(node.Type);
}
- if (node.BreakLabel is not null)
+ if (node.Name is not null)
{
- loop.Break = new Target(this[this.VisitLabelTarget(node.BreakLabel)]);
+ target.Name = node.Name;
}
return node;
}
+ }
- protected override Linq.Expression VisitMember(Linq.MemberExpression node)
+ protected override Linq.Expression VisitListInit(Linq.ListInitExpression node)
+ {
+ var listInit = new ListInit(Current)
{
- var memberAccess = node.Member.MemberType switch
- {
- MemberTypes.Field => (MemberAccess)new Field(this.Current),
- MemberTypes.Property => (MemberAccess)new Property(this.Current),
- };
+ NewExpression = new New(VisitCache(node.NewExpression)),
+ };
- memberAccess.Name = node.Member.Name;
+ foreach (var initializer in node.Initializers)
+ {
+ listInit.Initializers.Add(new ElementInit(this[VisitElementInit(initializer)]));
+ }
- if (node.Expression is not null)
- {
- memberAccess.Expression = this.VisitCacheParse(node.Expression);
- }
+ return node;
+ }
- if (node.Expression is null || node.Expression.Type != node.Member.DeclaringType)
- {
- memberAccess.Type = this.VisitType(node.Member.DeclaringType);
- }
+ protected override Linq.Expression VisitLambda(Linq.Expression node)
+ {
+ var lambda = new Lambda(Current)
+ {
+ Body = VisitCacheParse(node.Body),
+ };
- return node;
+ foreach (var parameter in node.Parameters)
+ {
+ lambda.Parameters.Add(new Parameter(VisitCache(parameter)));
}
- protected override Linq.MemberAssignment VisitMemberAssignment(Linq.MemberAssignment node)
+ return node;
+ }
+
+ protected override Linq.Expression VisitLoop(Linq.LoopExpression node)
+ {
+ var loop = new Loop(Current)
{
- _ = new Bind(this.Current)
- {
- Member = this.VisitMember(node.Member),
- Expression = this.VisitCacheParse(node.Expression),
- };
+ Body = VisitCacheParse(node.Body),
+ };
- return node;
+ if (node.ContinueLabel is not null)
+ {
+ loop.Continue = new Target(this[VisitLabelTarget(node.ContinueLabel)]);
}
- protected override Linq.MemberBinding VisitMemberBinding(Linq.MemberBinding node)
+ if (node.BreakLabel is not null)
{
- using (this.Wrap(node))
- {
- return node switch
- {
- Linq.MemberAssignment binding => this.VisitMemberAssignment(binding),
- Linq.MemberMemberBinding binding => this.VisitMemberMemberBinding(binding),
- Linq.MemberListBinding binding => this.VisitMemberListBinding(binding),
- };
- }
+ loop.Break = new Target(this[VisitLabelTarget(node.BreakLabel)]);
}
- protected override Linq.Expression VisitMemberInit(Linq.MemberInitExpression node)
+ return node;
+ }
+
+ protected override Linq.Expression VisitMember(Linq.MemberExpression node)
+ {
+ var memberAccess = node.Member.MemberType switch
{
- var memberInit = new MemberInit(this.Current)
- {
- NewExpression = new New(this.VisitCache(node.NewExpression)),
- };
+ MemberTypes.Field => new Field(Current) as MemberAccess,
+ MemberTypes.Property => new Property(Current) as MemberAccess,
+ var mt => throw new Exception($"unknown member type {mt}")
+ };
- foreach (var binding in node.Bindings)
- {
- memberInit.Bindings.Add(BaseBind.Create(this[this.VisitMemberBinding(binding)], binding.BindingType));
- }
+ memberAccess.Name = node.Member.Name;
- return node;
+ if (node.Expression is not null)
+ {
+ memberAccess.Expression = VisitCacheParse(node.Expression);
}
- protected override Linq.MemberListBinding VisitMemberListBinding(Linq.MemberListBinding node)
+ if (node.Expression is null || node.Expression.Type != node.Member.DeclaringType)
{
- var listBinding = new ListBind(this.Current)
- {
- Member = this.VisitMember(node.Member),
- };
+ memberAccess.Type = VisitType(node.Member.DeclaringType);
+ }
- foreach (var item in node.Initializers)
- {
- listBinding.Initializers.Add(new ElementInit(this[this.VisitElementInit(item)]));
- }
+ return node;
+ }
- return node;
- }
+ protected override Linq.MemberAssignment VisitMemberAssignment(Linq.MemberAssignment node)
+ {
+ _ = new Bind(Current)
+ {
+ Member = VisitMember(node.Member),
+ Expression = VisitCacheParse(node.Expression),
+ };
+
+ return node;
+ }
- protected override Linq.MemberMemberBinding VisitMemberMemberBinding(Linq.MemberMemberBinding node)
+ protected override Linq.MemberBinding VisitMemberBinding(Linq.MemberBinding node)
+ {
+ using (Wrap(node))
{
- var memberBinding = new MemberBind(this.Current)
+ return node switch
{
- Member = this.VisitMember(node.Member),
+ Linq.MemberAssignment binding => VisitMemberAssignment(binding),
+ Linq.MemberMemberBinding binding => VisitMemberMemberBinding(binding),
+ Linq.MemberListBinding binding => VisitMemberListBinding(binding),
+ var n => throw new Exception($"unknown member binding {n}")
};
+ }
+ }
- foreach (var binding in node.Bindings)
- {
- memberBinding.Bindings.Add(BaseBind.Create(this[this.VisitMemberBinding(binding)], binding.BindingType));
- }
+ protected override Linq.Expression VisitMemberInit(Linq.MemberInitExpression node)
+ {
+ var memberInit = new MemberInit(Current)
+ {
+ NewExpression = new New(VisitCache(node.NewExpression)),
+ };
- return node;
+ foreach (var binding in node.Bindings)
+ {
+ memberInit.Bindings.Add(BaseBind.Create(this[VisitMemberBinding(binding)], binding.BindingType));
}
- protected override Linq.Expression VisitMethodCall(Linq.MethodCallExpression node)
+ return node;
+ }
+
+ protected override Linq.MemberListBinding VisitMemberListBinding(Linq.MemberListBinding node)
+ {
+ var listBinding = new ListBind(Current)
{
- var call = new Call(this.Current)
- {
- Method = this.VisitMethod(node.Method),
- };
+ Member = VisitMember(node.Member),
+ };
- if (node.Object is not null)
- {
- call.Instance = this.VisitCacheParse(node.Object);
- }
+ foreach (var item in node.Initializers)
+ {
+ listBinding.Initializers.Add(new ElementInit(this[VisitElementInit(item)]));
+ }
- foreach (var argument in node.Arguments)
- {
- call.Arguments.Add(this.VisitCacheParse(argument));
- }
+ return node;
+ }
- return node;
+ protected override Linq.MemberMemberBinding VisitMemberMemberBinding(Linq.MemberMemberBinding node)
+ {
+ var memberBinding = new MemberBind(Current)
+ {
+ Member = VisitMember(node.Member),
+ };
+
+ foreach (var binding in node.Bindings)
+ {
+ memberBinding.Bindings.Add(BaseBind.Create(this[VisitMemberBinding(binding)], binding.BindingType));
}
- protected override Linq.Expression VisitNew(Linq.NewExpression node)
+ return node;
+ }
+
+ protected override Linq.Expression VisitMethodCall(Linq.MethodCallExpression node)
+ {
+ var call = new Call(Current)
{
- _ = new New(this.Current)
- {
- Type = this.VisitType(node.Type),
- };
+ Method = VisitMethod(node.Method),
+ };
- return node;
+ if (node.Object is not null)
+ {
+ call.Instance = VisitCacheParse(node.Object);
}
- protected override Linq.Expression VisitNewArray(NewArrayExpression node)
+ foreach (var argument in node.Arguments)
{
- NewArray newArray;
- if (node.NodeType == Linq.ExpressionType.NewArrayBounds)
- {
- newArray = new NewArrayBounds(this.Current);
- }
- else
- {
- newArray = new NewArrayInit(this.Current);
- }
+ call.Arguments.Add(VisitCacheParse(argument));
+ }
+
+ return node;
+ }
- newArray.Type = this.VisitType(node.Type.GetElementType());
+ protected override Linq.Expression VisitNew(Linq.NewExpression node)
+ {
+ _ = new New(Current)
+ {
+ Type = VisitType(node.Type),
+ };
- foreach (var expression in node.Expressions)
- {
- newArray.Expressions.Add(this.VisitCacheParse(expression));
- }
+ return node;
+ }
- return node;
+ protected override Linq.Expression VisitNewArray(Linq.NewArrayExpression node)
+ {
+ NewArray newArray;
+ if (node.NodeType == Linq.ExpressionType.NewArrayBounds)
+ {
+ newArray = new NewArrayBounds(Current);
}
-
- protected override Linq.Expression VisitParameter(Linq.ParameterExpression node)
+ else
{
- var parameter = new Parameter(this.Current)
- {
- Type = this.VisitType(node.Type),
- };
+ newArray = new NewArrayInit(Current);
+ }
- if (node.Name is not null)
- {
- parameter.Name = node.Name;
- }
+ newArray.Type = VisitType(node.Type.GetElementType());
- return node;
+ foreach (var expression in node.Expressions)
+ {
+ newArray.Expressions.Add(VisitCacheParse(expression));
}
- protected override Linq.Expression VisitRuntimeVariables(Linq.RuntimeVariablesExpression node)
+ return node;
+ }
+
+ protected override Linq.Expression VisitParameter(Linq.ParameterExpression node)
+ {
+ var parameter = new Parameter(Current)
{
- var runtimeVariables = new RuntimeVariables(this.Current);
+ Type = VisitType(node.Type),
+ };
- foreach (var variable in node.Variables)
- {
- runtimeVariables.Variables.Add(new Parameter(this.VisitCache(variable)));
- }
+ if (node.Name is not null)
+ {
+ parameter.Name = node.Name;
+ }
- return node;
+ return node;
+ }
+
+ protected override Linq.Expression VisitRuntimeVariables(Linq.RuntimeVariablesExpression node)
+ {
+ var runtimeVariables = new RuntimeVariables(Current);
+
+ foreach (var variable in node.Variables)
+ {
+ runtimeVariables.Variables.Add(new Parameter(VisitCache(variable)));
}
- protected override Linq.Expression VisitTypeBinary(TypeBinaryExpression node)
+ return node;
+ }
+
+ protected override Linq.Expression VisitTypeBinary(Linq.TypeBinaryExpression node)
+ {
+ _ = new TypeBinary(Current)
{
- _ = new TypeBinary(this.Current)
- {
- ExpressionType = this.VisitExpressionType(node.NodeType),
- Expression = this.VisitCacheParse(node.Expression),
- Type = this.VisitType(node.TypeOperand),
- };
+ ExpressionType = VisitExpressionType(node.NodeType),
+ Expression = VisitCacheParse(node.Expression),
+ Type = VisitType(node.TypeOperand),
+ };
- return node;
- }
+ return node;
+ }
- protected override Linq.Expression VisitUnary(Linq.UnaryExpression node)
+ protected override Linq.Expression VisitUnary(Linq.UnaryExpression node)
+ {
+ if (node.NodeType == Linq.ExpressionType.Throw)
{
- if (node.NodeType == Linq.ExpressionType.Throw)
+ if (node.Operand is null && node.Type == typeof(void))
{
- if (node.Operand is null && node.Type == typeof(void))
- {
- _ = new Rethrow(this.Current);
- }
-
- var @throw = new Throw(this.Current);
+ _ = new Rethrow(Current);
+ }
- if (node.Operand is Linq.Expression value)
- {
- @throw.Value = this.VisitCacheParse(value);
- }
+ var @throw = new Throw(Current);
- if (node.Type is System.Type type)
- {
- @throw.Type = this.VisitType(type);
- }
+ if (node.Operand is Linq.Expression value)
+ {
+ @throw.Value = VisitCacheParse(value);
}
- else
+
+ if (node.Type is System.Type type)
{
- var unary = Unary.Create(this.Current, node.NodeType);
+ @throw.Type = VisitType(type);
+ }
+ }
+ else
+ {
+ var unary = Unary.Create(Current, node.NodeType);
- unary.Type = this.VisitType(node.Type);
+ unary.Type = VisitType(node.Type);
- unary.Operand = this.VisitCacheParse(node.Operand);
+ unary.Operand = VisitCacheParse(node.Operand);
- if (node.Method is MethodInfo method)
- {
- unary.Method = this.VisitMethod(method);
- }
+ if (node.Method is MethodInfo method)
+ {
+ unary.Method = VisitMethod(method);
}
-
- return node;
}
- private Expression VisitCacheParse(Linq.Expression node) => Expression.Parse(this.VisitCache(node));
+ return node;
+ }
+
+ private Expression VisitCacheParse(Linq.Expression node) => Expression.Parse(VisitCache(node));
- private NodeWithGraph VisitCache(Linq.Expression node) => this[this.Visit(node)];
+ private NodeWithGraph VisitCache(Linq.Expression node) => this[Visit(node)];
- private ArgumentInfo VisitArgumentInfo(string argument)
+ private ArgumentInfo VisitArgumentInfo(string argument)
+ {
+ using (Wrap(argument))
{
- using (this.Wrap(argument))
- {
- return new ArgumentInfo(this.Current);
- }
+ return new ArgumentInfo(Current);
}
+ }
- private Binder VisitBinder(CallSiteBinder callSiteBinder)
+ private Binder VisitBinder(CallSiteBinder callSiteBinder)
+ {
+ using (Wrap(callSiteBinder))
{
- using (this.Wrap(callSiteBinder))
+ switch (callSiteBinder)
{
- switch (callSiteBinder)
- {
- case InvokeMemberBinder invokeMember:
- var invokeMemberBinder = new InvokeMember(this.Current)
- {
- Name = invokeMember.Name,
- };
+ case InvokeMemberBinder invokeMember:
+ var invokeMemberBinder = new InvokeMember(Current)
+ {
+ Name = invokeMember.Name,
+ };
- // Object member is invoked on
- invokeMemberBinder.Arguments.Add(new ArgumentInfo(this[this.VisitArgumentInfo(string.Empty)]));
+ // Object member is invoked on
+ invokeMemberBinder.Arguments.Add(new ArgumentInfo(this[VisitArgumentInfo(string.Empty)]));
- foreach (var argument in invokeMember.CallInfo.ArgumentNames)
- {
- invokeMemberBinder.Arguments.Add(new ArgumentInfo(this[this.VisitArgumentInfo(argument)]));
- }
+ foreach (var argument in invokeMember.CallInfo.ArgumentNames)
+ {
+ invokeMemberBinder.Arguments.Add(new ArgumentInfo(this[VisitArgumentInfo(argument)]));
+ }
- return invokeMemberBinder;
+ return invokeMemberBinder;
- case BinaryOperationBinder binaryOperation:
- var binaryOperationBinder = new BinaryOperation(this.Current)
- {
- ExpressionType = this.VisitExpressionType(binaryOperation.Operation),
- };
+ case BinaryOperationBinder binaryOperation:
+ var binaryOperationBinder = new BinaryOperation(Current)
+ {
+ ExpressionType = VisitExpressionType(binaryOperation.Operation),
+ };
- // Left operand
- binaryOperationBinder.Arguments.Add(new ArgumentInfo(this[this.VisitArgumentInfo(string.Empty)]));
+ // Left operand
+ binaryOperationBinder.Arguments.Add(new ArgumentInfo(this[VisitArgumentInfo(string.Empty)]));
- // Right operand
- binaryOperationBinder.Arguments.Add(new ArgumentInfo(this[this.VisitArgumentInfo(string.Empty)]));
+ // Right operand
+ binaryOperationBinder.Arguments.Add(new ArgumentInfo(this[VisitArgumentInfo(string.Empty)]));
- return binaryOperationBinder;
+ return binaryOperationBinder;
- case var unknown:
- throw new Exception($"Unkown binder {unknown}");
- }
+ case var unknown:
+ throw new Exception($"Unkown binder {unknown}");
}
}
+ }
- private ExpressionType VisitExpressionType(Linq.ExpressionType expressionType)
+ private ExpressionType VisitExpressionType(Linq.ExpressionType expressionType)
+ {
+ using (Wrap(expressionType))
{
- using (this.Wrap(expressionType))
- {
- return ExpressionType.Create(expressionType, this.node.Graph);
- }
+ return ExpressionType.Create(expressionType, node.Graph);
}
+ }
- private Member VisitMember(MemberInfo member)
+ private Member VisitMember(MemberInfo member)
+ {
+ using (Wrap(member))
{
- using (this.Wrap(member))
+ return new Member(Current)
{
- return new Member(this.Current)
- {
- Type = this.VisitType(member.DeclaringType),
- Name = member.Name,
- };
- }
+ Type = VisitType(member.DeclaringType),
+ Name = member.Name,
+ };
}
+ }
- private Method VisitMethod(MethodInfo method)
+ private Method VisitMethod(MethodInfo method)
+ {
+ using (Wrap(method))
{
- using (this.Wrap(method))
+ var methodNode = new Method(Current)
{
- var methodNode = new Method(this.Current)
- {
- Type = this.VisitType(method.DeclaringType),
- Name = method.Name,
- };
-
- foreach (var type in method.GetGenericArguments())
- {
- methodNode.TypeArguments.Add(this.VisitType(type));
- }
-
- return methodNode;
- }
- }
+ Type = VisitType(method.DeclaringType),
+ Name = method.Name,
+ };
- private SymbolDocument VisitSymbolDocument(SymbolDocumentInfo document)
- {
- using (this.Wrap(document))
+ foreach (var type in method.GetGenericArguments())
{
- return new SymbolDocument(this.Current)
- {
- FileName = document.FileName,
- Language = NullIfEmpty(document.Language),
- LanguageVendor = NullIfEmpty(document.LanguageVendor),
- DocumentType = NullIfEmpty(document.DocumentType),
- };
+ methodNode.TypeArguments.Add(VisitType(type));
}
- static Guid? NullIfEmpty(Guid guid) => guid == Guid.Empty ? (Guid?)null : guid;
+ return methodNode;
}
+ }
- private Type VisitType(System.Type type)
+ private SymbolDocument VisitSymbolDocument(Linq.SymbolDocumentInfo document)
+ {
+ using (Wrap(document))
{
- using (this.Wrap(type))
+ return new SymbolDocument(Current)
{
- var t = new Type(this.Current)
- {
- Name = $"{type}, {type.Assembly}",
- };
-
- foreach (var argument in type.GenericTypeArguments)
- {
- t.Arguments.Add(this.VisitType(argument));
- }
-
- return t;
- }
+ FileName = document.FileName,
+ Language = NullIfEmpty(document.Language),
+ LanguageVendor = NullIfEmpty(document.LanguageVendor),
+ DocumentType = NullIfEmpty(document.DocumentType),
+ };
}
- private IDisposable Wrap(object node) => new Wrapper(this, this[node]);
+ static Guid? NullIfEmpty(Guid guid) => guid == Guid.Empty ? (Guid?)null : guid;
+ }
- private readonly struct Wrapper : IDisposable
+ private Type VisitType(System.Type type)
+ {
+ using (Wrap(type))
{
- private readonly SerialisingVisitor visitor;
+ var t = new Type(Current)
+ {
+ Name = $"{type}, {type.Assembly}",
+ };
- internal Wrapper(SerialisingVisitor visitor, NodeWithGraph node)
+ foreach (var argument in type.GenericTypeArguments)
{
- this.visitor = visitor;
- this.visitor.path.Push(node);
+ t.Arguments.Add(VisitType(argument));
}
- void IDisposable.Dispose() => this.visitor.path.Pop();
+ return t;
+ }
+ }
+
+ private Wrapper Wrap(object node) => new(this, this[node]);
+
+ private readonly struct Wrapper : IDisposable
+ {
+ private readonly SerialisingVisitor visitor;
+
+ internal Wrapper(SerialisingVisitor visitor, NodeWithGraph node)
+ {
+ this.visitor = visitor;
+ this.visitor.path.Push(node);
}
+
+ void IDisposable.Dispose() => visitor.path.Pop();
}
}
diff --git a/GraphEngine/SymbolDocument.cs b/GraphEngine/SymbolDocument.cs
index 4c8d5bc..56d28ea 100644
--- a/GraphEngine/SymbolDocument.cs
+++ b/GraphEngine/SymbolDocument.cs
@@ -1,54 +1,42 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
+namespace GraphEngine;
+
+public class SymbolDocument(NodeWithGraph node) : Node(node)
{
- using System;
- using System.Diagnostics;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
+ public string FileName
+ {
+ get => GetRequired(SymbolDocumentFileName, AsString);
+
+ set => SetRequired(SymbolDocumentFileName, value);
+ }
- public class SymbolDocument : Node
+ public Guid? Language
{
- [DebuggerStepThrough]
- internal SymbolDocument(NodeWithGraph node)
- : base(node)
- {
- }
-
- public string FileName
- {
- get => this.GetRequired(SymbolDocumentFileName, AsString);
-
- set => this.SetRequired(SymbolDocumentFileName, value);
- }
-
- public Guid? Language
- {
- get => this.GetOptionalS(SymbolDocumentLanguage, AsGuid);
-
- set => this.SetOptional(SymbolDocumentLanguage, value);
- }
-
- public Guid? LanguageVendor
- {
- get => this.GetOptionalS(SymbolDocumentLanguageVendor, AsGuid);
-
- set => this.SetOptional(SymbolDocumentLanguageVendor, value);
- }
-
- public Guid? DocumentType
- {
- get => this.GetOptionalS(SymbolDocumentDocumentType, AsGuid);
-
- set => this.SetOptional(SymbolDocumentDocumentType, value);
- }
-
- public Linq.SymbolDocumentInfo LinqDocument => this switch
- {
- { Language: Guid language, LanguageVendor: Guid languageVendor, DocumentType: Guid documentType } => Linq.Expression.SymbolDocument(this.FileName, language, languageVendor, documentType),
- { Language: Guid language, LanguageVendor: Guid languageVendor } => Linq.Expression.SymbolDocument(this.FileName, language, languageVendor),
- { Language: Guid language } => Linq.Expression.SymbolDocument(this.FileName, language),
- _ => Linq.Expression.SymbolDocument(this.FileName)
- };
+ get => GetOptionalS(SymbolDocumentLanguage, AsGuid);
+
+ set => SetOptional(SymbolDocumentLanguage, value);
}
+
+ public Guid? LanguageVendor
+ {
+ get => GetOptionalS(SymbolDocumentLanguageVendor, AsGuid);
+
+ set => SetOptional(SymbolDocumentLanguageVendor, value);
+ }
+
+ public Guid? DocumentType
+ {
+ get => GetOptionalS(SymbolDocumentDocumentType, AsGuid);
+
+ set => SetOptional(SymbolDocumentDocumentType, value);
+ }
+
+ public Linq.SymbolDocumentInfo LinqDocument => this switch
+ {
+ { Language: Guid language, LanguageVendor: Guid languageVendor, DocumentType: Guid documentType } => Linq.Expression.SymbolDocument(FileName, language, languageVendor, documentType),
+ { Language: Guid language, LanguageVendor: Guid languageVendor } => Linq.Expression.SymbolDocument(FileName, language, languageVendor),
+ { Language: Guid language } => Linq.Expression.SymbolDocument(FileName, language),
+ _ => Linq.Expression.SymbolDocument(FileName)
+ };
}
diff --git a/GraphEngine/Target.cs b/GraphEngine/Target.cs
index f86a393..09d62a9 100644
--- a/GraphEngine/Target.cs
+++ b/GraphEngine/Target.cs
@@ -1,61 +1,47 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using VDS.RDF;
- using static Vocabulary;
- using Linq = System.Linq.Expressions;
-
- public class Target : Node
- {
- private static readonly Dictionary Cache = new ();
+namespace GraphEngine;
- [DebuggerStepThrough]
- internal Target(NodeWithGraph node)
- : base(node)
- {
- }
+public class Target(NodeWithGraph node) : Node(node)
+{
+ private static readonly Dictionary Cache = [];
- public Type? Type
- {
- get => this.GetOptional(TargetType, Type.Parse);
+ public Type? Type
+ {
+ get => GetOptional(TargetType, Type.Parse);
- set => this.SetOptional(TargetType, value);
- }
+ set => SetOptional(TargetType, value);
+ }
- public string? Name
- {
- get => this.GetOptional(TargetName, AsString);
+ public string? Name
+ {
+ get => GetOptional(TargetName, AsString);
- set => this.SetOptional(TargetName, value);
- }
+ set => SetOptional(TargetName, value);
+ }
- public Linq.LabelTarget LinqTarget
+ public Linq.LabelTarget LinqTarget
+ {
+ get
{
- get
+ if (!Cache.TryGetValue(this, out var label))
{
- if (!Cache.TryGetValue(this, out var label))
+ Cache[this] = label = this switch
{
- Cache[this] = label = this switch
- {
- { Type: not null, Name: not null } => Linq.Expression.Label(this.Type.SystemType, this.Name),
- { Type: not null } => Linq.Expression.Label(this.Type.SystemType),
- { Name: not null } => Linq.Expression.Label(this.Name),
- _ => Linq.Expression.Label()
- };
- }
-
- return label;
+ { Type: not null, Name: not null } => Linq.Expression.Label(Type.SystemType, Name),
+ { Type: not null } => Linq.Expression.Label(Type.SystemType),
+ { Name: not null } => Linq.Expression.Label(Name),
+ _ => Linq.Expression.Label()
+ };
}
- }
- internal static Target Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new Target(node)
- };
+ return label;
+ }
}
+
+ internal static Target Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new Target(node)
+ };
}
diff --git a/GraphEngine/Type.cs b/GraphEngine/Type.cs
index 2ecc42e..4da549a 100644
--- a/GraphEngine/Type.cs
+++ b/GraphEngine/Type.cs
@@ -1,49 +1,36 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using static Vocabulary;
+namespace GraphEngine;
- public class Type : Node
+public class Type(NodeWithGraph node) : Node(node)
+{
+ public string Name
{
- [DebuggerStepThrough]
- public Type(NodeWithGraph node)
- : base(node)
- {
- }
+ get => GetRequired(TypeName, AsString);
- public string Name
- {
- get => this.GetRequired(TypeName, AsString);
-
- set => this.SetRequired(TypeName, value);
- }
+ set => SetRequired(TypeName, value);
+ }
- public ICollection Arguments => this.Collection(TypeArguments, Parse);
+ public ICollection Arguments => Collection(TypeArguments, Parse);
- public System.Type SystemType
+ public System.Type SystemType
+ {
+ get
{
- get
- {
- var t = System.Type.GetType(this.Name) ?? throw new InvalidOperationException($"Type {this.Name} not found.");
-
- if (t.IsGenericTypeDefinition)
- {
- return t.MakeGenericType(this.Arguments.Select(arg => arg.SystemType).ToArray());
- }
+ var t = System.Type.GetType(Name) ?? throw new InvalidOperationException($"Type {Name} not found.");
- return t;
+ if (t.IsGenericTypeDefinition)
+ {
+ return t.MakeGenericType(Arguments.Select(arg => arg.SystemType).ToArray());
}
- }
- internal static Type Parse(NodeWithGraph node) => node switch
- {
- null => throw new ArgumentNullException(nameof(node)),
- _ => new Type(node)
- };
+ return t;
+ }
}
+
+ internal static Type Parse(NodeWithGraph node) => node switch
+ {
+ null => throw new ArgumentNullException(nameof(node)),
+ _ => new Type(node)
+ };
}
diff --git a/GraphEngine/Vocabulary.cs b/GraphEngine/Vocabulary.cs
index a300f2b..e4bcded 100644
--- a/GraphEngine/Vocabulary.cs
+++ b/GraphEngine/Vocabulary.cs
@@ -1,173 +1,170 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using System;
- using VDS.RDF;
- using VDS.RDF.Ontology;
- using VDS.RDF.Parsing;
+namespace GraphEngine;
- public static partial class Vocabulary
- {
- private const string BaseUriString = "http://example.com/";
+using VDS.RDF.Ontology;
+using VDS.RDF.Parsing;
- private static readonly NodeFactory Factory = new (new NodeFactoryOptions());
+public static partial class Vocabulary
+{
+ private const string BaseUriString = "http://example.com/";
- public static Uri BaseUri => UriFactory.Create(BaseUriString);
+ private static readonly NodeFactory Factory = new (new NodeFactoryOptions());
- public static IUriNode Ontology { get; } = EngineNode("schema");
+ public static Uri BaseUri => UriFactory.Create(BaseUriString);
- public static IUriNode RdfType { get; } = AnyNode(RdfSpecsHelper.RdfType);
+ public static IUriNode Ontology { get; } = EngineNode("schema");
- public static IUriNode SubClassOf { get; } = AnyNode(OntologyHelper.PropertySubClassOf);
+ public static IUriNode RdfType { get; } = AnyNode(RdfSpecsHelper.RdfType);
- public static IUriNode RdfsComment { get; } = AnyNode(OntologyHelper.PropertyComment);
+ public static IUriNode SubClassOf { get; } = AnyNode(OntologyHelper.PropertySubClassOf);
- public static IUriNode RdfsDomain { get; } = AnyNode(OntologyHelper.PropertyDomain);
+ public static IUriNode RdfsComment { get; } = AnyNode(OntologyHelper.PropertyComment);
- public static IUriNode RdfsIsDefinedBy { get; } = AnyNode(OntologyHelper.PropertyIsDefinedBy);
+ public static IUriNode RdfsDomain { get; } = AnyNode(OntologyHelper.PropertyDomain);
- public static IUriNode RdfsLabel { get; } = AnyNode(OntologyHelper.PropertyLabel);
+ public static IUriNode RdfsIsDefinedBy { get; } = AnyNode(OntologyHelper.PropertyIsDefinedBy);
- public static IUriNode RdfsRange { get; } = AnyNode(OntologyHelper.PropertyRange);
+ public static IUriNode RdfsLabel { get; } = AnyNode(OntologyHelper.PropertyLabel);
- public static IUriNode OwlOntology { get; } = AnyNode(OntologyHelper.OwlOntology);
+ public static IUriNode RdfsRange { get; } = AnyNode(OntologyHelper.PropertyRange);
- public static IUriNode OwlClass { get; } = AnyNode(OntologyHelper.OwlClass);
+ public static IUriNode OwlOntology { get; } = AnyNode(OntologyHelper.OwlOntology);
- public static IUriNode OwlDatatypeProperty { get; } = AnyNode(OntologyHelper.OwlDatatypeProperty);
+ public static IUriNode OwlClass { get; } = AnyNode(OntologyHelper.OwlClass);
- public static IUriNode OwlObjectProperty { get; } = AnyNode(OntologyHelper.OwlObjectProperty);
+ public static IUriNode OwlDatatypeProperty { get; } = AnyNode(OntologyHelper.OwlDatatypeProperty);
- private static IUriNode EngineNode(string name) => AnyNode($"{BaseUriString}{name}");
+ public static IUriNode OwlObjectProperty { get; } = AnyNode(OntologyHelper.OwlObjectProperty);
- private static IUriNode AnyNode(string uri) => Factory.CreateUriNode(UriFactory.Create(uri));
+ private static IUriNode EngineNode(string name) => AnyNode($"{BaseUriString}{name}");
- public static class ExpressionTypes
- {
- private const string BaseUriString = "ExpressionTypes/";
+ private static IUriNode AnyNode(string uri) => Factory.CreateUriNode(UriFactory.Create(uri));
+
+ public static class ExpressionTypes
+ {
+ private const string BaseUriString = "ExpressionTypes/";
- public static IUriNode Add { get; } = ExpressionTypeNode("Add");
+ public static IUriNode Add { get; } = ExpressionTypeNode("Add");
- public static IUriNode AddAssign { get; } = ExpressionTypeNode("AddAssign");
+ public static IUriNode AddAssign { get; } = ExpressionTypeNode("AddAssign");
- public static IUriNode AddAssignChecked { get; } = ExpressionTypeNode("AddAssignChecked");
+ public static IUriNode AddAssignChecked { get; } = ExpressionTypeNode("AddAssignChecked");
- public static IUriNode AddChecked { get; } = ExpressionTypeNode("AddChecked");
+ public static IUriNode AddChecked { get; } = ExpressionTypeNode("AddChecked");
- public static IUriNode And { get; } = ExpressionTypeNode("And");
+ public static IUriNode And { get; } = ExpressionTypeNode("And");
- public static IUriNode AndAlso { get; } = ExpressionTypeNode("AndAlso");
+ public static IUriNode AndAlso { get; } = ExpressionTypeNode("AndAlso");
- public static IUriNode AndAssign { get; } = ExpressionTypeNode("AndAssign");
+ public static IUriNode AndAssign { get; } = ExpressionTypeNode("AndAssign");
- public static IUriNode ArrayLength { get; } = ExpressionTypeNode("ArrayLength");
+ public static IUriNode ArrayLength { get; } = ExpressionTypeNode("ArrayLength");
- public static IUriNode ArrayIndex { get; } = ExpressionTypeNode("ArrayIndex");
+ public static IUriNode ArrayIndex { get; } = ExpressionTypeNode("ArrayIndex");
- public static IUriNode Assign { get; } = ExpressionTypeNode("Assign");
+ public static IUriNode Assign { get; } = ExpressionTypeNode("Assign");
- public static IUriNode Coalesce { get; } = ExpressionTypeNode("Coalesce");
+ public static IUriNode Coalesce { get; } = ExpressionTypeNode("Coalesce");
- public static IUriNode Convert { get; } = ExpressionTypeNode("Convert");
+ public static IUriNode Convert { get; } = ExpressionTypeNode("Convert");
- public static IUriNode ConvertChecked { get; } = ExpressionTypeNode("ConvertChecked");
+ public static IUriNode ConvertChecked { get; } = ExpressionTypeNode("ConvertChecked");
- public static IUriNode Decrement { get; } = ExpressionTypeNode("Decrement");
+ public static IUriNode Decrement { get; } = ExpressionTypeNode("Decrement");
- public static IUriNode Divide { get; } = ExpressionTypeNode("Divide");
+ public static IUriNode Divide { get; } = ExpressionTypeNode("Divide");
- public static IUriNode DivideAssign { get; } = ExpressionTypeNode("DivideAssign");
+ public static IUriNode DivideAssign { get; } = ExpressionTypeNode("DivideAssign");
- public static IUriNode Equal { get; } = ExpressionTypeNode("Equal");
+ public static IUriNode Equal { get; } = ExpressionTypeNode("Equal");
- public static IUriNode ExclusiveOr { get; } = ExpressionTypeNode("ExclusiveOr");
+ public static IUriNode ExclusiveOr { get; } = ExpressionTypeNode("ExclusiveOr");
- public static IUriNode ExclusiveOrAssign { get; } = ExpressionTypeNode("ExclusiveOrAssign");
+ public static IUriNode ExclusiveOrAssign { get; } = ExpressionTypeNode("ExclusiveOrAssign");
- public static IUriNode GreaterThan { get; } = ExpressionTypeNode("GreaterThan");
+ public static IUriNode GreaterThan { get; } = ExpressionTypeNode("GreaterThan");
- public static IUriNode GreaterThanOrEqual { get; } = ExpressionTypeNode("GreaterThanOrEqual");
+ public static IUriNode GreaterThanOrEqual { get; } = ExpressionTypeNode("GreaterThanOrEqual");
- public static IUriNode Increment { get; } = ExpressionTypeNode("Increment");
+ public static IUriNode Increment { get; } = ExpressionTypeNode("Increment");
- public static IUriNode IsFalse { get; } = ExpressionTypeNode("IsFalse");
+ public static IUriNode IsFalse { get; } = ExpressionTypeNode("IsFalse");
- public static IUriNode IsTrue { get; } = ExpressionTypeNode("IsTrue");
+ public static IUriNode IsTrue { get; } = ExpressionTypeNode("IsTrue");
- public static IUriNode LeftShift { get; } = ExpressionTypeNode("LeftShift");
+ public static IUriNode LeftShift { get; } = ExpressionTypeNode("LeftShift");
- public static IUriNode LeftShiftAssign { get; } = ExpressionTypeNode("LeftShiftAssign");
+ public static IUriNode LeftShiftAssign { get; } = ExpressionTypeNode("LeftShiftAssign");
- public static IUriNode LessThan { get; } = ExpressionTypeNode("LessThan");
+ public static IUriNode LessThan { get; } = ExpressionTypeNode("LessThan");
- public static IUriNode LessThanOrEqual { get; } = ExpressionTypeNode("LessThanOrEqual");
+ public static IUriNode LessThanOrEqual { get; } = ExpressionTypeNode("LessThanOrEqual");
- public static IUriNode Modulo { get; } = ExpressionTypeNode("Modulo");
+ public static IUriNode Modulo { get; } = ExpressionTypeNode("Modulo");
- public static IUriNode ModuloAssign { get; } = ExpressionTypeNode("ModuloAssign");
+ public static IUriNode ModuloAssign { get; } = ExpressionTypeNode("ModuloAssign");
- public static IUriNode Multiply { get; } = ExpressionTypeNode("Multiply");
+ public static IUriNode Multiply { get; } = ExpressionTypeNode("Multiply");
- public static IUriNode MultiplyAssign { get; } = ExpressionTypeNode("MultiplyAssign");
+ public static IUriNode MultiplyAssign { get; } = ExpressionTypeNode("MultiplyAssign");
- public static IUriNode MultiplyAssignChecked { get; } = ExpressionTypeNode("MultiplyAssignChecked");
+ public static IUriNode MultiplyAssignChecked { get; } = ExpressionTypeNode("MultiplyAssignChecked");
- public static IUriNode MultiplyChecked { get; } = ExpressionTypeNode("MultiplyChecked");
+ public static IUriNode MultiplyChecked { get; } = ExpressionTypeNode("MultiplyChecked");
- public static IUriNode Negate { get; } = ExpressionTypeNode("Negate");
+ public static IUriNode Negate { get; } = ExpressionTypeNode("Negate");
- public static IUriNode NegateChecked { get; } = ExpressionTypeNode("NegateChecked");
+ public static IUriNode NegateChecked { get; } = ExpressionTypeNode("NegateChecked");
- public static IUriNode Not { get; } = ExpressionTypeNode("Not");
+ public static IUriNode Not { get; } = ExpressionTypeNode("Not");
- public static IUriNode NotEqual { get; } = ExpressionTypeNode("NotEqual");
+ public static IUriNode NotEqual { get; } = ExpressionTypeNode("NotEqual");
- public static IUriNode OnesComplement { get; } = ExpressionTypeNode("OnesComplement");
+ public static IUriNode OnesComplement { get; } = ExpressionTypeNode("OnesComplement");
- public static IUriNode Or { get; } = ExpressionTypeNode("Or");
+ public static IUriNode Or { get; } = ExpressionTypeNode("Or");
- public static IUriNode OrAssign { get; } = ExpressionTypeNode("OrAssign");
+ public static IUriNode OrAssign { get; } = ExpressionTypeNode("OrAssign");
- public static IUriNode OrElse { get; } = ExpressionTypeNode("OrElse");
+ public static IUriNode OrElse { get; } = ExpressionTypeNode("OrElse");
- public static IUriNode PostDecrementAssign { get; } = ExpressionTypeNode("PostDecrementAssign");
+ public static IUriNode PostDecrementAssign { get; } = ExpressionTypeNode("PostDecrementAssign");
- public static IUriNode PostIncrementAssign { get; } = ExpressionTypeNode("PostIncrementAssign");
+ public static IUriNode PostIncrementAssign { get; } = ExpressionTypeNode("PostIncrementAssign");
- public static IUriNode Power { get; } = ExpressionTypeNode("Power");
+ public static IUriNode Power { get; } = ExpressionTypeNode("Power");
- public static IUriNode PowerAssign { get; } = ExpressionTypeNode("PowerAssign");
+ public static IUriNode PowerAssign { get; } = ExpressionTypeNode("PowerAssign");
- public static IUriNode PreDecrementAssign { get; } = ExpressionTypeNode("PreDecrementAssign");
+ public static IUriNode PreDecrementAssign { get; } = ExpressionTypeNode("PreDecrementAssign");
- public static IUriNode PreIncrementAssign { get; } = ExpressionTypeNode("PreIncrementAssign");
+ public static IUriNode PreIncrementAssign { get; } = ExpressionTypeNode("PreIncrementAssign");
- public static IUriNode Quote { get; } = ExpressionTypeNode("Quote");
+ public static IUriNode Quote { get; } = ExpressionTypeNode("Quote");
- public static IUriNode RightShift { get; } = ExpressionTypeNode("RightShift");
+ public static IUriNode RightShift { get; } = ExpressionTypeNode("RightShift");
- public static IUriNode RightShiftAssign { get; } = ExpressionTypeNode("RightShiftAssign");
+ public static IUriNode RightShiftAssign { get; } = ExpressionTypeNode("RightShiftAssign");
- public static IUriNode Subtract { get; } = ExpressionTypeNode("Subtract");
+ public static IUriNode Subtract { get; } = ExpressionTypeNode("Subtract");
- public static IUriNode SubtractAssign { get; } = ExpressionTypeNode("SubtractAssign");
+ public static IUriNode SubtractAssign { get; } = ExpressionTypeNode("SubtractAssign");
- public static IUriNode SubtractAssignChecked { get; } = ExpressionTypeNode("SubtractAssignChecked");
+ public static IUriNode SubtractAssignChecked { get; } = ExpressionTypeNode("SubtractAssignChecked");
- public static IUriNode SubtractChecked { get; } = ExpressionTypeNode("SubtractChecked");
+ public static IUriNode SubtractChecked { get; } = ExpressionTypeNode("SubtractChecked");
- public static IUriNode TypeAs { get; } = ExpressionTypeNode("TypeAs");
+ public static IUriNode TypeAs { get; } = ExpressionTypeNode("TypeAs");
- public static IUriNode TypeEqual { get; } = ExpressionTypeNode("TypeEqual");
+ public static IUriNode TypeEqual { get; } = ExpressionTypeNode("TypeEqual");
- public static IUriNode TypeIs { get; } = ExpressionTypeNode("TypeIs");
+ public static IUriNode TypeIs { get; } = ExpressionTypeNode("TypeIs");
- public static IUriNode UnaryPlus { get; } = ExpressionTypeNode("UnaryPlus");
+ public static IUriNode UnaryPlus { get; } = ExpressionTypeNode("UnaryPlus");
- public static IUriNode Unbox { get; } = ExpressionTypeNode("Unbox");
+ public static IUriNode Unbox { get; } = ExpressionTypeNode("Unbox");
- private static IUriNode ExpressionTypeNode(string name) => EngineNode($"{BaseUriString}{name}");
- }
+ private static IUriNode ExpressionTypeNode(string name) => EngineNode($"{BaseUriString}{name}");
}
}
diff --git a/GraphEngine/Vocabulary.generated.cs b/GraphEngine/Vocabulary.generated.cs
index 7753727..9e5f4b7 100644
--- a/GraphEngine/Vocabulary.generated.cs
+++ b/GraphEngine/Vocabulary.generated.cs
@@ -1,333 +1,330 @@
// MIT License, Copyright 2020 Samu Lang
-namespace GraphEngine
-{
- using VDS.RDF;
+namespace GraphEngine;
- public static partial class Vocabulary
- {
- public static IUriNode ArrayAccess { get; } = EngineNode("ArrayAccess");
+public static partial class Vocabulary
+{
+ public static IUriNode ArrayAccess { get; } = EngineNode("ArrayAccess");
- public static IUriNode ArrayIndex { get; } = EngineNode("ArrayIndex");
+ public static IUriNode ArrayIndex { get; } = EngineNode("ArrayIndex");
- public static IUriNode BaseBind { get; } = EngineNode("BaseBind");
+ public static IUriNode BaseBind { get; } = EngineNode("BaseBind");
- public static IUriNode BaseGoto { get; } = EngineNode("BaseGoto");
+ public static IUriNode BaseGoto { get; } = EngineNode("BaseGoto");
- public static IUriNode Binary { get; } = EngineNode("Binary");
+ public static IUriNode Binary { get; } = EngineNode("Binary");
- public static IUriNode BinaryOperation { get; } = EngineNode("BinaryOperation");
+ public static IUriNode BinaryOperation { get; } = EngineNode("BinaryOperation");
- public static IUriNode Bind { get; } = EngineNode("Bind");
+ public static IUriNode Bind { get; } = EngineNode("Bind");
- public static IUriNode Block { get; } = EngineNode("Block");
+ public static IUriNode Block { get; } = EngineNode("Block");
- public static IUriNode Break { get; } = EngineNode("Break");
+ public static IUriNode Break { get; } = EngineNode("Break");
- public static IUriNode Call { get; } = EngineNode("Call");
+ public static IUriNode Call { get; } = EngineNode("Call");
- public static IUriNode Case { get; } = EngineNode("Case");
+ public static IUriNode Case { get; } = EngineNode("Case");
- public static IUriNode Catch { get; } = EngineNode("Catch");
+ public static IUriNode Catch { get; } = EngineNode("Catch");
- public static IUriNode ClearDebugInfo { get; } = EngineNode("ClearDebugInfo");
+ public static IUriNode ClearDebugInfo { get; } = EngineNode("ClearDebugInfo");
- public static IUriNode Condition { get; } = EngineNode("Condition");
+ public static IUriNode Condition { get; } = EngineNode("Condition");
- public static IUriNode Constant { get; } = EngineNode("Constant");
+ public static IUriNode Constant { get; } = EngineNode("Constant");
- public static IUriNode Continue { get; } = EngineNode("Continue");
+ public static IUriNode Continue { get; } = EngineNode("Continue");
- public static IUriNode DebugInfo { get; } = EngineNode("DebugInfo");
+ public static IUriNode DebugInfo { get; } = EngineNode("DebugInfo");
- public static IUriNode Default { get; } = EngineNode("Default");
+ public static IUriNode Default { get; } = EngineNode("Default");
- public static IUriNode Dynamic { get; } = EngineNode("Dynamic");
+ public static IUriNode Dynamic { get; } = EngineNode("Dynamic");
- public static IUriNode ElementInit { get; } = EngineNode("ElementInit");
+ public static IUriNode ElementInit { get; } = EngineNode("ElementInit");
- public static IUriNode Empty { get; } = EngineNode("Empty");
+ public static IUriNode Empty { get; } = EngineNode("Empty");
- public static IUriNode Field { get; } = EngineNode("Field");
+ public static IUriNode Field { get; } = EngineNode("Field");
- public static IUriNode Goto { get; } = EngineNode("Goto");
+ public static IUriNode Goto { get; } = EngineNode("Goto");
- public static IUriNode IfThen { get; } = EngineNode("IfThen");
+ public static IUriNode IfThen { get; } = EngineNode("IfThen");
- public static IUriNode IfThenElse { get; } = EngineNode("IfThenElse");
+ public static IUriNode IfThenElse { get; } = EngineNode("IfThenElse");
- public static IUriNode Invoke { get; } = EngineNode("Invoke");
+ public static IUriNode Invoke { get; } = EngineNode("Invoke");
- public static IUriNode InvokeMember { get; } = EngineNode("InvokeMember");
+ public static IUriNode InvokeMember { get; } = EngineNode("InvokeMember");
- public static IUriNode Label { get; } = EngineNode("Label");
+ public static IUriNode Label { get; } = EngineNode("Label");
- public static IUriNode Lambda { get; } = EngineNode("Lambda");
+ public static IUriNode Lambda { get; } = EngineNode("Lambda");
- public static IUriNode ListBind { get; } = EngineNode("ListBind");
+ public static IUriNode ListBind { get; } = EngineNode("ListBind");
- public static IUriNode ListInit { get; } = EngineNode("ListInit");
+ public static IUriNode ListInit { get; } = EngineNode("ListInit");
- public static IUriNode Loop { get; } = EngineNode("Loop");
+ public static IUriNode Loop { get; } = EngineNode("Loop");
- public static IUriNode Member { get; } = EngineNode("Member");
+ public static IUriNode Member { get; } = EngineNode("Member");
- public static IUriNode MemberBind { get; } = EngineNode("MemberBind");
+ public static IUriNode MemberBind { get; } = EngineNode("MemberBind");
- public static IUriNode MemberInit { get; } = EngineNode("MemberInit");
+ public static IUriNode MemberInit { get; } = EngineNode("MemberInit");
- public static IUriNode Method { get; } = EngineNode("Method");
+ public static IUriNode Method { get; } = EngineNode("Method");
- public static IUriNode New { get; } = EngineNode("New");
+ public static IUriNode New { get; } = EngineNode("New");
- public static IUriNode NewArrayBounds { get; } = EngineNode("NewArrayBounds");
+ public static IUriNode NewArrayBounds { get; } = EngineNode("NewArrayBounds");
- public static IUriNode NewArrayInit { get; } = EngineNode("NewArrayInit");
+ public static IUriNode NewArrayInit { get; } = EngineNode("NewArrayInit");
- public static IUriNode Parameter { get; } = EngineNode("Parameter");
+ public static IUriNode Parameter { get; } = EngineNode("Parameter");
- public static IUriNode Property { get; } = EngineNode("Property");
+ public static IUriNode Property { get; } = EngineNode("Property");
- public static IUriNode PropertyOrField { get; } = EngineNode("PropertyOrField");
+ public static IUriNode PropertyOrField { get; } = EngineNode("PropertyOrField");
- public static IUriNode ReferenceEqual { get; } = EngineNode("ReferenceEqual");
+ public static IUriNode ReferenceEqual { get; } = EngineNode("ReferenceEqual");
- public static IUriNode ReferenceNotEqual { get; } = EngineNode("ReferenceNotEqual");
+ public static IUriNode ReferenceNotEqual { get; } = EngineNode("ReferenceNotEqual");
- public static IUriNode Rethrow { get; } = EngineNode("Rethrow");
+ public static IUriNode Rethrow { get; } = EngineNode("Rethrow");
- public static IUriNode Return { get; } = EngineNode("Return");
+ public static IUriNode Return { get; } = EngineNode("Return");
- public static IUriNode RuntimeVariables { get; } = EngineNode("RuntimeVariables");
+ public static IUriNode RuntimeVariables { get; } = EngineNode("RuntimeVariables");
- public static IUriNode Switch { get; } = EngineNode("Switch");
+ public static IUriNode Switch { get; } = EngineNode("Switch");
- public static IUriNode Target { get; } = EngineNode("Target");
+ public static IUriNode Target { get; } = EngineNode("Target");
- public static IUriNode Throw { get; } = EngineNode("Throw");
+ public static IUriNode Throw { get; } = EngineNode("Throw");
- public static IUriNode Try { get; } = EngineNode("Try");
+ public static IUriNode Try { get; } = EngineNode("Try");
- public static IUriNode Type { get; } = EngineNode("Type");
+ public static IUriNode Type { get; } = EngineNode("Type");
- public static IUriNode TypeBinary { get; } = EngineNode("TypeBinary");
+ public static IUriNode TypeBinary { get; } = EngineNode("TypeBinary");
- public static IUriNode Unary { get; } = EngineNode("Unary");
+ public static IUriNode Unary { get; } = EngineNode("Unary");
- public static IUriNode Variable { get; } = EngineNode("Variable");
+ public static IUriNode Variable { get; } = EngineNode("Variable");
- public static IUriNode ArrayAccessArray { get; } = EngineNode("arrayAccessArray");
+ public static IUriNode ArrayAccessArray { get; } = EngineNode("arrayAccessArray");
- public static IUriNode ArrayAccessIndexes { get; } = EngineNode("arrayAccessIndexes");
+ public static IUriNode ArrayAccessIndexes { get; } = EngineNode("arrayAccessIndexes");
- public static IUriNode ArrayIndexArray { get; } = EngineNode("arrayIndexArray");
+ public static IUriNode ArrayIndexArray { get; } = EngineNode("arrayIndexArray");
- public static IUriNode ArrayIndexIndex { get; } = EngineNode("arrayIndexIndex");
+ public static IUriNode ArrayIndexIndex { get; } = EngineNode("arrayIndexIndex");
- public static IUriNode ArrayIndexIndexes { get; } = EngineNode("arrayIndexIndexes");
+ public static IUriNode ArrayIndexIndexes { get; } = EngineNode("arrayIndexIndexes");
- public static IUriNode BinaryConversion { get; } = EngineNode("binaryConversion");
+ public static IUriNode BinaryConversion { get; } = EngineNode("binaryConversion");
- public static IUriNode BinaryExpressionType { get; } = EngineNode("binaryExpressionType");
+ public static IUriNode BinaryExpressionType { get; } = EngineNode("binaryExpressionType");
- public static IUriNode BinaryLeft { get; } = EngineNode("binaryLeft");
+ public static IUriNode BinaryLeft { get; } = EngineNode("binaryLeft");
- public static IUriNode BinaryLiftToNull { get; } = EngineNode("binaryLiftToNull");
+ public static IUriNode BinaryLiftToNull { get; } = EngineNode("binaryLiftToNull");
- public static IUriNode BinaryMethod { get; } = EngineNode("binaryMethod");
+ public static IUriNode BinaryMethod { get; } = EngineNode("binaryMethod");
- public static IUriNode BinaryRight { get; } = EngineNode("binaryRight");
+ public static IUriNode BinaryRight { get; } = EngineNode("binaryRight");
- public static IUriNode BindExpression { get; } = EngineNode("bindExpression");
+ public static IUriNode BindExpression { get; } = EngineNode("bindExpression");
- public static IUriNode BindMember { get; } = EngineNode("bindMember");
+ public static IUriNode BindMember { get; } = EngineNode("bindMember");
- public static IUriNode BinderArguments { get; } = EngineNode("binderArguments");
+ public static IUriNode BinderArguments { get; } = EngineNode("binderArguments");
- public static IUriNode BinderExpressionType { get; } = EngineNode("binderExpressionType");
+ public static IUriNode BinderExpressionType { get; } = EngineNode("binderExpressionType");
- public static IUriNode BinderName { get; } = EngineNode("binderName");
+ public static IUriNode BinderName { get; } = EngineNode("binderName");
- public static IUriNode BlockExpressions { get; } = EngineNode("blockExpressions");
+ public static IUriNode BlockExpressions { get; } = EngineNode("blockExpressions");
- public static IUriNode BlockType { get; } = EngineNode("blockType");
+ public static IUriNode BlockType { get; } = EngineNode("blockType");
- public static IUriNode BlockVariables { get; } = EngineNode("blockVariables");
+ public static IUriNode BlockVariables { get; } = EngineNode("blockVariables");
- public static IUriNode CallArguments { get; } = EngineNode("callArguments");
+ public static IUriNode CallArguments { get; } = EngineNode("callArguments");
- public static IUriNode CallInstance { get; } = EngineNode("callInstance");
+ public static IUriNode CallInstance { get; } = EngineNode("callInstance");
- public static IUriNode CallMethod { get; } = EngineNode("callMethod");
+ public static IUriNode CallMethod { get; } = EngineNode("callMethod");
- public static IUriNode CallMethodName { get; } = EngineNode("callMethodName");
+ public static IUriNode CallMethodName { get; } = EngineNode("callMethodName");
- public static IUriNode CallType { get; } = EngineNode("callType");
+ public static IUriNode CallType { get; } = EngineNode("callType");
- public static IUriNode CallTypeArguments { get; } = EngineNode("callTypeArguments");
+ public static IUriNode CallTypeArguments { get; } = EngineNode("callTypeArguments");
- public static IUriNode CaseBody { get; } = EngineNode("caseBody");
+ public static IUriNode CaseBody { get; } = EngineNode("caseBody");
- public static IUriNode CaseTestValues { get; } = EngineNode("caseTestValues");
+ public static IUriNode CaseTestValues { get; } = EngineNode("caseTestValues");
- public static IUriNode CatchBody { get; } = EngineNode("catchBody");
+ public static IUriNode CatchBody { get; } = EngineNode("catchBody");
- public static IUriNode CatchFilter { get; } = EngineNode("catchFilter");
+ public static IUriNode CatchFilter { get; } = EngineNode("catchFilter");
- public static IUriNode CatchType { get; } = EngineNode("catchType");
+ public static IUriNode CatchType { get; } = EngineNode("catchType");
- public static IUriNode CatchVariable { get; } = EngineNode("catchVariable");
+ public static IUriNode CatchVariable { get; } = EngineNode("catchVariable");
- public static IUriNode ConditionIfFalse { get; } = EngineNode("conditionIfFalse");
+ public static IUriNode ConditionIfFalse { get; } = EngineNode("conditionIfFalse");
- public static IUriNode ConditionIfTrue { get; } = EngineNode("conditionIfTrue");
+ public static IUriNode ConditionIfTrue { get; } = EngineNode("conditionIfTrue");
- public static IUriNode ConditionTest { get; } = EngineNode("conditionTest");
+ public static IUriNode ConditionTest { get; } = EngineNode("conditionTest");
- public static IUriNode ConditionType { get; } = EngineNode("conditionType");
+ public static IUriNode ConditionType { get; } = EngineNode("conditionType");
- public static IUriNode ConstantType { get; } = EngineNode("constantType");
+ public static IUriNode ConstantType { get; } = EngineNode("constantType");
- public static IUriNode ConstantValue { get; } = EngineNode("constantValue");
+ public static IUriNode ConstantValue { get; } = EngineNode("constantValue");
- public static IUriNode DebugInfoDocument { get; } = EngineNode("debugInfoDocument");
+ public static IUriNode DebugInfoDocument { get; } = EngineNode("debugInfoDocument");
- public static IUriNode DebugInfoEndColumn { get; } = EngineNode("debugInfoEndColumn");
+ public static IUriNode DebugInfoEndColumn { get; } = EngineNode("debugInfoEndColumn");
- public static IUriNode DebugInfoEndLine { get; } = EngineNode("debugInfoEndLine");
+ public static IUriNode DebugInfoEndLine { get; } = EngineNode("debugInfoEndLine");
- public static IUriNode DebugInfoStartColumn { get; } = EngineNode("debugInfoStartColumn");
+ public static IUriNode DebugInfoStartColumn { get; } = EngineNode("debugInfoStartColumn");
- public static IUriNode DebugInfoStartLine { get; } = EngineNode("debugInfoStartLine");
+ public static IUriNode DebugInfoStartLine { get; } = EngineNode("debugInfoStartLine");
- public static IUriNode DefaultType { get; } = EngineNode("defaultType");
+ public static IUriNode DefaultType { get; } = EngineNode("defaultType");
- public static IUriNode DynamicArguments { get; } = EngineNode("dynamicArguments");
+ public static IUriNode DynamicArguments { get; } = EngineNode("dynamicArguments");
- public static IUriNode DynamicBinder { get; } = EngineNode("dynamicBinder");
+ public static IUriNode DynamicBinder { get; } = EngineNode("dynamicBinder");
- public static IUriNode DynamicReturnType { get; } = EngineNode("dynamicReturnType");
+ public static IUriNode DynamicReturnType { get; } = EngineNode("dynamicReturnType");
- public static IUriNode ElementInitAddMethod { get; } = EngineNode("elementInitAddMethod");
+ public static IUriNode ElementInitAddMethod { get; } = EngineNode("elementInitAddMethod");
- public static IUriNode ElementInitArguments { get; } = EngineNode("elementInitArguments");
+ public static IUriNode ElementInitArguments { get; } = EngineNode("elementInitArguments");
- public static IUriNode GotoTarget { get; } = EngineNode("gotoTarget");
+ public static IUriNode GotoTarget { get; } = EngineNode("gotoTarget");
- public static IUriNode GotoType { get; } = EngineNode("gotoType");
+ public static IUriNode GotoType { get; } = EngineNode("gotoType");
- public static IUriNode GotoValue { get; } = EngineNode("gotoValue");
+ public static IUriNode GotoValue { get; } = EngineNode("gotoValue");
- public static IUriNode InvokeArguments { get; } = EngineNode("invokeArguments");
+ public static IUriNode InvokeArguments { get; } = EngineNode("invokeArguments");
- public static IUriNode InvokeExpression { get; } = EngineNode("invokeExpression");
+ public static IUriNode InvokeExpression { get; } = EngineNode("invokeExpression");
- public static IUriNode LabelDefaultValue { get; } = EngineNode("labelDefaultValue");
+ public static IUriNode LabelDefaultValue { get; } = EngineNode("labelDefaultValue");
- public static IUriNode LabelTarget { get; } = EngineNode("labelTarget");
+ public static IUriNode LabelTarget { get; } = EngineNode("labelTarget");
- public static IUriNode LambdaBody { get; } = EngineNode("lambdaBody");
+ public static IUriNode LambdaBody { get; } = EngineNode("lambdaBody");
- public static IUriNode LambdaParameters { get; } = EngineNode("lambdaParameters");
+ public static IUriNode LambdaParameters { get; } = EngineNode("lambdaParameters");
- public static IUriNode ListBindInitializers { get; } = EngineNode("listBindInitializers");
+ public static IUriNode ListBindInitializers { get; } = EngineNode("listBindInitializers");
- public static IUriNode ListInitInitializers { get; } = EngineNode("listInitInitializers");
+ public static IUriNode ListInitInitializers { get; } = EngineNode("listInitInitializers");
- public static IUriNode ListInitNewExpression { get; } = EngineNode("listInitNewExpression");
+ public static IUriNode ListInitNewExpression { get; } = EngineNode("listInitNewExpression");
- public static IUriNode LoopBody { get; } = EngineNode("loopBody");
+ public static IUriNode LoopBody { get; } = EngineNode("loopBody");
- public static IUriNode LoopBreak { get; } = EngineNode("loopBreak");
+ public static IUriNode LoopBreak { get; } = EngineNode("loopBreak");
- public static IUriNode LoopContinue { get; } = EngineNode("loopContinue");
+ public static IUriNode LoopContinue { get; } = EngineNode("loopContinue");
- public static IUriNode MemberAccessExpression { get; } = EngineNode("memberAccessExpression");
+ public static IUriNode MemberAccessExpression { get; } = EngineNode("memberAccessExpression");
- public static IUriNode MemberAccessName { get; } = EngineNode("memberAccessName");
+ public static IUriNode MemberAccessName { get; } = EngineNode("memberAccessName");
- public static IUriNode MemberAccessType { get; } = EngineNode("memberAccessType");
+ public static IUriNode MemberAccessType { get; } = EngineNode("memberAccessType");
- public static IUriNode MemberBindBindings { get; } = EngineNode("memberBindBindings");
+ public static IUriNode MemberBindBindings { get; } = EngineNode("memberBindBindings");
- public static IUriNode MemberInitBindings { get; } = EngineNode("memberInitBindings");
+ public static IUriNode MemberInitBindings { get; } = EngineNode("memberInitBindings");
- public static IUriNode MemberInitNewExpression { get; } = EngineNode("memberInitNewExpression");
+ public static IUriNode MemberInitNewExpression { get; } = EngineNode("memberInitNewExpression");
- public static IUriNode MemberType { get; } = EngineNode("memberType");
+ public static IUriNode MemberType { get; } = EngineNode("memberType");
- public static IUriNode MemberName { get; } = EngineNode("memberName");
+ public static IUriNode MemberName { get; } = EngineNode("memberName");
- public static IUriNode MethodTypeArguments { get; } = EngineNode("methodTypeArguments");
+ public static IUriNode MethodTypeArguments { get; } = EngineNode("methodTypeArguments");
- public static IUriNode NewArguments { get; } = EngineNode("newArguments");
+ public static IUriNode NewArguments { get; } = EngineNode("newArguments");
- public static IUriNode NewArrayExpressions { get; } = EngineNode("newArrayExpressions");
+ public static IUriNode NewArrayExpressions { get; } = EngineNode("newArrayExpressions");
- public static IUriNode NewArrayType { get; } = EngineNode("newArrayType");
+ public static IUriNode NewArrayType { get; } = EngineNode("newArrayType");
- public static IUriNode NewType { get; } = EngineNode("newType");
+ public static IUriNode NewType { get; } = EngineNode("newType");
- public static IUriNode ParameterName { get; } = EngineNode("parameterName");
+ public static IUriNode ParameterName { get; } = EngineNode("parameterName");
- public static IUriNode ParameterType { get; } = EngineNode("parameterType");
+ public static IUriNode ParameterType { get; } = EngineNode("parameterType");
- public static IUriNode SwitchCases { get; } = EngineNode("switchCases");
+ public static IUriNode SwitchCases { get; } = EngineNode("switchCases");
- public static IUriNode PropertyArguments { get; } = EngineNode("propertyArguments");
+ public static IUriNode PropertyArguments { get; } = EngineNode("propertyArguments");
- public static IUriNode RuntimeVariablesVariables { get; } = EngineNode("runtimeVariablesVariables");
+ public static IUriNode RuntimeVariablesVariables { get; } = EngineNode("runtimeVariablesVariables");
- public static IUriNode SwitchComparison { get; } = EngineNode("switchComparison");
+ public static IUriNode SwitchComparison { get; } = EngineNode("switchComparison");
- public static IUriNode SwitchDefaultBody { get; } = EngineNode("switchDefaultBody");
+ public static IUriNode SwitchDefaultBody { get; } = EngineNode("switchDefaultBody");
- public static IUriNode SwitchSwitchValue { get; } = EngineNode("switchSwitchValue");
+ public static IUriNode SwitchSwitchValue { get; } = EngineNode("switchSwitchValue");
- public static IUriNode SwitchType { get; } = EngineNode("switchType");
+ public static IUriNode SwitchType { get; } = EngineNode("switchType");
- public static IUriNode SymbolDocumentFileName { get; } = EngineNode("symbolDocumentFileName");
+ public static IUriNode SymbolDocumentFileName { get; } = EngineNode("symbolDocumentFileName");
- public static IUriNode SymbolDocumentLanguage { get; } = EngineNode("symbolDocumentLanguage");
+ public static IUriNode SymbolDocumentLanguage { get; } = EngineNode("symbolDocumentLanguage");
- public static IUriNode SymbolDocumentLanguageVendor { get; } = EngineNode("symbolDocumentLanguageVendor");
+ public static IUriNode SymbolDocumentLanguageVendor { get; } = EngineNode("symbolDocumentLanguageVendor");
- public static IUriNode SymbolDocumentDocumentType { get; } = EngineNode("symbolDocumentDocumentType");
+ public static IUriNode SymbolDocumentDocumentType { get; } = EngineNode("symbolDocumentDocumentType");
- public static IUriNode TargetName { get; } = EngineNode("targetName");
+ public static IUriNode TargetName { get; } = EngineNode("targetName");
- public static IUriNode TargetType { get; } = EngineNode("targetType");
+ public static IUriNode TargetType { get; } = EngineNode("targetType");
- public static IUriNode ThrowType { get; } = EngineNode("throwType");
+ public static IUriNode ThrowType { get; } = EngineNode("throwType");
- public static IUriNode ThrowValue { get; } = EngineNode("throwValue");
+ public static IUriNode ThrowValue { get; } = EngineNode("throwValue");
- public static IUriNode TryBody { get; } = EngineNode("tryBody");
+ public static IUriNode TryBody { get; } = EngineNode("tryBody");
- public static IUriNode TryFault { get; } = EngineNode("tryFault");
+ public static IUriNode TryFault { get; } = EngineNode("tryFault");
- public static IUriNode TryFinally { get; } = EngineNode("tryFinally");
+ public static IUriNode TryFinally { get; } = EngineNode("tryFinally");
- public static IUriNode TryHandlers { get; } = EngineNode("tryHandlers");
+ public static IUriNode TryHandlers { get; } = EngineNode("tryHandlers");
- public static IUriNode TryType { get; } = EngineNode("tryType");
+ public static IUriNode TryType { get; } = EngineNode("tryType");
- public static IUriNode TypeArguments { get; } = EngineNode("typeArguments");
+ public static IUriNode TypeArguments { get; } = EngineNode("typeArguments");
- public static IUriNode TypeBinaryExpression { get; } = EngineNode("typeBinaryExpression");
+ public static IUriNode TypeBinaryExpression { get; } = EngineNode("typeBinaryExpression");
- public static IUriNode TypeBinaryExpressionType { get; } = EngineNode("typeBinaryExpressionType");
+ public static IUriNode TypeBinaryExpressionType { get; } = EngineNode("typeBinaryExpressionType");
- public static IUriNode TypeBinaryType { get; } = EngineNode("typeBinaryType");
+ public static IUriNode TypeBinaryType { get; } = EngineNode("typeBinaryType");
- public static IUriNode TypeName { get; } = EngineNode("typeName");
+ public static IUriNode TypeName { get; } = EngineNode("typeName");
- public static IUriNode UnaryExpressionType { get; } = EngineNode("unaryExpressionType");
+ public static IUriNode UnaryExpressionType { get; } = EngineNode("unaryExpressionType");
- public static IUriNode UnaryMethod { get; } = EngineNode("unaryMethod");
+ public static IUriNode UnaryMethod { get; } = EngineNode("unaryMethod");
- public static IUriNode UnaryOperand { get; } = EngineNode("unaryOperand");
+ public static IUriNode UnaryOperand { get; } = EngineNode("unaryOperand");
- public static IUriNode UnaryType { get; } = EngineNode("unaryType");
- }
+ public static IUriNode UnaryType { get; } = EngineNode("unaryType");
}
diff --git a/GraphEngine/Vocabulary.tt b/GraphEngine/Vocabulary.tt
index 1be8dac..66eb24e 100644
--- a/GraphEngine/Vocabulary.tt
+++ b/GraphEngine/Vocabulary.tt
@@ -11,22 +11,19 @@
<#+
private void GenerateNamespace()
{#>
-namespace GraphEngine
-{
- using VDS.RDF;
+namespace GraphEngine;
- public static partial class Vocabulary
- {<#+
- GenerateProperties();
-#> }
-}<#+}
+public static partial class Vocabulary
+{<#+
+GenerateProperties();
+#>}<#+}
private void GenerateProperties()
{
foreach(var item in Data)
{#>
- public static IUriNode <#= item.Property #> { get; } = EngineNode("<#= item.Uri #>");
+ public static IUriNode <#= item.Property #> { get; } = EngineNode("<#= item.Uri #>");
<#+}
}