[elephant-devel] Newbie question: Index on collections

Marc klists at saphor.de
Wed Mar 19 06:42:44 UTC 2008


Hi Ian,
>
> My best guess is weeks, not months.  We're hoping for April sometime, 
> but it depends on a number of factors.  Elephant is getting quite 
> complex to test so the last few bugs can take some time.
>
> You can speed this process up if you want to help develop and test the 
> association facility (most of the hooks are there so it shouldn't be 
> too hard, even if you don't fully understand the elephant internals).  
> If not, we have plenty of new features that need tests written against 
> them!
Since we need this feature anyway for our application, I'm quite 
prepared to join in the work on the association facility. Any pointer on 
what would be the best entry point into that task?

Best regards,

Marc
>
> On Mar 18, 2008, at 12:50 AM, Marc wrote:
>
>> Ian Eslick wrote:
>>> The pset is probably your best bet.  Other collection objects have 
>>> more performance impact.  With a pset you can ask:
>>>
>>> is X a friend of Y?  (find-item X (friends Y)) => X | nil
>>>
>>> all people that X is friends of:
>>>
>>> (remove-nulls
>>>  (map-class 'people (lambda (y)
>>>                        (when (find-item X (friends Y))
>>>                           Y))
>>>             :collect t))
>>>
>>> This requires walking all person objects.  For larger DB's, you can 
>>> build your own 'many-to-many' relation table or waiting for the next 
>>> release which should do this for you.
>> Is there a time line (however preliminary) when this release might be
>> available?
>>>
>>> (defpclass friend-relation ()
>>>   ((first :accessor first :initarg :first :index t)
>>>    (second :accessor second :initarg :second :index t)))
>>>
>>> (defmethod add-friend-relation (x y)
>>>   (make-instance 'friend-relation :first x :second y))
>>>
>>> (defmethod friends-of (x)
>>>   (union (mapcar #'second (get-instances-by-slot 'friend-relation 
>>> 'first x))
>>>          (mapcar #'first (get-instances-by-slot 'friend-relation 
>>> 'second x))))
>>>
>>> Of course there are ways to do this more efficiently, but I think 
>>> this is the idea.
>>>
>> Many thanks for this guidance. That does, indeed, give me an idea of the
>> best way forward in our application.
>>
>>
>> Best regards,
>>
>> Marc
>>
>>>
>>>
>>> On Mar 16, 2008, at 11:06 PM, Marc wrote:
>>>
>>>> Hello!
>>>>
>>>> I fear that this may be a rather stupid newbie question, but 
>>>> neither from the documentation nor from the mailing list posts I 
>>>> got an idea as to the best practice for the following type of 
>>>> searches. Let's use an example akin to the one in the tutorial:
>>>>
>>>> (defpclass person ()
>>>> ((name :accessor name :index t)
>>>> (friends :accessor friends)) ;collection with names (say as 
>>>> strings) of the friends of this person
>>>> )
>>>>
>>>> Given a similar structure, what is the recommended way to handle 
>>>> queries of the type "find all persons that X is a friend of?" (i.e. 
>>>> queries on individual entries in slots that contain collections)? 
>>>> What would be the best data structure for the friends slot, 
>>>> assuming that the collection remains fairly stable over time 
>>>> (psets, lists or other collections)?
>>>>
>>>> Thanks in advance for any hint!
>>>>
>>>> Best regards,
>>>>
>>>> Marc
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> elephant-devel site list
>>>> elephant-devel at common-lisp.net
>>>> http://common-lisp.net/mailman/listinfo/elephant-devel
>>>
>>> _______________________________________________
>>> elephant-devel site list
>>> elephant-devel at common-lisp.net
>>> http://common-lisp.net/mailman/listinfo/elephant-devel
>>>
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> elephant-devel site list
>> elephant-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/elephant-devel
>
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel
>
>
>





More information about the elephant-devel mailing list