示例#1
0
        public void TestTextMatcher()
        {
            var gn = new SparqlSyntaxNet();

            gn.MaxNumberOfPaths = 5;
            gn.MaxPathLenght    = 10;
            gn.TrainFromQueries(
                "select * where { ?s ?p ?o }",
                "select distinct ?p where { ?s ?p ?o }",
                "select * where { ?s <http://test.com/name> ?name }"
                );

            Assert.AreEqual("select", gn.Predict("s"));
        }
示例#2
0
        public void TestBasicSyntax()
        {
            var gn = new SparqlSyntaxNet();

            gn.MaxNumberOfPaths = 5;
            gn.MaxPathLenght    = 10;
            gn.TrainFromQueries(
                "select * where { ?s ?p ?o }",
                "select distinct ?p where { ?s ?p ?o }",
                "select * where { ?s <http://test.com/name> ?name }"
                );

            Assert.AreEqual("*", gn.Predict("select"));
            Assert.AreEqual("where", gn.Predict("*"));
            Assert.AreEqual("{", gn.Predict("where"));
            Assert.AreEqual("?s", gn.Predict("{"));
            Assert.AreEqual("?p", gn.Predict("?s"));
            Assert.AreEqual("?o", gn.Predict("?p"));
            Assert.AreEqual("}", gn.Predict("?o"));
            Assert.AreEqual("?p", gn.Predict("distinct"));
        }