Semantic Integration Engine: AI時代のBoK活用デモ

浅海 智晴 Created: 2025-12-08

BoKとして作成した知識をAIで活用するためには、AIが認識できる形に落とし込んだ上で、AIと連携するメカニズムを提供する必要があります。

"AIが認識できる形"として📄 KnowledgeGraph Explorer: SimpleModelingの知識グラフを探索するで説明した通り、RDFによる知識グラフを自動生成して提供しています。この記事ではこの知識グラフKnowledgeGraph Explorerで可視化する方法を紹介しました。

次に必要なのは"AIと連携するメカニズム"です。

この目的で開発しているのがSemantic Integration Engineです。

本稿ではSemantic Integration Engineについての紹介と、実際に問い合わせを行う最小構成のデモ環境を用いた動作例を解説します。

BoK

BoKではSmartDox文書として通常の文書 (document IRI)、LexiDox文書として用語を記述します。SmartDox文書とLexiDox文書は簡単なプレインテキスト・フォーマットなので開発者だけでなく、ドメイン・エキスパートにも作成をしてもらうことを期待しています。

CML文書はソフトウェアのオブジェクト関数モデルを記述します。こちらは開発者が作成します。

BoK文書から知識へのマッピング
図 1. BoK文書から知識へのマッピング

BoKの定義する形式知としてHTMLが外部に公開されます。ビジネス・オーナー、ドメイン・エキスパート、開発者が共通のHTMLを通して形式知を共有します。

ソフトウェア開発に使用できるコンポーネント (Component)が生成されます。(予定)

BoKの内容はRDF形式の知識としても出力されます。具体的には site.jsonld / site.ttl です。いずれもRDF形式で、site.jsonld はJSON-LDフォーマット、site.ttl はTurtleフォーマットです。

また知識グラフの語彙として📄 KnowledgeGraph Explorer: SimpleModelingの知識グラフを探索するでも解説した以下のオントロジーが生成されます。

https://www.simplemodeling.org/ontology/simplemodelingorg#

SimpleModeling.org 全体の基本語彙。Article、GlossaryTerm、Category、Site など、サイト構造を記述するための中核スキーマ。プレフィックス smorg。

https://www.simplemodeling.org/bok/ontology/0.1-SNAPSHOT#

SimpleModeling Body of Knowledge(知識体系)を表現する語彙。BoK トピック、知識領域、参照関係などを記述する。プレフィックス smbok。

https://www.simplemodeling.org/category/ontology/0.1-SNAPSHOT#

カテゴリ分類(分野・テーマ)を表す語彙。記事・用語に紐づくカテゴリー階層のモデルを提供する。プレフィックス smcat。

https://www.simplemodeling.org/docmodel/ontology/0.1-SNAPSHOT#

SmartDox 文書構造を記述する語彙。文書、セクション、パラグラフ、図表、コードブロックなどの構造要素を表す。プレフィックス smdoc。

https://www.simplemodeling.org/glossary/ontology/0.1-SNAPSHOT#

用語集の概念を表す語彙。Term、Definition、Alias、Relation(broader / narrower)などを定義する。プレフィックス smglo。

https://www.simplemodeling.org/bibliography/ontology/0.1-SNAPSHOT#

参考文献情報(書籍、論文、URL等)を記述する語彙。著者、出版年、出版社、ISBN、引用関係などをモデル化する。プレフィックス smbib。

https://www.simplemodeling.org/project/ontology/0.1-SNAPSHOT#

SimpleModeling に付随するプロジェクト(例:スマートツール、研究ライン)を表す語彙。プロジェクト名、成果物、関連コンポーネントなどを定義する。プレフィックス smproj。

https://www.simplemodeling.org/simplemodel/ontology/0.1-SNAPSHOT#

SimpleModeling の「モデリング要素」(Entity、Value、Event、Rule など)を表現する語彙。モデルのメタレベル構造を表す基幹スキーマ。プレフィックス smodel。

https://www.simplemodeling.org/componentRepository/ontology/0.1-SNAPSHOT#

コンポーネントリポジトリ(再利用コンポーネントの集合)を表す語彙。コンポーネント、インタフェース、依存関係などを定義する。プレフィックス smcompr。

Semantic Integration Engine

BoKの提供するRDFによる知識を活用するためにSemantic Integration Engineを開発しました。

SIERDF(構造)+ Vector(意味距離)+ Graph(関係性)を統合して「AIが解釈しやすい知識アクセス層」を提供します。

具体的には以下の機能を備えています。

  • 概念検索(Concept Retrieval): LexiDox由来の語彙を意味距離に基づいて抽出

  • 文書断片検索(Passage Retrieval): SmartDox由来のテキストをチャンク単位で検索

  • RDFグラフ検索(Graph Retrieval): Fusekiから関連グラフ(構造的関係)を抽出し統合

  • MCP/WebSocket経由のChatGPT連携(予定): ChatGPTから直接SIEへ問い合わせ可能

これにより、AIはBoKの知識を「文脈」「語彙」「構造」の3層から同時に参照できるようになります。

アーキテクチャ

Semantic Integration Engineのアーキテクチャを以下に示します。

Semantic Integration Engineアーキテクチャ
図 2. Semantic Integration Engineアーキテクチャ

SIEは大きく以下のコンポーネントから構成されています。

  • Semantic Integration Server本体

  • Fuseki : グラフDB

  • ChromaDB : ベクトルDB

Fuseki

FusekiはRDFを格納することができるグラフDBで、RDFの検索言語であるSPARQLを使ってRDF知識グラフを検索することができます。

SIEではBoKが提供する知識をFusekiに格納し、概念間の構造的関係を問い合わせに利用します。

ChromaDB

ChromaDBは意味距離の検索に用いるベクトルDBです。

SIEでは以下の目的で使用します。

  • コンセプト検索 : コンセプトの意味距離

  • パッセージ検索 : 文書断片の意味距離

起動

デモ用のdocker-compose.ymlを用意しました。

以下のdocker-compose.ymlをコピーして、作業ディレクトリに配置してください。

version: "3.9"
services:
  #######################################################################
  # FUSEKI — RDF / SPARQL server
  #######################################################################
  fuseki:
    image: ghcr.io/asami/preload-fuseki:latest
    container_name: sie-fuseki
    platform: linux/amd64
    ports:
      - "9030:3030"
    restart: unless-stopped
    networks:
      - sie-net
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3030/ds/query?query=SELECT%20*%20WHERE%20%7B%20?s%20?p%20?o%20%7D%20LIMIT%201"]
      interval: 5s
      timeout: 3s
      retries: 20
      start_period: 10s
  #######################################################################
  # SIE-EMBEDDING — Lightweight embedding service
  #######################################################################
  sie-embedding:
    image: ghcr.io/asami/sie-embedding:latest
    container_name: sie-embedding
    ports:
      - "8081:8081"
    restart: unless-stopped
    networks:
      - sie-net
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8081/health"]
      interval: 3s
      timeout: 2s
      retries: 20
  #######################################################################
  # SIE — Semantic Integration Engine (HTTP + MCP WebSocket)
  #######################################################################
  sie:
    image: ghcr.io/asami/sie:0.0.4
    command:
      - "java"
      - "-Dconfig.file=/app/conf/application.demo.conf"
      - "-jar"
      - "/app/semantic-integration-engine.jar"
    container_name: sie
    depends_on:
      fuseki:
        condition: service_healthy
      sie-embedding:
        condition: service_healthy
    ports:
      - "9050:9050"   # HTTP RAG API
      - "9051:9051"   # MCP WebSocket API
    environment:
      # ---- SIE configuration ----
      FUSEKI_URL: http://sie-fuseki:3030/ds
      SIE_EMBEDDING_MODE: "oss"
      SIE_OSS_EMBEDDING_URL: http://sie-embedding:8081/embed
      # ---- MCP WebSocket port ----
      SIE_MCP_PORT: 9051
    restart: unless-stopped
    networks:
      - sie-net
networks:
  sie-net:

docker-compose.ymlを配置したディレクトリでDocker Composeを起動するとSIEが動き出します。

$ docker compose up -d --build

SIEの起動には少し時間がかかるので、以下のようにhealth機能で確認していくとよいでしょう。

$ curl http://localhost:9050/health | jq

以下の出力が得られたら基本的な起動は完了です。

{
  "status": "ok",
  "embedding": {
    "enabled": true,
    "reachable": true
  },
  "chroma": {
    "reachable": true,
    "collectionExists": true
  },
  "fuseki": {
    "reachable": true
  }
}

ただし、SimpleModeling.orgからのデータ構築がバックグラウンドで動作しており、これが完了するまでに数分かかります。

実行

ただし、SimpleModeling.orgからのデータ構築がバックグラウンドで動作しており、これが完了するまでに数分かかります。

$ curl -X POST "http://localhost:9050/sie/query" \
  -H "Content-Type: application/json" \
  -d '{"query":"SimpleModeling"}' | jq

実行結果

問い合わせの結果、以下のJSONが表示されます。

{
  "concepts": [
    {
      "uri": "https://www.simplemodeling.org/glossary/knowledge-development/socialization",
      "label": "共同化",
      "lang": "en"
    },
    {
      "uri": "https://www.simplemodeling.org/glossary/development-process/alpha-state",
      "label": "アルファ状態",
      "lang": "en"
    },
    {
      "uri": "https://www.simplemodeling.org/glossary/development-process/activity",
      "label": "活動",
      "lang": "en"
    }
  ],
  "passages": [
    {
      "id": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-1",
      "text": "ns and structural descriptions. This allows AI to understand the meaning of the model, thereby assisting in generation and validation. Furthermore, in addition to the literate model and DSL, the Body of Knowledge (BoK) developed by SimpleModeling serves as the foundation for circulating knowledge between models and AI. Literate Model–Driven AI-Assisted Development Literate model–driven AI-assisted development is a development approach in which AI supports tasks such as design, generation, and verification based on a literate model that integrates natural language with formal specifications. In this approach, the literate model functions as a shared foundation for both human understanding and machine processing, allowing AI to enhance the consistency and efficiency of development processes ",
      "score": 1.222625160273825
    },
    {
      "id": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-3",
      "text": "in large-scale applications, it is difficult to represent all functions solely through DSLs and models, requiring manual supplementation for parts that fall outside specifications or unique implementation elements. At this point, the key idea is to decompose functionality structurally and combine it in reusable units. In other words, the CBD approach complements the limitations of models and DSLs, serving as the key to enabling large-scale development. What Is a Component The Unified Process (UP) is based on Component-Based Development (CBD), and in UML, a component is positioned as a unit that defines contracts and interfaces. A component encapsulates functionality as a reusable and replaceable design unit. In SimpleModeling, it is redefined as a unit that can be directly handled by AI an",
      "score": 1.3652391075281525
    },
    {
      "id": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-4",
      "text": "d the literate model. Furthermore, a component is positioned at the intersection of the logical and physical models. On the logical model side, it serves as an abstract structural unit that defines responsibilities, contracts, and collaborations. On the physical model side, it materializes as implementation, deployment, and operational units such as modules, services, or deployable artifacts. Viewpoint Logical Model Physical Model Definition Abstract unit with responsibilities, contracts, and dependencies Concrete entities such as code, binaries, or services Purpose Structuring for functional separation and reuse Configuration management for deployment, execution, and integration Connections Collaboration and dependencies among models APIs, messaging, and deployments Thus, a component func",
      "score": 1.3914285780145474
    },
    {
      "id": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-0",
      "text": "Component-Based Development in the Age of AI ASAMI, Tomoharu Created: 2025-10-06 Building on the significance of DSL (Domain Specific Language)-driven development in the AI era, this article reconsiders AI-assisted Component-Based Development centered on the literate model (see 📄 AI-Driven Program Generation ― Possibilities and Challenges for details). Literate Model and CBD SimpleModeling adopts Component-Based Development (CBD) as the core of its development methodology. By leveraging the literate model, design information and specifications can be integrated into a form understandable by both humans and AI, enabling structured and consistent development with AI assistance. A literate model is a representational form that integrates natural-language explanations with formal specificatio",
      "score": 1.4848466871770634
    },
    {
      "id": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-17",
      "text": "ty with existing component assets. AI Across the Software Lifecycle In the AI era of Component-Based Development (CBD), AI is expected to contribute across the entire software development lifecycle. AI will function not merely as a generation tool but as a collaborative engineering partner. Because CBD is based on clearly defined structural units called components, it is particularly well-suited for AI assistance. Each component explicitly defines responsibilities, contracts, inputs/outputs, and dependencies, making them easy for AI to analyze and optimize. As a result, design, verification, and integration can be effectively automated. Furthermore, by combining SimpleModeling’s Body of Knowledge (BoK), AI can reference past design knowledge, modeling examples, and implementation patterns ",
      "score": 1.5146504776258662
    }
  ],
  "graph": {
    "nodes": [
      {
        "id": "https://www.simplemodeling.org/glossary/knowledge-development/socialization",
        "label": "共同化",
        "kind": "concept"
      },
      {
        "id": "https://www.simplemodeling.org/glossary/development-process/alpha-state",
        "label": "アルファ状態",
        "kind": "concept"
      },
      {
        "id": "https://www.simplemodeling.org/glossary/development-process/activity",
        "label": "活動",
        "kind": "concept"
      },
      {
        "id": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-1",
        "label": "ns and structural descriptions. This allows AI to understand the meaning of the ",
        "kind": "passage"
      },
      {
        "id": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-3",
        "label": "in large-scale applications, it is difficult to represent all functions solely t",
        "kind": "passage"
      },
      {
        "id": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-4",
        "label": "d the literate model. Furthermore, a component is positioned at the intersection",
        "kind": "passage"
      },
      {
        "id": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-0",
        "label": "Component-Based Development in the Age of AI ASAMI, Tomoharu Created: 2025-10-06",
        "kind": "passage"
      },
      {
        "id": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-17",
        "label": "ty with existing component assets. AI Across the Software Lifecycle In the AI er",
        "kind": "passage"
      }
    ],
    "edges": [
      {
        "source": "https://www.simplemodeling.org/glossary/knowledge-development/socialization",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-1",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/knowledge-development/socialization",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-3",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/knowledge-development/socialization",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-4",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/knowledge-development/socialization",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-0",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/knowledge-development/socialization",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-17",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/development-process/alpha-state",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-1",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/development-process/alpha-state",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-3",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/development-process/alpha-state",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-4",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/development-process/alpha-state",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-0",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/development-process/alpha-state",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-17",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/development-process/activity",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-1",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/development-process/activity",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-3",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/development-process/activity",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-4",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/development-process/activity",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-0",
        "relation": "related"
      },
      {
        "source": "https://www.simplemodeling.org/glossary/development-process/activity",
        "target": "https://www.simplemodeling.org/en/blog/cbd-ai.html#chunk-17",
        "relation": "related"
      }
    ]
  }
}

なおpassagesやedgesの内容が空の場合はSimpleModeling.orgサイトの情報をデータベースに登録作業中なので、数分待ってから再度問い合わせをしてみてください。

説明

問い合わせから返ってくるJSONは主に以下の3つの情報が格納されています。

  • concepts

  • passages

  • graph

concepts

検索クエリに「意味的に関連が深い」と判定された概念(Concept)一覧です。LexiDox(用語)から生成されたRDF上の概念IRI (concept IRI)をスコア付きでまとめたものになります。

「この問い合わせは、どの概念(用語・モデル要素)に関係しそうか?」を示し、AIが“何について話すのか”を間違えないためのアンカーとして使います。

passages

検索クエリに対して意味的に近い文書断片(テキストチャンク)の一覧です。

SmartDox(文書)とLexiDox(用語)のテキストを分割・埋め込みした ChromaDB(ベクトルDB)から、ベクトル検索で取得した結果です。

回答生成時に引用する具体的な説明テキスト・根拠文を提供します。 conceptsが「何の話か」を表すのに対して、passagesは「どう説明するか」のための根拠文を提供します。

graph

検索結果に関連するRDFサブグラフ全体です。

Fuseki から取得した RDF トリプルを、「ノード」と「エッジ」に整理した構造になっています。

concepts や passages の IRI (Internationalization Resource Identifier) を起点に、その周辺の関係(カテゴリ、参照、上位・下位など)も含めて返します。

nodes

グラフ上のリソース(頂点)を表します。KnowledgeGraph Explorer などでノードとして可視化される単位です。

「どんな種類のリソースが関係しているか?」を一覧できます。

edges

RDFのトリプル(主語–述語–目的語)を“関係線”として表現したものです。

「どのノードが、どのノードと、どのような意味関係でつながっているか?」を示します。

AI が因果・階層・参照関係を理解するための土台になります。

まとめ

Semantic Integration Engineは、BoKで構築した知識をAIが扱える形式に統合し、概念・文書・グラフの3層から意味的に検索できる環境を提供します。

AIアプリケーションはSIEの提供するREST APIを通して、知識グラフに対して検索を行うことができます。

ChatGPTなどの生成AIコンソールは、SIEをバックエンドにして知識を参照・推論するためのインタラクティブなAIクライアントとして利用できます。

ChatGPTとSIEを連携させ、ChatGPTがBoKの知識を直接活用できるようにする方法については、次回の記事 📄 Semantic Integration EngineとChatGPT連携 で詳しく説明します。

参照

用語集

BoK (Body of Knowledge)

SimpleModelingでは文脈共有の核となる知識体系をBoK (Body of Knowledge)と呼んでいます。 BoKの構築は、知識の共有、教育、AIによる支援、自動化、意思決定支援を可能にするための基盤です。

RDF

W3C により標準化された、情報を「主語–述語–目的語」の三つ組(トリプル)で表現するための知識記述モデル。

知識グラフ (knowledge graph)

現実の概念・事物・出来事をノードとし、その関係をエッジとして表す意味的グラフ構造の知識ベース。

KnowledgeGraph Explorer

SimpleModeling.org の RDF/JSON-LD/Turtle から生成される知識グラフを可視化し、記事・用語・カテゴリー・関係構造を探索できるアプリケーション。

Semantic Integration Engine (SIE)

BoK(Body of Knowledge)から生成された構造化知識(RDF)および文書知識(SmartDox)を統合し、AIが直接利用できる形に変換・検索するための統合エンジン。

文書 (document IRI)

SmartDox文書・記事・GlossaryTermなど「文書(document)」を識別するIRI。

CML (Cozy Modeling Language)

CMLは、Cozyモデルを記述するための文芸モデル記述言語です。 SimpleModelingにおける分析モデルの中核を担うDSL(ドメイン固有言語)として設計されています。 モデル要素とその関係性を自然言語に近い文体で記述できるよう工夫されており、AIによる支援や自動生成との高い親和性を備えています。 CMLで記述された文芸モデルは、設計モデル、プログラムコード、技術文書などに変換可能な中間表現として機能します。

コンポーネント (Component)

責務・契約・依存関係を明示的に定義し、再利用可能で交換可能な単位としてカプセル化されたソフトウェア構成要素。論理モデルでは抽象構造単位として、物理モデルでは実装・デプロイメント単位として扱われる。

概念IRI (concept IRI)

Undefined

IRI (Internationalization Resource Identifier)

RDFにおけるリソース識別子。Web上で一意に識別できるIDとして利用され、概念・文書・プロパティなどあらゆるノードの基盤となる。