Skip to content

store4 is a Go package providing a fast in-memory quad store, with graph and subject views.

License

Notifications You must be signed in to change notification settings

jimsmart/store4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

store4

MIT Build Status codecov Go Report Card Used By Godoc

store4 is a Go package providing a fast in-memory quad store, with graph and subject views.

Installation

go get github.com/jimsmart/store4
import "github.com/jimsmart/store4"

Dependencies

  • Standard library.
  • Ginkgo and Gomega if you wish to run the tests.

Example

import "github.com/jimsmart/store4"

s := store4.NewQuadStore()
s.Add("Alice", "knows", "Bob", "")
s.Add("Alice", "knows", "Charlie", "")
s.Add("Charlie", "knows", "Bob", "")
s.Add("Charlie", "age", 23, "")

// Find everyone that Alice knows, in any graph.
x := s.FindObjects("Alice", "knows", "*")

// Find everyone who knows Charlie, in the unnamed/default graph.
y := s.FindSubjects("knows", "Charlie", "")

// Iterate over all quads.
s.ForEach(func(s, p string, o interface{}, g string) {
    // ...
})

// Iterate over quads matching given pattern.
s.ForEachWith("*", "*", "Bob", "*", func(s, p string, o interface{}, g string) {
    // ...
})

// Remove all statements about Charlie, from all graphs.
s.Remove("Charlie", "*", "*", "*")

See GoDocs for more detailed examples.

Documentation

GoDocs https://godoc.org/github.com/jimsmart/store4

Testing

Package store4 is extensively tested:

  • 200+ Gingko specs (see *_test.go)
  • Example code for most methods, with verified output (see *_examples_test.go)

To run the tests execute go test inside the project folder.

For a full coverage report, try:

go test -coverprofile=coverage.out && go tool cover -html=coverage.out

License

Package store4 is copyright 2016 by Jim Smart and released under the MIT License

Additional credits

The internals of QuadStore draw heavily from the implementation of N3Store, a component of N3.js. The N3.js library is copyrighted by Ruben Verborgh and released under the MIT License.

History

  • v0.0.1 (2021-04-19) Use Go modules. Enable CI using GitHub Actions. Remove Travis.

About

store4 is a Go package providing a fast in-memory quad store, with graph and subject views.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages