Skip to content

Make entity paths more similar to file paths #4464

@emilk

Description

@emilk

Motivation

People are used to file paths.
If we follow their lead, things like globs become more natural.

Examples of what we would like to do

  • Write glob matches: /world/**
  • Use . to mean "this folder", as in /world/car/.
  • Allow users to put file and folder names into entity paths
  • Prefix paths with minus in some queries (-/world == everything not in the world)
  • Reserve the right for special characters to have special meanings
    • E.g. use ? for a query suffix, /entity/path?Confidence>0.5

Summary

Entities are like folders, and components are like files.

When we print things, always normalize, and use syntax highlighting in the GUI.

Each part of an entity path is just a string.

We escape characters with \, so e.g. \n is a newline and \ is a space.

Example: /world/my\ image.JPG/

Parsing

Be VERY liberal in what we accept, but print warnings.

  • empty string is the same as root (/)
  • multiple consecutive slashes are treated as one slash
    • world//car => world/car
    • Allows user to do: world/ + /car
    • Foot-gun: f"world/{name}/car" with empty name
  • Unrecognized escapes are ignored so that \x is the same as x

Printing

  • Always escape anything not in a-zA-Z0-9.-_
  • In each part, escape leading non-alpha-numeric characters with \
  • Maybe (TBD):
    • Each path starts with a slash
  • Color-code slashes and escapes in GUI
  • Special-handle numbers when ordering, so that /image/3 comes before /image/10

Together with other things

We separate entity paths from component names with a colon: /car:Position3D (: in entity parts are escaped).

We separate entity paths from instance keys with []: /points[42] ([ in entity parts are escaped).

Future

We would like to expand the paths to uniquely identify a piece of data, which would require something like:

STORE_ID:/world/points[52]:Position3D[2]@frame=42

struct DataSelector {
  store_id:       Optional<…>,
  entity_path:    Optional<…>,
  instance_key:   Optional<…>,
  component_name: Optional<…>,
  arrow_selector: Optional<…>,
  time_query:     Optional<…>,
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions