[xwiki-dev] XWiki classes question

Stéphane Laurière slauriere at xwiki.com
Sat Apr 28 23:42:01 CEST 2007


Hi Evelina, Vincent and all

Vincent Massol wrote:
> Hi Evelina,
> 
> On Apr 28, 2007, at 10:43 PM, evelyne24 at gmail.com wrote:
> 
>> Hello,
>> 
>> I have the following question regarding relationing 2 classes in 
>> xwiki. I made a class Person with 2 properties (firstName, 
>> lastName) and a class Media with a prop. (title) and then I made an
>>  object "Richard Gere" of class person and 2 objects "Pretty Woman"
>>  and "Autumn at New York" of class Media. Now I would like to link 
>> somehow the 3 objects, i.e to say that Richard Gere played in 
>> "Pretty Woman" and also in the other movie (media). How can I do 
>> that? I don't seem to understand how to link the already created 
>> objects one with another. For instance, I cannot create another 
>> class with 2 properties, one of type Media and one of type Person, 
>> because these types don't appear under "Type" on "Add Property" 
>> panel. Please help me understand how can I do that in xwiki.
>> 
> 
> Not sure if it's the best solution but you could create a document 
> containing "Richard Gere" + "Pretty Woman" and "Autumn at New York" 
> objects. This document would answer the question: "show me the films 
> with Richard Gere".


Indeed, or another possible option would be to add a property "playsIn"
of type "Database list" to the class "Person". The query associated with
that property would be something like the one below, for fetching all
the Media titles:

======
select distinct prop.value from BaseObject as obj, StringProperty as
prop where obj.className='XWiki.Media' and prop.id.id = obj.id and
prop.id.name='title' order by prop.value
======

Or third possibility: simply use plain wiki links between the documents:
create three documents "Richard Gere", "Pretty Woman", "Autumn in New
York", attach structured objects to each of them, then add a link to
"Pretty Woman" and "Autumn in New York" to the body of the document
"Richard Gere".

I hope this helps.

By the way, this type of question should rather be submitted to the
xwiki-users mailing-list! -> I propose we continue the discussion on
that list instead.

Cheers

Stéphane


> -Vincent
> 
>> Ps. I heard something about attachments but I don't really
>> understand how... Thank you.
>> 
>> Evelina Slatineanu
> 
> 


-- 
Stéphane Laurière
slauriere at xwiki.com
+33 6 83 04 49 03
skype: arkubb

XWiki Research
http://www.xwiki.com
http://concerto.xwiki.com
http://nepomuk.semanticdesktop.org





More information about the devs mailing list