How to Authenticate to lqe endpoint and run the sparql query in Java?
![](http://jazz.net/_images/myphoto/d3049c27cfaa388851a141dfec238438.jpg)
Hi there,
I want to use Java and pass sparql query to /lqe/sparql endpoint and get the result. I used jena to run sparql query against the
localhost:9443/lqe/sparql
Query query = QueryFactory.create(queryString);
// HTTP QueryExecution
try ( QueryExecution qExec = new QueryEngineHTTP("https://localhost:9443/lqe/sparql", query, hc) ) {
QueryExecUtils.executeQuery(qExec);
I get following error which I guess it is related to three way hand shake or similar.
ResponseProcessCookies WARN Invalid cookie header: "Set-Cookie: lqe.authIdentifier=""; Expires=Thu, 01 Dec 1994 16:00:00 GMT; Path=/lqe; Secure; HttpOnly". Invalid 'expires' attribute: Thu, 01 Dec 1994 16:00:00 GMT
So my question is if it is possible to pass query to be parsed by jazz server using Java, if yes how can I manage to authenticate to lqe and get result back.
Another question is that if my query is using /qm data then I have to change end point from "https://localhost:9443/lqe/sparql to "https://localhost:9443/qm/query" . I am a bit confused as I read the lqe endpoint can be found in rootservices which is "https://localhost:9443/qm/query " and give query as parameter "query=Select...".
on the other hand I saw the lqe end points in /lqe setting is like "https://localhost:9443/lqe/sparql"
Thank you in advance
on the other hand I saw the lqe end points in /lqe setting is like "https://localhost:9443/lqe/sparql"
Thank you in advance
Accepted answer
![](http://jazz.net/_images/myphoto/d3049c27cfaa388851a141dfec238438.jpg)
LQE does not have any public REST APIs. The public REST APIs for ELM are documented on the API landing page at https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding. LQE is not described there because its REST APIs are currently private.
For general guidance on authentication with ELM, see https://jazz.net/wiki/bin/view/Main/NativeClientAuthentication.
Regarding querying, in general, there are 3 ways to find data in ELM:
- Execute a SPARQL query in LQE, either directly or through Report Builder. Since LQE indexes data from multiple applications, such queries can span multiple domains to provide traceability across requirements management, quality management, and change management.
- Use OSLC query in a specific aplication. See https://docs.oasis-open-projects.org/oslc-op/core/v3.0/os/discovery.html and https://docs.oasis-open-projects.org/oslc-op/query/v3.0/os/oslc-query.html. Note that such queries can only query for and return data on resources persisted and managed by that application. For example, if you use an OSLC query for ETM Test Cases, it cannot provide data on any requirements that a test case validates.
-
Use Reportable REST in a specific application - see the API landing page linked above. Again, this can only provide data that is persisted by the specific application..
Best regards,
David
David
Comments
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
With respect to https://jazz.net/wiki/bin/view/Main/NativeClientAuthentication I would suggest to also look at https://rsjazz.wordpress.com/2021/10/15/elm-authentication/
![](http://jazz.net/_images/myphoto/d3049c27cfaa388851a141dfec238438.jpg)
Thanks for your comprehensive answer.
I did not get one point, as in paragraph one you mentioned Rest API is private currently and in Number one you mentioned that LQE can be used directly( Did you mean the rest API which is private or there is other method than that?), could you please point me to documentation or resource which I can use for direct usage of LQE query, if it is available. currently I used report builder and ENI. but our goal is to run query programmatically and have access to multiple application at the same time.
Until the rest API for LQE become public, is there a way to test it progrmatically?
Best Regards,
MJ
![](http://jazz.net/_images/myphoto/277037455b7f6ac2ca8386734db46429.jpg)
No, there are no public REST APIs for LQE. So it is not possible to execute SPARQL on LQE through a REST call using a public API. You can enter the SPARQL on LQE's Query page and execute it through the UI.
Comments
Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Feb 15 '23, 4:08 a.m.Your qm endpoint is for either OSLC query API or the QM Reportable REST API - either is a very different beast from a SPARQL endpoint - so I suspect your problem is the Java QueryFactory is intended to work for OSLC Query which means it won't work for SPARQL Query.