### Run Go Service Quickstart Example Source: https://github.com/alibaba/unifiedmodel/blob/main/examples/sdk/README.md Navigate to the Go examples directory and run the service-quickstart example, providing the API address. ```bash cd examples/sdk/go go run ./service-quickstart -addr http://localhost:8080 ``` -------------------------------- ### API-only Startup Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/getting-started/quickstart.md Starts the UModel server with quickstart options enabled, useful for API-only interactions without the full demo setup. ```bash go run ./cmd/umodel-server --quickstart ``` -------------------------------- ### Start UModel Web UI Quickstart Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/guides/web-ui.md Run this command to quickly set up and start the UModel Web UI. Access the UI via the provided local URL. ```bash make quickstart ``` ```text http://localhost:5173 ``` -------------------------------- ### SDK Documentation Requirements Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/zh/umodel-sdk-specification.md Each SDK package needs installation guides, basic examples for parsing, serialization, type registry usage, validation, and error handling, along with compatibility and upgrade guides. ```markdown - 安装指南。 - 基础 parse/serialize 示例。 - Type registry 示例。 - Validation 示例。 - Error handling 示例。 - 兼容性与升级指南。 ``` -------------------------------- ### Quick Start with Docker Source: https://github.com/alibaba/unifiedmodel/blob/main/examples/incident-investigation/README.md Launches the UModel demo environment using Docker, exposing the API and Web UI. Assumes Docker is installed. ```bash docker build -t umodel-demo . docker run -p 8080:8080 -p 5173:5173 \ -e QUICKSTART_SAMPLE=examples/incident-investigation \ umodel-demo ``` -------------------------------- ### Start Web Development Server Source: https://github.com/alibaba/unifiedmodel/blob/main/web/README.md Installs dependencies and starts the Vite development server for the web UI. Proxies API requests. ```bash cd web pnpm install pnpm dev ``` -------------------------------- ### Setup Python Virtual Environment and Install Dependencies Source: https://github.com/alibaba/unifiedmodel/blob/main/tools/generators/README_schema_tools.md Prepare your environment by creating a virtual environment, activating it, and installing the PyYAML library. ```bash python3 -m venv venv source venv/bin/activate pip install PyYAML ``` -------------------------------- ### SDK and Examples Commands Source: https://github.com/alibaba/unifiedmodel/blob/main/AGENTS.md Commands for expanding, verifying, and validating SDK examples. ```bash make expand make verify make example-validate ``` -------------------------------- ### Run Commands Source: https://github.com/alibaba/unifiedmodel/blob/main/AGENTS.md Commands to start the project in quickstart or development mode, and to stop all services. ```bash make quickstart make dev make stop-all ``` -------------------------------- ### Environment Setup Commands Source: https://github.com/alibaba/unifiedmodel/blob/main/AGENTS.md Commands to check and install the necessary environment for the project. ```bash make check-env make install-env ``` -------------------------------- ### Run Built-in Examples Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/guides/query-service.md Execute the built-in examples for the Query Service from the command line. ```bash go run ./cmd/umctl --addr http://localhost:8080 query examples ``` -------------------------------- ### Sample Model Import HTTP Request Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/architecture/runtime-flow.md Example of an HTTP POST request used for importing a multi-domain quickstart sample. ```http POST /api/v1/samples/{workspace}/multi-domain-quickstart:import ``` -------------------------------- ### Quick Start with Go Binary Source: https://github.com/alibaba/unifiedmodel/blob/main/examples/incident-investigation/README.md Starts the UModel server for the incident investigation demo using only the Go binary. Suitable for API-only interaction. ```bash go run ./cmd/umodel-server --quickstart --sample examples/incident-investigation ``` -------------------------------- ### Import Bundled Quickstart Sample Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/ui-api.md Imports a bundled quickstart sample into the UModel workspace. This is a convenience endpoint for sample data. ```APIDOC ## POST /api/v1/samples/{workspace}/multi-domain-quickstart:import ### Description Imports a bundled multi-domain quickstart sample into the UModel workspace. ### Method POST ### Endpoint /api/v1/samples/{workspace}/multi-domain-quickstart:import ### Parameters #### Path Parameters - **workspace** (string) - Required - The ID of the workspace to import the sample into. ``` -------------------------------- ### Run Go Model Inspector Example Source: https://github.com/alibaba/unifiedmodel/blob/main/examples/sdk/README.md Navigate to the Go examples directory, tidy modules, and run the model-inspector with a specified path. ```bash cd examples/sdk/go go mod tidy go run ./model-inspector -path ../../quickstart-multidomain ``` -------------------------------- ### Start Go REST API Source: https://github.com/alibaba/unifiedmodel/blob/main/examples/sdk/README.md Start the development API from the repository root using the 'make dev-api' command. ```bash make dev-api ``` -------------------------------- ### Run Go REST Client Example Source: https://github.com/alibaba/unifiedmodel/blob/main/examples/sdk/full-flow.md Execute the Go REST client example to create a workspace, import a model pack, and query runtime state. Ensure the API is running and specify the address. ```bash cd examples/sdk/go go run ./service-quickstart -addr http://localhost:8080 -workspace sdk-demo ``` -------------------------------- ### Start UModel with Docker Compose Source: https://github.com/alibaba/unifiedmodel/blob/main/deployments/README.md Starts the UModel services defined in the docker-compose.yaml file, building the image if necessary. ```bash docker compose -f deployments/compose/docker-compose.yaml up --build ``` -------------------------------- ### Start Local API and Web UI Source: https://github.com/alibaba/unifiedmodel/blob/main/README.md Starts the local UModel API service and the Web UI, preloading a demo workspace with in-memory storage. This command is designed for a quick demonstration and cleans up demo data upon stopping. ```bash make quickstart ``` -------------------------------- ### CLI Agent Tool Explain Example Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/architecture/query-and-agent.md Executes the `query_spl_explain` tool with a query parameter using `umctl`. ```bash go run ./cmd/umctl --addr http://localhost:8080 agent tool demo query_spl_explain '{"query":".umodel | limit 5"}' ``` -------------------------------- ### Quick Start with Make Source: https://github.com/alibaba/unifiedmodel/blob/main/examples/incident-investigation/README.md Initiates the UModel demo environment for incident investigation using a Make command. Requires Go and Make. ```bash make quickstart QUICKSTART_SAMPLE=examples/incident-investigation ``` -------------------------------- ### Go: Create Workspace, Import UModel, and Query Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/guides/sdk-clients.md This Go snippet demonstrates how to initialize a service client, create a workspace, import a UModel, and perform a query against the workspace. Ensure the service is running locally on port 8080. ```go client := service.NewClient("http://localhost:8080") ctx := context.Background() _, err := client.CreateWorkspace(ctx, service.CreateWorkspaceRequest{ ID: "demo", Name: "Demo", }) if err != nil { return err } _, err = client.ImportUModel(ctx, "demo", service.UModelImportRequest{ Path: "examples/quickstart-multidomain", }) if err != nil { return err } result, err := client.Query(ctx, "demo", service.QueryRequest{ Query: ".umodel with(kind='entity_set') | limit 5", }) if err != nil { return err } _ = result ``` -------------------------------- ### Serve Production Build with Go Server Source: https://github.com/alibaba/unifiedmodel/blob/main/web/README.md Starts the Go server to serve the production-ready web UI assets from the specified directory. ```bash go run ./cmd/umodel-server --addr :8080 --data data --graphstore file.memory --ui-dir web/dist ``` -------------------------------- ### Stop All Local Services Source: https://github.com/alibaba/unifiedmodel/blob/main/README.md Gracefully stops all local services started by the quickstart or development commands, ensuring no background processes remain active. ```bash make stop-all ``` -------------------------------- ### Prepare Dependencies Source: https://github.com/alibaba/unifiedmodel/blob/main/examples/sdk/full-flow.md Run this command to set up Python dependencies and download Go or Java dependencies if the tools are available. ```bash make setup ``` -------------------------------- ### UModel API Endpoints for Workspace Scoping Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/concepts/workspaces-and-domains.md Examples of HTTP POST and GET requests demonstrating how workspace names are included in API paths for various UModel operations. ```http POST /api/v1/umodel/{workspace}/import POST /api/v1/entitystore/{workspace}/entities:write POST /api/v1/query/{workspace}/execute GET /api/v1/agent/{workspace}/discover ``` -------------------------------- ### Start Legacy HTTP+SSE MCP Server Source: https://github.com/alibaba/unifiedmodel/blob/main/examples/mcp/README.md Initiate the HTTP MCP server, which will be used for Server-Sent Events (SSE) communication. This setup is for older clients or specific streaming patterns. ```bash curl -N http://127.0.0.1:8090/sse ``` -------------------------------- ### Install Dependencies and Validate Configuration Source: https://github.com/alibaba/unifiedmodel/blob/main/tools/validators/README_umodel_validator.md Install the PyYAML package and then use the umodel_validator.py script to validate a configuration file. Ensure you have the necessary dependencies installed before running the validation. ```bash # Install dependencies pip install PyYAML # Validate configuration file python ./scripts/validators/umodel_validator.py examples/dataset/metricset/sls.front.metric.yaml ``` -------------------------------- ### Validate Generated Assets and Examples Source: https://github.com/alibaba/unifiedmodel/blob/main/CONTRIBUTING.md Performs validation checks on generated SDKs, schemas, and examples. Use `make verify` for general validation and `make example-validate` specifically for examples. ```bash make verify make example-validate ``` -------------------------------- ### Validation Warnings Example Source: https://github.com/alibaba/unifiedmodel/blob/main/tools/validators/README_umodel_validator.md This example shows a validation report containing warnings for undefined fields in the configuration. ```text ## ⚠️ Warnings (2) 1. Path 'spec.metrics[0].extra_field': Field is not defined in the schema 2. Path 'metadata.unknown_field': Field is not defined in the schema ``` -------------------------------- ### Go REST Client Example Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/guides/sdk-clients.md This Go code demonstrates how to use the minimal Go REST client to create a workspace and execute a query. Ensure the client is initialized with the correct address. ```go client := service.NewClient("http://localhost:8080") ctx := context.Background() _, err := client.CreateWorkspace(ctx, service.CreateWorkspaceRequest{ ID: "demo", Name: "Demo", }) if err != nil { return err } result, err := client.Query(ctx, "demo", service.QueryRequest{ Query: ".umodel | limit 5", }) if err != nil { return err } _ = result ``` -------------------------------- ### Data Filter Example Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/html/data_link.html Example of using a data filter with query syntax. This method is complex and not recommended. ```text data_fiter = "type='db'" ``` -------------------------------- ### Install Local Dependencies Source: https://github.com/alibaba/unifiedmodel/blob/main/README.md Installs local dependencies required for development. Run this command before building the project. ```bash make install-env ``` -------------------------------- ### Explain Query via CLI Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/guides/query-service.md Explain UModel queries from the command line using the `umctl query explain` command. ```bash go run ./cmd/umctl --addr http://localhost:8080 query explain demo ".umodel | limit 5" ``` -------------------------------- ### Validation Errors and Warnings Example Source: https://github.com/alibaba/unifiedmodel/blob/main/tools/validators/README_umodel_validator.md This example demonstrates a validation report with both errors (missing required fields) and warnings (undefined fields). ```text ## 🚨 Errors (1) 1. Path 'spec.metrics[0].name': Missing required field ## ⚠️ Warnings (1) 1. Path 'spec.unknown_section': Field is not defined in the schema ``` -------------------------------- ### Startup Sequence Diagram Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/architecture/runtime-flow.md Illustrates the sequence of operations during the umodel-server startup process, from flag parsing to registering routes and listening on an address. ```mermaid sequenceDiagram participant Main as umodel-server participant Bootstrap as internal/bootstrap participant Workspace as Workspace Store participant Graph as GraphStore Provider participant HTTP as REST Router Main->>Bootstrap: parse flags and build app Bootstrap->>Graph: select provider Bootstrap->>Workspace: initialize workspace persistence Bootstrap->>HTTP: register routes and UI handler HTTP-->>Main: listen on address ``` -------------------------------- ### MetricSet Definition Example Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/concepts/datasets.md Defines a metric set with labels and metrics. This example shows a service metric set keyed by service_id. ```yaml kind: metric_set metadata: name: "devops.metric.devops.service" domain: devops spec: labels: keys: - name: service_id type: string metrics: - name: request_count aggregator: sum ``` -------------------------------- ### Setup Search Functionality Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/html_en/index.html Initializes the search input event listener. Filters documentation items based on user input and re-renders the list. ```javascript function setupSearch() { const searchInput = document.getElementById('searchInput'); searchInput.addEventListener('input', (e) => { const searchTerm = e.target.value.toLowerCase().trim(); if (searchTerm === '') { renderDocs(docs); return; } const filteredDocs = docs.filter(doc => doc.title.toLowerCase().includes(searchTerm) || doc.subtitle.toLowerCase().includes(searchTerm) || doc.description.toLowerCase().includes(searchTerm) || getCategoryName(doc.category).toLowerCase().includes(searchTerm) ); renderDocs(filteredDocs); }); } ``` -------------------------------- ### Explain Query with umctl Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/concepts/query-surfaces.md Demonstrates explaining a query using the `umctl` command-line tool, returning the query plan. ```bash go run ./cmd/umctl --addr http://localhost:8080 query explain demo ".entity with(domain='devops', name='devops.service') | limit 5" ``` -------------------------------- ### Validate Model Pack Examples Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/guides/model-authoring.md Command to run the repository's example validator. Use this to check the integrity of your model pack before further steps. ```bash make example-validate ``` -------------------------------- ### Run Web UI Development Server Source: https://github.com/alibaba/unifiedmodel/blob/main/docs/en/getting-started/installation.md Start the Web UI development server in a separate terminal. It uses the same package manager resolution as `make install-env`. ```bash make dev-web ```