本文整理汇总了Golang中github.com/google/badwolf/triple/predicate.Predicate.GUID方法的典型用法代码示例。如果您正苦于以下问题:Golang Predicate.GUID方法的具体用法?Golang Predicate.GUID怎么用?Golang Predicate.GUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/google/badwolf/triple/predicate.Predicate
的用法示例。
在下文中一共展示了Predicate.GUID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TriplesForPredicate
// TriplesForPredicate returns all triples available for the given predicate.
func (m *memory) TriplesForPredicate(p *predicate.Predicate, lo *storage.LookupOptions) (storage.Triples, error) {
pGUID := p.GUID()
m.rwmu.RLock()
triples := make(chan *triple.Triple, len(m.idxP[pGUID]))
go func() {
ckr := newChecker(lo)
for _, t := range m.idxP[pGUID] {
if ckr.CheckAndUpdate(t.Predicate()) {
triples <- t
}
}
m.rwmu.RUnlock()
close(triples)
}()
return triples, nil
}
示例2: TriplesForPredicateAndObject
// TriplesForPredicateAndObject returns all triples available for the given
// predicate and object.
func (m *memory) TriplesForPredicateAndObject(p *predicate.Predicate, o *triple.Object, lo *storage.LookupOptions) (storage.Triples, error) {
pGUID := p.GUID()
oGUID := o.GUID()
poIdx := strings.Join([]string{pGUID, oGUID}, ":")
m.rwmu.RLock()
triples := make(chan *triple.Triple, len(m.idxPO[poIdx]))
go func() {
ckr := newChecker(lo)
for _, t := range m.idxPO[poIdx] {
if ckr.CheckAndUpdate(t.P()) {
triples <- t
}
}
m.rwmu.RUnlock()
close(triples)
}()
return triples, nil
}
示例3: TriplesForSubjectAndPredicate
// TriplesForSubjectAndPredicate returns all triples available for the given
// subject and predicate.
func (m *memory) TriplesForSubjectAndPredicate(s *node.Node, p *predicate.Predicate, lo *storage.LookupOptions) (storage.Triples, error) {
sGUID := s.GUID()
pGUID := p.GUID()
spIdx := strings.Join([]string{sGUID, pGUID}, ":")
m.rwmu.RLock()
triples := make(chan *triple.Triple, len(m.idxSP[spIdx]))
go func() {
ckr := newChecker(lo)
for _, t := range m.idxSP[spIdx] {
if ckr.CheckAndUpdate(t.P()) {
triples <- t
}
}
m.rwmu.RUnlock()
close(triples)
}()
return triples, nil
}
示例4: Subjects
// Subject returns the subjects for the give predicate and object.
func (m *memory) Subjects(p *predicate.Predicate, o *triple.Object, lo *storage.LookupOptions) (storage.Nodes, error) {
pGUID := p.GUID()
oGUID := o.GUID()
poIdx := strings.Join([]string{pGUID, oGUID}, ":")
m.rwmu.RLock()
subs := make(chan *node.Node, len(m.idxPO[poIdx]))
go func() {
ckr := newChecker(lo)
for _, t := range m.idxPO[poIdx] {
if ckr.CheckAndUpdate(t.P()) {
subs <- t.S()
}
}
m.rwmu.RUnlock()
close(subs)
}()
return subs, nil
}
示例5: Objects
// Objects returns the objects for the give object and predicate.
func (m *memory) Objects(ctx context.Context, s *node.Node, p *predicate.Predicate, lo *storage.LookupOptions) (storage.Objects, error) {
sGUID := s.GUID()
pGUID := p.GUID()
spIdx := strings.Join([]string{sGUID, pGUID}, ":")
m.rwmu.RLock()
objs := make(chan *triple.Object, len(m.idxSP[spIdx]))
go func() {
ckr := newChecker(lo)
for _, t := range m.idxSP[spIdx] {
if ckr.CheckAndUpdate(t.Predicate()) {
objs <- t.Object()
}
}
m.rwmu.RUnlock()
close(objs)
}()
return objs, nil
}