public void InteropSemWebGraphSource()
        {
            Graph g = new Graph();
            //FileLoader.Load(g, "InferenceTest.ttl");
            GraphSource source = new GraphSource(g);

            Console.WriteLine("Reading the input using SemWeb");
            N3Reader reader = new N3Reader("InferenceTest.ttl");
            reader.Select(source);
            Console.WriteLine();

            Console.WriteLine("Outputting all Triples using N3Writer");
            N3Writer writer = new N3Writer(Console.Out);
            source.Select(writer);
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("Outputting all Triples of the form ?s rdf:type ?type");
            Statement template = new Statement(new Variable(), new Entity(RdfSpecsHelper.RdfType), new Variable());
            source.Select(template, writer);
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("Outputting all Triples of the form ?s rdf:type ?car");
            template = new Statement(new Variable(), new Entity(RdfSpecsHelper.RdfType), new Entity("http://example.org/vehicles/Car"));
            source.Select(template, writer);
            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("Outputting all Triples for Cars and Planes");
            SelectFilter filter = new SelectFilter();
            filter.Predicates = new Entity[] { new Entity(RdfSpecsHelper.RdfType) };
            filter.Objects = new Entity[] { new Entity("http://example.org/vehicles/Car"), new Entity("http://example.org/vehicles/Plane") };
            source.Select(filter, writer);
            Console.WriteLine();
            Console.WriteLine();

            writer.Close();
        }
        public void InteropSemWebGraphQuery() 
        {
            Graph g = new Graph();
            FileLoader.Load(g, "InferenceTest.ttl");
            GraphSource source = new GraphSource(g);

            Console.WriteLine("Query for Cars and their Speeds");
            Console.WriteLine();
            SemWeb.Query.SparqlXmlQuerySink sink = new SemWeb.Query.SparqlXmlQuerySink(Console.Out);
            Variable car = new Variable("car");
            Statement[] graphPattern = new Statement[] 
            {
                new Statement(car, new Entity(RdfSpecsHelper.RdfType), new Entity("http://example.org/vehicles/Car")),
                new Statement(car, new Entity("http://example.org/vehicles/Speed"), new Variable("speed"))
            };

            source.Query(graphPattern, new SemWeb.Query.QueryOptions(), sink);

            Console.WriteLine("Query for the 1st Car and it's Speed");
            Console.WriteLine();
            sink = new SemWeb.Query.SparqlXmlQuerySink(Console.Out);
            graphPattern = new Statement[] 
            {
                new Statement(car, new Entity(RdfSpecsHelper.RdfType), new Entity("http://example.org/vehicles/Car")),
                new Statement(car, new Entity("http://example.org/vehicles/Speed"), new Variable("speed"))
            };
            SemWeb.Query.QueryOptions options = new SemWeb.Query.QueryOptions();
            options.Limit = 1;
            source.Query(graphPattern, options, sink);
        }