You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何SPARQL查询中rdfs:subClassOf无法正常工作?

SPARQL查询中rdfs:subClassOf语句失效问题

需求说明

原SPARQL查询期望输出三列数据:患者所患疾病名称、患者死亡的其他因素、信息来源论文标题。

原查询代码

PREFIX snomed: <http://www.ihtsdo.org/SCT_>
PREFIX sct: <http://wasp.cs.vu.nl/sct/sct#>
PREFIX drugbank: <https://www.drugbank.ca/drugs/>
PREFIX ztonekg:<http://www.ztonebv.nl/KG#>
PREFIX pubmed:<http://www.ncbi.nlm.nih.gov/pubmed/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select distinct ?disease ?suicide ?title
where {
    ?diseaseid rdfs:subClassOf snomed:73595000.
    ?t1s1 ztonekg:SenseURL ?diseaseid.
    ?diseaseid sct:hasEnglishLabel ?disease.
    ?t1 ztonekg:hasSense ?t1s1.
    ?s7 ztonekg:hasSenses ?t1.    
    ?s ztonekg:hasTerm ?s7.      
    ?s1 ztonekg:hasAnnotation ?s.
    ?s1 ztonekg:hasSource "Title".
    ?pubmed ztonekg:hasAnnotations ?s1.
    ?pubmed ztonekg:hasAnnotations ?s1b.
    ?s1b ztonekg:hasSource "Title".
    ?s1b ztonekg:hasAnnotation ?sb.
    ?sb ztonekg:hasTerm ?s7b.
    ?s7b ztonekg:hasSenses ?t1b.
    ?t1b ztonekg:hasSense ?t1s1b.
    ?t1s1b ztonekg:SenseURL ?suicideid.
    ?suicideid rdfs:subClassOf snomed:262188008. #suice:44301001
    ?suicideid sct:hasEnglishLabel ?suicide.
    ?s1b ztonekg:hasText ?title.   
}

问题描述

原查询中**?diseaseid rdfs:subClassOf snomed:73595000和?suicideid rdfs:subClassOf snomed:262188008**这两句无法正常工作,只能通过直接指定SNOMED URI的方式绕过。

绕过的查询代码(前缀与原查询相同)

select ?t1s1 ?t1s1b ?title
where { 
    ?t1s1 ztonekg:SenseURL snomed:248062006. #40683002.#248062006.#self-harm
    ?t1 ztonekg:hasSense ?t1s1.
    ?s7 ztonekg:hasSenses ?t1.    
    ?s ztonekg:hasTerm ?s7.
    ?s1 ztonekg:hasAnnotation ?s.
    ?s1 ztonekg:hasSource "Title".
    ?pubmed ztonekg:hasAnnotations ?s1.
    ?pubmed ztonekg:hasAnnotations ?s1b.
    ?s1b ztonekg:hasSource "Title".
    ?s1b ztonekg:hasAnnotation ?sb.
    ?sb ztonekg:hasTerm ?s7b.
    ?s7b ztonekg:hasSenses ?t1b.
    ?t1b ztonekg:hasSense ?t1s1b.
    ?t1s1b ztonekg:SenseURL snomed:133937008.#adolescent
    ?s1b ztonekg:hasText ?title.
}

诉求

由于项目后续步骤需要保留原查询写法的主体,希望解决原查询中rdfs相关语句的失效问题。

内容的提问来源于stack exchange,提问作者aida

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 22:30:38