Skip to content

Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.

5.6 KB
Raw Blame
language: [zh, en]

name: spatial_graph
type: spatial_graph
tags: [general]

description:
  zh: '通用空间图结构知识模板 - 从任意文本中提取实体之间的关系,并在文本提供位置信息时为关系补充空间属性。'
  en: 'General-purpose Spatial Graph Knowledge Template - Extracts relationships between entities from any text and supplements spatial attributes when location information is available.'

output:
  description:
    zh: '提取出来的空间图谱结构,包含实体节点、关系边及位置信息。'
    en: 'Extracted spatial graph structure containing entity nodes, relation edges, and location information.'
  entities:
    description:
      zh: '文本中可独立识别、可参与关系连接的实体节点。'
      en: 'Entity nodes that can be independently identified and participate in relation connections.'
    fields:
    - name: name
      type: str
      description:
        zh: '实体名称,使用文本中最明确、最稳定的称呼。'
        en: 'Entity name, using the most explicit and stable designation in the text.'
    - name: type
      type: str
      description:
        zh: '实体类型。例如:人物/地点/组织/物品/概念/事件/制度/技术/产品/服务等'
        en: 'Entity type. Examples: person/location/organization/object/concept/event/institution/technology/product/service, etc.'
    - name: description
      type: str
      description:
        zh: '对实体身份、含义或其在当前文本中作用的简要说明。'
        en: 'Brief description of the entity identity, meaning, or its role in the current text.'
      required: false
  relations:
    description:
      zh: '实体之间的关系边;若文本提供位置,可在关系上补充位置属性。'
      en: 'Relation edges between entities; spatial attributes can be added when location information is provided.'
    fields:
    - name: source
      type: str
      description:
        zh: '关系起点实体,必须对应已提取实体的名称。'
        en: 'Source entity of the relation, must correspond to the name of an extracted entity.'
    - name: target
      type: str
      description:
        zh: '关系终点实体,必须对应已提取实体的名称。'
        en: 'Target entity of the relation, must correspond to the name of an extracted entity.'
    - name: type
      type: str
      description:
        zh: '关系类型,用简洁词语概括两个实体之间的连接方式。例如:创建/属于/位于/使用/影响/导致/参与/拥有/相关等'
        en: 'Relation type, concisely describing the connection between two entities. Examples: created/belongs_to/located_at/uses/affects/causes/participates_in/owns/related_to, etc.'
    - name: location
      type: str
      description:
        zh: '关系对应的位置信息;无明确位置时可留空。例如:北京市/会议室A/华东地区/现场等'
        en: 'Location information associated with the relation; can be left empty if no explicit location is available. Examples: Beijing/c Meeting_Room_A/East_China_region/on_site, etc.'
      required: false
    - name: description
      type: str
      description:
        zh: '对关系的简要补充说明;无额外信息时可留空。'
        en: 'Brief supplementary explanation for the relation; can be left empty if no additional information is available.'
      required: false

guideline:
  target:
    zh: '你是一位空间知识图谱构建专家。请从文本中提取关键实体及其关系;如果文本提供了位置信息,再为关系补充空间属性。'
    en: 'You are an expert in spatial knowledge graph construction. Extract key entities and their relationships from the text; supplement spatial attributes when location information is provided.'
  rules_for_entities:
    zh:
    - '提取对理解文本事实有价值,且能够参与关系连接的实体。'
    - '同一实体在全文中保持命名一致。'
    en:
    - 'Extract entities that are valuable for understanding text facts, and that can participate in relation connections.'
    - 'Maintain consistent naming for the same entity throughout the text.'
  rules_for_relations:
    zh:
    - '仅在文本明确表达两个实体之间存在关系时创建关系边。'
    en:
    - 'Create relation edges only when the text explicitly expresses a relationship between two entities.'
  rules_for_location:
    zh:
    - '当前观察位置:{observation_location}'
    - 'location 是可选字段;仅在文本明确提供位置,或可依据相对位置可靠确定时填写。'
    - '优先使用文本中的原始位置表达;可接受地名、地址、区域等。'
    - '若关系涉及空间转移或分布,可在 location 中标注起点和终点。'
    - '无法可靠确定位置时留空,不要根据常识补写。'
    en:
    - 'Current observation location: {observation_location}'
    - 'location is optional; fill in only when the text explicitly provides location or when relative location can be reliably determined.'
    - 'Prefer to use the original location expression from the text; place names, addresses, and regions are acceptable.'
    - 'If the relation involves spatial transfer or distribution, indicate the start and end points in location.'
    - 'Leave empty when location cannot be reliably determined.'

identifiers:
  entity_id: name
  relation_id: '{source}|{type}|{target}|{location}'
  relation_members:
    source: source
    target: target
  location_field: location

options:
  extraction_mode: two_stage

display:
  entity_label: '{name} ({type})'
  relation_label: '{type}@{location}'