-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to import schema defined in JSON format via file path or directly via JSON string. This implementation doesn't migrate or update already defined schema elements. Neither it removes existing defined elements. SchemaInitStrategy is defined in mind to be able to implement migration and more advance schema management, even so current JSON schema importer implementation is fairly simple. This work is made in hopes to simplify schema definition for beginners, speed-up prototypes development based on JanusGraph, and simplify testing. Signed-off-by: Oleksandr Porunov <[email protected]>
- Loading branch information
Showing
50 changed files
with
3,196 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
janusgraph-backend-testutils/src/main/resources/jsonSimpleSchemaExample.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"vertexLabels": [ | ||
{ | ||
"label": "organization" | ||
}, | ||
{ | ||
"label": "user" | ||
} | ||
], | ||
|
||
"edgeLabels": [ | ||
{ | ||
"label": "connects", | ||
"multiplicity": "SIMPLE", | ||
"unidirected": false | ||
}, | ||
{ | ||
"label": "viewed", | ||
"multiplicity": "MULTI", | ||
"unidirected": true | ||
} | ||
], | ||
|
||
"propertyKeys": [ | ||
{ | ||
"key": "time", | ||
"className": "java.lang.Long" | ||
}, | ||
{ | ||
"key": "doubleProp", | ||
"className": "java.lang.Double" | ||
}, | ||
{ | ||
"key": "integerProp", | ||
"className": "java.lang.Integer" | ||
}, | ||
{ | ||
"key": "longPropCardinalityList", | ||
"className": "java.lang.Long", | ||
"cardinality": "LIST" | ||
}, | ||
{ | ||
"key": "name", | ||
"className": "java.lang.String", | ||
"cardinality": "SINGLE" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
janusgraph-core/src/main/java/org/janusgraph/core/schema/IndicesActivationType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2024 JanusGraph Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package org.janusgraph.core.schema; | ||
|
||
import org.janusgraph.graphdb.configuration.ConfigName; | ||
|
||
public enum IndicesActivationType implements ConfigName { | ||
SKIP_ACTIVATION("skip_activation"), | ||
REINDEX_AND_ENABLE_UPDATED_ONLY("reindex_and_enable_updated_only"), | ||
REINDEX_AND_ENABLE_NON_ENABLED("reindex_and_enable_non_enabled"), | ||
FORCE_ENABLE_UPDATED_ONLY("force_enable_updated_only"), | ||
FORCE_ENABLE_NON_ENABLED("force_enable_non_enabled"); | ||
|
||
private final String configurationOptionName; | ||
|
||
IndicesActivationType(String configurationOptionName){ | ||
this.configurationOptionName = configurationOptionName; | ||
} | ||
|
||
@Override | ||
public String getConfigName() { | ||
return configurationOptionName; | ||
} | ||
} |
Oops, something went wrong.