public RDFGraph(string path) { Path = path; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } PType tp_triple = new PTypeRecord( new NamedType("subj", new PType(PTypeEnumeration.integer)), new NamedType("pred", new PType(PTypeEnumeration.integer)), new NamedType("obj", ObjectVariantsPolarType.ObjectVariantPolarType)); table = new TableView(path + "triples", tp_triple); ps_index = new IndexCascadingDynamic <int>(path + "ps_index", (IBearingTableImmutable)table, ob => (int)((object[])((object[])ob)[1])[1], ob => (int)((object[])((object[])ob)[1])[0], i => i); po_index = new IndexCascadingDynamic <ObjectVariants>(path + "po_index", (IBearingTableImmutable)table, ob => (int)((object[])((object[])ob)[1])[1], ob => ((object[])((object[])ob)[1])[2].ToOVariant(NodeGenerator), ov => ov.GetHashCode()); textObjectIndex = new TextObjectIndex((ulong)(table.TableCell.IsEmpty ? 10 : table.TableCell.Root.Count() / 3 + 1), this); OnAddPortion += po_index.index_arr.FillPortion; OnAddPortion += ps_index.index_arr.FillPortion; OnAddPortion += textObjectIndex.FillPortion; NodeGenerator = NodeGeneratorInt.Create(new NameTableDictionaryRam(path)); //new NametableLinearBuffered(path)); _ng = NodeGenerator as NodeGeneratorInt; ((NameTableDictionaryRam)_ng.coding_table).Expand((int)10000 / 3 + 1, Enumerable.Repeat(SpecialTypesClass.RdfType, 1)); Start(); }
public CascadingTest() { var uniqPath = Path+DateTime.Now.ToString(CultureInfo.InvariantCulture).Replace(":"," ")+DateTime.Now.Millisecond+"/";// Directory.CreateDirectory(uniqPath); Directory.CreateDirectory(uniqPath); tableView = new TableView(uniqPath + "table", TpTableElement); index = new IndexCascadingDynamic<string>(uniqPath + "cascading index", tableView, row => (int) ((object[])((object[])row)[1])[0], row => (string)((object[])((object[])row)[1])[1], i => i.GetHashModifiedBernstein()); tableView.Fill( Enumerable.Range(0, NumberOfRecords).SelectMany(i => Enumerable.Range(0, NumberOfRecords).Select(j => (object) (new object[] {i, j.ToString()})))); index.Build(); index.CreateDiscaleDictionary(); }
public SimpleTripleStore(string path, int portion) { this.portion = portion; table = new TableView(path + "table.pac", new PTypeRecord(new NamedType("s", new PType(PTypeEnumeration.integer)), new NamedType("p", new PType(PTypeEnumeration.integer)), new NamedType("o", new PType(PTypeEnumeration.sstring)))); ps_index = new IndexCascadingDynamic <int>(path + "ps_index", table, ob => (int)((object[])((object[])ob)[1])[1], ob => (int)((object[])((object[])ob)[1])[0], i => i); po_index = new IndexCascadingDynamic <string>(path + "po_index", table, ob => (int)((object[])((object[])ob)[1])[1], ob => (string)((object[])((object[])ob)[1])[2], s => s.GetHashSpooky()); predicatemappingPath = path + "predicates"; if (File.Exists(predicatemappingPath)) { using (StreamReader file = new StreamReader(predicatemappingPath)) while (!file.EndOfStream) { predicatemapping.Add(file.ReadLine(), predicatemapping.Count); } } if (table.TableCell.IsEmpty) { return; } po_index.CreateDiscaleDictionary(); ps_index.CreateDiscaleDictionary(); table.Warmup(); po_index.Warmup(); ps_index.Warmup(); }