Graph Model
The graph model is the central registry that tells Gremlinq which .NET classes represent vertices and which
represent edges, and how each class's name maps to a label in the graph database. It drives type-safe
querying: when you call .V<Person>(), Gremlinq consults the model to know which label (or labels) to
filter by.
Default Behaviour
When you call UseGremlinServer<TVertex, TEdge>(...), Gremlinq automatically builds a graph model by
scanning the calling assembly for every concrete class that inherits from TVertex or TEdge. By
default, the class name is used as-is for the graph label.
Class name used as label
The standard setup below produces a model where Person maps to the label "Person" and Edge maps to "Edge".
Label Conventions
Labels can be transformed globally or overridden for a single type via
ConfigureEnvironment(env => env.ConfigureModel(model => model...)).
camelCase labels
UseCamelCaseLabels() converts every vertex label to camelCase. For example, a class named
PersonAccount will be stored and queried with the label "personAccount".
lowercase labels
UseLowerCaseLabels() lowercases every vertex label. PersonAccount becomes "personaccount".
Explicit label for a single type
ConfigureMetadata lets you assign an arbitrary label to one specific type without affecting the rest
of the model. Here Person is mapped to the label "human":
Type Hierarchy
Gremlinq tracks the full inheritance tree of your vertex and edge types. When you query for a base type, Gremlinq automatically includes all concrete subtypes in the label filter.
For example, if you have WorkingAdult : Person : Vertex, then .V<Person>() will match both Person
and WorkingAdult vertices in the database because WorkingAdult is a subtype of Person. The model
resolves this at query-build time, so no runtime reflection occurs per query.
When FilterLabelsVerbosity.Minimum is active and every known subtype is included in the filter,
Gremlinq can omit the label constraint entirely, letting the graph engine return all vertices and relying
on the type system instead.
Additional Assemblies
The automatic scan covers the assembly that calls UseGremlinServer, but entity classes defined in
separate class libraries are not included by default. Add them with AddAssemblies:
Scanning an additional assembly
Pass typeof(AnyTypeFromThatAssembly).Assembly to bring additional vertex and edge types into the model.
Related: Property Metadata — rename properties, suppress writes on add/update, and apply naming conventions across the whole model.