Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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

0 votes

Comments

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
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

1 vote

Comments

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

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 1,702
× 113
× 89
× 73

Question asked: Feb 14 '23, 4:04 p.m.

Question was seen: 1,293 times

Last updated: Aug 24 '23, 9:39 a.m.

Confirmation Cancel Confirm