示例#1
0
        public void CreateDocuments(IThingGraph graph, IThing root, int count)
        {
            var digidoc = new DigidocSchema();

            for (int i = 0; i < count; i++)
            {
                var document = digidoc.CreateDocument(graph, null);
                digidoc.CreatePage(graph, document, null, 1);
                graph.Add(Factory.CreateEdge(root, document, DigidocSchema.Document));
            }
        }
示例#2
0
        public virtual void TestDocumentWithTestData()
        {
            IThingGraph thingGraph = new ThingGraph();
            var         prov       = new Limada.IO.Db4oThingGraphIo();
            var         d          = prov.Open(Iori.FromFileName(TestLocations.GraphtestDir + "DocumentTest.limo"));

            thingGraph = d.Data;

            this.ReportDetail("**** TestDocumentWithTestData");
            var factory = new DigidocSampleFactory();
            var digidoc = new DigidocSchema();
            var graph   = new SchemaThingGraph(thingGraph);

            Limada.Schemata.Schema.IdentityGraph.ForEach(s => graph.Add(s));

            var root = DigidocSchema.DocumentsRoot;
            var path = TestLocations.BlobSource;

            var document = digidoc.CreateDocument(graph, path);

            graph.Add(Factory.CreateEdge(root, document, DigidocSchema.Document));

            factory.ReadPagesFromDir(graph, document, path);

            var docs = graph.Edges(root).Where(l => l.Marker == DigidocSchema.Document).Select(l => l.Leaf);

            foreach (var doc in docs)
            {
                var title = graph.ThingToDisplay(doc);
                this.ReportDetail(title.ToString());
                var pages = graph.Edges(doc).Where(l => l.Marker == DigidocSchema.DocumentPage).Select(l => l.Leaf);
                foreach (var page in pages)
                {
                    var number = graph.ThingToDisplay(page);
                    Assert.IsNotNull(number);
                    this.ReportDetail(number.ToString());
                }
            }
            prov.Flush(d);
        }