Creating SelectEntry for Attributes of a Class [message #636420] |
Mon, 01 November 2010 07:51 |
|
Hi All,
I was trying to retrieve all values stored for a class using Query2. I used the following code :-
ResourceSet rs = new ResourceSetImpl();
QueryContext queryContext = getQueryContext(rs);
QueryProcessor queryProcessor = QueryProcessorFactory.getDefault().createQueryProcessor(IndexFactory.getInstance());
SelectEntry select = new SelectAlias("obj");
FromType from = new FromType(/* aliasName */"obj", /* type URI */
eClassURI, /* withoutsubtypes */false);
Query query = new Query(new SelectEntry[] { select }, new FromEntry[] { from });
ResultSet resultSet = queryProcessor.execute(query, queryContext);
return resultSet;
The above snippet represents a query:-
Search:
from eClass /* Variable */ as obj select obj
But here the SelectEntry is only for the class and not for its attributes.
I want to create a SelectEntry for the attributes. I have the attributes retrieved but i have no idea about the format to be used to use those attributes in the code. How can i create a java code like the above for a query which is something like this :-
Search:
from eClass /* Variable */ as obj select obj.attribute1, obj.attribute2
Regards,
Animesh
[Updated on: Mon, 01 November 2010 07:54] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02973 seconds