From fea08dd7ebe0c874544ec619c6bd0c387681f741 Mon Sep 17 00:00:00 2001 From: Oleksandr Porunov Date: Sun, 3 Nov 2024 16:57:37 +0000 Subject: [PATCH] Fix doc formatting for schema-init-strategies CTR Signed-off-by: Oleksandr Porunov --- docs/schema/schema-init-strategies.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/schema/schema-init-strategies.md b/docs/schema/schema-init-strategies.md index adcf097df5..99ee2ac2fe 100644 --- a/docs/schema/schema-init-strategies.md +++ b/docs/schema/schema-init-strategies.md @@ -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` @@ -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. @@ -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. @@ -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`. @@ -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. @@ -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`. @@ -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`. @@ -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 `.`) 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, @@ -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`). @@ -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)`