Beispiel #1
0
        public IEnumerable <Triple> GetTriples()
        {
            var nameBytes = KeySegments.GetNameSKey(_name);
            var start     = KeyConfig.ConcatBytes(nameBytes, KeyConfig.ByteZero);
            var end       = KeyConfig.ConcatBytes(nameBytes, KeyConfig.ByteOne);

            return(new RocksEnumerable(_db, start, end, (Iterator it) => { return it.Next(); }));
        }
Beispiel #2
0
        public IEnumerable <IGrouping <string, IGrouping <string, TripleObject> > > GetGroupings()
        {
            var nameBytes = KeySegments.GetNameSKey(Name);
            var start     = KeyConfig.ConcatBytes(nameBytes, KeyConfig.ByteZero);
            var end       = KeyConfig.ConcatBytes(nameBytes, KeyConfig.ByteOne);
            var subjects  = new RocksEnumerable(_db, start, end, (it) => {
                var key     = it.Key();
                var splits  = KeyConfig.Split(key);
                var nextKey = KeyConfig.ConcatBytes(splits[0], KeyConfig.ByteZero, splits[1], KeyConfig.ByteOne);
                return(it.Seek(nextKey));
            }).Select(x => x.Subject);

            foreach (var s in subjects)
            {
                var sh     = KeySegments.GetNameSKeySubject(Name, s);
                var startS = KeyConfig.ConcatBytes(sh, KeyConfig.ByteZero);
                var endS   = KeyConfig.ConcatBytes(sh, KeyConfig.ByteOne);

                yield return(new RocksSubjectGrouping(_db, Name, s, startS, endS));
            }
        }