Rename TSVal

This commit is contained in:
kortschak 2014-07-02 12:13:15 +09:30
parent a1453da84e
commit d87e227ff3
29 changed files with 118 additions and 118 deletions

View file

@ -32,15 +32,15 @@ type Iterator interface {
// Tag Accessors. // Tag Accessors.
AddTag(string) AddTag(string)
Tags() []string Tags() []string
AddFixedTag(string, TSVal) AddFixedTag(string, Value)
FixedTags() map[string]TSVal FixedTags() map[string]Value
CopyTagsFrom(Iterator) CopyTagsFrom(Iterator)
// Fills a tag-to-result-value map. // Fills a tag-to-result-value map.
TagResults(map[string]TSVal) TagResults(map[string]Value)
// Returns the current result. // Returns the current result.
Result() TSVal Result() Value
// DEPRECATED -- Fills a ResultTree struct with Result(). // DEPRECATED -- Fills a ResultTree struct with Result().
ResultTree() *ResultTree ResultTree() *ResultTree
@ -59,7 +59,7 @@ type Iterator interface {
// //
// Next() advances the iterator and returns the next valid result. Returns // Next() advances the iterator and returns the next valid result. Returns
// (<value>, true) or (nil, false) // (<value>, true) or (nil, false)
Next() (TSVal, bool) Next() (Value, bool)
// NextResult() advances iterators that may have more than one valid result, // NextResult() advances iterators that may have more than one valid result,
// from the bottom up. // from the bottom up.
@ -72,7 +72,7 @@ type Iterator interface {
// Check(), given a value, returns whether or not that value is within the set // Check(), given a value, returns whether or not that value is within the set
// held by this iterator. // held by this iterator.
Check(TSVal) bool Check(Value) bool
// Start iteration from the beginning // Start iteration from the beginning
Reset() Reset()
@ -117,7 +117,7 @@ type Iterator interface {
type FixedIterator interface { type FixedIterator interface {
Iterator Iterator
AddValue(TSVal) AddValue(Value)
} }
type IteratorStats struct { type IteratorStats struct {
@ -128,13 +128,13 @@ type IteratorStats struct {
// Utility logging functions for when an iterator gets called Next upon, or Check upon, as // Utility logging functions for when an iterator gets called Next upon, or Check upon, as
// well as what they return. Highly useful for tracing the execution path of a query. // well as what they return. Highly useful for tracing the execution path of a query.
func CheckLogIn(it Iterator, val TSVal) { func CheckLogIn(it Iterator, val Value) {
if glog.V(4) { if glog.V(4) {
glog.V(4).Infof("%s %d CHECK %d", strings.ToUpper(it.Type()), it.UID(), val) glog.V(4).Infof("%s %d CHECK %d", strings.ToUpper(it.Type()), it.UID(), val)
} }
} }
func CheckLogOut(it Iterator, val TSVal, good bool) bool { func CheckLogOut(it Iterator, val Value, good bool) bool {
if glog.V(4) { if glog.V(4) {
if good { if good {
glog.V(4).Infof("%s %d CHECK %d GOOD", strings.ToUpper(it.Type()), it.UID(), val) glog.V(4).Infof("%s %d CHECK %d GOOD", strings.ToUpper(it.Type()), it.UID(), val)
@ -151,7 +151,7 @@ func NextLogIn(it Iterator) {
} }
} }
func NextLogOut(it Iterator, val TSVal, ok bool) (TSVal, bool) { func NextLogOut(it Iterator, val Value, ok bool) (Value, bool) {
if glog.V(4) { if glog.V(4) {
if ok { if ok {
glog.V(4).Infof("%s %d NEXT IS %d", strings.ToUpper(it.Type()), it.UID(), val) glog.V(4).Infof("%s %d NEXT IS %d", strings.ToUpper(it.Type()), it.UID(), val)

View file

@ -66,7 +66,7 @@ func (it *Int64) DebugString(indent int) string {
// Next() on an Int64 all iterator is a simple incrementing counter. // Next() on an Int64 all iterator is a simple incrementing counter.
// Return the next integer, and mark it as the result. // Return the next integer, and mark it as the result.
func (it *Int64) Next() (graph.TSVal, bool) { func (it *Int64) Next() (graph.Value, bool) {
graph.NextLogIn(it) graph.NextLogIn(it)
if it.at == -1 { if it.at == -1 {
return graph.NextLogOut(it, nil, false) return graph.NextLogOut(it, nil, false)
@ -89,7 +89,7 @@ func (it *Int64) Size() (int64, bool) {
// Check() for an Int64 is merely seeing if the passed value is // Check() for an Int64 is merely seeing if the passed value is
// withing the range, assuming the value is an int64. // withing the range, assuming the value is an int64.
func (it *Int64) Check(tsv graph.TSVal) bool { func (it *Int64) Check(tsv graph.Value) bool {
graph.CheckLogIn(it, tsv) graph.CheckLogIn(it, tsv)
v := tsv.(int64) v := tsv.(int64)
if it.min <= v && v <= it.max { if it.min <= v && v <= it.max {

View file

@ -73,7 +73,7 @@ func (it *And) SubIterators() []graph.Iterator {
// Overrides Base TagResults, as it needs to add it's own results and // Overrides Base TagResults, as it needs to add it's own results and
// recurse down it's subiterators. // recurse down it's subiterators.
func (it *And) TagResults(dst map[string]graph.TSVal) { func (it *And) TagResults(dst map[string]graph.Value) {
it.Base.TagResults(dst) it.Base.TagResults(dst)
if it.primaryIt != nil { if it.primaryIt != nil {
it.primaryIt.TagResults(dst) it.primaryIt.TagResults(dst)
@ -139,9 +139,9 @@ func (it *And) AddSubIterator(sub graph.Iterator) {
// intersection of its subiterators, it must choose one subiterator to produce a // intersection of its subiterators, it must choose one subiterator to produce a
// candidate, and check this value against the subiterators. A productive choice // candidate, and check this value against the subiterators. A productive choice
// of primary iterator is therefore very important. // of primary iterator is therefore very important.
func (it *And) Next() (graph.TSVal, bool) { func (it *And) Next() (graph.Value, bool) {
graph.NextLogIn(it) graph.NextLogIn(it)
var curr graph.TSVal var curr graph.Value
var exists bool var exists bool
for { for {
curr, exists = it.primaryIt.Next() curr, exists = it.primaryIt.Next()
@ -157,7 +157,7 @@ func (it *And) Next() (graph.TSVal, bool) {
} }
// Checks a value against the non-primary iterators, in order. // Checks a value against the non-primary iterators, in order.
func (it *And) checkSubIts(val graph.TSVal) bool { func (it *And) checkSubIts(val graph.Value) bool {
var subIsGood = true var subIsGood = true
for _, sub := range it.internalIterators { for _, sub := range it.internalIterators {
subIsGood = sub.Check(val) subIsGood = sub.Check(val)
@ -168,7 +168,7 @@ func (it *And) checkSubIts(val graph.TSVal) bool {
return subIsGood return subIsGood
} }
func (it *And) checkCheckList(val graph.TSVal) bool { func (it *And) checkCheckList(val graph.Value) bool {
ok := true ok := true
for _, c := range it.checkList { for _, c := range it.checkList {
ok = c.Check(val) ok = c.Check(val)
@ -183,7 +183,7 @@ func (it *And) checkCheckList(val graph.TSVal) bool {
} }
// Check a value against the entire iterator, in order. // Check a value against the entire iterator, in order.
func (it *And) Check(val graph.TSVal) bool { func (it *And) Check(val graph.Value) bool {
graph.CheckLogIn(it, val) graph.CheckLogIn(it, val)
if it.checkList != nil { if it.checkList != nil {
return it.checkCheckList(val) return it.checkCheckList(val)

View file

@ -43,7 +43,7 @@ func TestTag(t *testing.T) {
if val != 234 { if val != 234 {
t.Errorf("Unexpected value") t.Errorf("Unexpected value")
} }
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
and.TagResults(tags) and.TagResults(tags)
if tags["bar"] != 234 { if tags["bar"] != 234 {
t.Errorf("no bar tag") t.Errorf("no bar tag")

View file

@ -17,7 +17,7 @@ package iterator
// Defines one of the base iterators, the Fixed iterator. A fixed iterator is quite simple; it // Defines one of the base iterators, the Fixed iterator. A fixed iterator is quite simple; it
// contains an explicit fixed array of values. // contains an explicit fixed array of values.
// //
// A fixed iterator requires an Equality function to be passed to it, by reason that graph.TSVal, the // A fixed iterator requires an Equality function to be passed to it, by reason that graph.Value, the
// opaque Triple store value, may not answer to ==. // opaque Triple store value, may not answer to ==.
import ( import (
@ -31,16 +31,16 @@ import (
// an equality function. // an equality function.
type Fixed struct { type Fixed struct {
Base Base
values []graph.TSVal values []graph.Value
lastIndex int lastIndex int
cmp Equality cmp Equality
} }
// Define the signature of an equality function. // Define the signature of an equality function.
type Equality func(a, b graph.TSVal) bool type Equality func(a, b graph.Value) bool
// Define an equality function of purely ==, which works for native types. // Define an equality function of purely ==, which works for native types.
func BasicEquality(a, b graph.TSVal) bool { func BasicEquality(a, b graph.Value) bool {
if a == b { if a == b {
return true return true
} }
@ -56,7 +56,7 @@ func newFixed() *Fixed {
func NewFixedIteratorWithCompare(compareFn Equality) *Fixed { func NewFixedIteratorWithCompare(compareFn Equality) *Fixed {
var it Fixed var it Fixed
BaseInit(&it.Base) BaseInit(&it.Base)
it.values = make([]graph.TSVal, 0, 20) it.values = make([]graph.Value, 0, 20)
it.lastIndex = 0 it.lastIndex = 0
it.cmp = compareFn it.cmp = compareFn
return &it return &it
@ -79,7 +79,7 @@ func (it *Fixed) Clone() graph.Iterator {
// Add a value to the iterator. The array now contains this value. // Add a value to the iterator. The array now contains this value.
// TODO(barakmich): This ought to be a set someday, disallowing repeated values. // TODO(barakmich): This ought to be a set someday, disallowing repeated values.
func (it *Fixed) AddValue(v graph.TSVal) { func (it *Fixed) AddValue(v graph.Value) {
it.values = append(it.values, v) it.values = append(it.values, v)
} }
@ -104,7 +104,7 @@ func (it *Fixed) Type() string {
} }
// Check if the passed value is equal to one of the values stored in the iterator. // Check if the passed value is equal to one of the values stored in the iterator.
func (it *Fixed) Check(v graph.TSVal) bool { func (it *Fixed) Check(v graph.Value) bool {
// Could be optimized by keeping it sorted or using a better datastructure. // Could be optimized by keeping it sorted or using a better datastructure.
// However, for fixed iterators, which are by definition kind of tiny, this // However, for fixed iterators, which are by definition kind of tiny, this
// isn't a big issue. // isn't a big issue.
@ -119,7 +119,7 @@ func (it *Fixed) Check(v graph.TSVal) bool {
} }
// Return the next stored value from the iterator. // Return the next stored value from the iterator.
func (it *Fixed) Next() (graph.TSVal, bool) { func (it *Fixed) Next() (graph.Value, bool) {
graph.NextLogIn(it) graph.NextLogIn(it)
if it.lastIndex == len(it.values) { if it.lastIndex == len(it.values) {
return graph.NextLogOut(it, nil, false) return graph.NextLogOut(it, nil, false)

View file

@ -99,7 +99,7 @@ func (it *HasA) Optimize() (graph.Iterator, bool) {
} }
// Pass the TagResults down the chain. // Pass the TagResults down the chain.
func (it *HasA) TagResults(dst map[string]graph.TSVal) { func (it *HasA) TagResults(dst map[string]graph.Value) {
it.Base.TagResults(dst) it.Base.TagResults(dst)
it.primaryIt.TagResults(dst) it.primaryIt.TagResults(dst)
} }
@ -123,7 +123,7 @@ func (it *HasA) DebugString(indent int) string {
// Check a value against our internal iterator. In order to do this, we must first open a new // Check a value against our internal iterator. In order to do this, we must first open a new
// iterator of "triples that have `val` in our direction", given to us by the triple store, // iterator of "triples that have `val` in our direction", given to us by the triple store,
// and then Next() values out of that iterator and Check() them against our subiterator. // and then Next() values out of that iterator and Check() them against our subiterator.
func (it *HasA) Check(val graph.TSVal) bool { func (it *HasA) Check(val graph.Value) bool {
graph.CheckLogIn(it, val) graph.CheckLogIn(it, val)
if glog.V(4) { if glog.V(4) {
glog.V(4).Infoln("Id is", it.ts.NameOf(val)) glog.V(4).Infoln("Id is", it.ts.NameOf(val))
@ -173,7 +173,7 @@ func (it *HasA) NextResult() bool {
// Get the next result from this iterator. This is simpler than Check. We have a // Get the next result from this iterator. This is simpler than Check. We have a
// subiterator we can get a value from, and we can take that resultant triple, // subiterator we can get a value from, and we can take that resultant triple,
// pull our direction out of it, and return that. // pull our direction out of it, and return that.
func (it *HasA) Next() (graph.TSVal, bool) { func (it *HasA) Next() (graph.Value, bool) {
graph.NextLogIn(it) graph.NextLogIn(it)
if it.resultIt != nil { if it.resultIt != nil {
it.resultIt.Close() it.resultIt.Close()

View file

@ -36,9 +36,9 @@ func nextID() uintptr {
// The Base iterator is the iterator other iterators inherit from to get some // The Base iterator is the iterator other iterators inherit from to get some
// default functionality. // default functionality.
type Base struct { type Base struct {
Last graph.TSVal Last graph.Value
tags []string tags []string
fixedTags map[string]graph.TSVal fixedTags map[string]graph.Value
canNext bool canNext bool
uid uintptr uid uintptr
} }
@ -64,9 +64,9 @@ func (it *Base) AddTag(tag string) {
it.tags = append(it.tags, tag) it.tags = append(it.tags, tag)
} }
func (it *Base) AddFixedTag(tag string, value graph.TSVal) { func (it *Base) AddFixedTag(tag string, value graph.Value) {
if it.fixedTags == nil { if it.fixedTags == nil {
it.fixedTags = make(map[string]graph.TSVal) it.fixedTags = make(map[string]graph.Value)
} }
it.fixedTags[tag] = value it.fixedTags[tag] = value
} }
@ -76,7 +76,7 @@ func (it *Base) Tags() []string {
return it.tags return it.tags
} }
func (it *Base) FixedTags() map[string]graph.TSVal { func (it *Base) FixedTags() map[string]graph.Value {
return it.fixedTags return it.fixedTags
} }
@ -97,7 +97,7 @@ func (it *Base) DebugString(indent int) string {
} }
// Nothing in a base iterator. // Nothing in a base iterator.
func (it *Base) Check(v graph.TSVal) bool { func (it *Base) Check(v graph.Value) bool {
return false return false
} }
@ -114,7 +114,7 @@ func (it *Base) ResultTree() *graph.ResultTree {
} }
// Nothing in a base iterator. // Nothing in a base iterator.
func (it *Base) Next() (graph.TSVal, bool) { func (it *Base) Next() (graph.Value, bool) {
return nil, false return nil, false
} }
@ -123,7 +123,7 @@ func (it *Base) NextResult() bool {
} }
// Returns the last result of an iterator. // Returns the last result of an iterator.
func (it *Base) Result() graph.TSVal { func (it *Base) Result() graph.Value {
return it.Last return it.Last
} }
@ -142,7 +142,7 @@ func (it *Base) CanNext() bool { return it.canNext }
// Fill the map based on the tags assigned to this iterator. Default // Fill the map based on the tags assigned to this iterator. Default
// functionality works well for most iterators. // functionality works well for most iterators.
func (it *Base) TagResults(dst map[string]graph.TSVal) { func (it *Base) TagResults(dst map[string]graph.Value) {
for _, tag := range it.Tags() { for _, tag := range it.Tags() {
dst[tag] = it.Result() dst[tag] = it.Result()
} }

View file

@ -77,7 +77,7 @@ func (it *LinksTo) Clone() graph.Iterator {
func (it *LinksTo) Direction() graph.Direction { return it.dir } func (it *LinksTo) Direction() graph.Direction { return it.dir }
// Tag these results, and our subiterator's results. // Tag these results, and our subiterator's results.
func (it *LinksTo) TagResults(dst map[string]graph.TSVal) { func (it *LinksTo) TagResults(dst map[string]graph.Value) {
it.Base.TagResults(dst) it.Base.TagResults(dst)
it.primaryIt.TagResults(dst) it.primaryIt.TagResults(dst)
} }
@ -98,7 +98,7 @@ func (it *LinksTo) DebugString(indent int) string {
// If it checks in the right direction for the subiterator, it is a valid link // If it checks in the right direction for the subiterator, it is a valid link
// for the LinksTo. // for the LinksTo.
func (it *LinksTo) Check(val graph.TSVal) bool { func (it *LinksTo) Check(val graph.Value) bool {
graph.CheckLogIn(it, val) graph.CheckLogIn(it, val)
node := it.ts.TripleDirection(val, it.dir) node := it.ts.TripleDirection(val, it.dir)
if it.primaryIt.Check(node) { if it.primaryIt.Check(node) {
@ -135,7 +135,7 @@ func (it *LinksTo) Optimize() (graph.Iterator, bool) {
} }
// Next()ing a LinksTo operates as described above. // Next()ing a LinksTo operates as described above.
func (it *LinksTo) Next() (graph.TSVal, bool) { func (it *LinksTo) Next() (graph.Value, bool) {
graph.NextLogIn(it) graph.NextLogIn(it)
val, ok := it.nextIt.Next() val, ok := it.nextIt.Next()
if !ok { if !ok {

View file

@ -27,14 +27,14 @@ type TestTripleStore struct {
mock.Mock mock.Mock
} }
func (ts *TestTripleStore) ValueOf(s string) graph.TSVal { func (ts *TestTripleStore) ValueOf(s string) graph.Value {
args := ts.Mock.Called(s) args := ts.Mock.Called(s)
return args.Get(0) return args.Get(0)
} }
func (ts *TestTripleStore) AddTriple(*graph.Triple) {} func (ts *TestTripleStore) AddTriple(*graph.Triple) {}
func (ts *TestTripleStore) AddTripleSet([]*graph.Triple) {} func (ts *TestTripleStore) AddTripleSet([]*graph.Triple) {}
func (ts *TestTripleStore) Triple(graph.TSVal) *graph.Triple { return &graph.Triple{} } func (ts *TestTripleStore) Triple(graph.Value) *graph.Triple { return &graph.Triple{} }
func (ts *TestTripleStore) TripleIterator(d graph.Direction, i graph.TSVal) graph.Iterator { func (ts *TestTripleStore) TripleIterator(d graph.Direction, i graph.Value) graph.Iterator {
args := ts.Mock.Called(d, i) args := ts.Mock.Called(d, i)
return args.Get(0).(graph.Iterator) return args.Get(0).(graph.Iterator)
} }
@ -43,7 +43,7 @@ func (ts *TestTripleStore) TriplesAllIterator() graph.Iterator { return &Null{}
func (ts *TestTripleStore) GetIteratorByString(string, string, string) graph.Iterator { func (ts *TestTripleStore) GetIteratorByString(string, string, string) graph.Iterator {
return &Null{} return &Null{}
} }
func (ts *TestTripleStore) NameOf(v graph.TSVal) string { func (ts *TestTripleStore) NameOf(v graph.Value) string {
args := ts.Mock.Called(v) args := ts.Mock.Called(v)
return args.Get(0).(string) return args.Get(0).(string)
} }
@ -56,5 +56,5 @@ func (ts *TestTripleStore) FixedIterator() graph.FixedIterator {
return NewFixedIteratorWithCompare(BasicEquality) return NewFixedIteratorWithCompare(BasicEquality)
} }
func (ts *TestTripleStore) Close() {} func (ts *TestTripleStore) Close() {}
func (ts *TestTripleStore) TripleDirection(graph.TSVal, graph.Direction) graph.TSVal { return 0 } func (ts *TestTripleStore) TripleDirection(graph.Value, graph.Direction) graph.Value { return 0 }
func (ts *TestTripleStore) RemoveTriple(t *graph.Triple) {} func (ts *TestTripleStore) RemoveTriple(t *graph.Triple) {}

View file

@ -69,7 +69,7 @@ func (it *Optional) Clone() graph.Iterator {
// Nexting the iterator is unsupported -- error and return an empty set. // Nexting the iterator is unsupported -- error and return an empty set.
// (As above, a reasonable alternative would be to Next() an all iterator) // (As above, a reasonable alternative would be to Next() an all iterator)
func (it *Optional) Next() (graph.TSVal, bool) { func (it *Optional) Next() (graph.Value, bool) {
glog.Errorln("Nexting an un-nextable iterator") glog.Errorln("Nexting an un-nextable iterator")
return nil, false return nil, false
} }
@ -87,7 +87,7 @@ func (it *Optional) NextResult() bool {
// Check() is the real hack of this iterator. It always returns true, regardless // Check() is the real hack of this iterator. It always returns true, regardless
// of whether the subiterator matched. But we keep track of whether the subiterator // of whether the subiterator matched. But we keep track of whether the subiterator
// matched for results purposes. // matched for results purposes.
func (it *Optional) Check(val graph.TSVal) bool { func (it *Optional) Check(val graph.Value) bool {
checked := it.subIt.Check(val) checked := it.subIt.Check(val)
it.lastCheck = checked it.lastCheck = checked
it.Last = val it.Last = val
@ -96,7 +96,7 @@ func (it *Optional) Check(val graph.TSVal) bool {
// If we failed the check, then the subiterator should not contribute to the result // If we failed the check, then the subiterator should not contribute to the result
// set. Otherwise, go ahead and tag it. // set. Otherwise, go ahead and tag it.
func (it *Optional) TagResults(dst map[string]graph.TSVal) { func (it *Optional) TagResults(dst map[string]graph.Value) {
if it.lastCheck == false { if it.lastCheck == false {
return return
} }

View file

@ -83,7 +83,7 @@ func (it *Or) SubIterators() []graph.Iterator {
// Overrides BaseIterator TagResults, as it needs to add it's own results and // Overrides BaseIterator TagResults, as it needs to add it's own results and
// recurse down it's subiterators. // recurse down it's subiterators.
func (it *Or) TagResults(dst map[string]graph.TSVal) { func (it *Or) TagResults(dst map[string]graph.Value) {
it.Base.TagResults(dst) it.Base.TagResults(dst)
it.internalIterators[it.currentIterator].TagResults(dst) it.internalIterators[it.currentIterator].TagResults(dst)
} }
@ -128,9 +128,9 @@ func (it *Or) AddSubIterator(sub graph.Iterator) {
// Returns the Next value from the Or graph.iterator. Because the Or is the // Returns the Next value from the Or graph.iterator. Because the Or is the
// union of its subiterators, it must produce from all subiterators -- unless // union of its subiterators, it must produce from all subiterators -- unless
// it's shortcircuiting, in which case, it's the first one that returns anything. // it's shortcircuiting, in which case, it's the first one that returns anything.
func (it *Or) Next() (graph.TSVal, bool) { func (it *Or) Next() (graph.Value, bool) {
graph.NextLogIn(it) graph.NextLogIn(it)
var curr graph.TSVal var curr graph.Value
var exists bool var exists bool
firstTime := false firstTime := false
for { for {
@ -157,7 +157,7 @@ func (it *Or) Next() (graph.TSVal, bool) {
} }
// Checks a value against the iterators, in order. // Checks a value against the iterators, in order.
func (it *Or) checkSubIts(val graph.TSVal) bool { func (it *Or) checkSubIts(val graph.Value) bool {
var subIsGood = false var subIsGood = false
for i, sub := range it.internalIterators { for i, sub := range it.internalIterators {
subIsGood = sub.Check(val) subIsGood = sub.Check(val)
@ -170,7 +170,7 @@ func (it *Or) checkSubIts(val graph.TSVal) bool {
} }
// Check a value against the entire graph.iterator, in order. // Check a value against the entire graph.iterator, in order.
func (it *Or) Check(val graph.TSVal) bool { func (it *Or) Check(val graph.Value) bool {
graph.CheckLogIn(it, val) graph.CheckLogIn(it, val)
anyGood := it.checkSubIts(val) anyGood := it.checkSubIts(val)
if !anyGood { if !anyGood {

View file

@ -65,7 +65,7 @@ func NewComparison(sub graph.Iterator, op Operator, val interface{}, ts graph.Tr
// Here's the non-boilerplate part of the ValueComparison iterator. Given a value // Here's the non-boilerplate part of the ValueComparison iterator. Given a value
// and our operator, determine whether or not we meet the requirement. // and our operator, determine whether or not we meet the requirement.
func (it *Comparison) doComparison(val graph.TSVal) bool { func (it *Comparison) doComparison(val graph.Value) bool {
//TODO(barakmich): Implement string comparison. //TODO(barakmich): Implement string comparison.
nodeStr := it.ts.NameOf(val) nodeStr := it.ts.NameOf(val)
switch cVal := it.val.(type) { switch cVal := it.val.(type) {
@ -117,8 +117,8 @@ func (it *Comparison) Clone() graph.Iterator {
return out return out
} }
func (it *Comparison) Next() (graph.TSVal, bool) { func (it *Comparison) Next() (graph.Value, bool) {
var val graph.TSVal var val graph.Value
var ok bool var ok bool
for { for {
val, ok = it.subIt.Next() val, ok = it.subIt.Next()
@ -147,7 +147,7 @@ func (it *Comparison) NextResult() bool {
return true return true
} }
func (it *Comparison) Check(val graph.TSVal) bool { func (it *Comparison) Check(val graph.Value) bool {
if !it.doComparison(val) { if !it.doComparison(val) {
return false return false
} }
@ -156,7 +156,7 @@ func (it *Comparison) Check(val graph.TSVal) bool {
// If we failed the check, then the subiterator should not contribute to the result // If we failed the check, then the subiterator should not contribute to the result
// set. Otherwise, go ahead and tag it. // set. Otherwise, go ahead and tag it.
func (it *Comparison) TagResults(dst map[string]graph.TSVal) { func (it *Comparison) TagResults(dst map[string]graph.Value) {
it.Base.TagResults(dst) it.Base.TagResults(dst)
it.subIt.TagResults(dst) it.subIt.TagResults(dst)
} }

View file

@ -72,7 +72,7 @@ func (it *AllIterator) Clone() graph.Iterator {
return out return out
} }
func (it *AllIterator) Next() (graph.TSVal, bool) { func (it *AllIterator) Next() (graph.Value, bool) {
if !it.open { if !it.open {
it.Last = nil it.Last = nil
return nil, false return nil, false
@ -92,7 +92,7 @@ func (it *AllIterator) Next() (graph.TSVal, bool) {
return out, true return out, true
} }
func (it *AllIterator) Check(v graph.TSVal) bool { func (it *AllIterator) Check(v graph.Value) bool {
it.Last = v it.Last = v
return true return true
} }

View file

@ -38,7 +38,7 @@ type Iterator struct {
originalPrefix string originalPrefix string
} }
func NewIterator(prefix string, d graph.Direction, value graph.TSVal, ts *TripleStore) *Iterator { func NewIterator(prefix string, d graph.Direction, value graph.Value, ts *TripleStore) *Iterator {
var it Iterator var it Iterator
iterator.BaseInit(&it.Base) iterator.BaseInit(&it.Base)
it.checkId = value.([]byte) it.checkId = value.([]byte)
@ -85,7 +85,7 @@ func (it *Iterator) Close() {
} }
} }
func (it *Iterator) Next() (graph.TSVal, bool) { func (it *Iterator) Next() (graph.Value, bool) {
if it.it == nil { if it.it == nil {
it.Last = nil it.Last = nil
return nil, false return nil, false
@ -166,7 +166,7 @@ func GetPositionFromPrefix(prefix []byte, d graph.Direction, ts *TripleStore) in
panic("unreachable") panic("unreachable")
} }
func (it *Iterator) Check(v graph.TSVal) bool { func (it *Iterator) Check(v graph.Value) bool {
val := v.([]byte) val := v.([]byte)
if val[0] == 'z' { if val[0] == 'z' {
return false return false

View file

@ -420,9 +420,9 @@ func TestOptimize(t *testing.T) {
Convey("With the correct tags", func() { Convey("With the correct tags", func() {
oldIt.Next() oldIt.Next()
newIt.Next() newIt.Next()
oldResults := make(map[string]graph.TSVal) oldResults := make(map[string]graph.Value)
oldIt.TagResults(oldResults) oldIt.TagResults(oldResults)
newResults := make(map[string]graph.TSVal) newResults := make(map[string]graph.Value)
oldIt.TagResults(newResults) oldIt.TagResults(newResults)
So(newResults, ShouldResemble, oldResults) So(newResults, ShouldResemble, oldResults)
}) })

View file

@ -301,7 +301,7 @@ func (ts *TripleStore) Close() {
ts.open = false ts.open = false
} }
func (ts *TripleStore) Triple(k graph.TSVal) *graph.Triple { func (ts *TripleStore) Triple(k graph.Value) *graph.Triple {
var triple graph.Triple var triple graph.Triple
b, err := ts.db.Get(k.([]byte), ts.readopts) b, err := ts.db.Get(k.([]byte), ts.readopts)
if err != nil && err != leveldb.ErrNotFound { if err != nil && err != leveldb.ErrNotFound {
@ -328,7 +328,7 @@ func (ts *TripleStore) convertStringToByteHash(s string) []byte {
return key return key
} }
func (ts *TripleStore) ValueOf(s string) graph.TSVal { func (ts *TripleStore) ValueOf(s string) graph.Value {
return ts.createValueKeyFor(s) return ts.createValueKeyFor(s)
} }
@ -352,7 +352,7 @@ func (ts *TripleStore) getValueData(value_key []byte) ValueData {
return out return out
} }
func (ts *TripleStore) NameOf(k graph.TSVal) string { func (ts *TripleStore) NameOf(k graph.Value) string {
if k == nil { if k == nil {
glog.V(2).Infoln("k was nil") glog.V(2).Infoln("k was nil")
return "" return ""
@ -360,7 +360,7 @@ func (ts *TripleStore) NameOf(k graph.TSVal) string {
return ts.getValueData(k.([]byte)).Name return ts.getValueData(k.([]byte)).Name
} }
func (ts *TripleStore) GetSizeFor(k graph.TSVal) int64 { func (ts *TripleStore) GetSizeFor(k graph.Value) int64 {
if k == nil { if k == nil {
return 0 return 0
} }
@ -401,7 +401,7 @@ func (ts *TripleStore) GetApproximateSizeForPrefix(pre []byte) (int64, error) {
return 0, nil return 0, nil
} }
func (ts *TripleStore) TripleIterator(d graph.Direction, val graph.TSVal) graph.Iterator { func (ts *TripleStore) TripleIterator(d graph.Direction, val graph.Value) graph.Iterator {
var prefix string var prefix string
switch d { switch d {
case graph.Subject: case graph.Subject:
@ -426,7 +426,7 @@ func (ts *TripleStore) TriplesAllIterator() graph.Iterator {
return NewAllIterator("po", graph.Predicate, ts) return NewAllIterator("po", graph.Predicate, ts)
} }
func (ts *TripleStore) TripleDirection(val graph.TSVal, d graph.Direction) graph.TSVal { func (ts *TripleStore) TripleDirection(val graph.Value, d graph.Direction) graph.Value {
v := val.([]uint8) v := val.([]uint8)
offset := GetPositionFromPrefix(v[0:2], d, ts) offset := GetPositionFromPrefix(v[0:2], d, ts)
if offset != -1 { if offset != -1 {
@ -436,7 +436,7 @@ func (ts *TripleStore) TripleDirection(val graph.TSVal, d graph.Direction) graph
} }
} }
func compareBytes(a, b graph.TSVal) bool { func compareBytes(a, b graph.Value) bool {
return bytes.Equal(a.([]uint8), b.([]uint8)) return bytes.Equal(a.([]uint8), b.([]uint8))
} }

View file

@ -31,7 +31,7 @@ func NewMemstoreAllIterator(ts *TripleStore) *AllIterator {
return &out return &out
} }
func (it *AllIterator) Next() (graph.TSVal, bool) { func (it *AllIterator) Next() (graph.Value, bool) {
next, out := it.Int64.Next() next, out := it.Int64.Next()
if !out { if !out {
return next, out return next, out

View file

@ -73,7 +73,7 @@ func (it *Iterator) Clone() graph.Iterator {
func (it *Iterator) Close() {} func (it *Iterator) Close() {}
func (it *Iterator) Next() (graph.TSVal, bool) { func (it *Iterator) Next() (graph.Value, bool) {
graph.NextLogIn(it) graph.NextLogIn(it)
if it.tree.Max() == nil || it.Last == int64(it.tree.Max().(Int64)) { if it.tree.Max() == nil || it.Last == int64(it.tree.Max().(Int64)) {
return graph.NextLogOut(it, nil, false) return graph.NextLogOut(it, nil, false)
@ -87,7 +87,7 @@ func (it *Iterator) Size() (int64, bool) {
return int64(it.tree.Len()), true return int64(it.tree.Len()), true
} }
func (it *Iterator) Check(v graph.TSVal) bool { func (it *Iterator) Check(v graph.Value) bool {
graph.CheckLogIn(it, v) graph.CheckLogIn(it, v)
if it.tree.Has(Int64(v.(int64))) { if it.tree.Has(Int64(v.(int64))) {
it.Last = v it.Last = v

View file

@ -217,11 +217,11 @@ func (ts *TripleStore) RemoveTriple(t *graph.Triple) {
} }
} }
func (ts *TripleStore) Triple(index graph.TSVal) *graph.Triple { func (ts *TripleStore) Triple(index graph.Value) *graph.Triple {
return &ts.triples[index.(int64)] return &ts.triples[index.(int64)]
} }
func (ts *TripleStore) TripleIterator(d graph.Direction, value graph.TSVal) graph.Iterator { func (ts *TripleStore) TripleIterator(d graph.Direction, value graph.Value) graph.Iterator {
index, ok := ts.index.Get(d, value.(int64)) index, ok := ts.index.Get(d, value.(int64))
data := fmt.Sprintf("dir:%s val:%d", d, value.(int64)) data := fmt.Sprintf("dir:%s val:%d", d, value.(int64))
if ok { if ok {
@ -243,11 +243,11 @@ func (ts *TripleStore) DebugPrint() {
} }
} }
func (ts *TripleStore) ValueOf(name string) graph.TSVal { func (ts *TripleStore) ValueOf(name string) graph.Value {
return ts.idMap[name] return ts.idMap[name]
} }
func (ts *TripleStore) NameOf(id graph.TSVal) string { func (ts *TripleStore) NameOf(id graph.Value) string {
return ts.revIdMap[id.(int64)] return ts.revIdMap[id.(int64)]
} }
@ -259,7 +259,7 @@ func (ts *TripleStore) FixedIterator() graph.FixedIterator {
return iterator.NewFixedIteratorWithCompare(iterator.BasicEquality) return iterator.NewFixedIteratorWithCompare(iterator.BasicEquality)
} }
func (ts *TripleStore) TripleDirection(val graph.TSVal, d graph.Direction) graph.TSVal { func (ts *TripleStore) TripleDirection(val graph.Value, d graph.Direction) graph.Value {
name := ts.Triple(val).Get(d) name := ts.Triple(val).Get(d)
return ts.ValueOf(name) return ts.ValueOf(name)
} }

View file

@ -39,7 +39,7 @@ type Iterator struct {
collection string collection string
} }
func NewIterator(ts *TripleStore, collection string, d graph.Direction, val graph.TSVal) *Iterator { func NewIterator(ts *TripleStore, collection string, d graph.Direction, val graph.Value) *Iterator {
var m Iterator var m Iterator
iterator.BaseInit(&m.Base) iterator.BaseInit(&m.Base)
@ -109,7 +109,7 @@ func (it *Iterator) Clone() graph.Iterator {
return newM return newM
} }
func (it *Iterator) Next() (graph.TSVal, bool) { func (it *Iterator) Next() (graph.Value, bool) {
var result struct { var result struct {
Id string "_id" Id string "_id"
//Sub string "Sub" //Sub string "Sub"
@ -128,7 +128,7 @@ func (it *Iterator) Next() (graph.TSVal, bool) {
return result.Id, true return result.Id, true
} }
func (it *Iterator) Check(v graph.TSVal) bool { func (it *Iterator) Check(v graph.Value) bool {
graph.CheckLogIn(it, v) graph.CheckLogIn(it, v)
if it.isAll { if it.isAll {
it.Last = v it.Last = v

View file

@ -209,7 +209,7 @@ func (ts *TripleStore) RemoveTriple(t *graph.Triple) {
} }
} }
func (ts *TripleStore) Triple(val graph.TSVal) *graph.Triple { func (ts *TripleStore) Triple(val graph.Value) *graph.Triple {
var bsonDoc bson.M var bsonDoc bson.M
err := ts.db.C("triples").FindId(val.(string)).One(&bsonDoc) err := ts.db.C("triples").FindId(val.(string)).One(&bsonDoc)
if err != nil { if err != nil {
@ -223,7 +223,7 @@ func (ts *TripleStore) Triple(val graph.TSVal) *graph.Triple {
} }
} }
func (ts *TripleStore) TripleIterator(d graph.Direction, val graph.TSVal) graph.Iterator { func (ts *TripleStore) TripleIterator(d graph.Direction, val graph.Value) graph.Iterator {
return NewIterator(ts, "triples", d, val) return NewIterator(ts, "triples", d, val)
} }
@ -235,11 +235,11 @@ func (ts *TripleStore) TriplesAllIterator() graph.Iterator {
return NewAllIterator(ts, "triples") return NewAllIterator(ts, "triples")
} }
func (ts *TripleStore) ValueOf(s string) graph.TSVal { func (ts *TripleStore) ValueOf(s string) graph.Value {
return ts.ConvertStringToByteHash(s) return ts.ConvertStringToByteHash(s)
} }
func (ts *TripleStore) NameOf(v graph.TSVal) string { func (ts *TripleStore) NameOf(v graph.Value) string {
val, ok := ts.idCache.Get(v.(string)) val, ok := ts.idCache.Get(v.(string))
if ok { if ok {
return val return val
@ -262,7 +262,7 @@ func (ts *TripleStore) Size() int64 {
return int64(count) return int64(count)
} }
func compareStrings(a, b graph.TSVal) bool { func compareStrings(a, b graph.Value) bool {
return a.(string) == b.(string) return a.(string) == b.(string)
} }
@ -274,7 +274,7 @@ func (ts *TripleStore) Close() {
ts.db.Session.Close() ts.db.Session.Close()
} }
func (ts *TripleStore) TripleDirection(in graph.TSVal, d graph.Direction) graph.TSVal { func (ts *TripleStore) TripleDirection(in graph.Value, d graph.Direction) graph.Value {
// Maybe do the trick here // Maybe do the trick here
var offset int var offset int
switch d { switch d {

View file

@ -17,11 +17,11 @@ package graph
import "fmt" import "fmt"
type ResultTree struct { type ResultTree struct {
result TSVal result Value
subtrees []*ResultTree subtrees []*ResultTree
} }
func NewResultTree(result TSVal) *ResultTree { func NewResultTree(result Value) *ResultTree {
return &ResultTree{result: result} return &ResultTree{result: result}
} }

View file

@ -95,7 +95,7 @@ func TestTreeConstraintTagParse(t *testing.T) {
if !ok { if !ok {
t.Error("Got no results") t.Error("Got no results")
} }
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
if ts.NameOf(tags["$a"]) != "food" { if ts.NameOf(tags["$a"]) != "food" {
t.Errorf("Got %s, expected food", ts.NameOf(tags["$a"])) t.Errorf("Got %s, expected food", ts.NameOf(tags["$a"]))

View file

@ -81,7 +81,7 @@ func (s *Session) ExecInput(input string, out chan interface{}, limit int) {
if !ok { if !ok {
break break
} }
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
out <- &tags out <- &tags
nResults++ nResults++
@ -89,7 +89,7 @@ func (s *Session) ExecInput(input string, out chan interface{}, limit int) {
break break
} }
for it.NextResult() == true { for it.NextResult() == true {
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
out <- &tags out <- &tags
nResults++ nResults++
@ -103,7 +103,7 @@ func (s *Session) ExecInput(input string, out chan interface{}, limit int) {
func (s *Session) ToText(result interface{}) string { func (s *Session) ToText(result interface{}) string {
out := fmt.Sprintln("****") out := fmt.Sprintln("****")
tags := result.(map[string]graph.TSVal) tags := result.(map[string]graph.Value)
tagKeys := make([]string, len(tags)) tagKeys := make([]string, len(tags))
i := 0 i := 0
for k := range tags { for k := range tags {

View file

@ -26,14 +26,14 @@ import (
) )
// Defines an opaque "triple store value" type. However the backend wishes to // Defines an opaque "triple store value" type. However the backend wishes to
// implement it, a TSVal is merely a token to a triple or a node that the backing // implement it, a Value is merely a token to a triple or a node that the backing
// store itself understands, and the base iterators pass around. // store itself understands, and the base iterators pass around.
// //
// For example, in a very traditional, graphd-style graph, these are int64s // For example, in a very traditional, graphd-style graph, these are int64s
// (guids of the primitives). In a very direct sort of graph, these could be // (guids of the primitives). In a very direct sort of graph, these could be
// pointers to structs, or merely triples, or whatever works best for the // pointers to structs, or merely triples, or whatever works best for the
// backing store. // backing store.
type TSVal interface{} type Value interface{}
type TripleStore interface { type TripleStore interface {
// Add a triple to the store. // Add a triple to the store.
@ -47,11 +47,11 @@ type TripleStore interface {
RemoveTriple(*Triple) RemoveTriple(*Triple)
// Given an opaque token, returns the triple for that token from the store. // Given an opaque token, returns the triple for that token from the store.
Triple(TSVal) *Triple Triple(Value) *Triple
// Given a direction and a token, creates an iterator of links which have // Given a direction and a token, creates an iterator of links which have
// that node token in that directional field. // that node token in that directional field.
TripleIterator(Direction, TSVal) Iterator TripleIterator(Direction, Value) Iterator
// Returns an iterator enumerating all nodes in the graph. // Returns an iterator enumerating all nodes in the graph.
NodesAllIterator() Iterator NodesAllIterator() Iterator
@ -61,15 +61,15 @@ type TripleStore interface {
// Given a node ID, return the opaque token used by the TripleStore // Given a node ID, return the opaque token used by the TripleStore
// to represent that id. // to represent that id.
ValueOf(string) TSVal ValueOf(string) Value
// Given an opaque token, return the node that it represents. // Given an opaque token, return the node that it represents.
NameOf(TSVal) string NameOf(Value) string
// Returns the number of triples currently stored. // Returns the number of triples currently stored.
Size() int64 Size() int64
// Creates a fixed iterator which can compare TSVals // Creates a fixed iterator which can compare Values
FixedIterator() FixedIterator FixedIterator() FixedIterator
// Optimize an iterator in the context of the triple store. // Optimize an iterator in the context of the triple store.
@ -89,7 +89,7 @@ type TripleStore interface {
// //
// Iterators will call this. At worst, a valid implementation is // Iterators will call this. At worst, a valid implementation is
// ts.IdFor(ts.Triple(triple_id).Get(dir)) // ts.IdFor(ts.Triple(triple_id).Get(dir))
TripleDirection(triple_id TSVal, d Direction) TSVal TripleDirection(triple_id Value, d Direction) Value
} }
type Options map[string]interface{} type Options map[string]interface{}

View file

@ -135,7 +135,7 @@ func mapFunc(env *otto.Otto, ses *Session, obj *otto.Object) func(otto.FunctionC
} }
} }
func tagsToValueMap(m map[string]graph.TSVal, ses *Session) map[string]string { func tagsToValueMap(m map[string]graph.Value, ses *Session) map[string]string {
outputMap := make(map[string]string) outputMap := make(map[string]string)
for k, v := range m { for k, v := range m {
outputMap[k] = ses.ts.NameOf(v) outputMap[k] = ses.ts.NameOf(v)
@ -155,7 +155,7 @@ func runIteratorToArray(it graph.Iterator, ses *Session, limit int) []map[string
if !ok { if !ok {
break break
} }
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
output = append(output, tagsToValueMap(tags, ses)) output = append(output, tagsToValueMap(tags, ses))
count++ count++
@ -166,7 +166,7 @@ func runIteratorToArray(it graph.Iterator, ses *Session, limit int) []map[string
if ses.doHalt { if ses.doHalt {
return nil return nil
} }
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
output = append(output, tagsToValueMap(tags, ses)) output = append(output, tagsToValueMap(tags, ses))
count++ count++
@ -212,7 +212,7 @@ func runIteratorWithCallback(it graph.Iterator, ses *Session, callback otto.Valu
if !ok { if !ok {
break break
} }
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
val, _ := this.Otto.ToValue(tagsToValueMap(tags, ses)) val, _ := this.Otto.ToValue(tagsToValueMap(tags, ses))
val, _ = callback.Call(this.This, val) val, _ = callback.Call(this.This, val)
@ -224,7 +224,7 @@ func runIteratorWithCallback(it graph.Iterator, ses *Session, callback otto.Valu
if ses.doHalt { if ses.doHalt {
return return
} }
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
val, _ := this.Otto.ToValue(tagsToValueMap(tags, ses)) val, _ := this.Otto.ToValue(tagsToValueMap(tags, ses))
val, _ = callback.Call(this.This, val) val, _ = callback.Call(this.This, val)
@ -253,7 +253,7 @@ func runIteratorOnSession(it graph.Iterator, ses *Session) {
if !ok { if !ok {
break break
} }
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
cont := ses.SendResult(&GremlinResult{metaresult: false, err: "", val: nil, actualResults: &tags}) cont := ses.SendResult(&GremlinResult{metaresult: false, err: "", val: nil, actualResults: &tags})
if !cont { if !cont {
@ -263,7 +263,7 @@ func runIteratorOnSession(it graph.Iterator, ses *Session) {
if ses.doHalt { if ses.doHalt {
return return
} }
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
cont := ses.SendResult(&GremlinResult{metaresult: false, err: "", val: nil, actualResults: &tags}) cont := ses.SendResult(&GremlinResult{metaresult: false, err: "", val: nil, actualResults: &tags})
if !cont { if !cont {

View file

@ -65,7 +65,7 @@ type GremlinResult struct {
metaresult bool metaresult bool
err string err string
val *otto.Value val *otto.Value
actualResults *map[string]graph.TSVal actualResults *map[string]graph.Value
} }
func (s *Session) ToggleDebug() { func (s *Session) ToggleDebug() {

View file

@ -20,7 +20,7 @@ import (
"github.com/google/cayley/graph" "github.com/google/cayley/graph"
) )
func (q *Query) treeifyResult(tags map[string]graph.TSVal) map[ResultPath]string { func (q *Query) treeifyResult(tags map[string]graph.Value) map[ResultPath]string {
// Transform the map into something a little more interesting. // Transform the map into something a little more interesting.
results := make(map[Path]string) results := make(map[Path]string)
for k, v := range tags { for k, v := range tags {

View file

@ -92,11 +92,11 @@ func (s *Session) ExecInput(input string, c chan interface{}, limit int) {
if !ok { if !ok {
break break
} }
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
c <- tags c <- tags
for it.NextResult() == true { for it.NextResult() == true {
tags := make(map[string]graph.TSVal) tags := make(map[string]graph.Value)
it.TagResults(tags) it.TagResults(tags)
c <- tags c <- tags
} }
@ -104,7 +104,7 @@ func (s *Session) ExecInput(input string, c chan interface{}, limit int) {
} }
func (s *Session) ToText(result interface{}) string { func (s *Session) ToText(result interface{}) string {
tags := result.(map[string]graph.TSVal) tags := result.(map[string]graph.Value)
out := fmt.Sprintln("****") out := fmt.Sprintln("****")
tagKeys := make([]string, len(tags)) tagKeys := make([]string, len(tags))
s.currentQuery.treeifyResult(tags) s.currentQuery.treeifyResult(tags)
@ -127,7 +127,7 @@ func (s *Session) ToText(result interface{}) string {
} }
func (s *Session) BuildJson(result interface{}) { func (s *Session) BuildJson(result interface{}) {
s.currentQuery.treeifyResult(result.(map[string]graph.TSVal)) s.currentQuery.treeifyResult(result.(map[string]graph.Value))
} }
func (s *Session) GetJson() (interface{}, error) { func (s *Session) GetJson() (interface{}, error) {