Why can't I see oslc links added to a requirement through the api on a view?
The code works successfully to add a "Elaborates/Elaborated By Link" between requirement types x & y.
The code updates the xml for req x.
I can see this in the tool when I open up req x, I see a "Elaborates" link to req y. I open req y and can see req x linked using "Elaborated By". So the directional link is working.
I set up a view to show req x with a column for "elaborates" and req y is shown with the id and title of the requirement so all appears well. When I set up a view for req y with a "Elaborated By" column, nothing appears in the column.
It's strange as it appears when req y is opened.
The other odd thing I can now see is that there are two link types for "Elaborates/Elaborated By". i.e. I have two choices for "Elaborates" if trying to apply a filter to requirements. I can also see this in the "Link Types" page in the project properties.
Is this even possible? Do I need to add the reverse link to get it to work?
3 answers
The behaviour you described here looks normal. RDNG does not create bidirectional links. However, when you navigate to either x or y requirement URL you see the relationship to each other. This is possible because RDNG queries on the fly all the service providers associated a given project in order to fetch and show all the links in the links widgets.
For exemple, you could try with Design Manager. Make few links to a requirement. Then fetch the RDF representation of this requirement using a REST plugin (I use POSTER with Firefox or Chrome). You will NOT see the link to the Model element in RDM despite this link is displayed in an Internet browser.
I hope it helps.
Best regards,
JLJ
Having two link types with same ( or similar names is odd ) try by adding both link types in the grid and verify that your link appears.
Best Regards.
Comments
Even though I am just adding the elaborates link from x to y, I can see elaborated by (the opposite link) from y to x if I open the artifact. I cannot see this however on the view I have set up? Is this what you would expect to happen?
http://open-services.net/bin/view/Main/RmSpecificationV2
Which link types from the list on the link above are best for adding programmatically to internal rm artifacts. I can work with any just need to be consistent?
For "internal" links (for example those in the namespace http://www.ibm.com/xmlns/rdm/types/), only one direction is recorded in the artifacts.
My advice would be avoid using the links this way.
Comments
Even though I am just adding the elaborates link from x to y, I can see elaborated by (the opposite link) from y to x if I open the artifact. I cannot see this however on the view I have set up? Is this what you would expect to happen?
http://open-services.net/bin/view/Main/RmSpecificationV2
Which link types from the list on the link above are best for adding programmatically to internal rm artifacts. I can work with any just need to be consistent?
On second thought, I believe the behavior is by design and probably for performance consideration, regardless what link type you choose. When you add a bidirectional link to an artifact, a property with the link type is added to the "subject/source" artifact, and a separate link relationship "subject-predicate-object" is also recorded. When you open the "object/target" artifact, the link relationship is queried, and all links, whether the current artifact is the subject or the object, are shown. In a view, I believe the link relationship is not queried, as it can be done only in a one-by-one way, and will be very slow. I believe only the "property" part is read and displayed.
If you think the behavior should be changed, an RFE is probably the best way.