-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Example program:
package main
import (
"fmt"
"github.com/cayleygraph/cayley"
"github.com/cayleygraph/quad"
)
func main() {
store, err := cayley.NewMemoryGraph()
if err != nil {
panic(err)
}
store.AddQuad(quad.MakeIRI("node1", "predicate", "node2", ""))
store.AddQuad(quad.MakeIRI("node1", "predicate", "node3", "myvalue"))
store.AddQuad(quad.MakeIRI("node1", "predicate", "node4", "othervalue"))
// Expected output, <node2>
p := cayley.
StartPath(store, quad.IRI("node1")).
// TODO: limit to just node2 (empty label field)
// LabelContext(""). - doesn't work, lists none
// LabelContext(quad.IRI("")). - doesn't work, lists none
// LabelContext(quad.Raw("")). - doesn't work, lists node3 and node4 (???)
// LabelContext(nil). - doesn't work, lists node3 and node4 (??)
Out(quad.IRI("predicate"))
it := p.Iterate(nil)
err = it.EachValue(nil, func(value quad.Value) error {
nativeValue := quad.NativeOf(value) // this converts RDF values to normal Go types
fmt.Println(nativeValue)
return nil
})
if err != nil {
fmt.Println(err.Error())
}
}None of these successfully limit to just the quad with the empty Label:
// LabelContext(""). - doesn't work, lists none
// LabelContext(quad.IRI("")). - doesn't work, lists none
// LabelContext(quad.Raw("")). - doesn't work, lists node3 and node4 (???)
// LabelContext(nil). - doesn't work, lists node3 and node4 (??)
How can I do that?
Additionally, I don't understand why empty string "" and nil both return the values that have populated Label fields but not the one that has an empty Label field. Shouldn't it be the other way around?
Metadata
Metadata
Assignees
Labels
No labels