MCPcopy Index your code
hub / github.com/OpenSPG/openspg

github.com/OpenSPG/openspg @v0.8

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.8 ↗ · + Follow
9,999 symbols 30,960 edges 1,390 files 1,827 documented · 18% updated 12mo agov0.8 · 2025-06-29★ 2,14752 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

OpenSPG

中文版文档

License

OpenSPG is a knowledge graph engine developed by Ant Group in collaboration with OpenKG, based on the SPG (Semantic-enhanced Programmable Graph) framework, which is a summary of Ant Group's years of experience in constructing and applying diverse domain knowledge graphs in the financial scenarios.

OpenSPG Architecture

SPG Background

SPG (Semantic-enhanced Programmable Graph): semantic-enhanced programmable framework is a set of semantic representation framework based on property graph precipitated by Ant Knowledge Graph platform after years of supporting business in the financial field. It creatively integrates LPG structural and RDF semantic, which overcomes the problem that RDF/OWL semantic complexity cannot be industrially landed, and fully inherits the advantages of LPG structural simplicity and compatibility with big data system. The framework defines and represents knowledge semantics from three aspects. First, SPG explicitly defines the formal representation and programmable framework of "knowledge", so that it can be defined, programmed, understood and processed by machines. Secondly, SPG achieves compatibility and progressive advancement between knowledge levels, supporting the construction of knowledge graphs and the continuous iterative evolution of incomplete data states in industrial-level scenarios. Finally, SPG serves as an effective bridge between big data and AI technology systems, facilitating the efficient transformation of massive data into knowledge-based insights. By doing so, it enhances the value and application potential of the data. With the SPG framework, we can construct and manage graph data more efficiently, and at the same time, we can better support business requirements and application scenarios. Since SPG framework has good scalability and flexibility, new business scenarios can quickly build their domain models and solutions by extending the domain knowledge model and developing new operators.

For a detailed introduction to SPG, please refer to the 《SPG White Paper》 jointly released by Ant Group and OpenKG.

OpenSPG

OpenSPG is an open engine for knowledge graph designed and implemented on the basis of SPG framework, which provides explicit semantic representations, logical rule definitions, operator frameworks (construction, inference) and other capabilities for the domain knowledge graphs, and supports pluggable adaptation of basic engines and algorithmic services by various vendors to build customized solutions.

OpenSPG Core Capabilities:

  • SPG-Schema semantic modeling
  • Schema framework responsible for semantic enhancement of property graphs, such as subject models, evolutionary models, predicate models, etc.
  • SPG-Builder knowledge construction
  • Supports the construction of both structured and unstructured knowledge.
  • Compatible and articulated with big data architecture, provides a knowledge construction operator framework to realize the conversion from data to knowledge.
  • Abstracts the knowledge processing SDK framework, provides the ability of entity linking, concept standardization and entity normalization operators, combines Natural Language Processing (NLP) and deep learning algorithms, improves the uniqueness level of different instances within a single type. Furthermore, it supports the continuous iterative evolution of the domain knowledge graphs.
  • SPG-Reasoner logical rule reasoning
  • Abstracts KGDSL (Knowledge Graph Domain Specific Language) to provide programmable symbolic representation of logic rules.
  • Supports downstream tasks, such as rule inference, neural/symbolic fusion learning, KG2Prompt linked LLM knowledge extraction/knowledge reasoning, represented in machine-understandable symbolic form.
  • Define dependency and transfer between knowledge through predicate semantics and logic rules, and support modeling and analysis of complex business scenarios.
  • Programmable Framework -- KNext
  • As a programmable framework of knowledge graph, KNext offers a set of extensible, procedural, and user-friendly components;
  • It abstracts the core capabilities of knowledge graphs, congealing them into componentized, framework-oriented, and engine-built-in capabilities;
  • Achieves isolation between the engine and business logic, domain models, facilitating rapid definition of knowledge graph solutions for businesses;
  • Constructs a controllable AI technology stack driven by knowledge, based on the OpenSPG engine, connecting deep learning capabilities such as LLM and GraphLearning.
  • Cloud Adaptation Layer -- Cloudext
  • Business systems build their own characteristic business front-end by interfacing with open SDKs
  • Extensible/adaptable customized graph storage/graph calculation engine
  • Extensible/adaptable machine learning framework suitable for their own business characteristics

How to use

Get Started

Advanced tutorials

How to contribute

Cite

If you use this software, please cite it as below: * KAG: Boosting LLMs in Professional Domains via Knowledge Augmented Generation * KGFabric: A Scalable Knowledge Graph Warehouse for Enterprise Data Interconnection

@article{liang2024kag,
  title={KAG: Boosting LLMs in Professional Domains via Knowledge Augmented Generation},
  author={Liang, Lei and Sun, Mengshu and Gui, Zhengke and Zhu, Zhongshu and Jiang, Zhouyu and Zhong, Ling and Zhao, Peilong and Bo, Zhongpu and Yang, Jin and others},
  journal={arXiv preprint arXiv:2409.13731},
  year={2024}
}

@article{yikgfabric,
  title={KGFabric: A Scalable Knowledge Graph Warehouse for Enterprise Data Interconnection},
  author={Yi, Peng and Liang, Lei and Da Zhang, Yong Chen and Zhu, Jinye and Liu, Xiangyu and Tang, Kun and Chen, Jialin and Lin, Hao and Qiu, Leijie and Zhou, Jun}
}

License

Apache License 2.0

OpenSPG Core Team

Lei Liang, Mengshu Sun, Zhengke Gui, Zhongshu Zhu, Zhouyu Jiang, Ling Zhong, Peilong Zhao, Zhongpu Bo, Jin Yang, Huaidong Xiong, Lin Yuan, Jun Xu, Zaoyang Wang, Zhiqiang Zhang, Wen Zhang, Huajun Chen, Wenguang Chen, Jun Zhou, Haofen Wang

Extension points exported contracts — how you extend this code

AsyncTaskExecute (Interface)
Async scheduler Task, submit/stop task [9 implementers]
server/core/scheduler/service/src/main/java/com/antgroup/openspg/server/core/scheduler/service/task/async/AsyncTaskExecute.java
DataSourceMetaClient (Interface)
数据源的元数据信息 @author yangjin [7 implementers]
server/common/service/src/main/java/com/antgroup/openspg/server/common/service/datasource/meta/client/DataSourceMetaClient.java
QueryManager (Interface)
(no doc) [44 implementers]
server/biz/service/src/main/java/com/antgroup/openspg/server/biz/service/QueryManager.java
ModelDetailDOMapper (Interface)
(no doc) [20 implementers]
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/mapper/ModelDetailDOMapper.java
PropertyLinking (Interface)
(no doc) [9 implementers]
builder/core/src/main/java/com/antgroup/openspg/builder/core/strategy/linking/PropertyLinking.java
TestFunction (Interface)
(no doc) [8 implementers]
reasoner/runner/local-runner/src/test/java/com/antgroup/openspg/reasoner/runner/local/main/KgReasonerAliasSetKFilmTest.java
BaseUdaf (Interface)
(no doc) [28 implementers]
reasoner/udf/src/main/java/com/antgroup/openspg/reasoner/udf/model/BaseUdaf.java
LPGDataManipulationService (Interface)
Provides data manipulation service for LPG . [4 implementers]
cloudext/interface/graph-store/src/main/java/com/antgroup/openspg/cloudext/interfaces/graphstore/LPGDataManipulationService.java

Core symbols most depended-on inside this repo

put
called by 1310
reasoner/common/src/main/java/com/antgroup/openspg/reasoner/common/graph/property/IProperty.java
get
called by 1190
reasoner/common/src/main/java/com/antgroup/openspg/reasoner/common/graph/property/IProperty.java
size
called by 741
builder/core/src/main/java/com/antgroup/openspg/builder/core/logical/LogicalPlan.java
getId
called by 482
reasoner/common/src/main/java/com/antgroup/openspg/reasoner/common/graph/vertex/IVertex.java
addCriterion
called by 338
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/OntologyPropertyDOExample.java
getValue
called by 310
reasoner/common/src/main/java/com/antgroup/openspg/reasoner/common/graph/edge/IEdge.java
from
called by 301
reasoner/common/src/main/java/com/antgroup/openspg/reasoner/common/graph/vertex/IVertexId.java
constructionVertex
called by 266
reasoner/runner/runner-common/src/main/java/com/antgroup/openspg/reasoner/graphstate/generator/AbstractGraphGenerator.java

Shape

Method 8,445
Class 1,235
Interface 196
Enum 102
Function 21

Languages

Java100%
C++1%

Modules by API surface

server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/OntologyPropertyDOExample.java367 symbols
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/OntologyDOExample.java255 symbols
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/ConstraintDOExample.java233 symbols
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/SemanticDOExample.java175 symbols
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/LogicRuleDOExample.java159 symbols
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/ProjectOntologyRelDOExample.java157 symbols
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/OntologyParentRelDOExample.java145 symbols
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/ProjectDOExample.java133 symbols
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/TenantDOExample.java121 symbols
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/ReleaseDOExample.java103 symbols
server/infra/dao/src/main/java/com/antgroup/openspg/server/infra/dao/dataobject/SysLockDOExample.java93 symbols
reasoner/runner/runner-common/src/main/java/com/antgroup/openspg/reasoner/utils/RunnerUtil.java68 symbols

Datastores touched

(mysql)Database · 1 repos
openspgDatabase · 1 repos

For agents

$ claude mcp add openspg \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact