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

[Concept] API Query Language LSSMAQL #51

Open
3 tasks
jxn-30 opened this issue Aug 6, 2020 · 7 comments · May be fixed by #2937
Open
3 tasks

[Concept] API Query Language LSSMAQL #51

jxn-30 opened this issue Aug 6, 2020 · 7 comments · May be fixed by #2937
Assignees
Labels
concept This summarizes a whole new thing consisting of many sub tasks enhancement New feature or request LSSMAQL This is related to the LSSMAQL Project not ready This issue is not yet ready to work with. Changes are made regulary

Comments

@jxn-30
Copy link
Member

jxn-30 commented Aug 6, 2020

A Query Language to get API-Results from cached API Values.

Note: This is not yet a full concept and may change at any time

An LSSMAQL-Query Always returns an List of return Values.

Query should be able to process:

  • get an object
  • get attribute of an object, accessible with .-Notation
  • get a list of objects filtered by a condition
    • Filtering is done with WHERE

EBNF of a Query:
We used EBNF used in Railroad Diagram Generator
This may still contain errors

query ::= object getter* filter?
object ::= (identifier ("(" query ")")?) | query | identifier
getter ::= object_getter | list_getter
object_getter ::= "."+ identifier
list_getter ::= "[" number "]"

filter ::= where condition
condition ::= (condition (and | or) condition) | "(" condition ")" | object | comparison
comparison ::= (element ("=" | "!=" | "<" | ">") element) |( element "<" object "<" element)
element ::= object | number | string | object_getter

identifier ::= ("_" | lowercase_letter)+
lowercase_letter ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"

number ::= ((digit - "0") digit+) | "0"
digit ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

where ::= "WHERE "
and ::= "AND "
or ::= "OR "

Examples can be found in lssmaql@LSSM-V.4/lssmaql/specs/examples.md

@jxn-30 jxn-30 added the enhancement New feature or request label Aug 6, 2020
@jxn-30 jxn-30 self-assigned this Aug 6, 2020
@jxn-30 jxn-30 added concept This summarizes a whole new thing consisting of many sub tasks not ready This issue is not yet ready to work with. Changes are made regulary LSSMAQL This is related to the LSSMAQL Project labels Aug 6, 2020
@jxn-30
Copy link
Member Author

jxn-30 commented Aug 9, 2020

Version V.0.0.1 merged into master with #53

@RagingLightning
Copy link

RagingLightning commented Jun 5, 2022

I've been looking into the examples given and found one thing that is a bit weird:

sum of personal in all buildings that have more than 3 vehicles
sum((buildings WHERE len(vehicles WHERE .building_id = ..id) > 3).personal_count)

in this example, personal_count strikes me as odd.
I know that much of the LSSM is german (since the game is german), but as this is a query language, where everything is in english, I do believe that using the english personnel_count would be better suited. Especially since personal refers to something completely different in english

@JRH-1997
Copy link
Contributor

JRH-1997 commented Jun 5, 2022

I've been looking into the examples given and found one thing that is a bit weird:

sum of personal in all buildings that have more than 3 vehicles
sum((buildings WHERE len(vehicles WHERE .building_id = ..id) > 3).personal_count)

in this example, personal_count strikes me as odd.
I know that much of the LSSM is german (since the game is german), but as this is a query language, where everything is in english, I do believe that using the english personnel_count would be better suited. Especially since personal refers to something completely different in english

Thats just a name used in the API of the game. And LSSMAQL is just something to use the APi of the game. So they need to use the exact names of that.

@jxn-30
Copy link
Member Author

jxn-30 commented Jun 5, 2022

The attributes are the same as used in the APIs:
https://www.missionchief.com/api/buildings
https://www.missionchief.com/api/vehicles
https://www.missionchief.com/api/allianceinfo
https://www.missionchief.com/api/credits
https://www.missionchief.com/einsaetze.json

This is because Sebastian, the original founder of the game, used some "denglish" (mixing german and english) terms internally and the new developer team also does this now and then.

As the idea of LSSMAQL was/is to provide a Language to query these APIs, the exact same attribute names are required.
There are also plans to provide a GUI for LSSMAQL but unfortunately the project is on hold currently.

@kdev
Copy link
Member

kdev commented Feb 19, 2024

I just found something that would be an interesting change to this idea.
There is a query language for JSON that is perfect for our usecase and should be easy to implement.
I understand that it's not "made" by us but would provide a feature till we do.

@Cr4zyc4k3
Copy link
Collaborator

@Cr4zyc4k3
Copy link
Collaborator

after fiddling around with JSONata and GROQ in tend to favorite JSONata since a more complete feature set.
Eg. string/number conversion is not possible with groq.

@Cr4zyc4k3 Cr4zyc4k3 linked a pull request Mar 10, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concept This summarizes a whole new thing consisting of many sub tasks enhancement New feature or request LSSMAQL This is related to the LSSMAQL Project not ready This issue is not yet ready to work with. Changes are made regulary
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants