本文整理匯總了Golang中github.com/google/cayley/graph.TripleStore.GetNameFor方法的典型用法代碼示例。如果您正苦於以下問題:Golang TripleStore.GetNameFor方法的具體用法?Golang TripleStore.GetNameFor怎麽用?Golang TripleStore.GetNameFor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/google/cayley/graph.TripleStore
的用法示例。
在下文中一共展示了TripleStore.GetNameFor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: checkIteratorContains
func checkIteratorContains(ts graph.TripleStore, it graph.Iterator, expected []string, t *testing.T) {
var actual []string
actual = nil
for {
val, ok := it.Next()
if !ok {
break
}
actual = append(actual, ts.GetNameFor(val))
}
actualSet := actual[:]
for _, a := range expected {
found := false
for j, b := range actualSet {
if a == b {
actualSet = append(actualSet[:j], actualSet[j+1:]...)
found = true
break
}
}
if !found {
t.Error("Couldn't find", a, "in actual output.\nActual:", actual, "\nExpected: ", expected, "\nRemainder: ", actualSet)
return
}
}
if len(actualSet) != 0 {
t.Error("Actual output has more than expected.\nActual:", actual, "\nExpected: ", expected, "\nRemainder: ", actualSet)
}
}
示例2: extractValuesFromIterator
func extractValuesFromIterator(ts graph.TripleStore, it graph.Iterator) []string {
var output []string
for {
val, ok := it.Next()
if !ok {
break
}
output = append(output, ts.GetNameFor(val))
}
return output
}