Comments (9)
This is trivially implemented, but the design is important. How do you propose to detect compressed input? Easier and more brittle is to go by extensions, more robust is to use magic numbers for bzip2 and gzip
@barakmich, your view?
from cayley.
Easiest ways is detect compressed input by file extension or add "--format" parameter "./cayley http --dbpath=30kmovies.nt.zip --format=zip".
The reason of doing it is to save space on HDD. Sometimes it's hard to find 300Gb of space especially on rented hardware (VPS, Cloud services).
from cayley.
I'm not keen on adding a flag for this; it allows a greater opportunity for discordance between data and processing. Per extension is easy:
func extension(file *os.File) (io.Reader, error) {
switch filepath.Ext(file.Name()) {
case ".gz", ".gzip":
return gzip.NewReader(f)
case ".bz2":
return bzip2.NewReader(f), nil
default:
return f, nil
}
}
All magic number determination needs is a read of the head of the file to get the file type (gzip[:] == "\x1f\x8b" and b2zip[:3] == "BZh"). This is not difficult:
const (
gzipMagic = "\x1f\x8b"
b2zipMagic = "BZh"
)
type readAtReader interface {
io.Reader
io.ReaderAt
}
func magic(r readAtReader) (io.Reader, error) {
var buf [3]byte
_, err := r.ReadAt(buf[:], 0)
if err != nil {
return nil, err
}
switch {
case bytes.Compare(buf[:2], []byte(gzipMagic)) == 0:
return gzip.NewReader(r)
case bytes.Compare(buf[:3], []byte(b2zipMagic)) == 0:
return bzip2.NewReader(r), nil
default:
return r, nil
}
}
from cayley.
Sounds very good. Can you please make pull request? I really need to be able to search data in FreeBase compressed database as soon as possible. Thanks.
from cayley.
I'm waiting on Barak's input. I'd prefer the magic number approach, but I'll defer to his view on this.
from cayley.
Currently I seeing process of using this database:
- Load data into Level DB, MongoDB etc.
- Use loaded data in step 1 in Cayley.
My questions are:
- Is it possible to use gziped FreeBase data dump in Cayley as backend without loading dump into database? As I can see from examples of using Cayley it's possible to use only unpacked FreeBase data dump but it require a lot of RAM.
- If Q1 is not possible. To speed up process and reduce RAM usage. Is it possible to load only into Level DB, MongoDB etc. only need data from gziped FreeBase data dump? For example I need only
music
domain.
To make Cayley usable I cut needed data with few grep
s then using Cayley to query it.
from cayley.
This was fixed by 984ab6f.
from cayley.
Thanks. I'll test it as soon as new version of binaries will be released for Mac OS X.
from cayley.
0.3.1 is available (point release, yay)
from cayley.
Related Issues (20)
- 'go build ./cmd/cayley' breaks: missing go.sum entry for module providing package github.com/golang/protobuf/proto HOT 3
- Move cayley.io to Github Pages or Netlify or similar HOT 1
- Aggregations
- Code quality: NameOf and ValueOf should return errors HOT 2
- Relationships not displaying correctly in new cayley version HOT 1
- Cayley.io is down again HOT 10
- Seeking for a new maintainer HOT 13
- hidalgo: interfaces changed a bit in newer versions HOT 2
- Security issue with github.com/gogo/protobuf version < 1.3.2 HOT 2
- Repl Allows One Command to Execute and Subsequent Commands Fail HOT 1
- request a new release HOT 1
- Filter path by Label field of quads HOT 1
- Filter path by empty label field (FilterContext) HOT 1
- Plans for a new release? HOT 2
- Build Issue using cayley 0.7.7 HOT 1
- q InternalQuad ==> q *InternalQuad
- gio gui HOT 1
- Plans for a new release?
- Discourse forum down
- Is this project dead? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cayley.