private void GetMiniMt(object results, string assertTemplate, string graphKBName, PNode repo, bool show, ICollection <Rule> newRules, TextWriter ruleSources, RdfRules ruleDefs)
        {
            assertTemplate = assertTemplate ?? "triple($?s$,$?p$,$?o$).\n";
            bool MakeRules = newRules != null && assertTemplate.Trim().EndsWith(".");
            var  outMap    = new Dictionary <string, string>();

            outMap["s"]  = "unknownSubject";
            outMap["p"]  = "unknownPredicate";
            outMap["o"]  = "unknownObject";
            outMap["mt"] = Atom.aq(repo.Id);

            if (results is SparqlResultSet)
            {
                //SELECT/ASK queries give a SparqlResultSet
                SparqlResultSet rset = (SparqlResultSet)results;
                if (show)
                {
                    ConsoleWriteLine("SparqlResultSet.Count = {0}", rset.Count);
                    ConsoleWriteLine("SparqlResultSet:{0}", rset.ToString());
                }
                foreach (SparqlResult r in rset)
                {
                    //Do whatever you want with each Result
                    if (show)
                    {
                        ConsoleWriteLine("SparqlResult.Count = {0}", r.Count);
                        ConsoleWriteLine("SparqlResult:{0}", r.ToString());
                    }

                    var assertIt = assertTemplate;
                    //Do whatever you want with each Triple
                    foreach (string vname in r.Variables)
                    {
                        INode value0 = r[vname];
                        SIProlog.checkNode(value0);
                        //Graph into = FindGraph(baseURI.AbsoluteUri);
                        INode  value  = value0.CopyWNode(repo.rdfGraph);
                        string strVal = GraphWithDef.PlReadble(value, ruleDefs);
                        assertIt = assertIt.Replace("$?" + vname + "$", strVal);
                        if (show)
                        {
                            ConsoleWriteLine("BIND: {0} = {1}", vname, strVal);
                        }
                    }
                    if (assertIt.Contains("$?s$"))
                    {
                        foreach (KeyValuePair <string, string> map in outMap)
                        {
                            assertIt = assertIt.Replace("$?" + map.Key + "$", map.Value);
                        }
                    }
                    if (MakeRules)
                    {
                        Rule rule = ParseRule(new Tokeniser(assertIt), graphKBName);
                        if (show)
                        {
                            ConsoleWriteLine("RULE_IG: {0}", rule);
                        }
                        newRules.Add(rule);
                    }
                    else
                    {
                        if (show)
                        {
                            ConsoleWriteLine("TRIPLE_IG: {0}", assertIt);
                        }
                    }
                    if (ruleSources != null)
                    {
                        ruleSources.WriteLine(assertIt);
                    }
                }
            }
            else if (results is IGraph)
            {
                //CONSTRUCT/DESCRIBE queries give a IGraph
                IGraph resGraph = (IGraph)results;
                var    rset     = resGraph.Triples;
                outMap["mt"] = "<" + resGraph.BaseUri.AbsoluteUri + ">";
                if (show)
                {
                    ConsoleWriteLine("IGraphResultSet.Count = {0}", rset.Count);
                    ConsoleWriteLine("IGraphResultSet:{0}", rset.ToString());
                }
                foreach (Triple t in rset)
                {
                    var assertIt = assertTemplate;
                    //Do whatever you want with each Triple
                    outMap["s"] = GraphWithDef.PlReadble(t.Subject, ruleDefs);
                    outMap["p"] = GraphWithDef.PlReadble(t.Predicate, ruleDefs);
                    outMap["o"] = GraphWithDef.PlReadble(t.Object, ruleDefs);
                    foreach (KeyValuePair <string, string> map in outMap)
                    {
                        assertIt = assertIt.Replace("$?" + map.Key + "$", map.Value);
                    }
                    if (MakeRules)
                    {
                        Rule rule = ParseRule(new Tokeniser(assertIt), graphKBName);
                        if (show)
                        {
                            ConsoleWriteLine("RULE_IG: {0}", rule);
                        }
                        newRules.Add(rule);
                    }
                    else
                    {
                        if (show)
                        {
                            ConsoleWriteLine("TRIPLE_IG: {0}", assertIt);
                        }
                    }
                    if (ruleSources != null)
                    {
                        ruleSources.WriteLine(assertIt);
                    }
                }
            }
            else
            {
                //If you don't get a SparqlResutlSet or IGraph something went wrong
                //but didn't throw an exception so you should handle it here
                if (results == null)
                {
                    throw ErrorBadOp("ERROR: no Results From NULL Query Object for " + graphKBName);
                }
                throw ErrorBadOp("ERROR: Cant how understand " + results.GetType() + " " + results + " to import to " +
                                 graphKBName);
            }
        }