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

Rework question catalog scheme #247

Open
Robbendebiene opened this issue Feb 29, 2024 · 1 comment
Open

Rework question catalog scheme #247

Robbendebiene opened this issue Feb 29, 2024 · 1 comment
Labels
feature request New feature request

Comments

@Robbendebiene
Copy link
Member

Robbendebiene commented Feb 29, 2024

The question catalogue was originally focused on serving a good balance between readability and versatility. However over time it gained more complexity and especially with the introduction of multi language keys it has become less readable. Additionally the structure sometimes requires duplicating tags or conditions (see crossing:markings questions) which ultimately makes it less readable, understandable and maintainable.

The duplication is mainly needed because AND + OR operators cannot be defined explicitly. They are always implicitly defined by the JSON structure. Usually arrays [] are disjunctions (OR) while the object notation {} defines conjunctions (AND).

Idea:

Reuse the expression system from the constructor and supplement it with more conditional expressions for matching elements similar to mapbox filter expressions. Nesting conditions could also improve performance because it avoids double checking the same tags.

Example:


["ALL"
  ["EQUALS", $type, "bar"]
  ["CONTAINS", $tag, "foo", "bla"]
]

["ANY"
  ["EQUALS", $type, "foo"]
  ["CONTAINS", $tag, "foo", "bla"]
]

---------------------------------------

"conditions": [
  "ALL",
  ["==", [GET, $tags, "highway"], "footway"],
  ["==", [GET, $tags, "conveying"], "yes"],
  ["HAS", $tags, "bus"],
  ["WITHOUT", $tags, "train"]
]

---------------------------------------

"conditions": [
  "ANY",
  [
    "ALL",
    ["==", [GET, $tags, "highway"], "footway"],
    ["==", [GET, $tags, "conveying"], "yes"],
    ["HAS", $tags, "bus"],
    ["WITHOUT", $tags, "train"]
  ],
  [
    "ALL",
    ["HAS", $tags, "railway"],
    ["WITHOUT", $tags, "train"]
  ]
]

Other goals:

  • Allow RegEx in keys - This is necessary to match language sub keys like in tactile_writing:embossed_printed_letters:XX=yes (required to properly fix https://www.openstreetmap.org/changeset/134263638)
  • Constructor could expose a variable for the pre-existing value of a tag - this might be useful when concatenating values to pre-existing ones. If there is no previous value it would simply be null
  • Required for check_date evaluation (Expression that allows parsing and comparing date time)
@Robbendebiene Robbendebiene added the feature request New feature request label Feb 29, 2024
@rugk
Copy link

rugk commented Mar 28, 2024

FYI StreetComplete also once used Overpass-query simple syntax, but switched to their own, more information here. If you could embed Kotlin, you could of course just use theirs, but that may or may not be useful given your syntax seems to be quite different.

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

No branches or pull requests

2 participants