Exemple #1
0
        // Использовать надо следующим образом:

        public static void Test()
        {
            PType objectTriplets = new PTypeSequence(new PTypeRecord(
                                                         new NamedType("deleted", new PType(PTypeEnumeration.boolean)),
                                                         new NamedType("s", new PType(PTypeEnumeration.sstring)),
                                                         new NamedType("p", new PType(PTypeEnumeration.sstring)),
                                                         new NamedType("o", new PType(PTypeEnumeration.sstring))
                                                         ));
            // инициализация таблицы
            var directCell = new PaCell(objectTriplets, "path", false);

            // Более компактный способ заполнения ячейки
            directCell.Clear();
            directCell.Fill(new object[0]);
            //foreach (var element in elements) // Закомментарил из-за отсутствия перечислителя elements
            {
                directCell.Root.AppendElement(new object[] { false, "subject", "predicate", "object" });
            }
            directCell.Flush();
            // Создание индекса
            FixedIndex <SubjPred> sp_index = new FixedIndex <SubjPred>("..sp", directCell.Root, entry =>
            {
                return(new SubjPred()
                {
                    subj = (string)entry.Field(1).Get(), pred = (string)entry.Field(1).Get()
                });
            });
        }
 private void CreateIndexes()
 {
     sDataIndex   = new FixedIndex <string>("s of data", dataCell.Root, entry => (string)entry.Field(0).Get());
     sDirectIndex = new FixedIndex <string>("s of direct", directCell.Root, entry => (string)entry.Field(0).Get());
     oIndex       = new FixedIndex <string>("o of direct", directCell.Root, entry => (string)entry.Field(2).Get());
     spDataIndex  = new FixedIndex <SubjPred>("s and p of data", dataCell.Root,
                                              entry =>
                                              new SubjPred
     {
         subj = (string)entry.Field(0).Get(),
         pred = (string)entry.Field(1).Get()
     });
     spDirectIndex = new FixedIndex <SubjPred>("s and p of direct", directCell.Root,
                                               entry =>
                                               new SubjPred
     {
         subj = (string)entry.Field(0).Get(),
         pred = (string)entry.Field(1).Get()
     });
     opIndex = new FixedIndex <SubjPred>("o and p of direct", directCell.Root,
                                         entry =>
                                         new SubjPred
     {
         subj = (string)entry.Field(2).Get(),
         pred = (string)entry.Field(1).Get()
     });
 }