Skip to content

Commit

Permalink
Fix doc formatting for schema-init-strategies CTR
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Porunov <[email protected]>
  • Loading branch information
porunov committed Nov 3, 2024
1 parent 0cb87d3 commit fea08dd
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docs/schema/schema-init-strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ file path to `schema.init.json.file` or directly insert JSON schema into
Schema defined via JSON must be a deserialized JSON version of
`org.janusgraph.core.schema.json.definition.JsonSchemaDefinition` class where top
level object elements will be the following:

- `vertexLabels`
- `edgeLabels`
- `propertyKeys`
Expand All @@ -46,6 +47,7 @@ or mixed indexes.
#### JSON Vertex Label Definition

Each vertex label object consists of the following keys:

- `label` - `string` datatype. (**Required**)
- `staticVertex` - `boolean` datatype.
- `partition` - `boolean` datatype.
Expand All @@ -54,6 +56,7 @@ Each vertex label object consists of the following keys:
#### JSON Edge Label Definition

Each edge label object consists of the following keys:

- `label` - `string` datatype. (**Required**)
- `multiplicity` - `string` datatype. Allowed values: `MULTI`, `SIMPLE`, `ONE2MANY`, `MANY2ONE`, `ONE2ONE`.
- `unidirected` - `boolean` datatype.
Expand All @@ -62,6 +65,7 @@ Each edge label object consists of the following keys:
#### JSON Property Key Definition

Each property key object consists of the following keys:

- `key` - `string` datatype. (**Required**)
- `className` - `string` datatype. This must be a full class path of the selected property datatype. For example, `java.lang.String`, `java.lang.Long`,`org.janusgraph.core.attribute.Geoshape`. (**Required**)
- `cardinality` - `string` datatype. Allowed values: `SINGLE`, `LIST`, `SET`.
Expand All @@ -70,17 +74,19 @@ Each property key object consists of the following keys:
#### JSON Composite Index Definition

Each composite index object consists of the following keys:

- `name` - `string` datatype. (**Required**)
- `typeClass` - `string` datatype. Full class path of the datatype of an indexed element. Allowed values: `org.apache.tinkerpop.gremlin.structure.Vertex`, `org.apache.tinkerpop.gremlin.structure.Edge`. (**Required**)
- `indexOnly` - `string` datatype. Vertex or Edge label.
- `unique` - `boolean` datatype.
- `consistency` - `string` datatype. Allowed values: `DEFAULT`, `LOCK`, `FORK`.
- `keys` - an array of objects representing `org.janusgraph.core.schema.json.definition.index.JsonIndexedPropertyKeyDefinition` (see definition below after indexes definition). These are used index keys. (**Required**)
- `inlinePropertyKeys` - an array of property keys to be inlined into the composite index. Currently supported for vertex composite indexes only. See [documentation](./schema/index-management/index-performance.md#inlining-vertex-properties-into-a-composite-index) for more information about this feature.
- `inlinePropertyKeys` - an array of property keys to be inlined into the composite index. Currently supported for vertex composite indexes only. See [documentation](./index-management/index-performance.md#inlining-vertex-properties-into-a-composite-index) for more information about this feature.

#### JSON Mixed Index Definition

Each mixed index object consists of the following keys:

- `name` - `string` datatype. (**Required**)
- `typeClass` - `string` datatype. Full class path of the datatype of an indexed element. Allowed values: `org.apache.tinkerpop.gremlin.structure.Vertex`, `org.apache.tinkerpop.gremlin.structure.Edge`. (**Required**)
- `indexOnly` - `string` datatype. Vertex or Edge label.
Expand All @@ -90,6 +96,7 @@ Each mixed index object consists of the following keys:
#### JSON Vertex-Centric Edge Index Definition

Each vertex-centric edge index object consists of the following keys:

- `name` - `string` datatype. (**Required**)
- `propertyKeys` - an array of strings (each value has `string` datatype). These are the Edge properties which will be used for the index. (**Required**)
- `order` - `string` datatype. Allowed values: `asc`, `desc`.
Expand All @@ -99,6 +106,7 @@ Each vertex-centric edge index object consists of the following keys:
#### JSON Vertex-Centric Property Index Definition

Each vertex-centric property index object consists of the following keys:

- `name` - `string` datatype. (**Required**)
- `propertyKeys` - an array of strings (each value has `string` datatype). These are the meta-properties which will be used for the index. (**Required**)
- `order` - `string` datatype. Allowed values: `asc`, `desc`.
Expand All @@ -107,17 +115,20 @@ Each vertex-centric property index object consists of the following keys:
#### JSON Definition of Property Keys defined in Composite and Mixed indexes (`keys`)

Each property key object defined as `keys` representation of composite or mixed index consists of the following keys:

- `propertyKey` - `string` datatype. (**Required**)
- `parameters` - an array of objects representing `org.janusgraph.core.schema.json.definition.JsonParameterDefinition`. These are optional parameters to let index know of additional configurations for the property key. (See description below)

#### JSON Definition of Parameters defined in Property Keys for Composite and Mixed indexes (`parameters`)

Each parameter is a configuration for to let underlying index backend configure relative properties better. Each such parameter consists of the following keys:

- `key` - `string` datatype. (**Required**)
- `value` - `string` datatype. (**Required**)
- `parser` - `string` datatype. This must be a full class pass of the parser which will be used to parse `value` of the parameter or a pre-defined shortcut. This parser must implement `org.janusgraph.core.schema.json.parser.JsonParameterParser` interface and have a parameterless constructor. If none is provided then `string` parser is used by default.

Pre-defined `parser` shortcuts:

- `string` - doesn't change `value` and uses it as is (`String` datatype).
- `enum` - replaces the provided string (defined as `<full class path>.<enum option>`) to actual enum value.
For example, if `value` has a string `org.janusgraph.core.schema.Mapping.STRING` it will be replaced to actual `STRING` enum,
Expand Down Expand Up @@ -393,6 +404,7 @@ Following the rules above (defined in `JSON Schema Format`) an example of JSON s

Currently, JSON schema initialization flow is simple and doesn't include any schema update or schema migration features.
The flow is split on multiple phases:

1) Creation of simple elements: `PropertyKey`, `VertexLabel`, `EdgeLabel`.
2) Creation of indices: Composite indexes, Vertex-centric Edge indexes, Vertex-centric Property indexes, Mixed indexes.
3) Indexes activation phase (configured via `schema.init.json.indices-activation`).
Expand Down Expand Up @@ -430,5 +442,6 @@ JsonSchemaInitStrategy.initializeSchemaFromString(graph, "{ \"vertexLabels\": [

Also, there are additional `initializeSchemaFromFile` and `initializeSchemaFromString` methods where it's possible to
provide all configuration options directly instead of fetching them from the configuration of the graph:

- `initializeSchemaFromFile(JanusGraph graph, boolean createSchemaElements, boolean createSchemaIndices, IndicesActivationType indicesActivationType, boolean forceRollBackActiveTransactions, boolean forceCloseOtherInstances, long indexStatusTimeout, String jsonSchemaFilePath)`
- `initializeSchemaFromString(JanusGraph graph, boolean createSchemaElements, boolean createSchemaIndices, IndicesActivationType indicesActivationType, boolean forceRollBackActiveTransactions, boolean forceCloseOtherInstances, long indexStatusTimeout, String jsonSchemaString)`

0 comments on commit fea08dd

Please sign in to comment.