当前位置: 首页>>代码示例>>Golang>>正文


Golang Predicate.GUID方法代码示例

本文整理汇总了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
}
开发者ID:defrager,项目名称:badwolf,代码行数:17,代码来源:memory.go

示例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
}
开发者ID:rtu,项目名称:badwolf,代码行数:20,代码来源:memory.go

示例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
}
开发者ID:rtu,项目名称:badwolf,代码行数:20,代码来源:memory.go

示例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
}
开发者ID:rtu,项目名称:badwolf,代码行数:19,代码来源:memory.go

示例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
}
开发者ID:msingle,项目名称:badwolf,代码行数:19,代码来源:memory.go


注:本文中的github.com/google/badwolf/triple/predicate.Predicate.GUID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。