[elephant-devel] indexing in elephant
Alex Mizrahi
killerstorm at newmail.ru
Tue Dec 22 23:23:52 UTC 2009
> 2. What we have decided is to make separate persistent class for each
> predicate.
So, class is a predicate, right?
>3. (defpclass dependson ()
> ((subject :accessor subject)
> (predicate :accessor predicate)
> (object :accessor object)))
Why do you need a predicate slot then? Predicate for dependson class is
dependson.
> 4. How do I index a slot so that later if I have a query where I have been
provided with two slot values I should be able to get the third slot value.
For example: Force-dependson-? should return "mass" and "acceleration".
Elephant implements (on a low level) key-value pair store rather than a
triple store.
If you want a triple store, there are basically two way to do it -- either
use
compound keys, e.g. (subject, predicate)->object.
Or use nested key-value stores, something like
subject->(predicate->object).
Class-per-predicate essentially implements later approach with nested
key-value stores -- because each class in Elephant has its own btrees
for indices.
So, just use get-instances-by-value. Like
(ele:get-instances-by-value 'dependson 'object value)
or
(ele:get-instances-by-value 'dependson 'subject value)
Pretty obvious, no?
Either you've got confused by your own constructs, or I've misunderstood
something.
More information about the elephant-devel
mailing list