Welcome, Guest. Please Login or Register
WebLab - An SOA Platform for media mining. News:
You can now retrieve WebLab Core sources from our OW2 SVN
  HomeHelpSearchLoginRegister
 
Pages: 1
Send Topic Print
(De-)serializing lists of Weblab objects - order preserved? (Read 33 times)
Tonio Wandmacher
Junior WebLab Member
**
Offline

I Love WebLab

Posts: 19

Gender: male
(De-)serializing lists of Weblab objects - order preserved?
18.06.2010 at 10:39:58
 
Hello again,

I have a question concerning the serialization/deserialization of Weblab lists (e.g. a sequence of MediaUnits in a document). When I serialize a list and deserialize it later on using the Weblab Marshaller, is the list order guaranteed to be preserved?

I tried toy examples where it seems to be the case, but can I rely on it?

Thanks for your efforts!

Tonio






Back to top
 
 
  IP Logged
Gérard Dupont
WebLab Administrator
*****
Offline

WebLab addict.

Posts: 66

Re: (De-)serializing lists of Weblab objects - order preserved?
Reply #1 - 18.06.2010 at 11:08:00
 
Hi,

Keeping the order when serializing/de-serializing list of objects will depend on JAXB. To be frank I've never seen a case where the order was not kept but I don't have strong clue stating that JAXB will always respect the order.

So if you're idea is to use the item index in the list to keep in mind that the first contains for instance the introduction and the second a paragraph, it may be risky... A better way would be to annotate the item and to rely on this annotation to be sure that you're dealing with the item you think you have.

Last point, if you are talking about ordering in the RDF/XML part, then it's simpler : never assumer ordering to be kept !
Back to top
 
 
WWW   IP Logged
Jérémie Doucy
WebLab Administrator
*****
Offline

Every nights I dream
about WebLab ...

Posts: 89
Elancourt
Gender: male
Re: (De-)serializing lists of Weblab objects - order preserved?
Reply #2 - 18.06.2010 at 13:19:02
 
In fact, in pure XML, you can rely on it, but I'm not sure that JAXB preserve this order (I think so but it's not explicitly defined in JAXB). And if another service use another serialization mechanism (GSOAP or .NET), I can't assure that the elements order will be preserved. In fact, can you explain why do you need to rely on this order ? Maybe we could help you to solve it.
Back to top
 
 
  IP Logged
Tonio Wandmacher
Junior WebLab Member
**
Offline

I Love WebLab

Posts: 19

Gender: male
Re: (De-)serializing lists of Weblab objects - order preserved?
Reply #3 - 18.06.2010 at 14:03:33
 
Thanks for your replies!
I use a list of MediaUnits to represent text in an NLP application. Each MediaUnit contains a phrase, including further annotation. This phrase is then treated by an external service, and in the end the original text has to be reassembled. This won't be possible if the MediaUnits are returned in a different order.

Do you have any smart ideas on how to fixate the order (well, apart from adding an index to each MU) ?

Have a nice week-end,

Tonio
Back to top
 
 
  IP Logged
Yann Mombrun
WebLab Administrator
*****
Offline

I Love WebLab

Posts: 58
Val de Reuil, France
Gender: male
Re: (De-)serializing lists of Weblab objects - order preserved?
Reply #4 - 18.06.2010 at 14:13:52
 
I never encountered a case having JAXB changing the ordering of a list.
You can do as you said, for sure !
Back to top
 
 
WWW   IP Logged
Pages: 1
Send Topic Print