public void TestQueryWithBlobParameter()
        {
            SaveDocument(new MutableDocument());

            var textModel = new TextModel();

            textModel.RegisterModel();

            var input = Expression.Dictionary(new Dictionary <string, object>
            {
                ["text"] = Expression.Parameter("text")
            });
            var prediction = Function.Prediction(textModel.Name, input).Property("wc");

            using (var q = QueryBuilder.Select(SelectResult.Expression(prediction).As("wc"))
                           .From(DataSource.Database(Db))) {
                var parameters = new Parameters();
                parameters.SetBlob("text",
                                   new Blob("text/plain",
                                            Encoding.UTF8.GetBytes("Knox on fox in socks in box.  Socks on Knox and Knox in box.")));
                q.Parameters = parameters;
                var numRows = VerifyQuery(q, (n, r) =>
                {
                    r.GetLong(0).Should().Be(14, "because that is the word count of the sentence in the parameter");
                });
                numRows.Should().Be(1);
                textModel.ContentType.Should().Be("text/plain");
                textModel.UnregisterModel();
            }
        }
        public void TestQueryWithBlobProperty()
        {
            var texts = new[]
            {
                "Knox on fox in socks in box.  Socks on Knox and Knox in box.",
                "Clocks on fix tick. Clocks on Knox tock. Six sick bricks tick.  Six sick chicks tock."
            };

            foreach (var text in texts)
            {
                using (var doc = new MutableDocument()) {
                    doc.SetBlob("text", new Blob("text/plain", Encoding.UTF8.GetBytes(text)));
                    SaveDocument(doc);
                }
            }

            var textModel = new TextModel();

            textModel.RegisterModel();

            var input      = TextModel.CreateInput("text");
            var prediction = Function.Prediction(textModel.Name, input).Property("wc");

            using (var q = QueryBuilder
                           .Select(SelectResult.Property("text"), SelectResult.Expression(prediction).As("wc"))
                           .From(DataSource.Database(Db))
                           .Where(prediction.GreaterThan(Expression.Int(15)))) {
                foreach (var row in q.Execute())
                {
                    WriteLine(row.GetInt("wc").ToString());
                }
            }

            textModel.ContentType.Should().Be("text/plain");
            Database.Prediction.UnregisterModel(textModel.Name);
        }