//// Идея хорошая, но надо менять схему реализации //private GroupedEntities getable; //private Dictionary<int, object[]> geHash; public ColumnsStore(string path, IStringIntCoding entityCoding, PredicatesCoding predicatesCoding, NameSpaceStore nameSpaceStore, LiteralStoreAbstract literalStore) : base(path, entityCoding, predicatesCoding, nameSpaceStore, literalStore) { InitTypes(); otriplets_op_filePath = path + "otriples_op.pac"; otriples_filePath = path + "otriples.pac"; dtriples_filePath = path + "dtriples.pac"; dataPredicatesColumn_filePath = path + "dataPredicatesColumn.pac"; objPredicatesColumn_filePath = path + "objPredicatesColumn.pac"; invPredicatesColumn_filePath = path + "invPredicatesColumn.pac"; invSubjectsColumn_filePath = path + "invSubjectsColumn.pac"; objectsColumn_filePath = path + "objectsColumn.pac"; dataColumn_filePath = path + "dataColumn.pac"; Open(File.Exists(otriples_filePath)); ewt = new EntitiesWideTable(path, 3); //ewtHash = new EntitiesMemoryHashTable(ewt); // ewtHash.Load(); //getable = new GroupedEntities(path); // Это хорошая идея, но нужно менять схему реализации //getable.CheckGroupedEntities(); //geHash = getable.GroupedEntitiesHash(); }
protected RDFIntStoreAbstract(string path, IStringIntCoding entityCoding, PredicatesCoding predicatesCoding, NameSpaceStore nameSpaceStore, LiteralStoreAbstract literalStore) : this(entityCoding, predicatesCoding, nameSpaceStore, literalStore, new ScaleCell(path)) { // TODO: Complete member initialization this.path = path; }
private static void TestPerfomanceCoding(IStringIntCoding stringIntMd5Coding, IEnumerable <string> forCode, int length) { // TripleStoreInt ts = new TripleStoreInt(@"C:\Users\Admin\Source\Repos\PolarDemo\Databases\" + Millions + @"mln\"); long max = 0; long total = 0; int i = 0, imax = 0; long load; long createindex; stringIntMd5Coding.Close(); stringIntMd5Coding.Open(false); stringIntMd5Coding.Clear(); int loadPortion = 1000 * 1000; var st = DateTime.Now; for (int j = 0; j < length / loadPortion + 1; j++) { stringIntMd5Coding.InsertPortion(forCode.Skip(j * loadPortion).Take(loadPortion).ToArray()); } load = (DateTime.Now - st).Ticks / 10000; st = DateTime.Now; stringIntMd5Coding.MakeIndexed(); createindex = (DateTime.Now - st).Ticks / 10000; int testsCount = 100; for (int j = 0; j < testsCount; j++) { var value1 = forCode.ElementAt(i); st = DateTime.Now; var code = stringIntMd5Coding.GetCode(value1); var getCode = (DateTime.Now - st).Ticks / 10000; if (getCode > max) { max = getCode; imax = i; } i++; total += getCode; } using (StreamWriter r = new StreamWriter(@"..\..\output.txt", true)) { r.WriteLine("milions " + Millions); r.WriteLine("max " + max); r.WriteLine("elements " + length); r.WriteLine("index of max " + imax); r.WriteLine("total " + total); r.WriteLine("count tests " + i); r.WriteLine("average " + (double)total / i); r.WriteLine("load " + load); r.WriteLine("create index " + createindex); } }
private static void TestCoding(IStringIntCoding stringIntMd5Coding, IEnumerable <string> forCode) { // TripleStoreInt ts = new TripleStoreInt(@"C:\Users\Admin\Source\Repos\PolarDemo\Databases\" + Millions + @"mln\"); long max = 0; long total = 0; int i = 0, imax = 0; long load; long createindex; stringIntMd5Coding.Close(); stringIntMd5Coding.Open(false); stringIntMd5Coding.Clear(); var st = DateTime.Now; var d1 = stringIntMd5Coding.InsertPortion(forCode.Take(forCode.Count() / 2).ToArray()); var d2 = stringIntMd5Coding.InsertPortion(forCode.Skip(forCode.Count() / 2).ToArray()); load = (DateTime.Now - st).Ticks / 10000; st = DateTime.Now; stringIntMd5Coding.MakeIndexed(); createindex = (DateTime.Now - st).Ticks / 10000; var value1 = forCode.ElementAt(i); st = DateTime.Now; var code = stringIntMd5Coding.GetCode(value1); var getCode = (DateTime.Now - st).Ticks / 10000; if (getCode > max) { max = getCode; imax = i; } i++; total += getCode; int c1, c2; bool ok = (d1.TryGetValue(value1, out c1) && c1 == code) || (d2.TryGetValue(value1, out c2) && c2 == code); if (!ok) { throw new Exception(); } using (StreamWriter r = new StreamWriter(@"..\..\output.txt", true)) { r.WriteLine("milions " + Millions); r.WriteLine("max " + max); r.WriteLine("index of max " + imax); r.WriteLine("total " + total); r.WriteLine("count " + i); r.WriteLine("average " + (double)total / i); r.WriteLine("load " + load); r.WriteLine("create index " + createindex); } }
protected RDFIntStoreAbstract(IStringIntCoding entityCoding, PredicatesCoding predicatesCoding, NameSpaceStore nameSpaceStore, LiteralStoreAbstract literalStore, ScaleCell scale) { this.literalStore = literalStore; this.entityCoding = entityCoding; this.nameSpaceStore = nameSpaceStore; this.predicatesCoding = predicatesCoding; this.scale = scale; if (!scale.Cell.IsEmpty) { scale.CalculateRange(); } }
/// <summary> /// Конструктор /// </summary> /// <param name="path">директория базы данных с (обратным) слешем</param> /// <param name="literalStore"></param> /// <param name="entityCoding"></param> /// <param name="nameSpaceStore"></param> /// <param name="predicatesCoding"></param> public RdfTrees(string path, IStringIntCoding entityCoding, PredicatesCoding predicatesCoding, NameSpaceStore nameSpaceStore, LiteralStoreAbstract literalStore) : base(path, entityCoding, predicatesCoding, nameSpaceStore, literalStore) { // Построим типы InitTypes(); // Создадим или откроем ячейки this.entitiesTree = new PxCell(tp_entitiesTree, entitiesTreePath = path + "entitiesTree.pxc", false); //this.literalsTree = new PxCell(tp_literalsTree, path + "literalsTree.pxc", false); // this.dtriples = new PaCell(tp_dtriple_spf, path + "dtriples.pac", false); // Это вместо не работающего дерева литералов } otriples = new PaCell(tp_otriple_seq, path + "otriples.pac", File.Exists(path + "otriples.pac")); otriples.Close(); }
//// Идея хорошая, но надо менять схему реализации //private GroupedEntities getable; //private Dictionary<int, object[]> geHash; public TripleStoreInt(string path, IStringIntCoding entityCoding, PredicatesCoding predicatesCoding, NameSpaceStore nameSpaceStore, LiteralStoreAbstract literalStore) : base(path, entityCoding, predicatesCoding, nameSpaceStore, literalStore) { this.path = path; InitTypes(); otriplets_op_filePath = path + "otriples_op.pac"; otriples_filePath = path + "otriples.pac"; dtriples_filePath = path + "dtriples_spf.pac"; if (File.Exists(otriples_filePath)) { Open(true); } else { otriples = new PaCell(tp_triple_seq_two, otriples_filePath, false); otriples_op = new PaCell(tp_triple_seq_two, otriplets_op_filePath, false); dtriples_sp = new PaCell(tp_dtriple_spf_two, dtriples_filePath, false); } if (!Scale.Cell.IsEmpty) { Scale.CalculateRange(); } ewt = new EntitiesWideTable(path, 3); //ewtHash = new EntitiesMemoryHashTable(ewt); // ewtHash.Load(); //getable = new GroupedEntities(path); // Это хорошая идея, но нужно менять схему реализации //getable.CheckGroupedEntities(); //geHash = getable.GroupedEntitiesHash(); }
public CasheCoding(IStringIntCoding stringIntEncoded) { @base = stringIntEncoded; }
public NamespaceMapCoding(IStringIntCoding coding) { this.coding = coding; coding.Open(false); }