Exemplo n.º 1
0
        public IEnumerable <IGrouping <string, TripleObject> > GetSubjectGroupings(string s)
        {
            var sh     = KeySegments.GetNameSKeySubject(_name, s);
            var startS = KeyConfig.ConcatBytes(sh, KeyConfig.ByteZero);
            var endS   = KeyConfig.ConcatBytes(sh, KeyConfig.ByteOne);

            return(new RocksSubjectGrouping(_db, _name, s, startS, endS));
        }
Exemplo n.º 2
0
        public IEnumerable <Triple> S(string s)
        {
            var sh     = KeySegments.GetNameSKeySubject(_name, s);
            var startS = KeyConfig.ConcatBytes(sh, KeyConfig.ByteZero);
            var endS   = KeyConfig.ConcatBytes(sh, KeyConfig.ByteOne);

            return(new RocksEnumerable(_db, startS, endS, (Iterator it) => { return it.Next(); }));
        }
Exemplo n.º 3
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));
            }
        }
Exemplo n.º 4
0
        public IEnumerable <Triple> S(string s, Triple c)
        {
            var sh     = KeySegments.GetNameSKeySubject(_name, s);
            var startS = KeyConfig.ConcatBytes(sh, KeyConfig.ByteZero);
            var endS   = KeyConfig.ConcatBytes(sh, KeyConfig.ByteOne);

            // todo: optimize
            var(sKey, _, _) = new KeySegments(_name, c).GetKeys();

            var continuation = KeyConfig.ConcatBytes(sKey, KeyConfig.ByteOne);

            if (KeyConfig.ByteCompare(continuation, startS) < 0)
            {
                throw new InvalidOperationException("Invalid continuation token. Before range");
            }
            else if (KeyConfig.ByteCompare(continuation, endS) > 0)
            {
                return(Enumerable.Empty <Triple>());
            }

            return(new RocksEnumerable(_db, continuation, endS, (Iterator it) => { return it.Next(); }));
        }