Source Code Tour
Who is this guide for?
- Developers approaching qOntology for the first time who need a map of the project.
- Developers extending ontology modeling, knowledge extraction or graph applications.
- Maintainers tracing implementation from a page, endpoint or database table.
Starting with directories and entry points, this guide follows actual code to explain how pages, business services, AI and graph storage work together. Source paths are relative to the qOntology product repository. Use the target branch’s POMs for module membership and runtime configuration and arguments for effective settings.
1. Top-level directories
qOntology/
├── pom.xml # Maven aggregation, dependency and version management
├── qontology-server/ # Main service entrance and packaging
├── qontology-framework/ # Shared infrastructure
├── qontology-module-basic/ # Project, version, Data Sources, file, etc. Basic Management
├── qontology-module-om/ # ontology, Semantic Assets, constraints, auxiliary modeling
├── qontology-module-app/ # Extract tasks, logs, publishing and graph applications, etc. Ontology Applications
├── qontology-module-ai/ # Model and API Key management
├── qontology-module-system/ # Users, roles, menus, dictionaries and logs, etc. System Management
├── qontology-ui/ # Vue front-end engineering
├── sql/ # Initialization, upgrade and database modeling materials
├── docker/ # Compose, mount configuration and deployment directoryThe root POM aggregates the framework, five business modules and the server. Business modules generally separate *-api from *-biz. qontology-server/pom.xml imports the implementations and assembles them into one Spring Boot process. The frontend is built separately and calls the server over HTTP.
Why this structure helps
- Clear navigation: business identifiers connect pages, endpoints and backend modules.
- Shared capabilities: data access, authorization, files, AI and graphs live in the framework.
- Clear deployment boundaries: frontend output, server JARs, SQL and container configuration are maintained separately.
Publishing scripts may push images or update environments. Reading the source does not require running them; local build commands follow below.
2. Runtime entry points
| Runtime | Entry point | Default port | Responsibility | Build location |
|---|---|---|---|---|
| Main server | QOntologyApplication.java | 8099 | Business APIs, authorization and module assembly | Root Maven project |
| Frontend dev server | src/main.js | 80 | Initialize Vue, router, Pinia and components | qontology-ui |
The main server entry point is:
qontology-server/src/main/java/tech/qiantong/qontology/server/QOntologyApplication.javaThe main project uses Java 17, Spring Boot 3.5.8. The front-end package.json uses Vue 3.4.31, Vite 5.3.2, Pinia 2.1.7, Element Plus 2.7.6. AI, extraction and graph services run with the main service and are not independent applications that need to be started separately in this repository.
Build and run locally
Prepare the databases, Redis, graph storage and file storage required by the selected configuration, then verify connections. Build the server from the product repository root. -DskipTests skips tests; it does not indicate successful verification:
mvn clean package -pl qontology-server -am -DskipTests
java -jar qontology-server/target/qontology-server.jar --spring.profiles.active=devRun the frontend in a separate terminal. After installing dependencies, use these commands for development and production builds:
cd qontology-ui
npm install
npm run devnpm run build:prodbuild:prod runs vite build and produces qontology-ui/dist. Although build:stage exists in the scripts, the inspected directory has no .env.staging; it is not a ready-to-use staging configuration.
Distinguish the port settings
The source server’s application.yml uses 8099. The Dockerfile default command and mounted container configuration use 8097. Nginx listens on 80 inside its container, while Compose determines the exposed port. The frontend development port 80 is a separate setting from Nginx exposure. Check proxy targets when changing ports.
3. Frontend project structure
3.1. Frontend root
qontology-ui/
├── .env.development # Development environment variables
├── .env.production # Production environment variables
├── .eslintignore # ESLint ignores configuration
├── eslint.config.js # ESLint rules
├── jsconfig.json # Editor and path alias configuration
├── index.html # Vite page entrance
├── package.json # Dependencies, versions and npm commands
├── package-lock.json # npm dependency lock file
├── vite.config.js # Vite, proxy and build configuration
├── bin/ # Windows build and startup scripts
│ ├── build.bat
│ ├── package.bat
│ └── run-web.bat
├── html/
│ └── ie.html # Browser compatibility prompt page
├── public/ # Static resources that do not participate in compilation and are copied directly
│ ├── excel/ # Excel template file
│ └── favicon.ico # site icon
├── vite/
│ └── plugins/ # Vite plugin configuration
│ ├── auto-import.js
│ ├── compression.js
│ ├── setup-extend.js
│ ├── svg-icon.js
│ └── index.js
└── src/ # Front-end business source codeStructural benefit: environment parameters, build rules and business code are separate. Start proxy investigations with environment files and Vite configuration rather than searching every page.
3.2. The src directory
qontology-ui/src/
├── App.vue # Root component
├── main.js # App and global capability registration
├── permission.js # Login checks and route guards
├── settings.js # Page and layout settings
├── api/ # Requests grouped by business module
├── views/ # Pages and page-specific components
├── router/ # Static, hidden and dynamic route definitions
├── store/ # Pinia state and menu permissions
├── layout/ # Shell, navigation and tabs
├── components/ # Reusable components
├── directive/ # Custom directives
├── plugins/ # Application plugins
├── utils/ # Request wrapper, authentication and utilities
└── assets/ # Icons, fonts, styles and business assetsmain.js creates the Vue app, connects the router and Pinia, registers components, directives and plugins, and imports Element Plus, product styles and SVG registration. Keep request definitions in api, page state and presentation in views, and shared state in store. See Static Resource Standards.
Structural benefit: presentation, communication and shared capabilities have separate entry points; a page’s imports reveal its dependencies.
3.3. Routing mechanism
src/router
+ src/permission.js (router.beforeEach)
→ store/system/user.js (getInfo)
→ store/system/permission.js (generateRoutes)
→ api/system/menu.js → GET /getRouters
→ import.meta.glob → views/**/*.vue
→ router.addRoute → pageStatic and hidden routes are defined in src/router. src/permission.js checks login state, obtains user information when needed and invokes the permission store’s generateRoutes(). Menu responses contain component paths. The store resolves them to Vue files under views, handles placeholders such as Layout and builds accessible routes; the guard registers returned business routes and re-enters the destination.
The current store filters business menus with missing components and handles dynamic routes defined in code. Adding a .vue file therefore also requires a static route or a menu component path and role permissions. For a missing menu, inspect /getRouters, frontend paths and authorization together.
3.4. Map frontend features to backend modules
Frontend paths below are relative to qontology-ui/src; backend module paths are relative to the repository root.
| business | Page/request directory | backend module | represents the entrance |
|---|---|---|---|
| Basic Management (basic business such as projects) | For exceptions such as views/basic/api/basic, Model Marketplace, see below | qontology-module-basic | BasicProjectController |
| Ontology Modeling | views/om / api/om | qontology-module-om | OmObjectTypeController |
| Ontology Applications | views/app / api/app | qontology-module-app | AppStructTaskController |
| Model management (Model Marketplace, my model) | views/basic/llm / api/basic/llm | qontology-module-ai | AiModelController / AiApiKeyController |
| System Management | views/system / api/system | qontology-module-system | SysUserController |
The front-end directory is usually organized by the menu to which the page belongs, and the back-end modules are divided by business responsibilities. The two are not strictly one-to-one correspondence. For example, Model Marketplace is located in the Basic Management menu, and the page and request files are placed under basic/llm, but the model request uses interfaces such as /ai/model and is processed by the AI module. It cannot be determined that the request must enter the Basic Management module just based on views/basic.
Location method: First narrow the search scope according to the business directory, then check the request function imported by the page, confirm the request address and method, and finally match the mapping of the back-end Controller. The front-end directory, browser route, and interface prefix can be different, and the actual calling relationship is subject to this link.
3.5. How to locate frontend page source code
When customizing the application, use the following methods to find the .vue file corresponding to a browser page:
- Record page information: open the target page and note its browser URL, menu name and distinctive text.
- Find static pages: search
src/routerfor the route path in the URL. The route configuration’scomponentpoints to the corresponding file undersrc/views. - Use menu management: go to System Management → Menu Management, find the menu by name, check its Component Path, then locate the page file under
src/views. - Search by business directory: use the business abbreviation in the URL to find the matching directory under
src/views. For example,basic/projectusually corresponds tosrc/views/basic/project. - Search by page text: if the path does not reveal the file, search
src/viewsfor the page title, button label or message text.
After adding a
.vuefile, a route or another component must reference it before the page can be accessed.
Project management tracing example
- Record the menu label, distinctive page text and Network request. Check
routerfor a static route, or the menu component path for a dynamic one. - The project list is
qontology-ui/src/views/basic/project/index.vue. It imports@/api/basic/project/projectand callslistProject(queryParams.value). qontology-ui/src/api/basic/project/project.jssendsGET /basic/project/list, passing filters throughparams.src/utils/request.jsusesVITE_APP_BASE_APIas baseURL and adds authentication tokens according to its rules. The development proxy strips/dev-apibefore forwarding.BasicProjectController.listcallsBasicProjectServiceImpl.getBasicProjectPage;BasicProjectMapper.selectPageconstructs the paging conditions.- The mapper uses
BasicProjectDO, mapped tobasic_project. This query is implemented in a Java default mapper method, so do not assume every query lives in XML.
views/basic/project/index.vue
→ api/basic/project/project.js:listProject
→ GET /dev-api/basic/project/list
→ Vite proxy → GET /basic/project/list
→ BasicProjectController.list
→ BasicProjectServiceImpl.getBasicProjectPage
→ BasicProjectMapper.selectPage → BasicProjectDO → basic_projectBackend files are under qontology-module-basic/qontology-module-basic-biz/src/main/java/tech/qiantong/qontology/module/basic/: inspect controller/admin/project, service/project/impl, dal/mapper/project and dal/dataobject/project.
4. Backend modules
The backend separates infrastructure, business contracts and implementations. Identify the business module first, then its controller and service; move into the framework when tracing shared behavior. Java package paths below are under src/main/java/tech/qiantong/qontology/ in the relevant module.
4.1. qontology-framework
The shared framework aggregation module contains the following submodules:
| Submodule | Capabilities |
|---|---|
qontology-common | Exceptions, enums, annotations, utilities, encryption, data masking and database adapters |
qontology-config | Spring, thread pools, internationalization, filters, CAPTCHA, resource access and server monitoring configuration |
qontology-core | Unified responses, base controllers and entities, pagination objects, login user objects, Excel utilities and sensitive-field serialization |
qontology-mybatis | MyBatis-Plus, pagination, base mappers, dynamic data sources, query wrappers, field filling and type handling |
qontology-security | Login authentication, token validation, API permissions, data permissions, rate limiting, operation logs and global exception handling |
qontology-redis | Redis serialization, cache configuration and shared cache services |
qontology-websocket | WebSocket configuration, online session management and message delivery |
qontology-quartz | Quartz task management, execution strategies, execution logs, Cron expressions and task invocation utilities |
qontology-file | File uploads, storage configuration and file processing utilities |
qontology-generator | Database table parsing and template-based generation of frontend, backend, SQL and Mapper XML code |
qontology-ai | Contracts for chat, embeddings, reranking and knowledge retrieval; model configuration, provider adapters, invocation routing and runtime governance |
qontology-graphis | Graph entities, node and relationship operations, repositories and query wrappers, plus Neo4j and ArangoDB adapters and configuration assembly |
qontology-core provides shared base objects and web capabilities; ontology modeling belongs to qontology-module-om. See 4.6 for the internal modules of qontology-graphis, adapter activation conditions and the distinction from legacy directories.
Module benefits
Centralized reuse of shared capabilities: security, databases, caching, files, scheduling and graph data access are maintained together, allowing business modules to focus on business logic while using consistent technical implementations.
4.2. Separating api and biz
Most business modules are split between *-api and *-biz: api defines service interfaces and data objects for calls by other modules, and biz implements business logic and provides HTTP interfaces. The following takes the Basic Management module as an example, omitting specific business subdirectories:
qontology-module-basic/
├── pom.xml # Aggregation api and biz submodules
├── qontology-module-basic-api/
│ ├── pom.xml # Dependency configuration across module contracts
│ └── src/main/java/.../module/basic/api/
│ ├── dto/ # Data objects passed across modules
│ └── service/ # Service interface exposed to other modules
└── qontology-module-basic-biz/
├── pom.xml # Dependency configuration of business implementation
└── src/main/
├── java/.../module/basic/
│ ├── api/ # Implement the service interface of the api submodule
│ ├── controller/
│ │ └── admin/ # HTTP interface, organize Controller and VO by business
│ ├── service/ # Business service interface and impl implementation
│ ├── dal/
│ │ ├── dataobject/ # Database entity DO
│ │ └── mapper/ # MyBatis Mapper interface and query definition
│ ├── dto/ # Data transfer object inside the module
│ └── enums/ # Business enumeration
└── resources/
└── mapper/ # MyBatis XML mapping fileThe api submodule here is used for calls between Java modules and is not equivalent to the front-end src/api request directory; the HTTP interface accessed by the browser is provided by the Controller in biz. Each module adds directories as needed, such as convert for object conversion, utils for internal tools, international copywriting, configuration files or Prompt resources. Not every module contains these contents.
| Object / layer | Purpose | What to inspect |
|---|---|---|
| VO | HTTP request/response shape | Validation, paging and response fields |
| DTO | Transfer data across layers/modules | Contract fields and callers |
| DO | Persistent database object | Table, fields, soft deletion and filling |
| Service | Business rules and orchestration | Validation, transactions, cross-module calls |
| Mapper / XML | Persistence and queries | Check Java default methods as well as XML |
Prefer *-api interfaces and DTOs for cross-module calls. Extraction obtains sources through IBasicDatasourceApiService and file metadata through IBasicFileApiService. The basic API module supplies the contracts, the basic biz module implements them, and the server assembles both.
Structural benefit: callers depend on contracts rather than another module’s controllers and storage details, allowing internal persistence and conversions to evolve.
4.3. Basic management and ontology modeling
These modules maintain shared business resources and versioned model definitions respectively. The following controllers are under each *-biz module’s controller/admin; follow the matching business directories to services and mappers.
| Capability | Module / controller | Important data or flow |
|---|---|---|
| Projects and versions | basic: BasicProjectController, BasicProjectVersionController | basic_project, basic_project_version |
| Object types and attributes | om: OmObjectTypeController, OmObjectTypeAttributeController | om_object_type, om_object_type_attribute |
| Object relationships | om: OmObjectTypeRelationController | om_object_type_relation |
| Terms | om: OmTermController | om_term |
| Enums and business data types | om: OmEnumTypeController, OmDataTypeController | Model-level semantic definitions |
| Model axioms and data rules | om: OmModelAxiomController, OmDataRuleController | Constraint definitions and field references |
| Modeling goals | om: OmTargetController | Goals and links to objects/relationships |
BasicProjectServiceImpl.createBasicProject After creating the project, call the version service to create the project version. The back-end export service provides exportOwl and exportTurtle. Before exporting, it will be checked whether the version belongs to the current project; the current project management page only opens Turtle, and the RDF/XML and JSON-LD options are disabled. The existence of an export method in the backend does not mean that the page has opened the corresponding format. When modifying the project or version interface, you must also check the associated front-end selector, version service, and export process.
Ontology Modeling enters from views/om, api/om, and then to subdirectories such as objects, relationships, terms, and constraints. When locating the Model Axioms or Data Rules problem, in addition to the corresponding Controller, you should also check the referenced Object Types, attributes and version range. Common verification entries are as follows, and the paths are relative to qontology-module-om/qontology-module-om-biz/src/main/java/tech/qiantong/qontology/module/om/:
| question | Realize the entrance | Key points for troubleshooting |
|---|---|---|
| When deleting, it prompts that it is referenced by an axiom or rule. | service/constraint/impl/ConstraintReferenceGuardImpl.java, and the calling point of the Service corresponding to the deleted data | Object Types, attribute checking axioms and Data Rules are referenced; Business Data Types, enumeration checking axioms are referenced. Follow the prompts to locate the reference definition, and then delete it after unbinding it; simply deactivating the axiom will not dereference it. |
| Add or modify prompt name duplication | Service corresponding to the business; the axioms and rules are OmModelAxiomServiceImpl and OmDataRuleServiceImpl respectively. | The names of terms, items Business Data Types, items enumeration, Object Types, axioms and rules are checked according to the version of the project they belong to; they should be excluded when modifying. |
| Duplicate attribute code | service/object/impl/OmObjectTypeAttributeServiceImpl.java | The uniqueness range is the attribute code within the same Object Types, which cannot be understood as the attribute name must be unique. |
| Object Type RelationshipsDuplicate | service/relation/impl/OmObjectTypeRelationServiceImpl.java | In the same version, the combination of "starting point type + relationship name + end point type" is checked. Duplication cannot be determined based on the relationship name alone. |
Page forms also have required, type and associated selection validation. If you encounter a save or delete failure, you should combine the front-end prompts and the back-end verification to locate the cause to avoid bypassing business constraints by just modifying the display text.
Structural benefit: shared resources and model definitions have clear owners, and version references let developers trace the model used by an extraction or export. Verify actual isolation filters in the endpoint and query.
4.4. Ontology applications and extraction
qontology-module-app connects models to business data. Key frontend entry points are views/app/structTask, views/app/unstructTask, views/app/taskLog and views/app/graph. Important backend directories follow:
qontology-module-app/qontology-module-app-biz/src/main/
├── java/.../module/app/controller/admin/ # Task, mapping, log and graph endpoints
├── java/.../module/app/service/appStructTask/ # Structured extraction
├── java/.../module/app/service/appUnstructTask/ # Unstructured extraction
├── java/.../module/app/service/extraction/ # AI extraction bridge for TTL and text
├── java/.../module/app/service/appTaskLog/ # Execution logs and details
├── java/.../module/app/service/neo4j/ # Graph writes and publication of extraction results
├── java/.../module/app/service/graph/ # Graph retrieval and editing
└── resources/prompts/extraction-prompt.txt # Unstructured extraction promptStructured extraction flow
api/app/structTask.js
→ POST /app/structTask/executeExtraction
→ AppStructTaskController → AppStructTaskServiceImpl.executeExtraction
→ Redis "app_struck" + single-thread executor
→ consumeQueue → execStructTaskInternal
→ IBasicDatasourceApiService → DataSourceFactory → DbQuery
→ schema / attribute / relation mappings
→ AppNeo4jService.saveStructEntity / saveStructRelationship
→ GraphisRepository
+ IAppTaskLogService.startInvoke / recordStep / endInvokeThe execution entry checks existence, publication status, and whether the task is already running or queued. It sets QUEUE, writes to Redis and schedules consumption. consumeQueue sets INPROGRESS, starts a log and calls execStructTaskInternal.
The core method obtains a source connection and loads schema, attribute, relationship and intermediate-table mappings. It chooses single-table or multi-table processing, saves entities first and relationships afterward. Full extraction deletes the task’s previous graph data; incremental processing loads existing entities for matching. Success sets EXECUTED; failure sets ERROR and records the error.
The code also contains Quartz scheduling and full/incremental entry points. Their presence does not mean every frontend switch is available; check the current UI implementation too.
Unstructured extraction flow
api/app/unstructTask.js
→ POST /app/unstructTask/executeExtraction
→ AppUnstructTaskServiceImpl.executeExtraction
→ Redis queue + single-thread executor
→ consumeQueue → executeTask → execTaskByModel
→ TTL + IBasicFileApiService → FileReader → text segments
→ AppExtractionModelService.extract → AiChatService.chat
→ entities / relations → AppNeo4jService.saveUnstructExtraction
+ task text records + execution logsA task needs linked business files and a readable TTL file. The entry rejects published, running, queued or file-less tasks. Consumption loads the TTL and file metadata, reads text, splits it with the current FileReader.splitText2 parameters, and invokes extraction for each segment.
AppExtractionModelService compacts the ontology, loads its prompt, sends rules and schema as a system message and source text as a user message, then normalizes model JSON into entities and relations. Graph results retain links to text segments, while task text and execution logs are stored by business persistence. Re-execution removes existing results and text records for that task.
Execution, review and publication are separate: an accepted or queued response does not mean a graph has been generated. Review completed results before releaseByTaskId; cancelReleaseByTaskId reverses publication. Graph queries also depend on publication status and filters.
Structural benefit: task entry, text/mapping processing, graph writes and logs each have identifiable locations. Investigate task state, logs, inputs, results and publication rather than relying on HTTP success alone.
4.5. AI modules
AI code has four layers: model and credential management, the shared invocation framework, AI-assisted modeling, and unstructured extraction. They are assembled into the main server rather than separate AI services.
| Layer | Location / entry | Purpose |
|---|---|---|
| Model management | qontology-module-ai → AiModelController / AiApiKeyController | Manage data associated with ai_model and ai_api_key |
| Configuration bridge | DatabaseAiModelConfigProvider / AiModelApiServiceImpl | Resolve business settings into framework configuration or references |
| Shared framework | qontology-framework/qontology-ai | Chat contracts, invocation governance and provider adapters |
| Assisted modeling | qontology-module-om → service/ai/aiModeling | Document parsing, staged generation, candidate review and adoption |
| Extraction bridge | qontology-module-app → AppExtractionModelService | Extract from TTL and source text |
qontology-framework/qontology-ai/src/main/
├── java/.../ai/api/chat/ # AiChatService chat contract
├── java/.../ai/api/embedding/ # Embedding contract
├── java/.../ai/api/rerank/ # Reranking contract
├── java/.../ai/api/knowledge/ # Knowledge retrieval contracts
├── java/.../ai/config/ # Auto-configuration and AiProperties
├── java/.../ai/core/model/ # Core objects including model configuration
├── java/.../ai/core/spi/ # Configuration-provider and adapter interfaces
├── java/.../ai/core/routing/ # ProviderRegistry provider routing
├── java/.../ai/runtime/ # Chat execution, invocation governance and runtime services
├── java/.../ai/provider/ # openai, tongyi, ollama and deepseek adapters
└── resources/application-ai-*.yml # Environment-specific AI settingsLocate provider implementations by class name: OpenAiProviderAdapter, TongYiProviderAdapter, OllamaProviderAdapter and DeepSeekProviderAdapter. An interface or adapter does not imply every provider supports every capability; ProviderRegistry selects by provider code and requested capability.
AiAutoConfiguration is controlled by qontology.ai.enabled and is enabled when the property is absent. The framework supplies a default PropertiesAiModelConfigProvider. With business modules assembled, DatabaseAiModelConfigProvider supplies database settings; the default is guarded by ConditionalOnMissingBean. Identify the effective configuration provider before checking model identifiers, endpoints and authentication.
AiChatService.chat / stream
→ DefaultAiChatService
→ AiModelConfigProvider → AiModelConfig
→ ProviderRegistry.require(providerCode, CHAT / CHAT_STREAM)
→ GovernedInvocationExecutor
→ AiProviderAdapter.chat / stream → model endpointAI-assisted modeling: files, candidates and adopted models
OmAiTaskController (/om/aiTask)
→ create: upload files and create task
→ POST /{id}/analyze-stream (SSE)
→ OmAiModelingServiceImpl.start
→ threadPoolTaskExecutor → OmAiModelingAsyncProcessor.process
→ OmAiDocumentParser + OmAiPromptLoader
→ IAiModelApiService.getModelRef → AiChatService.stream
→ candidates + OmAiModelingStreamPublisher
→ POST /{id}/adopt-all → OmAiModelingServiceImpl.adoptAll
→ ontology business servicesTask creation stores files first. The analysis endpoint subscribes to SSE and asynchronously starts parsing and generation. OmAiModelingAsyncProcessor handles documents and model calls; OmAiModelingStreamPublisher publishes progress. Only adoption passes candidates to business services that persist formal targets, terms, enumerations, objects, attributes, relationships and constraints.
Prompts live in qontology-module-om/qontology-module-om-biz/src/main/resources/prompts/ai-modeling/: round-1-foundation.md, round-2-object.md, round-3-members.md and round-4-rules.md. OmAiPromptLoader loads them.
The current processor uses MODEL_KEY_ID = 1L; both text and vision model constants are qwen3.6-plus. It obtains references through IAiModelApiService.getModelRef. This is the current source selection mechanism, not automatic use of any model selected in a page. When changing models, also verify parsing, vision, structured output and prompt compatibility.
Model entry for unstructured extraction
AppExtractionModelService constructs AiModelRef with MODEL_PLATFORM_ID = "1" and MODEL_NAME = "qwen-max"; the platform identifier refers to the credential configuration record. Its prompt is resources/prompts/extraction-prompt.txt in the app module. ExtractionSchemaCompactor compacts TTL before substitution into {{TTL_SCHEMA}}. The service calls AiChatService.chat and parses entities and relationships from JSON.
Before running, ensure the referenced configuration exists, the provider/model is available, and endpoint and authentication settings are correct. Modeling and extraction maintain separate constants; changing one entry does not update the other. Use target-environment credentials and do not copy secrets into documentation or logs.
Structural benefit: a common chat contract and adapter layer let business services focus on modeling or extraction. Model selection and prompts remain with callers, so investigate both the business entry and shared framework.
4.6. Graph database modules
qontology-framework/qontology-graphis/
├── pom.xml # Graph module aggregation
├── qontology-graphis-core/ # GraphisRepository, GraphEntity and query/upsert wrappers
├── qontology-neo4j/ # Neo4jGraphisTemplate adapter
├── qontology-arangodb/ # Optional ArangodbGraphisTemplate adapter
└── qontology-graphis-starter/ # Dependency assembly and application-graphis-*.ymlGraphisRepository extends BaseRepository<GraphEntity, String>. Business code expresses reads and updates with graph entities, GraphQueryWrapper and GraphUpsertWrapper. The current qontology-graphis-starter mainly supplies dependencies and resource configuration; its name does not imply an additional Java auto-configuration class.
There are two application entry paths. Despite its retained Neo4j name, AppNeo4jServiceImpl injects GraphisRepository for extraction entities, relationships, deletion and publication. AppGraphServiceImpl uses the same interface for graph queries and editing.
extraction task → AppNeo4jServiceImpl ─┐
├→ GraphisRepository
AppGraphController → AppGraphServiceImpl ┘
→ graphis.type = neo4j → Neo4jGraphisTemplate
→ graphis.type = arangodb → ArangodbGraphisTemplateThe adapters are conditional on graphis.type=neo4j and graphis.type=arangodb. The deployment supplies Neo4j, and production graph configuration selects neo4j. ArangoDB is optional: prepare its database and connection configuration and verify required query/update operations before switching. Adapter code does not mean both databases run in the current deployment.
A legacy qontology-framework/qontology-neo4j directory also exists, but its aggregation entry is commented out. Do not confuse it with the active qontology-graphis/qontology-neo4j module.
Structural benefit: extraction and graph pages share a storage contract, with database details concentrated in adapters. Start business investigations in app services and query-conversion or driver investigations in the selected adapter.
5. Configuration, database and deployment files
5.1. Project configuration
| Configuration | Actual location | Purpose |
|---|---|---|
| Main server shared settings | qontology-server/src/main/resources/application.yml | Port, profile, imports and shared parameters |
| Server environment settings | qontology-server/src/main/resources/application-dev.yml / application-prod.yml | Environment-specific data access, cache and other settings |
| AI framework settings | qontology-framework/qontology-ai/src/main/resources/application-ai-*.yml | AI enablement, runtime and provider settings |
| File settings | qontology-framework/qontology-file/src/main/resources/application-file-*.yml | File storage settings |
| System settings | qontology-module-system/qontology-module-system-biz/src/main/resources/application-system-*.yml | System module settings |
| Graph settings | qontology-framework/qontology-graphis/qontology-graphis-starter/src/main/resources/application-graphis-*.yml | Graph adapter selection and connection settings |
| Frontend environment and proxy | qontology-ui/.env.development / .env.production / vite.config.js | API prefix, development port, proxy and build |
The main configuration defaults to dev. spring.config.import loads the environment-specific server file and classpath AI, file, system and graph settings. Maven packages module resources into dependency JARs; placing YAML in an arbitrary directory does not load it. Startup arguments can override profile and port, so inspect the actual command, mounts and imports together.
spring:
profiles:
active: dev
config:
import:
- "application-${spring.profiles.active}.yml"
- "classpath:application-ai-${spring.profiles.active}.yml"
- "classpath:application-file-${spring.profiles.active}.yml"
- "classpath:application-system-${spring.profiles.active}.yml"
- "classpath:application-graphis-${spring.profiles.active}.yml"The following demonstrates startup overrides only. Replace <PROFILE> and <PORT> with target values and prepare database, cache, graph and model settings separately.
java -jar qontology-server/target/qontology-server.jar --spring.profiles.active=<PROFILE> --server.port=<PORT>The VITE_APP_BASE_API of the development front end is /dev-api, and Vite removes the prefix and forwards it to http://localhost:8099. Production builds use /prod-api/ and need to be handled by the reverse proxy in the deployment. Environment variables are involved in generating static files during front-end construction and need to be rebuilt after modification. The WebSocket proxy should also match the backend address.
Configuration tracing order: inspect the active profile and startup overrides, then main imports, then module resources. For failed requests, check frontend prefix, proxy rewriting and backend port together.
5.2. Database scripts
sql/
├── mysql/initialization/ # Full initialization and related SQL
│ ├── latest初始化.sql # Current full initialization entry
│ ├── v1.0.0初始化.sql # Version-specific initialization snapshot
│ └── change.sql # Separate change SQL; inspect before execution
├── mysql/upgrade/v1.0.0/ # Upgrade material for this version
│ ├── v1.0.0-update.sql # Upgrade SQL
│ ├── v1.0.0-update-data.sql # Upgrade data SQL
│ └── v1.0.0-readme.md # Upgrade instructions
├── pdman/qOntology.pdma.json # Database modeling file
└── neo4j/ # Neo4j configuration and storage
├── conf/neo4j.conf # Neo4j configuration
└── data/ # Stored data, not relational initialization scriptsRelational tables use business prefixes, including basic_project, basic_project_version, om_object_type, om_object_type_attribute, om_object_type_relation and app_struct_task; the user table is system_user. Follow DO mappings and then check SQL for the target version instead of guessing table names from classes.
New-environment initialization differs from upgrading an existing environment. Read upgrade notes, compare previously applied changes and back up data; do not use full initialization as an upgrade. The pdma.json file is design material, while actual SQL governs creation and migration. Neo4j data contains storage files, not repeatable modeling scripts.
Structural benefit: separate initialization, upgrade and design files make change provenance and environment differences easier to inspect.
5.3. Docker
| File or directory | Purpose |
|---|---|
docker/docker-compose.yml | Entry point including base and application services |
docker/docker-compose-base.yml | MySQL, Redis, Neo4j, Nginx and file preview |
docker/docker-compose-qontology.yml | qontology-api service and configuration mounts |
docker/.env | Image versions, ports and environment parameters |
qontology-server/docker/Dockerfile | Java 17 runtime image, JAR and startup command |
docker/qOntology/server/ | Container server settings; loading depends on mounts/imports |
docker/qOntology/nginx/nginx.conf | Main Nginx configuration and site includes |
docker/qOntology/nginx/sites/qontology.conf | Static resources, API, WebSocket and preview proxy |
docker/qOntology/mysql/init/ | init-system.sql and init-show.sql initialization files |
docker/qOntology/mysql/conf.d/my.cnf | MySQL settings |
docker/qOntology/neo4j-init/conf/neo4j.conf | Neo4j initial configuration material |
docker/reset.sh | Initialization helper; inspect overwrite behavior before execution |
Base services include MySQL 5.7, Redis 6, Neo4j 4.4.40, Nginx 1.24 and file preview; the application composition starts qontology-api. Its image copies target/*.jar, uses Java 17, activates prod and defaults to --server.port=8097. Container server configuration also uses 8097, distinct from source development’s 8099.
The current Compose configuration does not publish a host port for qontology-api; browsers use Nginx. Frontend output is mounted at /usr/share/nginx. Site rules use try_files for page routing and forward API calls to the main service on the container network.
browser → Nginx:80
├─ page / asset → /usr/share/nginx
├─ /prod-api/basic/project/list
│ → rewrite /basic/project/list → qontology-api:8097
├─ /websocket → qontology-api:8097
└─ /kkfileview → kkfileview:8012
qontology-api → MySQL / Redis / selected graph database
→ configured model endpointWith the current environment defaults, example host mappings are Nginx 80 → 80, MySQL 33067 → 3306, Neo4j 17474 → 7474 and 17687 → 7687, Redis 6379 → 6379, and file preview 8017 → 8012. These are Compose mappings, not separate business-module ports. Use the deployed .env and resolved Compose configuration as the final authority.
Although AI and graph files also exist in the server directory, the current application composition mounts only the main application.yml and application-prod.yml configuration files. Check classpath imports for other modules; neighboring YAML files do not automatically override packaged resources.
Structural benefit: static files, reverse proxy, server process and infrastructure are separately configured. Trace failures through page loading, API rewriting, server listening and dependency reachability. See Deployment and Operations for deployment steps.
