本文整理汇总了Golang中github.com/google/badwolf/triple.Object类的典型用法代码示例。如果您正苦于以下问题:Golang Object类的具体用法?Golang Object怎么用?Golang Object使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Object类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TriplesForObject
// TriplesForObject returns all triples available for a given object.
func (m *memory) TriplesForObject(o *triple.Object, lo *storage.LookupOptions) (storage.Triples, error) {
oGUID := o.GUID()
m.rwmu.RLock()
triples := make(chan *triple.Triple, len(m.idxO[oGUID]))
go func() {
ckr := newChecker(lo)
for _, t := range m.idxO[oGUID] {
if ckr.CheckAndUpdate(t.P()) {
triples <- t
}
}
m.rwmu.RUnlock()
close(triples)
}()
return triples, nil
}
开发者ID:rtu,项目名称:badwolf,代码行数:17,代码来源:memory.go
示例2: PredicatesForObject
// PredicatesForObject returns all the predicates known for the given object.
func (m *memory) PredicatesForObject(o *triple.Object, lo *storage.LookupOptions) (storage.Predicates, error) {
oGUID := o.GUID()
m.rwmu.RLock()
preds := make(chan *predicate.Predicate, len(m.idxO[oGUID]))
go func() {
ckr := newChecker(lo)
for _, t := range m.idxO[oGUID] {
if ckr.CheckAndUpdate(t.Predicate()) {
preds <- t.Predicate()
}
}
m.rwmu.RUnlock()
close(preds)
}()
return preds, nil
}
开发者ID:defrager,项目名称:badwolf,代码行数:17,代码来源:memory.go
示例3: 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
示例4: PredicatesForSubjectAndObject
// PredicatesForSubjecAndObject returns all predicates available for the
// given subject and object.
func (m *memory) PredicatesForSubjectAndObject(s *node.Node, o *triple.Object, lo *storage.LookupOptions) (storage.Predicates, error) {
sGUID := s.GUID()
oGUID := o.GUID()
soIdx := strings.Join([]string{sGUID, oGUID}, ":")
m.rwmu.RLock()
preds := make(chan *predicate.Predicate, len(m.idxSO[soIdx]))
go func() {
ckr := newChecker(lo)
for _, t := range m.idxSO[soIdx] {
if ckr.CheckAndUpdate(t.P()) {
preds <- t.P()
}
}
m.rwmu.RUnlock()
close(preds)
}()
return preds, nil
}
开发者ID:rtu,项目名称:badwolf,代码行数:20,代码来源:memory.go
示例5: 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
示例6: objectToCell
// objectToCell returns a cell containing the data boxed in the object.
func objectToCell(o *triple.Object) (*table.Cell, error) {
c := &table.Cell{}
if n, err := o.Node(); err == nil {
c.N = n
return c, nil
}
if p, err := o.Predicate(); err == nil {
c.P = p
return c, nil
}
if l, err := o.Literal(); err == nil {
c.L = l
return c, nil
}
return nil, fmt.Errorf("unknown object type in object %q", o)
}
开发者ID:defrager,项目名称:badwolf,代码行数:17,代码来源:data_access.go
注:本文中的github.com/google/badwolf/triple.Object类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论