It's all about the answers!

Ask a question

How to Authenticate to lqe endpoint and run the sparql query in Java?


MJ Ranji (173) | asked Feb 14 '23, 4:04 p.m.

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


Comments
Ian Barnard commented Feb 15 '23, 4:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

Accepted answer


permanent link
David Honey (1.8k17) | answered Feb 15 '23, 4:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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:
  1. 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.
  2. 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.
  3. 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



MJ Ranji selected this answer as the correct answer

Comments
Ralph Schoon commented Feb 15 '23, 5:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

MJ Ranji commented Feb 16 '23, 4:11 a.m.

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


David Honey commented Feb 16 '23, 5:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.