Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lyo-dev] Keep Uses order

Hello,

most of requirement tools that I know used a multi level tree structure to represente data and not a list (ReqIf, Doors, R4J, ...).
Lyo Model is based 3 levels Tree (project, requirement collection, requirement). So if we want to present the tree without a view, just to let user browse and understand data has they already know it, we need to keep order and level. I already have level in my system but I loose the order information just because the data structure doesn't keep order.

If I weel understand you, you don't want to keep the order. Because RDF don't want it by nature. Is that it ?

But it's force user to query a second time the server to get the order.
For exemple, I see this post, where doors user query twice time Doors with internal api to get the order after getting data from OSLC :
https://jazz.net/forum/questions/221328/how-do-i-retrieve-doors-ng-module-content-using-oslc

If you only need to "read" the module strcuture you can use the Reportable API

https://jazz.net/wiki/bin/view/Main/RRCReportableRestAPI.


I am sorry, maybe we don't have the good approach. But I don't understand why OSLC must loose this information.
Because as OSLC client, it's interesting to show data as they really are in server.

I am really sorry, because my understanding of Lyo is maybe wrong ... For me this tools/ protocol help us to connect data between cross domain application.

Could you help me ? Must I use other approach ?





Le mar. 4 déc. 2018 à 11:46, Andrii Berezovskyi <andriib@xxxxxx> a écrit :
Guillaume,

Let me clarify a bit more as I dug up some notes. There are three places where ordering can be considered as far as OSLC Servers are concerned:

1) Usual GET/PUT OSLC requests (raw RDF inside the body).
2) OSLC Query results.
3) SPARQL results.

§1 Raw RDF does not have ordering guarantees on properties. Links:


"Information is represented by a set of RDF triples, often called a model. As it is a set, there is no ordering"

§2 The only place where we break RDF convention is the OSLC Query results, where the order of the returned results matters. The actual spec says in [query-50] that ordered resources should come in the right order. However, it has been proposed to change that to express ordering explicitly but the current spec allows [query-51] to satisfy this. Jim may have a different viewpoint on this. 

§3 SPARQL results return ordered set of rows. However, we don't expect SPARQL to be used anywhere by default and don't have special code to handle it.

Having said that, in the newly generated code (not used by default in Lyo yet) we use Sets and HashSets: https://github.com/eclipse/lyo.domains/blob/master/oslc-domains/src/main/java/org/eclipse/lyo/oslc/domains/rm/RequirementCollection.java

Ideally, I would like to generate methods like

Set<IResource> getSomeProperty();
void setSomeProperty(Collection<IResource> resources);

But this would require an incompatible change to the API and we don't want to break compatibility for little or no reason.

Bottom line: if you want to iterate the items of a Set in some order, better use a custom Comparator when creating a List copy of the Set: https://stackoverflow.com/a/45696217 

--
/Andrew

On 2018-12-04 , at 09:56, Andrii Berezovskyi <andriib@xxxxxx> wrote:

Hello Guillaume,

Thank you for inspecting this issue carefully! May I ask you why are you expecting any order to be preserved? Are you aware that RDF treats multiple resources not as a List but as a Set?

Because I would suggest to switch to a HashSet to make sure order is not preserved.

--
/Andrew

On 3 Dec 2018, at 10:33, Guillaume Dufour <guillaume.duff@xxxxxxxxx> wrote:

Hello,

I am using an OSLC Requirement Server with OSLC. And I see that requirement uses URI don't keep the order from OSLC Server because it's store in a TreeSet.

TreeSet use natural order comparator to sort element. But natural order have no sens for URI.
So I propose to use LinkedHashSet which keep the order provide by OSLC Server.
Can I provide a PullRequest for this ?
If you are ok, which the best way to do the PR : gerrit or github ?

Regards

_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/lyo-dev
_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/lyo-dev

_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/lyo-dev

Back to the top