how to query?
soloturn opened this issue · comments
looks very cool @ysimonson, imorting such a big xml file iis very quick. after make it starts up:
target/release/indradb-wikipedia --database-path data/wikipedia.rdb explore
grpc://127.0.0.1:27615
for beginners this is a little steep.
> ./indradb/target/release/indradb-client grpc://127.0.0.1:27615 ping
ok
to make it a little quicker i tried to use wikiquote dump
which for example contains a page for obama
<page>
<title>Barack Obama</title>
<ns>0</ns>
<id>4620</id>
<revision>
<id>3088861</id>
<parentid>3075964</parentid>
<timestamp>2022-03-20T16:31:20Z</timestamp>
<contributor>
<username>MusenInvincible</username>
<id>2414756</id>
</contributor>
<comment>/* 2010 */</comment>
how then to query it or list the contents?
> ./indradb/target/release/indradb-client grpc://127.0.0.1:27615 get vertex "Barack Obama"
Error: Error(Parser(InvalidLength { expected: Any([36, 32]), found: 12 }))
> ./indradb/target/release/indradb-client grpc://127.0.0.1:27615 get vertex 4620
Error: Error(Parser(InvalidLength { expected: Any([36, 32]), found: 4 }))
> ./indradb/target/release/indradb-client grpc://127.0.0.1:27615 get vertex 3088861
Error: Error(Parser(InvalidLength { expected: Any([36, 32]), found: 7 }))
- Run
make explore
- Visit
http://localhost:8080
in the browser
Then you can search for whatever article name
I noticed these instructions weren't in the readme, fixed! Going to close this out, but let me know if there's anything else that didn't make sense.
thanks @ysimonson ! i tried to add "trim" to the search string, and followed this one:
https://www.youtube.com/watch?v=HNnbIW2Kzbc
with:
> cargo watch -q -c -w src -x "run -- --database-path data/wikipedia.rdb"
Finished dev [unoptimized + debuginfo] target(s) in 0.11s
Running `target/debug/indradb-wikipedia --database-path data/wikipedia.rdb`
grpc://127.0.0.1:27615
thread 'main' panicked at 'no subcommand specified', src/main.rs:109:9
you d have a hint how to start this correctly?
I don’t use cargo watch, so not 100% sure, but it looks like the subcommand isn’t being passed in. Probably need to add “explore” after the first double dashes.
for the how to query question, there is a relevant ticket in indradb.
indradb/indradb#94.
summary of comments from this ticket to make the reaading quicker:
IndraDB has its own query language, https://github.com/indradb/indradb/blob/master/proto/indradb.proto .
IndraDB isn't optimized for running comparison checks on properties, and the query language is purposefully designed to not expose functionality that it can't execute efficiently. If comparisons on properties are necessary, a relational database would be the way to go. Or maybe neo4j, but I'm not privy to it's internal design and whether they efficiently handle this stuff.
Something like cypher could be adopted, but since it would have query parsing overhead and (more importantly) allow for the execution of inefficient queries, it would be substantially slower. I'd still be open to adding it though, because it would be "firewalled" away to a separate interface, with users still being able to use the native query language if they need full performance.
No changes to lib should be necessary, it'd be just some new endpoints exposed in bin that take in a cypher query. I can sketch out some more details, but would need a firm commitment from someone to develop this.