Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find / make a tool to help write and test JQ strings for BTE's use #736

Open
colleenXu opened this issue Oct 4, 2023 · 7 comments
Open
Assignees

Comments

@colleenXu
Copy link
Collaborator

(From first JQ issue + discussions Jackson @tokebe and I have had)

Jackson says it's difficult to write and test JQ strings for BTE's implementation. I haven't tried yet, but I agree that it's a learning curve to read JQ strings...what can we do to make this easier for us and future contributors?

Jackson suggested a "testing tool".

Any ideas, @rjawesome @newgene ?

@colleenXu colleenXu added enhancement New feature or request needs discussion labels Oct 4, 2023
@tokebe
Copy link
Member

tokebe commented Oct 4, 2023

I had a slightly more specific idea here -- essentially, the problem isn't JQ, rather it's the information (and structure of the information) available to the JQ string (the $edge variable, and the structure of the API response), as well as the expected output, all being somewhat vague and hard to capture for use in a testing tool like https://jqplay.org/.

Essentially I'm imagining a framework that allows for testing a JQ string with the data all prepared, so that a potential user wouldn't have to rely on breakpoints and/or BTE logs for debugging their JQ string.

This could be as simple as a document explaining some of this and providing a template JQ command to run in the command line to test. A more in-depth approach could be a script that handles some of the processing to prepare that command and simulate the conditions under which the string would be used.

@tokebe
Copy link
Member

tokebe commented Oct 4, 2023

@rjawesome If you have any input on how you tested your JQ strings while writing them, it could provide some insight on how to approach making testing documentation/a testing tool/script. Otherwise, I can just use what I threw together while working on CTD's JQ string as a basis.

@rjawesome
Copy link
Contributor

I'm working on a testing tool.

@rjawesome
Copy link
Contributor

See: https://bte-jq.rohanj.dev/
(probably could use some css)

@tokebe
Copy link
Member

tokebe commented Oct 6, 2023

This is a very good start! I think that we'd probably prefer a locally-runnable application (so a user could expect to use npm run jq-tester in the main workspace).

Additionally, while it's nice that there's an example for $edge, if a user writing such a jq string needed to provide one to test certain functionality, they'd need to obtain it basically by setting breakpoints in a BTE query and copying it. This isn't a reasonable expectation, so we'd probably want something that could automatically convert an x-bte snippet to the $edge format, or something else to make it easy for the user to generate the $edge data. This could make use of the smartapi-kg package to make a conversion, or some bespoke code if necessary.

@rjawesome
Copy link
Contributor

A feature has been added on the website to generate edge from a full smartapi yaml using smartapi-kg package: https://bte-jq.rohanj.dev/create_edge.html. It still needs an input field for the query graph to be used for reasoner edge property of edge. Also I will integrate this into the BTE project soon.

@tokebe
Copy link
Member

tokebe commented Oct 12, 2023

@rjawesome Given ongoing potential changes, you should hold up on further work on this issue until the path forward is clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants