Hello Lyo developers,
We are developing an application basing on Eclipse Lyo.
We would like to exclude some fields from a resource class when it is queried as RDF but leave those fileds when it is HTML.
How could we do it?
Are there any annotation which could be used on the resource class level?
Or any other ways to do it?
You can simply remove OSLC annotations from the properties you don’t want marshalled into RDF. HTML pages use raw getter calls, which won’t be affected by the annotations, e.g. aRequirementCollection.getTitle()
Thanks for your response. Unfortunatelly it doesn’t work.
Jena seems to marshal everything from an object and also generated JSP pages uses some OSLC annotations so there are some errors in HTML.
But there are different methods for different content types so I just nulled all the unnecessary fields for RDF and now everything is ok.
Strange. Jena should only marshal from an object based on the annotations. (Just to double check: are your Resource classes in another project? Did you build them separately?)
Another option indeed is to simply not set the values for the properties you don’t want to convert to RDF (or make them null afterwards). This approach means you odn’t have to change the code.
Another thought …
You mentioned problems with the JSP pages.
Have you considered using this “OSLC UI” alternative?
This flags then creates the front end based on this other “OSLC UI” angular project (GitHub - eclipse/lyo.oslc-ui)
Slightly better interface.
Could also be annotations coming from superclasses or implemented interfaces. Lyo analyses reflective metadata recursively.