任何人都可以提供带有where
服务类子句的示例 OSLC 代码吗?我最近才开始使用 OSLC。
这是我尝试过的代码(不起作用):
@GET
@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
public Project[] getChangeRequests(@QueryParam("oslc.where") final String where,
@QueryParam("oslc.prefix") final String prefix)
{
final List< Project> results = new ArrayList<Project>();
Map<String, String> prefixMap;
try
{
QueryUtils.parseSearchTerms(where);
prefixMap = QueryUtils.parsePrefixes(prefix);
WhereClause whereClause = QueryUtils.parseWhere(where, prefixMap);
}
catch (ParseException e)
{
e.printStackTrace();
}
final Project[] changeRequests = Persistence.getChangeRequestsForProject();
for (final Project changeRequest : changeRequests)
{
changeRequest.setServiceProvider(ServiceProviderSingleton.getServiceProviderURI());
results.add(changeRequest);
}
return results.toArray(new Project[results.size()]);
}