public void TestToString1() { var prefixes = new[] { SPARQL.Prefix("p1", "http://test.com/p1"), SPARQL.Prefix("p2", "http://test.com/p2"), }; var source = TestDataProvider.GetQuerable <dynamic>("", prefixes: prefixes); var query = source.Prefix("p3", "http://test.com/p3") .Prefix("p4", "http://test.com/p4") .Prefix("p5", "http://test.com/p5"); var resStr = query.ToString(); resStr.Should().StartWith( @"PREFIX p1: <http://test.com/p1> PREFIX p2: <http://test.com/p2> PREFIX p3: <http://test.com/p3> PREFIX p4: <http://test.com/p4> PREFIX p5: <http://test.com/p5>" ); }
/// <summary> /// Evaluates Prefix expression /// </summary> /// <param name="m">method call expression</param> private void VisitPrefix(MethodCallExpression m) { string prefix = (string)((ConstantExpression)m.Arguments[1]).Value; string iri = (string)((ConstantExpression)m.Arguments[2]).Value; Prefixes.Add(SPARQL.Prefix(prefix, iri)); }