【发布时间】:2017-12-12 04:45:33
【问题描述】:
我尝试向(公共)RDF 数据集(wordnet)添加一些本体,特别是我需要区分动词和名词的LexicalEntries,将其分为两个子类。按照网络和 OWL 标准中的示例,我假设
:LexicalEntryNoun a owl:Class ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:onProperty wn:part_of_speech ;
owl:hasValue wn:noun
] .
应该建立一个类LexicalEntryNoun,但是查询(在jena fuseki中)
prefix : <http://gerastree.at/2017/litonto#>
SELECT *
WHERE {
?s a :LexicalEntryNoun.
}
给出一个空结果。应该返回的两个 URI 包含在由空白节点表示的类中,代表限制,但不像其他查询中报告的那样报告为 LexicalEntryNoun。
我是 OWL 的新手,在海龟语法中找不到很多 OWL 的例子。我的错误在哪里? 谢谢你的帮助!
我构建了一个非常小的数据子集,它与 OWL 推理器 http://jena.hpl.hp.com/2003/OWLFBRuleReasoner 一起加载:
@prefix wn31: <http://wordnet-rdf.princeton.edu/wn31> .
@prefix lemon: <http://lemon-model.net/lemon#> .
@prefix nlp: <http://gerastree.at/nlp_2015#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix lit: <http://gerastree.at/lit_2014#> .
@prefix wn: <http://wordnet-rdf.princeton.edu/ontology#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ns: <http://www.example.org/ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix : <http://gerastree.at/2017/litonto#> .
<http://wordnet-rdf.princeton.edu/wn31/%27s+Gravenhage-n>
a _:b0 , owl:Thing , rdfs:Resource , lemon:LexicalEntry ;
lemon:canonicalForm <http://wordnet-rdf.princeton.edu/wn31/%27s+Gravenhage-n#CanonicalForm> ;
lemon:sense <http://www.lexvo.org/page/wordnet/30/noun/%27s_gravenhage_1_15_00> , <http://wordnet-rdf.princeton.edu/wn31/%27s+Gravenhage-n#1-n> ;
wn:part_of_speech wn:noun ;
owl:sameAs <http://wordnet-rdf.princeton.edu/wn31/%27s+Gravenhage-n> .
<http://wordnet-rdf.princeton.edu/wn31/%27hood-n>
a _:b0 , owl:Thing , rdfs:Resource , lemon:LexicalEntry ;
lemon:canonicalForm <http://wordnet-rdf.princeton.edu/wn31/%27hood-n#CanonicalForm> ;
lemon:sense <http://www.lexvo.org/page/wordnet/30/noun/%27hood_1_15_00> , <http://wordnet-rdf.princeton.edu/wn31/%27hood-n#1-n> ;
wn:part_of_speech wn:noun ;
owl:sameAs <http://wordnet-rdf.princeton.edu/wn31/%27hood-n> .
:LexicalEntryNoun a owl:Class ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:onProperty wn:part_of_speech ;
owl:hasValue wn:noun
] .
【问题讨论】:
-
您的查询正在尝试获取
LexicalEntryNoun类的实例。在您的数据中,我看不到任何此类实例。 SPARQL 是一种模式匹配语言,它不匹配您示例中的任何数据。 -
如果你想得到
LexicalEntryNoun的超类,你必须通过三重模式来做到这一点。使用你的 Turtle sn-p,并用变量替换你想要得到的东西。这正是模式匹配的工作原理。 -
我了解如何在 SPARQL 中匹配模式,但我假设
LexicalEntryNoun的 OWL 定义通过对值的限制将通过推理创建一个类,然后我可以在模式匹配中使用该类。为什么 OWL 定义不起作用? -
澄清一下:您的查询正在寻找与
?s rdf:type :LexicalEntryNoun .模式匹配的三元组,您的样本中是否存在此类数据? -
你对推理者有什么期望?我不明白。 SubClassOf 公理说明如果某个个体
:x属于类:LexicalEntryNoun,则可以推断出三元组:x wn:part_of_speech wn:noun .。我仍然看不出这将如何匹配您的查询。
标签: owl fuseki turtle-rdf jena-rules