You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by xi...@apache.org on 2026/09/01 20:26:46 UTC
(tinkerpop) 01/01: Merge remote-tracking branch 'origin/3.7-dev' into 3.8-dev
This is an automated email from the ASF dual-hosted git repository.
xiazcy pushed a commit to branch 3.8-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 2718dbbbf5e0d7934b3817649cb2d0a2fe164cdc
Merge: 99c9153c84 76b06f71ba
Author: Yang Xia <xi...@gmail.com>
AuthorDate: Tue Sep 1 13:26:18 2026 -0700
Merge remote-tracking branch 'origin/3.7-dev' into 3.8-dev
# Conflicts:
# docs/tinkeradoc-extension/src/main/java/org/apache/tinkerpop/tinkeradoc/GremlinTreeprocessor.java
docs/sass/tabs.scss | 53 +++++++++++-
docs/stylesheets/tinkerpop.css | 6 +-
.../apache/tinkerpop/tinkeradoc/GraphCatalog.java | 95 ++++++++++++++++++++++
.../tinkerpop/tinkeradoc/GremlinTreeprocessor.java | 51 ++++++------
.../tinkerpop/tinkeradoc/HtmlTabRenderer.java | 16 +++-
.../tinkerpop/tinkeradoc/MarkdownTabRenderer.java | 15 ++++
.../apache/tinkerpop/tinkeradoc/NeutralTab.java | 6 +-
.../tinkerpop/tinkeradoc/TabbedHtmlBuilder.java | 47 ++++++++++-
.../tinkeradoc/DualBackendIntegrationTest.java | 2 +-
.../tinkerpop/tinkeradoc/GraphCatalogTest.java | 65 +++++++++++++++
.../tinkeradoc/GremlinTreeprocessorTest.java | 66 ++++++++++++++-
.../tinkerpop/tinkeradoc/HtmlTabRendererTest.java | 4 +-
.../tinkerpop/tinkeradoc/IntegrationTest.java | 2 +-
.../tinkeradoc/MarkdownTabRendererTest.java | 18 +++-
.../tinkeradoc/TabbedHtmlBuilderTest.java | 33 +++++++-
15 files changed, 431 insertions(+), 48 deletions(-)
diff --cc docs/tinkeradoc-extension/src/main/java/org/apache/tinkerpop/tinkeradoc/GraphCatalog.java
index 0000000000,94db100ab3..4aa1011406
mode 000000,100644..100644
--- a/docs/tinkeradoc-extension/src/main/java/org/apache/tinkerpop/tinkeradoc/GraphCatalog.java
+++ b/docs/tinkeradoc-extension/src/main/java/org/apache/tinkerpop/tinkeradoc/GraphCatalog.java
@@@ -1,0 -1,94 +1,95 @@@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.tinkerpop.tinkeradoc;
+
+ import java.util.Collections;
+ import java.util.HashMap;
+ import java.util.Map;
+
+ /**
+ * Canonical registry of the toy graph datasets referenced by Gremlin documentation examples.
+ * <p>
+ * This is the single source of truth shared by two concerns that must never disagree about the set
+ * of datasets:
+ * <ul>
+ * <li><b>execution</b> — the Gremlin statement run to build the graph before an example
+ * ({@link GremlinTreeprocessor}); and</li>
+ * <li><b>rendering</b> — the dataset caption shown beneath an example and its link to the
+ * Sample Data book section ({@link TabbedHtmlBuilder}).</li>
+ * </ul>
+ * Adding a graph is therefore a one-line change here that feeds both, so a new dataset can never be
+ * executable-but-unlabeled (or vice versa).
+ */
+ final class GraphCatalog {
+
+ /** A dataset entry: how to construct it, how to name it, and where its Sample Data book section lives. */
+ static final class Entry {
+ /** Gremlin statement that constructs the graph into the {@code graph} binding. */
+ final String initStatement;
+ /** Human-readable name used in the rendered dataset caption. */
+ final String displayName;
+ /** Sample Data book section anchor, or {@code null} if the graph has no dedicated section. */
+ final String docAnchor;
+
+ Entry(final String initStatement, final String displayName, final String docAnchor) {
+ this.initStatement = initStatement;
+ this.displayName = displayName;
+ this.docAnchor = docAnchor;
+ }
+ }
+
+ /** Init statement for a bare block or any unrecognized token: a fresh, empty graph. */
+ static final String DEFAULT_INIT = "graph = TinkerGraph.open()";
+
+ private static final Map<String, Entry> BY_TOKEN;
+
+ static {
+ final Map<String, Entry> m = new HashMap<>();
+ // "crew" and "theCrew" are aliases for the same dataset.
+ final Entry crew = new Entry("graph = TinkerFactory.createTheCrew()", "crew", "the-crew");
+ m.put("modern", new Entry("graph = TinkerFactory.createModern()", "modern", "modern"));
+ m.put("classic", new Entry("graph = TinkerFactory.createClassic()", "classic", null));
+ m.put("crew", crew);
+ m.put("theCrew", crew);
+ m.put("grateful", new Entry("graph = TinkerFactory.createGratefulDead()", "Grateful Dead", "grateful-dead"));
++ m.put("airroutes", new Entry("graph = TinkerFactory.createAirRoutes()", "Air Routes", "air-routes"));
+ m.put("sink", new Entry("graph = TinkerFactory.createKitchenSink()", "kitchen sink", null));
+ BY_TOKEN = Collections.unmodifiableMap(m);
+ }
+
+ private GraphCatalog() {
+ }
+
+ /**
+ * Returns the catalog entry for a dataset token, or {@code null} if the token is not a known
+ * dataset (including {@code null}, a bare block, or a misspelling).
+ */
+ static Entry entry(final String token) {
+ return token == null ? null : BY_TOKEN.get(token);
+ }
+
+ /**
+ * Returns the Gremlin init statement for a token, falling back to {@link #DEFAULT_INIT} (a fresh
+ * empty graph) for {@code null} or unrecognized tokens.
+ */
+ static String initStatement(final String token) {
+ final Entry e = entry(token);
+ return e != null ? e.initStatement : DEFAULT_INIT;
+ }
+ }